extract_curves 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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/cstr.c +82 -0
- data/ruby_ext/pav/cstr.h +17 -0
- data/ruby_ext/pav/extconf.rb +22 -0
- data/ruby_ext/pav/pav.c +162 -0
- data/ruby_ext/pav/pgtk.c +40 -0
- data/ruby_ext/pav/pgtk.h +14 -0
- data/ruby_ext/pav/pix.c +806 -0
- data/ruby_ext/pav/pix.h +236 -0
- data/ruby_ext/pav/t.rb +35 -0
- data/ruby_ext/pav/t1.rb +35 -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.xcf +0 -0
- data/ruby_libs/pav/icons/alt_handle.xpm +3832 -0
- data/ruby_libs/pav/icons/alt_handle_hover.xcf +0 -0
- data/ruby_libs/pav/icons/alt_handle_hover.xpm +3368 -0
- data/ruby_libs/pav/icons/alt_handle_pressed.xcf +0 -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/extract_curves-logo-rgb.xcf +0 -0
- data/ruby_libs/pav/icons/extract_curves/trace_mark.xcf +0 -0
- data/ruby_libs/pav/icons/extract_curves/trace_mark.xpm +38 -0
- data/ruby_libs/pav/icons/handle.xcf +0 -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.rb +402 -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.rb +644 -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/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/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 +161 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'pav/attr_cache'
|
2
|
+
|
3
|
+
class C
|
4
|
+
include AttrCache
|
5
|
+
|
6
|
+
def f(x)
|
7
|
+
x
|
8
|
+
end
|
9
|
+
|
10
|
+
cache_attr! :f
|
11
|
+
end
|
12
|
+
|
13
|
+
a = C.new
|
14
|
+
b = C.new
|
15
|
+
p a.f("a")
|
16
|
+
p b.f("b")
|
17
|
+
c = C.new
|
18
|
+
d = C.new
|
19
|
+
p c.f("c")
|
20
|
+
p a.f(1)
|
21
|
+
p b.f(2)
|
22
|
+
p c.f(3)
|
23
|
+
p d.uncache_attr!(:f)
|
24
|
+
a.uncache_attr!(:f)
|
25
|
+
p a.f(0)
|
26
|
+
p a.f(1)
|
27
|
+
p a.cache_attr!(:f)
|
28
|
+
p a.f(2)
|
29
|
+
p a.f(3)
|
30
|
+
p a.kill_attr_cache!(:f)
|
31
|
+
p a.f(4)
|
32
|
+
p a.f(5)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#begin
|
2
|
+
require 'pav/pav'
|
3
|
+
#rescue LoadError
|
4
|
+
|
5
|
+
require 'weakref'
|
6
|
+
|
7
|
+
class PCache
|
8
|
+
attr_reader :tbl, :args
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
@args = args
|
12
|
+
#@tbl = WeakRef.new(Hash.new(*@args))
|
13
|
+
end
|
14
|
+
|
15
|
+
def method_missing(id, *args)
|
16
|
+
return @args[0]
|
17
|
+
gc_dis = GC.disable
|
18
|
+
unless @tbl.weakref_alive?
|
19
|
+
@tbl = WeakRef.new(Hash.new(*@args))
|
20
|
+
end
|
21
|
+
begin
|
22
|
+
res = @tbl.send(id, *args)
|
23
|
+
rescue WeakRef::RefError
|
24
|
+
res = @args[0]
|
25
|
+
end
|
26
|
+
GC.enable unless gc_dis
|
27
|
+
res
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#end # require 'pav/pav'
|
@@ -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
|