extract_curves 0.0.1-i586-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CVS/Entries +4 -0
- data/CVS/Repository +1 -0
- data/CVS/Root +1 -0
- data/bin/CVS/Entries +5 -0
- data/bin/CVS/Repository +1 -0
- data/bin/CVS/Root +1 -0
- data/bin/ec_rect2polar.rb +22 -0
- data/bin/ec_rev_lines.rb +5 -0
- data/bin/ec_sph_area.rb +30 -0
- data/bin/extract_curves.rb +2145 -0
- data/ruby_ext/CVS/Entries +1 -0
- data/ruby_ext/CVS/Repository +1 -0
- data/ruby_ext/CVS/Root +1 -0
- data/ruby_ext/pav/CVS/Entries +14 -0
- data/ruby_ext/pav/CVS/Repository +1 -0
- data/ruby_ext/pav/CVS/Root +1 -0
- data/ruby_ext/pav/extconf.rb +22 -0
- data/ruby_ext/pav/pav.so +0 -0
- data/ruby_libs/CVS/Entries +1 -0
- data/ruby_libs/CVS/Repository +1 -0
- data/ruby_libs/CVS/Root +1 -0
- data/ruby_libs/pav/CVS/Entries +20 -0
- data/ruby_libs/pav/CVS/Repository +1 -0
- data/ruby_libs/pav/CVS/Root +1 -0
- data/ruby_libs/pav/attr_cache.rb +211 -0
- data/ruby_libs/pav/attr_cache.t1.rb +32 -0
- data/ruby_libs/pav/cache.rb +31 -0
- data/ruby_libs/pav/dbg_log.rb +458 -0
- data/ruby_libs/pav/floatsio.rb +53 -0
- data/ruby_libs/pav/generator_cache.rb +165 -0
- data/ruby_libs/pav/gtk/CVS/Entries +4 -0
- data/ruby_libs/pav/gtk/CVS/Repository +1 -0
- data/ruby_libs/pav/gtk/CVS/Root +1 -0
- data/ruby_libs/pav/gtk/button.rb +130 -0
- data/ruby_libs/pav/gtk/icons.rb +87 -0
- data/ruby_libs/pav/gtk/toolbar.rb +192 -0
- data/ruby_libs/pav/heap.rb +54 -0
- data/ruby_libs/pav/icons/CVS/Entries +17 -0
- data/ruby_libs/pav/icons/CVS/Repository +1 -0
- data/ruby_libs/pav/icons/CVS/Root +1 -0
- data/ruby_libs/pav/icons/alt_handle.xpm +3832 -0
- data/ruby_libs/pav/icons/alt_handle_hover.xpm +3368 -0
- data/ruby_libs/pav/icons/alt_handle_pressed.xpm +3828 -0
- data/ruby_libs/pav/icons/extract_curves/CVS/Entries +6 -0
- data/ruby_libs/pav/icons/extract_curves/CVS/Repository +1 -0
- data/ruby_libs/pav/icons/extract_curves/CVS/Root +1 -0
- data/ruby_libs/pav/icons/extract_curves/extract_curves-icon-rgb.ppm +14 -0
- data/ruby_libs/pav/icons/extract_curves/extract_curves-logo-rgb.gif +0 -0
- data/ruby_libs/pav/icons/extract_curves/trace_mark.xpm +38 -0
- data/ruby_libs/pav/icons/handle.xpm +213 -0
- data/ruby_libs/pav/icons/next.xpm +29 -0
- data/ruby_libs/pav/icons/next_hover.xpm +315 -0
- data/ruby_libs/pav/icons/next_pressed.xpm +144 -0
- data/ruby_libs/pav/icons/prev.xpm +29 -0
- data/ruby_libs/pav/icons/prev_hover.xpm +315 -0
- data/ruby_libs/pav/icons/prev_pressed.xpm +144 -0
- data/ruby_libs/pav/icons/vnext.xpm +29 -0
- data/ruby_libs/pav/icons/vprev.xpm +29 -0
- data/ruby_libs/pav/numeric/CVS/Entries +2 -0
- data/ruby_libs/pav/numeric/CVS/Repository +1 -0
- data/ruby_libs/pav/numeric/CVS/Root +1 -0
- data/ruby_libs/pav/numeric/ext.rb +13 -0
- data/ruby_libs/pav/pav_find.rb +90 -0
- data/ruby_libs/pav/pix/CVS/Entries +11 -0
- data/ruby_libs/pav/pix/CVS/Repository +1 -0
- data/ruby_libs/pav/pix/CVS/Root +1 -0
- data/ruby_libs/pav/pix/aapix.rb +378 -0
- data/ruby_libs/pav/pix/blob.rb +543 -0
- data/ruby_libs/pav/pix/circle.rb +73 -0
- data/ruby_libs/pav/pix/contour/CVS/Entries +5 -0
- data/ruby_libs/pav/pix/contour/CVS/Repository +1 -0
- data/ruby_libs/pav/pix/contour/CVS/Root +1 -0
- data/ruby_libs/pav/pix/contour/calc_situations.rb +9 -0
- data/ruby_libs/pav/pix/contour/carp_calc.rb +212 -0
- data/ruby_libs/pav/pix/contour/situations.dmp +0 -0
- data/ruby_libs/pav/pix/contour/situations.rb +21 -0
- data/ruby_libs/pav/pix/contour.rb +644 -0
- data/ruby_libs/pav/pix/curve.rb +1508 -0
- data/ruby_libs/pav/pix/img_obj.rb +751 -0
- data/ruby_libs/pav/pix/node.rb +712 -0
- data/ruby_libs/pav/pix/node_grp.rb +853 -0
- data/ruby_libs/pav/pix/shaved_core.rb +534 -0
- data/ruby_libs/pav/pix/subpix.rb +212 -0
- data/ruby_libs/pav/pix.rb +402 -0
- data/ruby_libs/pav/rand_accessible.rb +16 -0
- data/ruby_libs/pav/rangeset.rb +63 -0
- data/ruby_libs/pav/search.rb +210 -0
- data/ruby_libs/pav/set.rb +20 -0
- data/ruby_libs/pav/string/CVS/Entries +6 -0
- data/ruby_libs/pav/string/CVS/Repository +1 -0
- data/ruby_libs/pav/string/CVS/Root +1 -0
- data/ruby_libs/pav/string/bits.rb +523 -0
- data/ruby_libs/pav/string/ext.rb +58 -0
- data/ruby_libs/pav/string/observable.rb +155 -0
- data/ruby_libs/pav/string/text.rb +79 -0
- data/ruby_libs/pav/string/words.rb +42 -0
- data/ruby_libs/pav/sub_arr.rb +55 -0
- data/ruby_libs/pav/traced_obj.rb +79 -0
- metadata +147 -0
| @@ -0,0 +1,458 @@ | |
| 1 | 
            +
            require 'logger'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class PLogProgrBar
         | 
