arcadia 0.1.3 → 0.2.0

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.
Files changed (56) hide show
  1. data/README +69 -77
  2. data/arcadia.rb +1097 -770
  3. data/base/a-commons.rb +480 -0
  4. data/base/a-contracts.rb +207 -322
  5. data/base/{a-utils.rb → a-tkcommons.rb} +933 -993
  6. data/conf/arcadia.conf +130 -203
  7. data/conf/arcadia.res.rb +1332 -1325
  8. data/ext/ae-action-dispatcher/ae-action-dispatcher.conf +6 -0
  9. data/ext/ae-action-dispatcher/ae-action-dispatcher.rb +22 -0
  10. data/ext/ae-complete-code/ae-complete-code.conf +2 -2
  11. data/ext/ae-complete-code/ae-complete-code.rb +82 -80
  12. data/ext/ae-doc-code/ae-doc-code.conf +2 -2
  13. data/ext/ae-doc-code/ae-doc-code.rb +114 -111
  14. data/ext/ae-editor/ae-editor.conf +110 -105
  15. data/ext/ae-editor/ae-editor.rb +2501 -2287
  16. data/ext/ae-editor/langs/conf.lang +15 -0
  17. data/ext/ae-editor/langs/lang.lang.bind +1 -0
  18. data/ext/ae-editor/langs/rb.lang +67 -0
  19. data/ext/ae-editor/langs/rbw.lang.bind +1 -0
  20. data/ext/ae-event-log/ae-event-log.rb +45 -52
  21. data/ext/ae-file-history/ae-file-history.conf +4 -4
  22. data/ext/ae-file-history/ae-file-history.rb +298 -286
  23. data/ext/ae-flag/ae-flag.conf +6 -6
  24. data/ext/ae-flag/ae-flag.rb +12 -12
  25. data/ext/ae-inspector/ae-inspector.conf +3 -3
  26. data/ext/ae-inspector/ae-inspector.rb +2 -2
  27. data/ext/ae-output-event/ae-output-event.conf +15 -15
  28. data/ext/ae-output/ae-output.conf +5 -3
  29. data/ext/ae-output/ae-output.rb +62 -33
  30. data/ext/ae-palette/ae-palette.conf +3 -3
  31. data/ext/ae-palette/ae-palette.rb +265 -306
  32. data/ext/ae-rad/ae-rad-inspector.rb +1534 -0
  33. data/{base/a-libs.rb → ext/ae-rad/ae-rad-libs.rb} +1118 -846
  34. data/ext/ae-rad/ae-rad-palette.rb +273 -0
  35. data/ext/ae-rad/ae-rad.conf +71 -0
  36. data/ext/ae-rad/ae-rad.rb +56 -0
  37. data/{lib → ext/ae-rad/lib}/tk/al-tk.rb +21 -110
  38. data/{lib → ext/ae-rad/lib}/tk/al-tk.res.rb +0 -0
  39. data/{lib → ext/ae-rad/lib}/tk/al-tkarcadia.rb +26 -26
  40. data/{lib → ext/ae-rad/lib}/tk/al-tkcustom.rb +70 -70
  41. data/{lib → ext/ae-rad/lib}/tkext/al-bwidget.rb +194 -194
  42. data/{lib → ext/ae-rad/lib}/tkext/al-iwidgets.rb +25 -25
  43. data/{lib → ext/ae-rad/lib}/tkext/al-tile.rb +173 -173
  44. data/{lib → ext/ae-rad/lib}/tkext/al-tktable.rb +0 -0
  45. data/ext/ae-ruby-debug/ae-ruby-debug.conf +7 -4
  46. data/ext/ae-ruby-debug/ae-ruby-debug.rb +278 -142
  47. data/ext/ae-search-in-files/ae-search-in-files.conf +15 -0
  48. data/ext/ae-search-in-files/ae-search-in-files.rb +284 -0
  49. data/ext/ae-shell/ae-shell.rb +88 -8
  50. data/ext/ae-shell/sh.rb +7 -0
  51. metadata +93 -79
  52. data/base/a-contracts-work.rb +0 -219
  53. data/base/a-ext.rb +0 -280
  54. data/ext/ae-debug/ae-debug.conf +0 -7
  55. data/ext/ae-debug/ae-debug.rb +0 -601
  56. data/ext/ae-debug/debug1.57.rb +0 -998
