From cd01cd76e133dce0708fcfedf3e62fc6fbae83af Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 Feb 2013 21:19:27 -0500 Subject: v4 (v3): utils (debug renamed), SiSU_Utils::CodeMarker (from Debug::Mark) --- data/doc/sisu/CHANGELOG_v3 | 2 + data/doc/sisu/CHANGELOG_v4 | 2 + lib/sisu/v3/debug.rb | 109 --------------------------------------------- lib/sisu/v3/hub.rb | 2 +- lib/sisu/v3/utils.rb | 109 +++++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v4/constants.rb | 4 +- lib/sisu/v4/debug.rb | 109 --------------------------------------------- lib/sisu/v4/hub.rb | 2 +- lib/sisu/v4/sysenv.rb | 2 +- lib/sisu/v4/utils.rb | 109 +++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 227 insertions(+), 223 deletions(-) delete mode 100644 lib/sisu/v3/debug.rb create mode 100644 lib/sisu/v3/utils.rb delete mode 100644 lib/sisu/v4/debug.rb create mode 100644 lib/sisu/v4/utils.rb diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 8379f677..9cd95b77 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -35,6 +35,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.9.orig.tar.xz sisu_3.3.9.orig.tar.xz sisu_3.3.9-1.dsc +* v3: utils (debug renamed), Utils::CodeMarker (from Debug::Mark) + %% 3.3.8.orig.tar.xz (2013-02-03:04/7) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_3.3.8 http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.8.orig.tar.xz diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 1b51330a..c79ebe1a 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -26,6 +26,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.6.orig.tar.xz * v4: html, screen reporting for --html-scroll, correctly identify output file +* v4: utils (debug renamed) SiSU_Utils::CodeMarker (from Debug::Mark) + %% 4.0.5.orig.tar.xz (2013-02-03:04/7) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.0.5 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.0.5-1 diff --git a/lib/sisu/v3/debug.rb b/lib/sisu/v3/debug.rb deleted file mode 100644 index a49cecb7..00000000 --- a/lib/sisu/v3/debug.rb +++ /dev/null @@ -1,109 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Download: - - - * Ralph Amissah - - - - ** Description: system environment, debug related - -=end -module SiSU_Debug - class Mark - def initialize(line,file,color=:red) - @line,@file,@color=line.to_s,file,color - end - def ansi(color=nil) - @color=color ? color : @color - c={} - c[:on]=case @color - when :red; ANSI_C[:red] - when :green; ANSI_C[:green] - when :yellow; ANSI_C[:yellow] - when :blue; ANSI_C[:blue] - when :fuchsia; ANSI_C[:fuchsia] - when :cyan; ANSI_C[:cyan] - when :inv_red; ANSI_C[:inv_red] - when :inv_green; ANSI_C[:inv_green] - when :inv_yellow; ANSI_C[:inv_yellow] - when :inv_blue; ANSI_C[:inv_blue] - when :inv_fuchsia; ANSI_C[:inv_fuchsia] - when :inv_cyan; ANSI_C[:inv_cyan] - when :b_red; ANSI_C[:b_red] - when :b_green; ANSI_C[:b_green] - when :b_yellow; ANSI_C[:b_yellow] - when :b_blue; ANSI_C[:b_blue] - when :b_fuchsia; ANSI_C[:b_fuchsia] - when :b_cyan; ANSI_C[:b_cyan] - else ANSI_C[:red] - end - c[:off]= ANSI_C[:off] - #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") - c - end - def set(color=nil) - c=ansi(color) - file,path=File.basename(@file),File.dirname(@file) - c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" - end - def set_(color=nil) - c=ansi(color) - c[:on] + @line + c[:off] + ' ' + - @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") - end - end -end -__END__ -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:green) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:inv_red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:red).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:green).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:inv_red).set diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index eeba4cb1..73155047 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -68,7 +68,7 @@ module SiSU include SiSU_Viz require_relative 'help' # help.rb include SiSU_Help - require_relative 'debug' # debug.rb + require_relative 'utils' # utils.rb require 'uri' class HubMaster def initialize(argv) diff --git a/lib/sisu/v3/utils.rb b/lib/sisu/v3/utils.rb new file mode 100644 index 00000000..ade6132a --- /dev/null +++ b/lib/sisu/v3/utils.rb @@ -0,0 +1,109 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, debug related + +=end +module SiSU_Debug + class Mark + def initialize(line,file,color=:red) + @line,@file,@color=line.to_s,file,color + end + def ansi(color=nil) + @color=color ? color : @color + c={} + c[:on]=case @color + when :red; ANSI_C[:red] + when :green; ANSI_C[:green] + when :yellow; ANSI_C[:yellow] + when :blue; ANSI_C[:blue] + when :fuchsia; ANSI_C[:fuchsia] + when :cyan; ANSI_C[:cyan] + when :inv_red; ANSI_C[:inv_red] + when :inv_green; ANSI_C[:inv_green] + when :inv_yellow; ANSI_C[:inv_yellow] + when :inv_blue; ANSI_C[:inv_blue] + when :inv_fuchsia; ANSI_C[:inv_fuchsia] + when :inv_cyan; ANSI_C[:inv_cyan] + when :b_red; ANSI_C[:b_red] + when :b_green; ANSI_C[:b_green] + when :b_yellow; ANSI_C[:b_yellow] + when :b_blue; ANSI_C[:b_blue] + when :b_fuchsia; ANSI_C[:b_fuchsia] + when :b_cyan; ANSI_C[:b_cyan] + else ANSI_C[:red] + end + c[:off]= ANSI_C[:off] + #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") + c + end + def set(color=nil) + c=ansi(color) + file,path=File.basename(@file),File.dirname(@file) + c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" + end + def set_(color=nil) + c=ansi(color) + c[:on] + @line + c[:off] + ' ' + + @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") + end + end +end +__END__ +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:inv_red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:inv_red).set diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb index 65b17796..d774be25 100644 --- a/lib/sisu/v4/constants.rb +++ b/lib/sisu/v4/constants.rb @@ -289,8 +289,8 @@ DEVELOPER={ maintenance: :false, } __END__ -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:red).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) puts ANSI_C[:red] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__ puts "#{ANSI_C[:red]} #{__LINE__.to_s} #{ANSI_C[:off]} #{__FILE__}" puts ANSI_C[:fuchsia] + __LINE__.to_s + ANSI_C[:off] + ' ' + __FILE__.gsub(/([^\/]+$)/,"#{ANSI_C[:fuchsia]}\\1#{ANSI_C[:off]}") diff --git a/lib/sisu/v4/debug.rb b/lib/sisu/v4/debug.rb deleted file mode 100644 index a49cecb7..00000000 --- a/lib/sisu/v4/debug.rb +++ /dev/null @@ -1,109 +0,0 @@ -# encoding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Download: - - - * Ralph Amissah - - - - ** Description: system environment, debug related - -=end -module SiSU_Debug - class Mark - def initialize(line,file,color=:red) - @line,@file,@color=line.to_s,file,color - end - def ansi(color=nil) - @color=color ? color : @color - c={} - c[:on]=case @color - when :red; ANSI_C[:red] - when :green; ANSI_C[:green] - when :yellow; ANSI_C[:yellow] - when :blue; ANSI_C[:blue] - when :fuchsia; ANSI_C[:fuchsia] - when :cyan; ANSI_C[:cyan] - when :inv_red; ANSI_C[:inv_red] - when :inv_green; ANSI_C[:inv_green] - when :inv_yellow; ANSI_C[:inv_yellow] - when :inv_blue; ANSI_C[:inv_blue] - when :inv_fuchsia; ANSI_C[:inv_fuchsia] - when :inv_cyan; ANSI_C[:inv_cyan] - when :b_red; ANSI_C[:b_red] - when :b_green; ANSI_C[:b_green] - when :b_yellow; ANSI_C[:b_yellow] - when :b_blue; ANSI_C[:b_blue] - when :b_fuchsia; ANSI_C[:b_fuchsia] - when :b_cyan; ANSI_C[:b_cyan] - else ANSI_C[:red] - end - c[:off]= ANSI_C[:off] - #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") - c - end - def set(color=nil) - c=ansi(color) - file,path=File.basename(@file),File.dirname(@file) - c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" - end - def set_(color=nil) - c=ansi(color) - c[:on] + @line + c[:off] + ' ' + - @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") - end - end -end -__END__ -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:green) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:inv_red) -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:red).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:green).set -puts SiSU_Debug::Mark.new(__LINE__,__FILE__,:inv_red).set diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index 2cfcee57..0cfa0d6e 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -68,7 +68,7 @@ module SiSU include SiSU_Viz require_relative 'help' # help.rb include SiSU_Help - require_relative 'debug' # debug.rb + require_relative 'utils' # utils.rb require 'uri' class HubMaster def initialize(argv) diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index d8b6f4fd..c5a1cebb 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -1067,7 +1067,7 @@ module SiSU_Env elsif output_dir_structure.by_filename? '' else - puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:fuschia) + puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuschia) puts 'set output type, by: language, filetype or filename' end @stub_set_manifest=stub + '/manifest' diff --git a/lib/sisu/v4/utils.rb b/lib/sisu/v4/utils.rb new file mode 100644 index 00000000..7567d26a --- /dev/null +++ b/lib/sisu/v4/utils.rb @@ -0,0 +1,109 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, debug related + +=end +module SiSU_Utils + class CodeMarker + def initialize(line,file,color=:red) + @line,@file,@color=line.to_s,file,color + end + def ansi(color=nil) + @color=color ? color : @color + c={} + c[:on]=case @color + when :red; ANSI_C[:red] + when :green; ANSI_C[:green] + when :yellow; ANSI_C[:yellow] + when :blue; ANSI_C[:blue] + when :fuchsia; ANSI_C[:fuchsia] + when :cyan; ANSI_C[:cyan] + when :inv_red; ANSI_C[:inv_red] + when :inv_green; ANSI_C[:inv_green] + when :inv_yellow; ANSI_C[:inv_yellow] + when :inv_blue; ANSI_C[:inv_blue] + when :inv_fuchsia; ANSI_C[:inv_fuchsia] + when :inv_cyan; ANSI_C[:inv_cyan] + when :b_red; ANSI_C[:b_red] + when :b_green; ANSI_C[:b_green] + when :b_yellow; ANSI_C[:b_yellow] + when :b_blue; ANSI_C[:b_blue] + when :b_fuchsia; ANSI_C[:b_fuchsia] + when :b_cyan; ANSI_C[:b_cyan] + else ANSI_C[:red] + end + c[:off]= ANSI_C[:off] + #ansi_color + @line.to_s + ansi_color_off + ' ' + @file.gsub(/([^\/]+$)/,"#{ansi_color}\\1#{ansi_color_off}") + c + end + def set(color=nil) + c=ansi(color) + file,path=File.basename(@file),File.dirname(@file) + c[:on] + @line + c[:off] + ' ' + path + '/' "#{c[:on]}#{file}#{c[:off]}" + end + def set_(color=nil) + c=ansi(color) + c[:on] + @line + c[:off] + ' ' + + @file.gsub(/([^\/]+$)/,"#{c[:on]}\\1#{c[:off]}") + end + end +end +__END__ +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:green) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:inv_red) +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:red).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:green).set +puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:inv_red).set -- cgit v1.2.3