| 4 | 
            +
            	attr_reader :pdbglog, :progr_units, :total_progr_units, :show_as,
         | 
| 5 | 
            +
            		:fmt_str
         | 
| 6 | 
            +
            	
         | 
| 7 | 
            +
            	def initialize(pdbglog)
         | 
| 8 | 
            +
            		@pdbglog = pdbglog
         | 
| 9 | 
            +
            		@total_progr_units = nil
         | 
| 10 | 
            +
            		@progr_units = 0
         | 
| 11 | 
            +
            		@show_as = "%"
         | 
| 12 | 
            +
            	end
         | 
| 13 | 
            +
            	
         | 
| 14 | 
            +
            	def incr(progr_units=1)
         | 
| 15 | 
            +
            		@progr_units += progr_units
         | 
| 16 | 
            +
            		self.disp_progr(progr_units)
         | 
| 17 | 
            +
            	end
         | 
| 18 | 
            +
            	
         | 
| 19 | 
            +
            	def progr_units=(val)
         | 
| 20 | 
            +
            		change = val - @progr_units
         | 
| 21 | 
            +
            		@progr_units = val
         | 
| 22 | 
            +
            		self.disp_progr(change)
         | 
| 23 | 
            +
            	end
         | 
| 24 | 
            +
            	
         | 
| 25 | 
            +
            	def total_progr_units=(val)
         | 
| 26 | 
            +
            		@total_progr_units = val
         | 
| 27 | 
            +
            		@fmt_str = val > 0 ? "%.#{[Math.log10(val).ceil - 2, 0].max}f" :
         | 
| 28 | 
            +
            			"%f"
         | 
| 29 | 
            +
            	end
         | 
| 30 | 
            +
            	
         | 
| 31 | 
            +
            	def show_as=(spec)
         | 
| 32 | 
            +
            		if !["%", "/"].include?(spec[0,1])
         | 
| 33 | 
            +
            			raise ArgumentError, "spec start with \"%\" or \"/\""
         | 
| 34 | 
            +
            		end
         | 
| 35 | 
            +
            		@show_as = spec
         | 
| 36 | 
            +
            	end
         | 
| 37 | 
            +
            	
         | 
| 38 | 
            +
            	def finish
         | 
| 39 | 
            +
            	end
         | 
| 40 | 
            +
            end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            class PLogTextProgrBar < PLogProgrBar
         | 
| 43 | 
            +
            	ROT_LN_CHARS = ["-", "\\", "|", "/"]
         | 
| 44 | 
            +
            	BUBBLE_CHARS = [".", "o", "0", "O", "0", "o"]
         | 
| 45 | 
            +
            	attr_reader :progr_char_i, :bs_len
         | 
| 46 | 
            +
            	attr_accessor :progr_rot_chars, :progr_mark, :neg_progr_rot_chars,
         | 
| 47 | 
            +
            		:neg_progr_mark
         | 
| 48 | 
            +
            	
         | 
| 49 | 
            +
            	def initialize(pdbglog)
         | 
| 50 | 
            +
            		super(pdbglog)
         | 
| 51 | 
            +
            		@progr_char_i = 0
         | 
| 52 | 
            +
            		@progr_rot_chars = ROT_LN_CHARS
         | 
| 53 | 
            +
            		@neg_progr_rot_chars = BUBBLE_CHARS
         | 
| 54 | 
            +
            		@progr_mark = "."
         | 
| 55 | 
            +
            		@neg_progr_mark = "!"
         | 
| 56 | 
            +
            		@bs_len = 0
         | 
| 57 | 
            +
            	end
         | 
| 58 | 
            +
            	
         | 
| 59 | 
            +
            	def undisp_progr
         | 
| 60 | 
            +
            		self.pdbglog.print_progr(self.pdbglog.backspc * @bs_len, 2)
         | 
| 61 | 
            +
            		@bs_len = 0
         | 
| 62 | 
            +
            	end
         | 
| 63 | 
            +
            	
         | 
| 64 | 
            +
            	def disp_progr(progr_units_change)
         | 
| 65 | 
            +
            		if self.total_progr_units
         | 
| 66 | 
            +
            			if self.pdbglog.outp.tty? && self.pdbglog.had_progr
         | 
| 67 | 
            +
            				str = self.pdbglog.backspc * @bs_len
         | 
| 68 | 
            +
            			elsif self.pdbglog.had_progr
         | 
| 69 | 
            +
            				str = " "
         | 
| 70 | 
            +
            			else
         | 
| 71 | 
            +
            				str = ""
         | 
| 72 | 
            +
            			end
         | 
| 73 | 
            +
            			if self.show_as[0,1] == "%"
         | 
| 74 | 
            +
            				pct =  self.fmt_str % (100.0*self.progr_units /
         | 
| 75 | 
            +
            					self.total_progr_units)
         | 
| 76 | 
            +
            			else
         | 
| 77 | 
            +
            				pct = "#{self.progr_units}/#{
         | 
| 78 | 
            +
            					self.total_progr_units}"
         | 
| 79 | 
            +
            			end
         | 
| 80 | 
            +
            			pct += self.show_as[1, self.show_as.length-1]
         | 
| 81 | 
            +
            			@bs_len = pct.length
         | 
| 82 | 
            +
            			str += pct
         | 
| 83 | 
            +
            		elsif self.show_as == "%"
         | 
| 84 | 
            +
            			if progr_units_change > 0
         | 
| 85 | 
            +
            				chars = @progr_rot_chars; mark = @progr_mark
         | 
| 86 | 
            +
            			elsif progr_units_change < 0
         | 
| 87 | 
            +
            				chars = @neg_progr_rot_chars
         | 
| 88 | 
            +
            				mark = @neg_progr_mark
         | 