@@ -1,7 +0,0 @@
1
- name=debug
2
- label=Debug
3
- frame=1.0
4
- active=yes
5
- require=ext/ae-debug/ae-debug
6
- class=ArcadiaDebug
7
-
@@ -1,601 +0,0 @@
1
- #
2
- # ae-debug.rb - Arcadia Ruby ide
3
- # by Antonio Galeone <antonio-galeone@rubyforge.org>
4
- #
5
-
6
- require "observer"
7
-
8
- class ArcadiaDebugWrapper
9
- include Observable
10
- attr_reader :last_command
11
- attr_reader :debugging
12
- def initialize
13
- (RUBY_PLATFORM.include?('mswin32'))?_cmd="cmd":_cmd='sh'
14
- @io = IO.popen(_cmd,'w')
15
- @last_command = _cmd
16
- @stop = false
17
- @transfer_file=ArcadiaDebugWrapper.transfer_file
18
- @threads = Array.new
19
- @debugging = false
20
- end
21
-
22
- def ArcadiaDebugWrapper.transfer_file
23
- '~transfer-debug-file.tmp'
24
- end
25
-
26
- def start_debug(_file=nil)
27
- @breakpoint_id=0
28
- @file=_file
29
- if File.exist?(@transfer_file)
30
- File.delete(@transfer_file)
31
- end
32
- if _file
33
- @main_thread = Thread.new{
34
- command($arcadia['conf']['shell.ruby']+" -r ext/ae-debug/debug1.57 "+_file)
35
- @last_command = 'debug'
36
- read
37
- }
38
- end
39
- end
40
-
41
- def quit_debug
42
- command("q\ny\n")
43
- command("exit\n")
44
- @threads.each{|t|
45
- if t.alive?
46
- t.kill
47
- end
48
- }
49
- @main_thread.kill
50
- end
51
-
52
- def step_over
53
- @threads << Thread.new{
54
- command("n")
55
- read
56
- }
57
- end
58
-
59
- def step_into
60
- @threads << Thread.new{
61
- command("s")
62
- read
63
- }
64
- end
65
-
66
- def resume
67
- Thread.new{
68
- command("c")
69
- read
70
- }
71
- end
72
-
73
- def finish
74
- Thread.new{
75
- command("fin")
76
- read
77
- }
78
- end
79
-
80
- def v_global
81
- @threads << Thread.new{
82
- command("v g")
83
- read
84
- }
85
- end
86
-
87
- def v_local
88
- @threads << Thread.new{
89
- command("v l")
90
- read
91
- }
92
- end
93
-
94
- def v_instance(_obj)
95
- @threads << Thread.new{
96
- command("v i "+_obj)
97
- read
98
- }
99
- end
100
-
101
- def breakpoint_set(_pos, _context=nil)
102
- @threads << Thread.new{
103
- if _context
104
- command("b "+_context+':'+_pos)
105
- else
106
- command("b "+_pos)
107
- end
108
- read
109
- }
110
- @breakpoint_id = @breakpoint_id + 1 if @breakpoint_id
111
- end
112
-
113
- def breckpoint_del(_id)
114
- @threads << Thread.new{
115
- if _id
116
- command("del "+_id)
117
- else
118
- command("del")
119
- end
120
- read
121
- }
122
- end
123
-
124
- def command(_command)
125
- begin
126
- @debugging = true
127
- @io.puts(_command)
128
- @last_command = _command
129
- rescue Exception => e
130
- $arcadia.outln("\n"+" error on :"+" command >>> "+_command+' : '+e.to_s ) if $arcadia
131
- end
132
- end
133
-
134
- def stop
135
- @stop = true
136
- end
137
-
138
- def read
139
- # t_i = 0
140
- # t_out = 5
141
- # while !File.exist?(@transfer_file) && t_i < t_out
142
- # sleep(t_i)
143
- # t_i = t_i + 1
144
- # end
145
- # if !File.exist?(@transfer_file)
146
- # return
147
- # end
148
-
149
- begin
150
- while !File.exist?(@transfer_file)
151
- end
152
- if File.exist?(@transfer_file)
153
- while !File.stat(@transfer_file).readable?
154
- end
155
- File.open(@transfer_file) do |f|
156
- $ppp = Marshal.load(f)
157
- end
158
- while !File.stat(@transfer_file).writable?
159
- end
160
- File.delete(@transfer_file) if File.exist?(@transfer_file)
161
- changed
162
- notify_observers($ppp)
163
- end
164
- rescue Exception => e
165
- MsgContract.instance.out_debug(self, "\n"+'Error on : '+" reading >>> "+@transfer_file+" : "+e.to_s )
166
- ensure
167
- @debugging = false
168
- end
169
- end
170
- end
171
-
172
- class ArcadiaDebug < ArcadiaExt
173
-
174
- class VariablesViewText < TkTitledFrame
175
- attr_reader :text
176
-
177
- def initialize(parent=nil, title='...', maximize_to=nil ,keys=nil)
178
- super(parent, title, maximize_to, keys)
179
- @top_label.configure(:background => 'red')
180
- @text = TkText.new(self.frame,
181
- 'relief' => 'flat',
182
- 'wrap' => 'none'
183
- ){|j|
184
- parent = TkWinfo.parent(j)
185
- TkScrollbar.new(parent){|s|
186
- command proc{|*args| j.yview(*args)}
187
- j.yscrollcommand proc{|first,last| s.set first,last}
188
- }.pack('side'=>'right', 'fill'=>'y')
189
- TkScrollbar.new(parent){|s|
190
- command proc{|*args| j.xview(*args)}
191
- orient 'horizontal'
192
- j.xscrollcommand proc{|first,last| s.set first,last}
193
- }.pack('side'=>'bottom', 'fill'=>'x')
194
- }.place(
195
- 'relwidth' => '1',
196
- 'relx' => 0,
197
- 'x' => '0',
198
- 'y' => '0',
199
- 'relheight' => '1',
200
- 'rely' => 0,
201
- 'height' => '-15',
202
- 'bordermode' =>
203
- 'inside',
204
- 'width' => '-15'
205
- )
206
- place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
207
- end
208
- end
209
-
210
- class VariablesViewProperties < TkTitledScrollFrame
211
- attr_reader :inspector
212
-
213
- def initialize(parent=nil, title='...', maximize_to=nil ,keys=nil)
214
- super(parent, title, maximize_to, keys)
215
- @inspector=InspectListReadOnly.new(self.frame.cwin)
216
- place('x'=>0, 'y'=>0,'relheight'=>1, 'relwidth'=>1)
217
- end
218
-
219
- end
220
-
221
-
222
- class ArcadiaDebugInfo
223
-
224
- def initialize(_parent=nil)
225
- @nb = Tk::BWidget::NoteBook.new(_parent){
226
- tabbevelsize 0
227
- internalborderwidth 2
228
- activeforeground 'red'
229
- activebackground 'yellow'
230
- borderwidth 1
231
- side $arcadia['conf']['editor.tabs.side']
232
- font $arcadia['conf']['editor.tabs.font']
233
- pack('fill'=>'both', :expand => 'yes')
234
- }
235
-
236
- @nb_variables = @nb.insert('end','var' ,'text'=>'Variables' )
237
-
238
- @hsplitter = AGTkOSplittedFrames.new(@nb_variables,220)
239
-
240
- @hsplitter2 = AGTkOSplittedFrames.new(@hsplitter.top_frame,80)
241
- @vvl=VariablesViewText.new(@hsplitter2.top_frame,'Local')
242
- @vvi=VariablesViewText.new(@hsplitter2.bottom_frame,'Instance(self)')
243
- @vvg=VariablesViewText.new(@hsplitter.bottom_frame,'Global')
244
- font = $arcadia['conf']['inspectors.debug.tabs.font']
245
- font_b = $arcadia['conf']['inspectors.debug.tabs.font.bold']
246
- @vvl.text.tag_configure('key',
247
- 'foreground' => 'blue',
248
- 'font'=> font
249
- )
250
- @vvl.text.tag_configure('value',
251
- 'foreground' => 'black',
252
- 'font'=> font
253
- )
254
- @vvl.text.tag_configure('sep',
255
- 'foreground' => 'gray',
256
- 'font'=> font
257
- )
258
-
259
- @vvi.text.tag_configure('key',
260
- 'foreground' => 'blue',
261
- 'font'=> font
262
- )
263
-
264
- @vvi.text.tag_configure('value',
265
- 'foreground' => 'black',
266
- 'font'=> font
267
- )
268
-
269
- @vvi.text.tag_configure('sep',
270
- 'foreground' => 'gray',
271
- 'font'=> font
272
- )
273
-
274
- @vvg.text.tag_configure('key',
275
- 'foreground' => '#018869',
276
- 'font'=> font
277
- )
278
-
279
- @vvg.text.tag_configure('value',
280
- 'foreground' => 'black' ,
281
- 'font'=> font
282
- )
283
-
284
- @vvg.text.tag_configure('sep',
285
- 'foreground' => 'gray',
286
- 'font'=> font
287
- )
288
-
289
- @nb.raise('var')
290
- end
291
-
292
- def hash_to_str(_hash, _ind=0)
293
- str = ''
294
- _hash.each{|key,val|
295
- str = str + "/s"*_ind+ key.to_s+' => '+val.to_s+"\n"
296
- if val.kind_of?(Hash)
297
- str = str + hash_to_str(val,_ind+2)
298
- end
299
- }
300
- return str
301
- end
302
-
303
- def update_globals(_vars)
304
- @vvg.text.delete('1.0','end')
305
- if _vars != nil
306
- str = ''
307
- _vars.each{|key,val|
308
- @vvg.text.insert('end',key.to_s.ljust(18),'key')
309
- @vvg.text.insert('end','','sep')
310
- @vvg.text.insert('end',val.to_s+"\n",'value')
311
- }
312
- end
313
- end
314
- def update_locals(_vars)
315
- @vvl.text.delete('1.0','end')
316
- if _vars != nil
317
- # @vvl.inspector.updatelines(_vars)
318
- _vars.each{|key,val|
319
- @vvl.text.insert('end',key.to_s.ljust(18),'key')
320
- @vvl.text.insert('end','','sep')
321
- @vvl.text.insert('end',val.to_s+"\n",'value')
322
- }
323
- end
324
- end
325
-
326
- def update_instances(_vars)
327
- @vvi.text.delete('1.0','end')
328
- if _vars != nil
329
- _vars.each{|key,val|
330
- @vvi.text.insert('end',key.to_s.ljust(18),'key')
331
- @vvi.text.insert('end','','sep')
332
- @vvi.text.insert('end',val.to_s+"\n",'value')
333
- }
334
- end
335
- end
336
-
337
- end
338
-
339
-
340
- def before_build
341
- ArcadiaContractListener.new(self, EditorContract, :do_editor_event)
342
- @breakpoints = Hash.new
343
- @static_breakpoints = Array.new
344
- end
345
-
346
- def build
347
- end
348
-
349
- def debug_state
350
- end
351
-
352
- def breakpoint_suf(_file,_line)
353
- return _line.to_s + "-" + _file.to_s
354
- end
355
-
356
- def breakpoint_add(_file,_line)
357
- if @adw
358
- @breakpoints[breakpoint_suf(_file,_line)] = @adw.breakpoint_set(_line, _file)
359
- else
360
- @static_breakpoints << {:file=>_file,:line=>_line}
361
- end
362
- end
363
-
364
- def breakpoint_del(_file,_line)
365
- if @adw
366
- @adw.breakpoint_del(@breakpoints.delete(breakpoint_suf(_file,_line)))
367
- end
368
- @static_breakpoints.delete_if{|b| (b[:file]==_file && b[:line]==_line)}
369
- end
370
-
371
- def do_editor_event(_event)
372
- #@arcadia.outln('in debug _sender ----> '+_sender.to_s)
373
- #@arcadia.outln('in debug _event.signature ----> '+_event.signature)
374
- case _event.signature
375
- when EditorContract::BREAKPOINT_AFTER_CREATE
376
- self.breakpoint_add(_event.context.file, _event.context.line)
377
- when EditorContract::BREAKPOINT_AFTER_DELETE
378
- self.breakpoint_del(_event.context.file, _event.context.line)
379
- when EditorContract::BUFFER_AFTER_RAISE
380
- @raised_file=_event.context.file
381
- end
382
- end
383
-
384
- def can_exit_query
385
- if @adw
386
- query = (Tk.messageBox('icon' => 'question', 'type' => 'yesno',
387
- 'title' => '(Arcadia) Debug',
388
- 'message' => "Debug in course, do you want to exit?")=='yes')
389
- if query
390
- debug_quit
391
- return true
392
- else
393
- return false
394
- end
395
- else
396
- return true
397
- end
398
- end
399
-
400
-
401
-
402
- def debug_begin
403
- @breakpoints.clear
404
- DebugContract.instance.debug_begin(self)
405
- end
406
-
407
-
408
- def debug_last
409
- debug($arcadia['pers']['run.file.last'])
410
- end
411
-
412
- def debug_current
413
- debug(@raised_file) if @raised_file!=nil
414
- end
415
-
416
- def debug(_filename=nil)
417
- if _filename
418
- begin
419
- self.debug_begin
420
- @debug_button_box = Tk::BWidget::ButtonBox.new(self.frame){
421
- homogeneous true
422
- }.pack('anchor'=>'w')#('fill'=>'x')
423
- @debug_button_box.add(
424
- 'name'=>'debug_next',
425
- 'command'=>proc{self.debug_next},
426
- 'helptext'=>'step next',
427
- 'image'=> TkPhotoImage.new('dat' => DEBUG_NEXT_GIF),
428
- 'relief'=>'flat'
429
- )
430
- @debug_button_box.add(
431
- 'name'=>'debug_into',
432
- 'command'=>proc{self.debug_into},
433
- 'helptext'=>'step into',
434
- 'image'=> TkPhotoImage.new('dat' => DEBUG_INTO_GIF),
435
- 'relief'=>'flat'
436
- )
437
- @debug_button_box.add(
438
- 'name'=>'debug_fin',
439
- 'helptext'=>'step over',
440
- 'command'=>proc{self.debug_fin},
441
- 'image'=> TkPhotoImage.new('dat' => DEBUG_OUT_GIF),
442
- 'relief'=>'flat'
443
- )
444
- @debug_button_box.add(
445
- 'name'=>'debug_resume',
446
- 'helptext'=>'resume',
447
- 'image'=> TkPhotoImage.new('dat' => DEBUG_RESUME_GIF),
448
- 'command'=>proc{self.debug_resume},
449
- 'relief'=>'flat'
450
- )
451
-
452
- @debug_button_box.configure(:state=>'disabled')
453
- @debug_info = ArcadiaDebugInfo.new(self.frame)
454
- $arcadia['pers']['run.file.last']=_filename
455
- @adw = ArcadiaDebugWrapper.new
456
- @adw.add_observer(self)
457
- @adw.start_debug(_filename)
458
- #@arcadia['editor'].debug_begin
459
- MsgContract.instance.out_simple(self,"\n<begin debug>")
460
-
461
- #@arcadia['shell'].outln("\n<begin debug>")
462
- rescue Exception => e
463
- MsgContract.instance.out_debug(self,"---> "+e.to_s)
464
- #@arcadia['shell'].outln("---> "+e.to_s )
465
- end
466
- end
467
- end
468
-
469
- def debug_next
470
- if @adw
471
- begin
472
- @debug_button_box.configure(:state=>'disabled')
473
- @adw.step_over
474
- rescue Exception => e
475
- MsgContract.instance.out_debug(self,"---> "+e.to_s)
476
- #@arcadia['shell'].outln("---> "+e.to_s )
477
- end
478
- end
479
- end
480
-
481
- def debug_resume
482
- if @adw
483
- begin
484
- @debug_button_box.configure(:state=>'disabled')
485
- @adw.resume
486
- rescue Exception => e
487
- MsgContract.instance.out_debug(self, "debug_resume:---> "+e.to_s)
488
- #@arcadia['shell'].outln("debug_resume:---> "+e.to_s )
489
- end
490
- end
491
- end
492
-
493
- def debug_into
494
- if @adw
495
- begin
496
- @debug_button_box.configure(:state=>'disabled')
497
- @adw.step_into
498
- rescue Exception => e
499
- MsgContract.instance.out_debug(self, "---> "+e.to_s)
500
- # @arcadia['shell'].outln("---> "+e.to_s )
501
- end
502
- end
503
- end
504
-
505
- def debug_fin
506
- if @adw
507
- begin
508
- @debug_button_box.configure(:state=>'disabled')
509
- @adw.finish
510
- rescue Exception => e
511
- MsgContract.instance.out_debug(self, "---> "+e.to_s)
512
- #@arcadia['shell'].outln("---> "+e.to_s )
513
- end
514
- end
515
- end
516
-
517
- def debug_quit
518
- if @adw
519
- if @adw.debugging
520
- Thread.new{
521
- Tk.messageBox('icon' => 'info',
522
- 'type' => 'ok',
523
- 'title' => '(Arcadia) Debug',
524
- 'message' => "Debug in course, wait next step to exit")
525
- }
526
- else
527
- begin
528
- self.frame_free
529
- #self.debug_end
530
- @adw.quit_debug
531
- @adw = nil
532
- #$arcadia['editor'].debug_end
533
- MsgContract.instance.out_debug(self, "\n<end debug>")
534
-
535
- #@arcadia['shell'].outln("\n<end debug>")
536
- rescue Exception => e
537
- MsgContract.instance.out_debug(self, "debug_quit:---> "+e.to_s)
538
- #@arcadia['shell'].outln("debug_quit:---> "+e.to_s )
539
- end
540
- end
541
- end
542
- end
543
- def debug_wrapper
544
- return @adw
545
- end
546
-
547
- def update(dbg)
548
- if dbg[:file] != nil
549
- DebugContract.instance.debug_step(self, 'file'=> dbg[:file], 'line'=>dbg[:line])
550
- #$arcadia['editor'].open_file_in_debug(dbg[:file], dbg[:line])
551
- end
552
- if @adw.last_command == 'debug' && @static_breakpoints.length > 0
553
- #set breakpoint
554
- @sindex = 0
555
- _line = @static_breakpoints[@sindex][:line]
556
- _file = @static_breakpoints[@sindex][:file]
557
- self.breakpoint_add(_file, _line)
558
- @sindex = @sindex + 1
559
- return
560
- elsif @adw.last_command[0..1] == 'b ' && @sindex < @static_breakpoints.length
561
- _line = @static_breakpoints[@sindex][:line]
562
- _file = @static_breakpoints[@sindex][:file]
563
- self.breakpoint_add(_file, _line)
564
- @sindex = @sindex + 1
565
- return
566
- end
567
- if dbg[:error_text] != nil
568
- str = "\n"+dbg[:file]+':'+dbg[:line].to_s
569
- str = str + ":\t" +dbg[:error_text].to_s+'('+dbg[:error_class].to_s+')'
570
- MsgContract.instance.out_debug(self, str)
571
- #@arcadia['shell'].outln(str,'error')
572
- end
573
- if dbg[:callers] != nil
574
- str = ''
575
- dbg[:callers].each{|caller|
576
- str = str+"\n from:"+caller.to_s
577
- }
578
-
579
- end
580
- if str
581
- MsgContract.instance.out_debug(self, str)
582
- #@arcadia['shell'].outln(str)
583
- end
584
- update_variables(dbg)
585
- @debug_button_box.configure(:state=>'normal')
586
- end
587
-
588
- def update_variables(dbg)
589
- if @adw.last_command == 'v g'
590
- @debug_info.update_globals(dbg[:variables])
591
- @adw.v_local
592
- elsif @adw.last_command == 'v l'
593
- @debug_info.update_locals(dbg[:variables])
594
- @adw.v_instance('self')
595
- elsif @adw.last_command == 'v i self'
596
- @debug_info.update_instances(dbg[:variables])
597
- elsif @adw.last_command[0..1] !='v '
598
- @adw.v_global
599
- end
600
- end
601
- end