| 89 | 
            +
            			end
         | 
| 90 | 
            +
            			if self.pdbglog.outp.tty?
         | 
| 91 | 
            +
            				new_char_i = (@progr_char_i+progr_units_change)%
         | 
| 92 | 
            +
            					chars.length
         | 
| 93 | 
            +
            				if new_char_i == @progr_char_i
         | 
| 94 | 
            +
            					new_char_i = (new_char_i+1)%chars.length
         | 
| 95 | 
            +
            				end
         | 
| 96 | 
            +
            				if self.pdbglog.had_progr
         | 
| 97 | 
            +
            					str = self.pdbglog.backspc * @bs_len
         | 
| 98 | 
            +
            				else
         | 
| 99 | 
            +
            					str = ""
         | 
| 100 | 
            +
            				end
         | 
| 101 | 
            +
            				str += chars[new_char_i] +
         | 
| 102 | 
            +
            					self.show_as[1, self.show_as.length-1]
         | 
| 103 | 
            +
            				@progr_char_i = new_char_i
         | 
| 104 | 
            +
            				@bs_len = chars[new_char_i].length +
         | 
| 105 | 
            +
            					self.show_as.length-1
         | 
| 106 | 
            +
            			else
         | 
| 107 | 
            +
            				str = ""
         | 
| 108 | 
            +
            				str += mark*(progr_units_change/mark.length) +
         | 
| 109 | 
            +
            					mark[0, progr_units_change%mark.length]+
         | 
| 110 | 
            +
            					self.show_as[1, self.show_as.length-1]
         | 
| 111 | 
            +
            			end
         | 
| 112 | 
            +
            		else
         | 
| 113 | 
            +
            			if self.pdbglog.outp.tty? && self.pdbglog.had_progr
         | 
| 114 | 
            +
            				str = self.pdbglog.backspc * @bs_len
         | 
| 115 | 
            +
            			else
         | 
| 116 | 
            +
            				str = ""
         | 
| 117 | 
            +
            			end
         | 
| 118 | 
            +
            			pct = "#{self.progr_units}" +
         | 
| 119 | 
            +
            				self.show_as[1, self.show_as.length-1]
         | 
| 120 | 
            +
            			@bs_len = pct.length
         | 
| 121 | 
            +
            			str += pct
         | 
| 122 | 
            +
            		end
         | 
| 123 | 
            +
            		self.pdbglog.print_progr(str, 2)
         | 
| 124 | 
            +
            	end
         | 
| 125 | 
            +
            end
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            class PDbgLog
         | 
| 128 | 
            +
            	PARSE_BT_PAT = Regexp.compile(
         | 
| 129 | 
            +
            		/^([^:]*):([0-9]*)(?:[:]in `([a-zA-Z0-9_!?=]*)'|)/)
         | 
| 130 | 
            +
            	
         | 
| 131 | 
            +
            	def self.parse_bt_lm(str)
         | 
| 132 | 
            +
            		m = PARSE_BT_PAT.match(str)
         | 
| 133 | 
            +
            		m ? m[1, m.length-1] : []
         | 
| 134 | 
            +
            	end
         | 
| 135 | 
            +
            	
         | 
| 136 | 
            +
            	attr_reader :outp, :indent, :trace, :had_lf, :traced_call_levs
         | 
| 137 | 
            +
            	attr_accessor :outp_ln_num, :msg_indent, :func_indent, :logger_severity,
         | 
| 138 | 
            +
            		:auto_lf, :class_pfx, :fmt_indent, :indent_omit_levs_cnt,
         | 
| 139 | 
            +
            		:fmt_func_pfx, :backspc, :progr_class, :progr_init_args,
         | 
| 140 | 
            +
            		:had_progr, :auto_had_progr
         | 
| 141 | 
            +
            	
         | 
| 142 | 
            +
            	def outp=(outp_spec)
         | 
| 143 | 
            +
            		if outp_spec.kind_of?(String)
         | 
| 144 | 
            +
            			@outp = open(outp_spec, "w")
         | 
| 145 | 
            +
            		else
         | 
| 146 | 
            +
            			@outp = outp_spec
         | 
| 147 | 
            +
            		end
         | 
| 148 | 
            +
            	end
         | 
| 149 | 
            +
            	
         | 
| 150 | 
            +
            	def initialize(outp_spec=$stderr, fmt_indent_func=nil, &fmt_func_pfx)
         | 
| 151 | 
            +
            		self.outp = outp_spec
         | 
| 152 | 
            +
            		if fmt_indent_func
         | 
| 153 | 
            +
            			@fmt_indent = fmt_indent_func
         | 
| 154 | 
            +
            		else
         | 
| 155 | 
            +
            			@fmt_indent = proc { |stack_lev|
         | 
| 156 | 
            +
            				if stack_lev < @indent_omit_levs_cnt
         | 
| 157 | 
            +
            					""
         | 
| 158 | 
            +
            				elsif stack_lev - @indent_omit_levs_cnt < 5
         | 
| 159 | 
            +
            					(@func_indent + @msg_indent) * 
         | 
| 160 | 
            +
            					  (stack_lev - @indent_omit_levs_cnt)
         | 
| 161 | 
            +
            				else
         | 
| 162 | 
            +
            					"  >lev %3d-- " % stack_lev
         | 
| 163 | 
            +
            				end
         | 
| 164 | 
            +
            			}
         | 
| 165 | 
            +
            		end
         | 
| 166 | 
            +
            		if block_given?
         | 
| 167 | 
            +
            			@fmt_func_pfx = fmt_func_pfx
         | 
| 168 | 
            +
            		else
         | 
| 169 | 
            +
            			@fmt_func_pfx = proc { |bt_lm, first_entry|
         | 
| 170 | 
            +
            				file, ln, meth = *PDbgLog.parse_bt_lm(bt_lm)
         | 
| 171 | 
            +
            				meth = "<unknown/main>" unless meth
         | 
| 172 | 
            +
            				if @outp_ln_num && ln
         | 
| 173 | 
            +
            					@class_pfx + meth + ":#{ln}: "
         | 
| 174 | 
            +
            				else
         | 
| 175 | 
            +
            					@class_pfx + meth + ": "
         | 
| 176 | 
            +
            				end
         | 
| 177 | 
            +
            			}
         | 
| 178 | 
            +
            		end
         | 
| 179 | 
            +
            		@outp_ln_num = outp_ln_num
         | 
| 180 | 
            +
            		@trace = false
         | 
| 181 | 
            +
            		@indent = true
         | 
| 182 | 
            +
            		@msg_indent = " "
         | 
| 183 | 
            +
            		@func_indent = "  "
         | 
| 184 | 
            +
            		@indent_omit_levs_cnt = 0
         | 
| 185 | 
            +
            		@call_lev = 0
         | 
| 186 | 
            +
            		@traced_call_levs = [nil]
         | 
| 187 | 
            +
            		@bt_skip_levs_stack = [[nil, 1], [nil, 1]]
         | 
| 188 | 
            +
            		@logger_severity = Logger::DEBUG
         | 
| 189 | 
            +
            		@msg = ""
         | 
| 190 | 
            +
            		@auto_lf = true
         | 
| 191 | 
            +
            		@had_lf = true
         | 
| 192 | 
            +
            		@class_pfx = ""
         | 
| 193 | 
            +
            		@class_pfx_stack = [""]
         | 
| 194 | 
            +
            		ObjectSpace.define_finalizer(self) {
         | 
| 195 | 
            +
            			self.print(@msg[-1,1]=="\n" ? "":"\n") if @msg.length>0
         | 
| 196 | 
            +
            		}
         | 
| 197 | 
            +
            		@reentry = false
         | 
| 198 | 
            +
            		@backspc = "\b"
         | 
| 199 | 
            +
            		@progr_levs = [[nil, nil]]
         | 
| 200 | 
            +
            		@had_progr = false
         | 
| 201 | 
            +
            		@auto_had_progr = true
         | 
| 202 | 
            +
            		@progr_class = PLogTextProgrBar
         | 
| 203 | 
            +
            		@progr_init_args = []
         | 
| 204 | 
            +
            	end
         | 
| 205 | 
            +
            	
         | 
| 206 | 
            +
            	def install_tracer
         | 
| 207 | 
            +
            		  set_trace_func(proc{|event, file, line, id, binding, klass, *|
         | 
| 208 | 
            +
            			if event == "call"
         | 
| 209 | 
            +
            				obj = ObjectSpace._id2ref(id)
         | 
| 210 | 
            +
            				@class_pfx = klass + (obj.kind_of?(Class) ||
         | 
| 211 | 
            +
            					obj.kind_of?(Module) ? "#" : ".")
         | 
| 212 | 
            +
            				if @bt_skip_levs_stack.last[1] != 1 ||
         | 
| 213 | 
            +
            				@bt_skip_levs_stack[-2][1] != 1
         | 
| 214 | 
            +
            					@bt_skip_levs_stack.push([@call_lev, 1])
         | 
| 215 | 
            +
            				end
         | 
| 216 | 
            +
            				@call_lev += 1
         | 
| 217 | 
            +
            			elsif event == "return"
         | 
| 218 | 
            +
            				obj = ObjectSpace._id2ref(id)
         | 
| 219 | 
            +
            				@class_pfx = klass + (obj.kind_of?(Class) ||
         | 
| 220 | 
            +
            					obj.kind_of?(Module) ? "#" : ".")
         | 
| 221 | 
            +
            				if @call_lev == @traced_call_levs.last
         | 
| 222 | 
            +
            					@traced_call_levs.pop
         | 
| 223 | 
            +
            					if @auto_lf && !@had_lf
         | 
| 224 | 
            +
            						@msg += "\n"; @had_lf = true
         | 
| 225 | 
            +
            					end
         | 
| 226 | 
            +
            					@reentry = true
         | 
| 227 | 
            +
            				end
         | 
| 228 | 
            +
            				if @bt_skip_levs_stack.last[0] == @call_lev
         | 
| 229 | 
            +
            					@bt_skip_levs_stack.pop
         | 
| 230 | 
            +
            				end
         | 
| 231 | 
            +
            				self.finish_progr
         | 
| 232 | 
            +
            				@call_lev -= 1
         | 
| 233 | 
            +
            			end
         | 
| 234 | 
            +
            		  })
         | 
| 235 | 
            +
            	end
         | 
| 236 | 
            +
            	
         | 
| 237 | 
            +
            	def indent=(flag)
         | 
| 238 | 
            +
            		return if flag == @indent
         | 
| 239 | 
            +
            		if flag
         | 
| 240 | 
            +
            			@call_lev = 0
         | 
| 241 | 
            +
            			self.install_tracer if @trace
         | 
| 242 | 
            +
            		else
         | 
| 243 | 
            +
            			set_trace_func(nil)
         | 
| 244 | 
            +
            		end
         | 
| 245 | 
            +
            		@indent = flag
         | 
| 246 | 
            +
            	end
         | 
| 247 | 
            +
            	
         | 
| 248 | 
            +
            	def trace=(flag)
         | 
| 249 | 
            +
            		return if flag == @trace
         | 
| 250 | 
            +
            		if flag
         | 
| 251 | 
            +
            			self.install_tracer if @indent
         | 
| 252 | 
            +
            		else
         | 
| 253 | 
            +
            			set_trace_func(nil)
         | 
| 254 | 
            +
            		end
         | 
| 255 | 
            +
            		@trace = flag
         | 
| 256 | 
            +
            	end
         | 
| 257 | 
            +
            	
         | 
| 258 | 
            +
            	def progr
         | 
| 259 | 
            +
            		@progr_levs.last[1]
         | 
| 260 | 
            +
            	end
         | 
| 261 | 
            +
            	
         | 
| 262 | 
            +
            	def write(str)
         | 
| 263 | 
            +
            		@msg += str
         | 
| 264 | 
            +
            		if @outp.kind_of?(IO)
         | 
| 265 | 
            +
            			@outp.write(@msg)
         | 
| 266 | 
            +
            			@had_lf = (@msg[-1,1] == "\n") if @msg.length > 0
         | 
| 267 | 
            +
            		elsif @outp.kind_of?(Logger)
         | 
| 268 | 
            +
            			@outp.add(@logger_severity, @msg)
         | 
| 269 | 
            +
            			@had_lf = true
         | 
| 270 | 
            +
            		end
         | 
| 271 | 
            +
            		@msg = ""
         | 
| 272 | 
            +
            	end
         | 
| 273 | 
            +
            	
         | 
| 274 | 
            +
            	def print(str)
         | 
| 275 | 
            +
            		@msg += str
         | 
| 276 | 
            +
            		if @outp.kind_of?(IO)
         | 
| 277 | 
            +
            			@outp.print(@msg)
         | 
| 278 | 
            +
            			@had_lf = (@msg[-1, 1] == "\n") if @msg.length > 0
         | 
| 279 | 
            +
            			@msg = ""
         | 
| 280 | 
            +
            		elsif @outp.kind_of?(Logger)
         | 
| 281 | 
            +
            			res_msg = ""
         | 
| 282 | 
            +
            			@had_lf = true
         | 
| 283 | 
            +
            			@msg.each_line { |ln|
         | 
| 284 | 
            +
            				if !ln[-1, 1] == "\n"
         | 
| 285 | 
            +
            					res_msg = ln
         | 
| 286 | 
            +
            					@had_lf = false
         | 
| 287 | 
            +
            					break
         | 
| 288 | 
            +
            				end
         | 
| 289 | 
            +
            				@outp.add(@logger_severity, ln.chop!)
         | 
| 290 | 
            +
            			}
         | 
| 291 | 
            +
            			@msg = res_msg
         | 
| 292 | 
            +
            		end
         | 
| 293 | 
            +
            	end
         | 
| 294 | 
            +
            	
         | 
| 295 | 
            +
            	def puts(str)
         | 
| 296 | 
            +
            		if @outp.kind_of?(IO)
         | 
| 297 | 
            +
            			@outp.puts(@msg + str)
         | 
| 298 | 
            +
            		elsif @outp.kind_of?(Logger)
         | 
| 299 | 
            +
            			(@msg + str + "\n").each_line { |ln|
         | 
| 300 | 
            +
            				@outp.add(@logger_severity, ln.chop!)
         | 
| 301 | 
            +
            			}
         | 
| 302 | 
            +
            		end
         | 
| 303 | 
            +
            		@msg = ""
         | 
| 304 | 
            +
            		@had_lf = true
         | 
| 305 | 
            +
            	end
         | 
| 306 | 
            +
            	
         | 
| 307 | 
            +
            	def mk_indent_str(call_bt_lm)
         | 
| 308 | 
            +
            		if @call_lev != @traced_call_levs.last
         | 
| 309 | 
            +
            			@traced_call_levs.push(@call_lev)
         | 
| 310 | 
            +
            			if @indent
         | 
| 311 | 
            +
            				@class_pfx = @class_pfx_stack.last unless @trace
         | 
| 312 | 
            +
            				@class_pfx = "" unless @class_pfx
         | 
| 313 | 
            +
            				indent_str = @fmt_indent.call(
         | 
| 314 | 
            +
            					@traced_call_levs.length - 1) +
         | 
| 315 | 
            +
            					@fmt_func_pfx.call(call_bt_lm, true)
         | 
| 316 | 
            +
            			else
         | 
| 317 | 
            +
            				indent_str = ""
         | 
| 318 | 
            +
            			end
         | 
| 319 | 
            +
            			if @auto_lf && !@had_lf
         | 
| 320 | 
            +
            				@msg += "\n"; @had_lf = true
         | 
| 321 | 
            +
            			end
         | 
| 322 | 
            +
            		else
         | 
| 323 | 
            +
            			if @indent
         | 
| 324 | 
            +
            				indent_str = @fmt_indent.call(
         | 
| 325 | 
            +
            					@traced_call_levs.length - 1) +
         | 
| 326 | 
            +
            					@msg_indent
         | 
| 327 | 
            +
            				if @reentry
         | 
| 328 | 
            +
            					@class_pfx=@class_pfx_stack.last unless
         | 
| 329 | 
            +
            						@trace
         | 
| 330 | 
            +
            					@class_pfx = "" unless @class_pfx
         | 
| 331 | 
            +
            					indent_str += @fmt_func_pfx.call(
         | 
| 332 | 
            +
            						call_bt_lm, false)
         | 
| 333 | 
            +
            				end
         | 
| 334 | 
            +
            			else
         | 
| 335 | 
            +
            				indent_str = ""
         | 
| 336 | 
            +
            			end
         | 
| 337 | 
            +
            		end
         | 
| 338 | 
            +
            		@reentry = false
         | 
| 339 | 
            +
            		indent_str
         | 
| 340 | 
            +
            	end
         | 
| 341 | 
            +
            	
         | 
| 342 | 
            +
            	def print_msg(str)
         | 
| 343 | 
            +
            		str = str.to_s unless str.kind_of?(String)
         | 
| 344 | 
            +
            		indent_str=self.mk_indent_str(caller(
         | 
| 345 | 
            +
            			@bt_skip_levs_stack[-2][1])[0])
         | 
| 346 | 
            +
            		if indent_str.length > 0
         | 
| 347 | 
            +
            			if !@had_lf
         | 
| 348 | 
            +
            				ind = ""
         | 
| 349 | 
            +
            				str.each_line { |ln| self.print(ind + ln)
         | 
| 350 | 
            +
            					ind = indent_str }
         | 
| 351 | 
            +
            			else
         | 
| 352 | 
            +
            				str.each_line {|ln| self.print(indent_str + ln)}
         | 
| 353 | 
            +
            			end
         | 
| 354 | 
            +
            		else
         | 
| 355 | 
            +
            			self.print(str)
         | 
| 356 | 
            +
            		end
         | 
| 357 | 
            +
            		@had_progr = false if @auto_had_progr
         | 
| 358 | 
            +
            	end
         | 
| 359 | 
            +
            	
         | 
| 360 | 
            +
            	def puts_msg(str)
         | 
| 361 | 
            +
            		str = str.to_s unless str.kind_of?(String)
         | 
| 362 | 
            +
            		indent_str=self.mk_indent_str(caller(
         | 
| 363 | 
            +
            			@bt_skip_levs_stack[-2][1])[0])
         | 
| 364 | 
            +
            		if indent_str.length > 0
         | 
| 365 | 
            +
            			if !@had_lf
         | 
| 366 | 
            +
            				ind = ""
         | 
| 367 | 
            +
            				(str + "\n").each_line { |ln|
         | 
| 368 | 
            +
            				 	self.print(ind + ln); ind = indent_str }
         | 
| 369 | 
            +
            			else
         | 
| 370 | 
            +
            				(str + "\n").each_line { |ln|
         | 
| 371 | 
            +
            					self.print(indent_str + ln) }
         | 
| 372 | 
            +
            			end
         | 
| 373 | 
            +
            		else
         | 
| 374 | 
            +
            			self.puts(str)
         | 
| 375 | 
            +
            		end
         | 
| 376 | 
            +
            		@had_progr = false if @auto_had_progr
         | 
| 377 | 
            +
            	end
         | 
| 378 | 
            +
            	
         | 
| 379 | 
            +
            	def print_progr(str, extra_bt_levs=1)
         | 
| 380 | 
            +
            		str = str.to_s unless str.kind_of?(String)
         | 
| 381 | 
            +
            		indent_str=self.mk_indent_str(caller(
         | 
| 382 | 
            +
            			@bt_skip_levs_stack[-2][1] + extra_bt_levs)[0])
         | 
| 383 | 
            +
            		if indent_str.length > 0
         | 
| 384 | 
            +
            			if !@had_lf
         | 
| 385 | 
            +
            				ind = ""
         | 
| 386 | 
            +
            				str.each_line { |ln| self.print(ind + ln)
         | 
| 387 | 
            +
            					ind = indent_str }
         | 
| 388 | 
            +
            			else
         | 
| 389 | 
            +
            				str.each_line {|ln| self.print(indent_str + ln)}
         | 
| 390 | 
            +
            			end
         | 
| 391 | 
            +
            		else
         | 
| 392 | 
            +
            			self.print(str)
         | 
| 393 | 
            +
            		end
         | 
| 394 | 
            +
            		@had_progr = true if @auto_had_progr
         | 
| 395 | 
            +
            	end
         | 
| 396 | 
            +
            	
         | 
| 397 | 
            +
            	def sig_wrapped_call
         | 
| 398 | 
            +
            		@bt_skip_levs_stack.last[1] += 1
         | 
| 399 | 
            +
            	end
         | 
| 400 | 
            +
            	
         | 
| 401 | 
            +
            	def sig_wrapped_return
         | 
| 402 | 
            +
            		@bt_skip_levs_stack.last[1] -= 1 if
         | 
| 403 | 
            +
            			@bt_skip_levs_stack.last[1] > 1
         | 
| 404 | 
            +
            	end
         | 
| 405 | 
            +
            	
         | 
| 406 | 
            +
            	def sig_call(class_pfx="")
         | 
| 407 | 
            +
            		return if @trace && @indent
         | 
| 408 | 
            +
            		if class_pfx.kind_of?(String)
         | 
| 409 | 
            +
            			@class_pfx = class_pfx
         | 
| 410 | 
            +
            		elsif class_pfx.kind_of?(Class) || class_pfx.kind_of?(Module)
         | 
| 411 | 
            +
            			@class_pfx = class_pfx.name + "#"
         | 
| 412 | 
            +
            		else
         | 
| 413 | 
            +
            			@class_pfx = class_pfx.class.name + "."
         | 
| 414 | 
            +
            		end
         | 
| 415 | 
            +
            		@class_pfx_stack.push(@class_pfx)
         | 
| 416 | 
            +
            		@call_lev += 1
         | 
| 417 | 
            +
            		if @bt_skip_levs_stack.last[1] != 1 ||
         | 
| 418 | 
            +
            		@bt_skip_levs_stack[-2][1] != 1
         | 
| 419 | 
            +
            			@bt_skip_levs_stack.push([@call_lev, 1])
         | 
| 420 | 
            +
            		end
         | 
| 421 | 
            +
            	end
         | 
| 422 | 
            +
            	
         | 
| 423 | 
            +
            	def sig_return(msg="")
         | 
| 424 | 
            +
            		if (msg = msg.to_s).length > 0
         | 
| 425 | 
            +
            			@bt_skip_levs_stack[-2][1] += 1
         | 
| 426 | 
            +
            			self.print_msg(msg)
         | 
| 427 | 
            +
            			@bt_skip_levs_stack[-2][1] -= 1
         | 
| 428 | 
            +
            		end
         | 
| 429 | 
            +
            		return if @trace && @indent
         | 
| 430 | 
            +
            		if @call_lev == @traced_call_levs.last
         | 
| 431 | 
            +
            			@traced_call_levs.pop
         | 
| 432 | 
            +
            			if @auto_lf && !@had_lf
         | 
| 433 | 
            +
            				@msg += "\n"; @had_lf = true
         | 
| 434 | 
            +
            			end
         | 
| 435 | 
            +
            			@reentry = true
         | 
| 436 | 
            +
            		end
         | 
| 437 | 
            +
            		if @bt_skip_levs_stack.last[0] == @call_lev
         | 
| 438 | 
            +
            			@bt_skip_levs_stack.pop
         | 
| 439 | 
            +
            		end
         | 
| 440 | 
            +
            		self.finish_progr 
         | 
| 441 | 
            +
            		@class_pfx_stack.pop
         | 
| 442 | 
            +
            		@call_lev -= 1
         | 
| 443 | 
            +
            	end
         | 
| 444 | 
            +
            	
         | 
| 445 | 
            +
            	def new_progr
         | 
| 446 | 
            +
            		@progr_levs.push([@call_lev,
         | 
| 447 | 
            +
            			@progr_class.new(*[self].concat(@progr_init_args))])
         | 
| 448 | 
            +
            	end
         | 
| 449 | 
            +
            	
         | 
| 450 | 
            +
            	def finish_progr
         | 
| 451 | 
            +
            		if @call_lev == @progr_levs.last[0]
         | 
| 452 | 
            +
            			@progr_levs.pop[1].finish
         | 
| 453 | 
            +
            			@had_progr = false if @auto_had_progr
         | 
| 454 | 
            +
            		end
         | 
| 455 | 
            +
            	end
         | 
| 456 | 
            +
            end
         | 
| 457 | 
            +
             | 
| 458 | 
            +
            $PDbgLog = PDbgLog.new
         | 
| @@ -0,0 +1,53 @@ | |
| 1 | 
            +
            class FloatsInp
         | 
| 2 | 
            +
            	@@float_pat = Regexp.compile(/[+-]?(?:[0-9]+[.]?[0-9]*|[0-9]*[.]?[0-9]+)(?:[eE]?[0-9]*[.]?[0-9]*|)/)
         | 
| 3 | 
            +
            	
         | 
| 4 | 
            +
            	attr_reader :io, :rec_buf
         | 
| 5 | 
            +
            	
         | 
| 6 | 
            +
            	def initialize(*args)
         | 
| 7 | 
            +
            		@rec_buf = []
         | 
| 8 | 
            +
            		if args[0].kind_of?(IO)
         | 
| 9 | 
            +
            			@io = args[0]
         | 
| 10 | 
            +
            		else
         | 
| 11 | 
            +
            			@io = File.new(*args)
         | 
| 12 | 
            +
            		end
         | 
| 13 | 
            +
            	end
         | 
| 14 | 
            +
            	
         | 
| 15 | 
            +
            	def method_missing(id, *args, &block)
         | 
| 16 | 
            +
            		@io.send(id, *args, &block)
         | 
| 17 | 
            +
            	end
         | 
| 18 | 
            +
            	
         | 
| 19 | 
            +
            	def get_float
         | 
| 20 | 
            +
            		if @rec_buf.empty? && (ln = self.gets)
         | 
| 21 | 
            +
            			ln.scan(@@float_pat) { |f| @rec_buf << f.to_f }
         | 
| 22 | 
            +
            		end
         | 
| 23 | 
            +
            		@rec_buf.shift
         | 
| 24 | 
            +
            	end
         | 
| 25 | 
            +
            	
         | 
| 26 | 
            +
            	def each_float
         | 
| 27 | 
            +
            		while (f = self.get_float)
         | 
| 28 | 
            +
            			yield(f)
         | 
| 29 | 
            +
            		end
         | 
| 30 | 
            +
            	end
         | 
| 31 | 
            +
            	
         | 
| 32 | 
            +
            	def get_rec
         | 
| 33 | 
            +
            		if @rec_buf.empty?
         | 
| 34 | 
            +
            			return nil unless (ln = self.gets)
         | 
| 35 | 
            +
            			ln.scan(@@float_pat) { |f| @rec_buf << f.to_f }
         | 
| 36 | 
            +
            		end
         | 
| 37 | 
            +
            		res = @rec_buf
         | 
| 38 | 
            +
            		@rec_buf = []
         | 
| 39 | 
            +
            		res
         | 
| 40 | 
            +
            	end
         | 
| 41 | 
            +
            	
         | 
| 42 | 
            +
            	def each_rec
         | 
| 43 | 
            +
            		while (rec = self.get_rec)
         | 
| 44 | 
            +
            			yield(rec)
         | 
| 45 | 
            +
            		end
         | 
| 46 | 
            +
            	end
         | 
| 47 | 
            +
            	
         | 
| 48 | 
            +
            	def read_recs
         | 
| 49 | 
            +
            		res = []
         | 
| 50 | 
            +
            		self.each_rec { |rec| res << rec }
         | 
| 51 | 
            +
            		res
         | 
| 52 | 
            +
            	end
         | 
| 53 | 
            +
            end
         | 
| @@ -0,0 +1,165 @@ | |
| 1 | 
            +
            #require 'generator'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class GeneratorCacheArr < Array
         | 
| 4 | 
            +
            	def initialize(gen_spec=nil)
         | 
| 5 | 
            +
            		if !gen_spec
         | 
| 6 | 
            +
            			@gen_func = Proc.new
         | 
| 7 | 
            +
            		elsif gen_spec.kind_of?(Proc) || gen_spec.kind_of?(Method)
         | 
| 8 | 
            +
            			@gen_func = gen_spec
         | 
| 9 | 
            +
            		else
         | 
| 10 | 
            +
            			@gen_func = gen_spec.method("each")
         | 
| 11 | 
            +
            		end
         | 
| 12 | 
            +
            		@end = false
         | 
| 13 | 
            +
            		@next_lm = nil
         | 
| 14 | 
            +
            		super()
         | 
| 15 | 
            +
            		self.rewind
         | 
| 16 | 
            +
            	end
         | 
| 17 | 
            +
            	
         | 
| 18 | 
            +
            	def end?
         | 
| 19 | 
            +
            		@end
         | 
| 20 | 
            +
            	end
         | 
| 21 | 
            +
            	
         | 
| 22 | 
            +
            	def next?
         | 
| 23 | 
            +
            		!@end
         | 
| 24 | 
            +
            	end
         | 
| 25 | 
            +
            	
         | 
| 26 | 
            +
            	def rewind
         | 
| 27 | 
            +
            		callcc { |@ret|
         | 
| 28 | 
            +
            			@gen_func.call { |lm|
         | 
| 29 | 
            +
            				callcc { |@next_lm| @ret.call }
         | 
| 30 | 
            +
            				self << lm
         | 
| 31 | 
            +
            			}
         | 
| 32 | 
            +
            			@end = true
         | 
| 33 | 
            +
            			@next_lm = proc {
         | 
| 34 | 
            +
            				raise EOFError, "no more elements available" }
         | 
| 35 | 
            +
            			@ret.call
         | 
| 36 | 
            +
            		}
         | 
| 37 | 
            +
            		self.clear
         | 
| 38 | 
            +
            	end
         | 
| 39 | 
            +
            	
         | 
| 40 | 
            +
            	def next
         | 
| 41 | 
            +
            		callcc { |@ret| @next_lm.call }
         | 
| 42 | 
            +
            		self.last
         | 
| 43 | 
            +
            	end
         | 
| 44 | 
            +
            	
         | 
| 45 | 
            +
            	def current
         | 
| 46 | 
            +
            		self.last
         | 
| 47 | 
            +
            	end
         | 
| 48 | 
            +
            	
         | 
| 49 | 
            +
            	def index
         | 
| 50 | 
            +
            		self.length - 1
         | 
| 51 | 
            +
            	end
         | 
| 52 | 
            +
            	
         | 
| 53 | 
            +
            	def cache_upto(last_i)
         | 
| 54 | 
            +
            		if last_i
         | 
| 55 | 
            +
            			self.length.upto(last_i) {
         | 
| 56 | 
            +
            				return if @end
         | 
| 57 | 
            +
            				self.next
         | 
| 58 | 
            +
            			}
         | 
| 59 | 
            +
            		else
         | 
| 60 | 
            +
            			while !@end
         | 
| 61 | 
            +
            				self.next
         | 
| 62 | 
            +
            			end
         | 
| 63 | 
            +
            		end
         | 
| 64 | 
            +
            	end
         | 
| 65 | 
            +
            	
         | 
| 66 | 
            +
            	def [](*args)
         | 
| 67 | 
            +
            		if args.length == 1
         | 
| 68 | 
            +
            			i = args[0]
         | 
| 69 | 
            +
            			if i.kind_of? Range
         | 
| 70 | 
            +
            				if i.first < 0
         | 
| 71 | 
            +
            					last_i = nil
         | 
| 72 | 
            +
            				elsif i.last >= i.first
         | 
| 73 | 
            +
            					last_i = i.last + (i.exclude_end? ? 0:1)
         | 
| 74 | 
            +
            				else
         | 
| 75 | 
            +
            					if i.last + (i.exclude_end? ? 0:-1) < 0
         | 
| 76 | 
            +
            						last_i = nil
         | 
| 77 | 
            +
            					else
         | 
| 78 | 
            +
            						last_i = i.first
         | 
| 79 | 
            +
            					end
         | 
| 80 | 
            +
            				end
         | 
| 81 | 
            +
            			elsif i.kind_of? Array
         | 
| 82 | 
            +
            				last_i = i.max
         | 
| 83 | 
            +
            			elsif i.kind_of? Integer
         | 
| 84 | 
            +
            				if i < 0
         | 
| 85 | 
            +
            					last_i = nil
         | 
| 86 | 
            +
            				else
         | 
| 87 | 
            +
            					last_i = i
         | 
| 88 | 
            +
            				end
         | 
| 89 | 
            +
            			else
         | 
| 90 | 
            +
            				raise ArgumentError,
         | 
| 91 | 
            +
            					"Wrong single argument: #{i.inspect}"
         | 
| 92 | 
            +
            			end
         | 
| 93 | 
            +
            		elsif args.length == 2
         | 
| 94 | 
            +
            			last_i = args[0] + args[1] - 1
         | 
| 95 | 
            +
            		else
         | 
| 96 | 
            +
            			raise ArgumentError,
         | 
| 97 | 
            +
            				"Wrong numbef of arguments: #{args.inspect}"
         | 
| 98 | 
            +
            		end
         | 
| 99 | 
            +
            		self.cache_upto(last_i)
         | 
| 100 | 
            +
            		super(*args)
         | 
| 101 | 
            +
            	end
         | 
| 102 | 
            +
            end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            =begin
         | 
| 105 | 
            +
            class GeneratorCacheArr < Generator
         | 
| 106 | 
            +
            	def initialize(*args, &block)
         | 
| 107 | 
            +
            		@arr = []
         | 
| 108 | 
            +
            		super(*args, &block)
         | 
| 109 | 
            +
            	end
         | 
| 110 | 
            +
            	
         | 
| 111 | 
            +
            	def cache_upto(last_i)
         | 
| 112 | 
            +
            		if last_i
         | 
| 113 | 
            +
            			self.index.upto(last_i) {
         | 
| 114 | 
            +
            				return if self.end?
         | 
| 115 | 
            +
            				@arr << self.next
         | 
| 116 | 
            +
            			}
         | 
| 117 | 
            +
            		else
         | 
| 118 | 
            +
            			while !self.end?
         | 
| 119 | 
            +
            				@arr << self.next
         | 
| 120 | 
            +
            			end
         | 
| 121 | 
            +
            		end
         | 
| 122 | 
            +
            	end
         | 
| 123 | 
            +
            	
         | 
| 124 | 
            +
            	def [](*args)
         | 
| 125 | 
            +
            		if args.length == 1
         | 
| 126 | 
            +
            			i = args[0]
         | 
| 127 | 
            +
            			if i.kind_of? Range
         | 
| 128 | 
            +
            				if i.first < 0
         | 
| 129 | 
            +
            					last_i = nil
         | 
| 130 | 
            +
            				elsif i.last >= i.first
         | 
| 131 | 
            +
            					last_i = i.last + (i.exclude_end? ? 0:1)
         | 
| 132 | 
            +
            				else
         | 
| 133 | 
            +
            					if i.last + (i.exclude_end? ? 0:-1) < 0
         | 
| 134 | 
            +
            						last_i = nil
         | 
| 135 | 
            +
            					else
         | 
| 136 | 
            +
            						last_i = i.first
         | 
| 137 | 
            +
            					end
         | 
| 138 | 
            +
            				end
         | 
| 139 | 
            +
            			elsif i.kind_of? Array
         | 
| 140 | 
            +
            				last_i = i.max
         | 
| 141 | 
            +
            			elsif i.kind_of? Integer
         | 
| 142 | 
            +
            				if i < 0
         | 
| 143 | 
            +
            					last_i = -i-1
         | 
| 144 | 
            +
            				else
         | 
| 145 | 
            +
            					last_i = i
         | 
| 146 | 
            +
            				end
         | 
| 147 | 
            +
            			else
         | 
| 148 | 
            +
            				raise ArgumentError,
         | 
| 149 | 
            +
            					"Wrong single argument: #{i.inspect}"
         | 
| 150 | 
            +
            			end
         | 
| 151 | 
            +
            		elsif args.length == 2
         | 
| 152 | 
            +
            			last_i = args[0] + args[1] - 1
         | 
| 153 | 
            +
            		else
         | 
| 154 | 
            +
            			raise ArgumentError,
         | 
| 155 | 
            +
            				"Wrong numbef of arguments: #{args.inspect}"
         | 
| 156 | 
            +
            		end
         | 
| 157 | 
            +
            		self.cache_upto(last_i)
         | 
| 158 | 
            +
            		@arr[*args]
         | 
| 159 | 
            +
            	end
         | 
| 160 | 
            +
            	
         | 
| 161 | 
            +
            	def []=(*args)
         | 
| 162 | 
            +
            		@arr.[]=(*args)
         | 
| 163 | 
            +
            	end
         | 
| 164 | 
            +
            end
         | 
| 165 | 
            +
            =end
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            extract-curves/ruby_libs/pav/gtk
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            :ext:pavpen@rubyforge.org:/var/cvs/extract-curves
         |