-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTodo
2506 lines (2222 loc) · 119 KB
/
Todo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
* Make controls more Mac-like (or include an option to do so, or include some
way to rebind keys)
* investigate network slowdown in SDL-based worms game when using SWL network
code instead of SDL's network code
* Fix bug in the "SWL Notification" dialog
- seems to complain if you try to destroy it (which pops up another one)
* toplevel's aspect-ratio support is reportedly broken on Windows (Tk bug)
- sent quick-hack workaround off to Jim Marshall (see .mail/lists/swl)
* use putenv to set up the environment variables instead of a shell script
- need malloc and strncpy
* better fix for Mac would be to use normal /usr/bin/swl script
(i.e. without the open -a /Applications/swl.app stuff) and have the
swl startup routine do the open -a stuff if it finds there is no swl
server running
(define-syntax trace-define-class
(syntax-rules ()
[(_ (<name> . args) base
(ivars iv ...)
(inherited ih ...)
(inheritable ihtbl ...)
(private [pname pfml . pbody] ...)
(protected [protname protfml . protbody] ...)
(public [pubname pubfml . pubbody] ...))
(define-class (<name> . args) base
(ivars (dummy (printf "creating instance of ~s\n" '<name>)) iv ...)
(inherited ih ...)
(inheritable ihtbl ...)
(private
[pname pfml (trace-method <name> pname pfml pbody)] ...)
(protected
[protname protfml
(trace-method <name> protname protfml protbody)] ...)
(public
[pubname pubfml
(trace-method <name> pubname pubfml pubbody)] ...))]))
(define-syntax trace-method
(syntax-rules ()
[(_ cname mname mfmls mbody)
(begin
(parameterize ([print-length 5] [print-level 2])
(printf "calling ~s's ~s method with ~s\n" 'cname 'mname (list . mfmls)))
(let-values ([x (begin . mbody)])
(parameterize ([print-length 5] [print-level 2])
(printf "returning ~s from ~s's ~s method\n" (if (= (length x) 1) (car x) x) 'cname 'mname))
(apply values x)))]))
come up with some easy way to get all the swl stuff imported:
(import swl:eventloop)
(import swl:foreign)
(import swl:generics)
(import swl:macros)
(import swl:module-setup)
(import swl:oop)
(import swl:option)
(import swl:threads)
(cd "apps/repl")
(optimize-level 2)
(generate-inspector-information #f)
(compile-file "repl-text")
(compile-file "repl")
> I noticed that if there is a TAB character (ASCII 9) in the beginning of a
> line (after editing in some other editor) then the SWL editor does not
> indent the line after pressing the TAB key. Was it intentionally done so?
* modify build process so that we can simply visit previously compiled .so
files if they're up to date
> Enable Home, End, PgUp, PgDn and Shift-arrows keys on the numeric keypad
> on Suns;
>
> Make PgUp and PgDn keys actually move the cursor making sure that PgDn
> followed by PgUp leaves the cursor on the same place (this is not the case
> in Emacs by default);
>
> Make M-p or up arrow scroll the REPL window to show the whole command if
> it consists of several lines.
>
> Thank you,
> Yevgeniy
- Fix bug: hitting control-g twice screws up minibuffer.
- Add feature: Move by word
- Add binding: shift-delete control-insert (whatever windows uses for cut/paste)
? Figure out why swl fails to start when build with something other than
Chez Scheme version 6.9b. Using plain 6.9 it panics on startup with an
error in thread-become-server!. We probably need scheme-version-case in
a few more places (probably related to interaction-environment).
x modify undo so that it recognizes when we undo/redo to the point of the
last file save (perhaps we just store the record at the car of the undo
list when we save the file and compare them using eq? to determine when
we've gotten back to the last saved state)
x note that "the box" is incompatible with the undo mechanism at present
x let's disable it for now
? seems that now that we're relative to begin-exp it should work, but
there's still some issue and it's not worth the time
x fixed:
x editor's modified flag not updated properly by app-text's method
x open two repls, and do
(let f () (read) (f)) in one
and
(let f () (write 'x) (f)) in the other
after first expression is entered, it seems to hang in this version
but not in earlier versions --- problem was that we were logging delete's
that clear out the excess lines, so the undo history was growing like mad
x move s-expression and undo stuff to scheme-text or app-text, and provide
way to control the undo history so we can avoid extending it in console.ss
and so we can limit it to the current expression in the repl
Bug carried over from earlier version:
- (read (console-input-port)) or similar stuff when interacting with the
debugger doesn't work right w/ paren balancing etc because we're feeding
input to the reader line by line and have no way to undo it --- they'd have
to go in through the repl-read interface instead (too bad there's not a read
method for generic ports)
? Add a pretty-print button that reformats their code
- comments?
- could just iterate through set of lines and run raw-indent-current-line
* input markup applied to output that is interleaved w/ input
* add a (with-prompt str expr ...) that handles the prompt stuff
* add parameter for toggling 7bit vs. 8bit clean cut and paste.
this is to deal w/ browsers that treat as #xA0
- add a --new or --solo option that bypasses the server stuff
- instead of SWL_PREFS_DIR let them name the SWLPREFS file
- server stuff should verify that the two versions of Scheme match
- maybe we can get the unique-id stashed away in the exec file,
but seems we need one for the Scheme side as well
- should also check to see whether we're running on the same display
(maybe it should print a message saying what's up in this case,
e.g. `refusing to connect to existing swl server on display ...')
- might be nice to have an option for connecting to the existing display
- can we just supply a --display option? or does Tk not handle that?
(or, should I say, our packaging of Tk)
- perhaps repl's save/load history should just dump/read S-expressions
- then we can lose a fair bit of code
* repl
- integration w/ editor via proxy procedure
- save-and-execute is broken since it has a call to load in the
callback thread
* insert-expression and set-current-expression! are broken when the
repl thread is evaluating stuff --- can't block on a mutex either
since they'd hang the event-queue thread.
- currently just disabling while repl thread is busy running
eventually need to fix this for sake of things like save-and-execute
* fix raise performance bug
? seems ok on Windows, test to confirm
- on Unix machines, bind the <Visibility> event and raise only when
the thing is partially or full obstructed (raise when obscured is fast,
but second raise is very slow)
- could implement a stay on top queue that we add widgets to (as in the
warning-dialog.ss code) and use the <Visibility> event to know when
we need to raise the intended "top" guy, currently just forking a thread
* hide and protect from gc the various callback procs in init.ss and canvas.ss
? add a .swlprefs entry and user interface for setting source directories?
- perhaps better to simply provide an interface for editing the
on-startup code (but they can't change what they don't know about)
* make warning dialog into application (if it isn't already) so that
swl won't exit if there is a dialog up unless we ask to exit swl
? hide warning dialog by putting it into normal swl module along
with swl:font-dialog etc. also rename it? (coedit)
? provide option for disabling the server mode?
- Kent had wanted us not to read the .swlprefs on startup in client mode
? hide error-handler-continuation as an export of thread.ss
- quick attempt failed grandly on startup
* get console.ss changes the delay auto raise of console window
* think about separating the console.ss code so that there is
a single thread that fields requests for interaction w/ the
actual port / widget internals (this may tank performance)
(if so, we may need to introduce proxy ports that do local
buffering before writing to the actual shared output window
port) --> the queue might go where we currently have the code
that calls show-window and interacts with the text widget
the rest of it we can probably make internal to the port
(ie. the double-buffering code)
- should move the init code into server.ss or some such
? we could modify editor so that it opens in read-only mode if it can't
create the backup file
x remove make-sem that is visible at top-level
x flush porthack.ss now that we're using 'truncate
=-========-========-========-========-========-========-=======
- fix semaphore code in console.ss
? running .swlprefs in current directory first and having on-startup
is a potential security hole -- maybe on unix we could check that
file is owned by user and has no group or other write permissions
* eliminate html viewer or package as module
? is there any way to change the default icon used to identify all the
SWL windows (right now it's an ugly red script Tk that looks like it
says 7k)
? why is courier showing up as not available??? (new courier works, btw)
*** write some code that goes through and searches for fixed-width fonts
instead of using (only) the built-in list of known fixed fonts
(maybe use known-fixed as a cache)
- try again to eliminate visible top-level bindings
*** fix the home-directory code in preferences.ss for i3nt
--> for version we ship to UITS, we need to be pulling an
expression out of the registry that we can eval to get the
users home dir, so for UITS it should be something like:
(string-append "//cfs.indiana.edu/" (getenv "USERNAME") "/SWL0.9v")
x add SWL menu to the interaction window
maybe nicer to scrap the SWL menu and add Repl to everyone's file menu
--> adding SWL menu is easier, sigh...
? add hook for loading patches
x sort-of ... they can add it as an on-startup in their .swlprefs
* scan this entire list before proceding
- audit uses of swl:begin-application
- need to test the focus on input raise on input raise on output settings
under windows (and on linux under some other window manager) to see if
they do the right thing
- test the font dialog stuff on windows --- how slow is it?
- may need background font cache thing
(or just load font info first time and save it)
maybe only start the process if there is somewhere to save the data
- add a preference to enable/disable this
* incorporate syntax.ss changes (any others?) from ../new-console workarea
x fixed stupid Alt+s keybinding conflict (SWL menu and file save)
- put global console in as default
x get it in as is
x add something to show that it's awaiting input (maybe change the title?)
- then add the EOF menu stuff
- then set up pretty font / color preferences
- test preference saving for the new toggles in the interaction window
* fix the flush-output-port handler so that it does a true flush
- we can't have it screwing around w/ thread delay stuff when folks
are counting on flush to make display consistent
* fix mutex bugs that are preventing it from printing in the first place
- if we enable mutex code, fire up repl, and try to print, it hangs
- input seems to work ok, however
?> * can we work around some synchronization bugs using on-error ?
* fix preferences for "auto-focus for input"
- start two repls and do this in one
(define foo
(lambda (n)
(if (zero? n)
'()
(let ([x (begin (printf "Enter item ~s> ") (read))])
(cons x (foo (- n 1)))))))
- now run (foo 5) in repl 1
- enter the first item
- kill repl 1 ---- the repl thread that was waiting on the message queue
dies and no one asks for any more input
* actually, this seems ok, since we can still read from repl 2 and
get the right thing...
---> what might be nice is if there were some way to point out
to the user that the repl they just killed was busy doing
something
- after updating preferences code, come back and make port bulletproof
[lower priority since students aren't going to be making threads much]
* strip out debugging printfs in the console code
- revisit the teventloop application-modal issues
- icing on cake: user preferences for color in repl (or do later)
- important data point: doing read-char was dog slow on file opened as:
(define ip (open-input-file "//cfs.indiana.edu/owaddell/share/swl.boot"))
but block-read with a huge buffer ran like a bat out of hell
- may be useful to write code that can load boot file over network quickly
and include this in the stuff that we have UITS install
- but this probably isn't very much code anyway ...
- may want to give ourselves a way to hook things automatically --- e.g.
automatically load a patch from a file in their home $HOME/SWL directory
- ask Kent to change the default current directory so that it's not tutorials
- esp. important later for the home users
- future patches may be smaller if we drop the macros for classes and stuff
-----------------------
x move all the cool fun code off into a separate entry point
- e.g. move the init.ss code that modifies source-error-handler, etc.
into a separate entry point swl:starup-customization
that we can overwrite via patch and yet still have run at the right
time during the swl:startup process
- perhaps a set of entry points for the various things
we might want to hook:
swl:startup-before-install-threads
swl:startup-before-repl
- perhaps with a specific gensym name (or exported by swl:module-setup)
that we can load and patch against
* persistant color prefs for all of SWL
- should affect minibuffer too (maybe even warning dialogs?)
* things to fix that were printf reminders in the code:
* update <scheme-text> show-sexpression-at method
? do we have csv6.9 w/ read patch pushed through?
* also change source-*-handler code in init.ss that calls the
old error handler with the OLD source info format
* be sure to clear mini-buffer of the error message when there are
modifications (maybe this is only an issue in the code that runs
when read.patch is not loaded)
- redirect current-input-port / current-output-port in repl-text.ss
[currently set to console (ie. repl-port)]
- do this very early (maybe before installing thread params)
* when multiple warnings while loading changed file we get a dialog
box for each one (can be tedious to dismiss them all)
- test loading s3.ss in $t/assignments
- wouldn't let me close the stupid window either
- then it wouldn't let me load the damn file!
- looks like source-warning-handler was getting stuck looking
editor while trying to give cool check warning
- also the SWL menu died --- maybe the background console thread
(or its fallback queue) is dead
- interesting: several people blocked on semaphore named semaphore
(guess we really will have to use dynamic-wind for those)
--> also update console.ss to use dynamic-wind for its sems?
--> rats, we can also get the whole system to deadlock by getting
the last remaining fallback thread to block on the semaphore
**** * looks like this may have been a fallback "save and execute" thread
trying to evaluate an unbound variable reference
- may have been important that there had been source warnings
for that file
? maybe these guys were trying to run begin-application and
died?
- once got lots of guys waiting on modal
- this was the multiple warnings while file
modified but here I killed the editor window
instead of having to click through all
the silly warning dialogs
- I had also run s3 spreadshee several times
and tested various combinations
of modify then try to close and allow or deny close
* would be nicer if widgets had a set of standard preferences they knew
how to load/save automatically so we could say:
(create <markup> with (prefs-key: 'input-markup))
and have it automatically save/restore font, color, etc. properties
- also would be cool if it could automatically generate a user-interface
for setting its preferences (should be very easy when/if we switch to
mozilla)
* have to change source-warning handler so it doesn't show one source warning
until it's done w/ the previous one
- more impotrant: prevent it from giving same stupid warning dialog
for the same file over and over
* swl:begin-application bug/feature
- make-app mutex is held the entire time start-k thunk is running
- programmer needs to fork thread in start-k if not returnning quickly
* audit uses of begin-application
* swl:application-modal bug
* Ah! problem is that we're not have to treated fbq-queue field as a stack,
so multiple warnings enqueue and we never restore the old queue, it's lost
* multiple warning handlers bug
- went application modal on me and left the editor unresponsive to anything but destroy
? while warning dialogs are up, no other window can be created
- combined w/ mutex bug/feature of swl:begin-application, this means we can't open
new windows while there's a warning up
* Still a race in the code that calls swl:application-modal, since its
call to get-app-context might interleave w/ someone else's call to
destroy the widget (note destroy-request-handler is likely to go app-modal)
so that we think we have a good context but don't by the time we get into
app-modal or so that we go modal for a destroyed application
* what if students get multiple warning dialogs, one of them is a kill
the editor warning while the others are informational, if they choose
kill the editor while the other warnings are pending, we could get in
trouble
in-drh
going-modal
if in-drh ok to go modal
can't go modal if if drh returns #t
if modal, block destroy
race in warning-dialog.ss:
- call warning-dialog once
- call warning-dialog again for same window
- have one warning dialog return quit-ok so the toplevel is destroyed
- now second call to warning-dialog gets into application modal and finds
that the get-application-context returns #f --- or bombs out ----
- need to make swl:application-modal take the widget
- starts by calling lock-application-context
which blocks destroy requests and which fails
(use on-error to trap?) (or returns #f) if the
application was already destroyed
- if lock-a-c succeeds, we do the modal thing and arrange to unlock-a-c
when we're done
- otherwise, we don't even run the thunk because the widget is done dead
already and all
* gak, splash screen holds the make-app mutex the whole time it's up
- if we start editor from repl and then exit that repl, we don't see
the error messages from save-and-execute because they're printed
to the repl (we do see source error messages in the editor minibuffer)
- lock-editor needs to be more like (see init.ss)
- sanitize-fp is NOP for now
- uncomment (send ed raise) in show-error code of init.ss
- need to wire in the parameter for open-new-window-to-show-error
- still need smarts to parse error messages to decide whether it
should try to hilight the whole s-expression or, say, hunt for
the string constant that's unterminated, etc.
- re-enable class.ss check (search for RE-ENABLE THIS CHECK)
- removed swl:set-grab procedure
- threads.ss now redefining a host of input/output primitives to
work around inlined current-{input,output}-port in Chez Scheme prims
- change calls to swl:font-families so that they use the list of sizes
specified in repl.ss and edit.ss
x warning dialog was application-modal but didn't set destroy-request-handler,
so could exit w/o releasing make-app mutex
x uncomment tkstream.ss defn of swl:bug-port
x uncomment swl:make-error-log-port
x removed printf about stripping cp1inline properties
x ? left swl:bug parameter in for now
; need to synchronize on this...
; probably need a watchdog for this as well --- maybe the error handler
; should fork off separate thread... ---
; need to think about what happens if the file cannot be opened / found, etc.
; i.e. if the message never makes it there...
; ---> probably should pop up a dialog to explain what's happened
* does get-line in console.ss need a mutex?
* what if we run keyboard-interrupt-handler after we've killed the repl?
- start repl, do (read p) (may have to fork thread), close the repl,
then hit Control-C in the interaction window
* ack! we need critical sections all over the place in the port handler
of the interaction window
- get-line proc seems like it needs some protection
WRONG: adding the critical sections / semaphores made the thing slower
than a dog (even if we disable line buffering)
ACTUALLY: what happened was that I compiled swl with inspector info on
so (length (oblist)) was nearly 5 times greater than usual
and I was using that as a convenient test. oops.
* resolve the keyboard interrupt issue in console.ss
* need to implement searching for .swlprefs in:
- current directory, followed by looking in HOME directory (screw env var)
- need to include init script as one of the things in the prefs and give
some way to edit the darn thing (parameterize editor's file save method
and its menu item titles?)
? make graphical current input/output ports the default
- separate one for each repl, or make this global?
* Fix the destroy method race condition:
- left off working in ../fix-race
- have each toplevel window create its own fallback-queue
- child widgets use get-application-context method to
find the fallback-queue (rename method to something like get-event-queue)
- menu widgets can do the same thing because they're added to toplevels
? might interfere w/ the SWL menu, but who cares --- pitch him
- swl:begin-application / end-application can still fork off thread group
but they don't have to muck with swl:fallback-queue
- when we get a destroy message for a top-level window:
- fork a destroy thread that
- enters critical section
- kills the thread for the event queue (so that methods running
won't be confused about these widgets dying)
- when the queue thread exits, then we do the actual Tk destroy
? what about situations where events for one toplevel window want to
invoke methods on another toplevel window?
- it's almost like each widget needs its own swl-tcl-eval (or needs
cooperation from there) so that we can discard calls when the widget
is dead
* Wait: can we modify fallback queues so that we have a way to push
a proc on the front (ie. store linked list in separate field of fbq record)
that is to be run on the next iteration of the loop (before the next item
is dequeued)
- destroy method for toplevel could push a proc that delete the widget
and then we combine this with the change in the ../callback-experiment
workarea (see diff below) where we check the widget handle before we
actually invoke the proc ---- OR maybe the event-queue loop could
do this before it actually calls the apply-callback method
Index: new-console.1/src/swl/callback.ss
73c73,78
< (if args (apply proc (if skip-1st? (cdr args) args)) (proc))]
---
> (if (null? args)
> (proc)
> (let ([handle (car args)])
> (if (not (swl:lookup-fallback-queue handle))
> (fprintf (swl:bug-port) "SKIPPED callback cause dead: ~s\n" token)
> (if skip-1st? (apply proc (cdr args)) (apply proc handle (cdr args))))))]
* fix paste in <scheme-text> widgets, guessing that JohnZ disabled / broke
middle-mouse-button paste, and we probably never implemented Shift-insert
* looks like fallback queues may have the wrong current-output-port set
? need to set current-output to the graphical console port before
we create the fallback threads?
-> e.g. try starting swl, start a new repl from there via new-repl,
cd to tutorials, load guide.ss, open entry.ss and click run,
enter some text there and click done ---> text prints to stdout
instead of the repl
* update documentation for swl:begin-application (see ChangeLog)
- saturday plan
x abstract error-handler code for use w/ warning handler
x get rid of the menu history items in the repl
x add warning dialogs for various cases where source information cannot
be displayed
x fix race condition where new editor is opened but file isn't finished
loading by the time we go to show the sexpression
* deal with locking problem sketched below:
what if the editor is destroyed while we're trying to use it to display
some error message info or while we're using it to display single-step
info?
----> maybe we should request an interface procedure from the editor
and carry out all operations via the interface
- maybe we have to register an exit continuation when we make the
request, so that the editor can kill any active threads that are
trying to manipulate it while it may be destroyed
- before each operation, the iface sets a "delay destroy" bit,
then checks whether the widget has been destroyed, and if not,
proceeds with the operation, then unlocks the delay destroy bit
- might even pop up a dialog if someone tries to destroy the
editor while there is an interaction pending
- - another alternative is to have each method do the live check
internally and return #f if dead and then have the client code
check return values everywhere
- - another alternative is to have methods to {un,}register interest
in the widget (maybe multiple clients can register interest)
with a description of why the client wants to keep the editor
alive and a continuation to invoke if the user decides to kill
the editor despite this
- this could be a refinement of the set-locked! method
- lock before getting content
- unlock when you decide it's the wrong editor or when
you finish displaying the marked up source
- we may want to have a notion of weak locks where
the system is allowed to deny reservation request
without popping up a dialog box, it just has to call
our deny notification procedure
? may want some way to recall the last error message, or some way to
guarantee the markup stays there for a little while, but heck they can
just reload it if it's a problem, right?
- wire in the unexpected end-of-file handler
- current draft I have does stupid stuff when looking at ( ... ( ... )
because it thinks the outer paren is unmatched, would really need to
parse the tokens and look for things like a definition with more than
one RHS, etc. to do a better job of helping students
- can we improve things in the case where there are multiple string
constants and some are unterminated
(maybe heuristic to look for line break, or way to highlight all
the string constants as seen by the computer)
- may have multiple warnings for a single buffer in addition to the errors,
- so the debug stuff should queue them up and probably should just choose
to show the error, but should also let them naviate a list of the other
warnings --- This will also be useful in the case where they want to
get pack to the error
- buttons only show up when there are saved error/warning msgs and
the buffer has not been modified --- they might have moved arrows
around and this would have cleared the error message display ---
- as soon as the buffer is actually modified, the error history
buttons would go away --- trouble is that they don't give much
indication of what they're there for, so
* maybe it really should be a menu that builds cascade menus
to handle the case where there are too many to fit on screen
* basically need to locate the correct editor, then package up a
structure that describes the error and lets the widget determine
whether the things still apply --- if the modifications made don't
change the checksum, then we could re-enable the menu -- or just say
hell with it and make them re-eval it since that's pretty low
overhead
? add < > buttons beside the minibuffer to navigate through
error/warning history
* maybe just have a parameter that says pause-for-each-warning?
- the other way (Kent may prefer) is to make the students click on
the warning or error message in the repl window and have this pop
up the actual editor window, etc. Then the markups in the REPL
become an implicit record of where the errors are.
- problem with this is if we don't have an open repl
- maybe in that case the errors should be going to graphical error
window that does the same clicking thing
* test S3 spreadsheet gui.ss and draw-tree code in new system before shipping
may just need a few imports, but let's be sure
* scrutinize critical-section and replace with semaphores where this makes sense
- hide <sem> class, maybe in threads.ss
* uncomment (send ed raise) in show-error code of init.ss
? we were getting (values) from source error handler on read-err33.ss
* add code to save/restore position of repl and editor windows
in preferences file (maybe also the interaction window)
- not critical, can do this in local version I use in lecture
* would be nice to permit customization of
- both text and markup support foreground/background color, so dialog
may be commonizable
- foreground, background, and cursor color (set-insert-color! ...)
for various text widgets
- autoapply to minibuffer as well
- parenthesis highlight color
- box color
* swl:font-dialog
- add support for color (foreground / background?)
x (sync) needs to set the label on the size menubutton to match the
actual size of the selected font
x when the list of size options is empty (eg. no italic fixed fonts)
the label on size menubutton should be disabled or blanked or should
show "(none)" and be disabled.
* add prefetch code from end of src/swl/dialog.ss to init.ss (or something)
and have it fetch the preferences and fork a thread to precompute font
availability in the background.
* incorporate the console.ss code
- should we set up console-error-port before installing thread system?
- maybe we should trap the destroy method and just delete the text widgets
contents
- probably should make closing the port a no-op as well.
? may want to give each repl its own interaction window
- modify option font dialog thing to also permit color spec (ie. markup)
- modify repl to allow customization of color / font for input exprs
- color dialog probably needs to permit selection of
foreground and background color
- add color customization there
- add preference for "Raise on output"
* NOTE, probably should always raise on input, at least if blocking
- need to add the save/restore preferences code there
* currently, forking a new repl either via menu or by (new-repl) causes
the current-output-port and current-input-port of the original repl to
be set to the repl-port built by the new repl
* this may be because current-*-port is hacked to go directly
through the real Chez Scheme thread-context structure and the
threaded parameter code uses the old param as a filter.
- ie. the C code probably isn't seeing the local param change
- can we somehow build a Chez Scheme thread structure for our threads?
? otoh, it seems that the parameter itself isn't working...
x update the preferences code to look in
* bullet-proof prefs code so it doesn't get confused by bad data/errors
./.swlpref ; current directory first
$HOME/.swlpref ; home directory next
; for CFS that we give UITS look in
(let ([user (getenv "USERNAME")])
(or (and user (try "//cfs.indiana.edu/" user "/SWL/.swlprefs"))
(try "M:/SWL/.swlprefs")
--- no prefs ---))
- code should save the path of successful preference loading
* add prefs code for running something on startup --- probably even
before we show the repl ---> maybe show splash screen first, though
- if we use the "cwd then home" search path ordering, we probably should
pop up a dialog box to give them a choice of where to save the
preferences:
(or just tell them to copy it manually to dir
and change menu title to "Save local preferences" or
"Save ~a preferences" w/ cwd)
use these preferences
- whenever I start swl
- only when starting swl in this directory
* implement a useful $source-error-handler for SWL that pops up the editor w/ location
highlighted --- unless msg is unexpected end of file error from read --- then it should
do an incremental read to show them where it left off (or maybe leave this for the expert)
* NOTE:
- be sure to test via save-and-execute button
---> I suspect that guy isn't forking off a thread that's
properly initialized.
* abstract the hooks well enough that we can reuse them for the stepper
and so that we can have the stepper provide error hooks that tell them
just where the error occurred (ie. in which call to cdr ...)
- cpdebug needs to help with following:
(for these, just showing a Where? (or Whence?) button that
shows the call site would help --- if our source info is good enough)
* modify as-time-goes-by so that it sets a flag that is checked by
the instrumentation code inserted by cpdebug and complains that
it's meaningless to time instrumented code...
- error incorrect number of arguments to procedure ...
- error attempt to apply non-procedure ...
- often extra parens wrapped around variable bound to non-procedure
type inference thing would help here, but it's really a syntax
error
- error ... is not a ... (e.g. void is not a number, () is not a pair)
- error in list-ref ... or any number of other prims
- error variable ... is not bound
- error in record-accessor: record that looks right is not of type
record ... (ie. they've built some test data and have redefined
the record type since they built the test data)
- error in open-output-file ... file not found (windows person w/o
write access in current directory)
* modify repl so that Editor's Save and Execute button does something
useful still even if they close the only repl and then do Save and
Execute where there is an error
- it may be that hooking the source error handler is enough to make
this sensible
- looks like we capture the value of console-error-port when the
editor's application thread is forked --- must be making a copy
of all the existing parameter values
- replace the printfs in error handler code with something that pops
up a warning dialog
- error handler can parse a few of the strings to look for:
- error in read
- if it's unexpected eof, try doing file position and reading
as far as possible and hook the error handler to catch when
it blows --- saving file position before each attempt ---
so we can show them where the computer was when reading file
- be sure to check for "unexpected end-of-file reading string"
for that we can do a better job
- "invalid syntax" or "invalid context for definition"
? consider plugin architecture where we can ship out new error
message parsers (or help) to the students
- these parsers could look for patterns they can help with
and direct the editor on how to display the error location
and could provide suggestions to the student on how to go
about fixing the problem.
- could install "Help for last error" in the help menu of the
editor that is notified of the error
- e.g. for "invalid syntax" they could try to parse the expression
that's supplied in the error message and see if they can suggest
some help --- ie. too many or too few arms to an if expression
- locate editor (or open editor if preference permits)
- if file is already being edited
- if buffer has been modified vs. source info, and if we're
supposed to show window w/ errors, notify user that the file
seems to have changed in the edit buffer since the version
that was loaded (probably best to refuse to open new window
in that case or the students will get confused --- no file
locking)
- jump the cursor to the right place and show the text of the
error message in the minibuffer
- maybe print some sort of suggestion for how to proceed,
or put that on the help menu
- if file is not being edited, check pref and open file if allowed
- if you can't open the file, notify user of this problem,
but don't do it as an error or they'll lose the debugger
continuation
- jump cursor to given file position and highlight the S-expression
- if it's a list, then we can just set cursor position one to
the right and editor will highlight for us
(might be better to modify the editor to be able to highlight
the S-expression following the cursor point, but be sure to
use the same mechanism to remove the highlight)
- if it's a keyword, we may have to hilight it ourselves
(or just skip the highlight)
- nice thing is that editor already handles the highlight for us
? could provide a Window menu that lets you raise the window you want
- (in progress) consider revamping repl/edit interface: add an "open" file
menu item in repl that opens a new edit buffer; change "open" file menu
item in edit to do the same; change quit to close on both file menus;
add exit to both file menus; add Version to file menus or replace
with top-level 'about' menu button; flush SWL menu. Consider opening
files passed on the command line instead of loading them.
* suddenly HTML viewer seems to choke on tables (no longer loads the
on-line help for repl and editor properly --- skips over the table?)
* destroying the repl should probably close the repl port for real
via mark-port-closed! ---- actually, the students could do that and
shoot themselves in the foot, right?
- should protect ourselves against this, but Chez Scheme doesn't seem to
- maybe some kind of global error handler that intercepts these things
and averts disaster ?
* do away with cafe-level so that forked repls always start with a > prompt
instead of increasing >>> prompts
[ thread.ss and repl maybe? ]
x (display (make-list 100 'foo)) doesn't generate output in the repl, but
does work as expected if we fork off a new repl (via menu or via new-repl)
- actually it works ok in the initial repl until we fork off the new repl,
then the first one doesn't generate output but the second one does
(more parameter weirdness?)
* scratch the (when (swl:bug) ...) code in swl:event-dispatch
(we can always load patched code if we really want to see that junk)
* installation scripts: Wise (Windows), RPM (Linux), and "make install"
- use registry to locate SWL library where we're currently using
the environment variable
* mechanism for saving/loading preferences on Windows
* open dialog in editor should return to directory of last open; should
also have recent-documents list
? package up one big real swl module from which we can import everything
- I've tried and failed several times now to get the system to build as
tidy little modules. This is *exceedingly* frustrating.
[ left off in swl.module-attempt.part-way-done-with-explicit-modules ]
- current plan is to push ahead and add the functionality we want
and then relocate any offensive user-visible bindings via some sort
of low-level hack like we used to build the scheme module in the first
place
* try to modulize everything to achieve namespace purity
- test thread primitives more extensively (see list at top of threads.ss)
(define read-report
(lambda (file)
(with-input-from-file file
(lambda ()
(let f ([ls '()])
(let ([x (read)])
(case x
[(#!eof) (list (reverse ls))]
[(compiling)
(let ([filename (read)]) (read) (read) (read) (read)
(if (null? ls)
(f (list filename))
(cons (reverse ls) (f (list filename)))))]
[else (f (cons x ls))])))))))
(define find-missing-import ; hack, needs better def/use support from cpdebug
(lambda (ls)
(for-each
(lambda (entry)
(let ([filename (car entry)])
(for-each
(lambda (sym)
(when (gensym? sym)
(let ([raw (string->symbol (symbol->string sym))])
(putprop raw 'gensym filename))))
(cdr entry))))
ls)
(for-each
(lambda (entry)
(let ([filename (car entry)])
(for-each
(lambda (sym)
(unless (gensym? sym)
(let ([src (getprop sym 'gensym #f)])
(when src
(printf
"~s refs global ~s instead of version exported by ~s\n"
filename
sym
src)))))
(cdr entry))))
ls)))
? fix warning about possible premature reference to the-class
editor
- save and execute button should show some notification in the
corresponding repl window (the one from which we forked the
editor or the one we forked from the editor)
and perhaps should raise that window to the front
* seems a bit strange that we get segfault if we start SWL, then
start a recompile of SWL, wait for the heap to be saved, then
post a menu (or click on a menu posted during the compile)
- expected that heaps would be copy on write
* looks like the "possible attempt to reference" warnings (e.g. see edit-text.ss)
may have something to do w/ protected methods (try the foo bar baz test at the end
of src/oop/test.ss)
x improve look of menus
x get rid of left-arrow and right-arrow (elim arrows.ss from make.ss)
* provide persistent preferences
* style -- font / color
* figure out why some of the tutorials don't load
---> actually important since it may indicate problem w/ import of modules
* looks like it's cases where we use api-syntax such as create within
another file (ie. src/swl/menu.ss) that doesn't import swl:syntax
----> hunt down other uses of api syntax and explicitly import swl:syntax etc.
* Revisit these files to see that they import everything they need (ie. including the new swl:option)
./src/swl/menu.ss
./src/swl/syntax.ss
./src/swl/option.ss
./apps/consbox/consbox.ss
./apps/graph/graph.ss
./apps/lecture/lecture.ss
./apps/automata/tm.ss
./console.ss
./tutorial/canvas.ss
./tutorial/menu.ss
./tutorial/button.ss
./tutorial/toplevel.ss
./tutorial/image.ss
./tutorial/entry.ss
./tutorial/label.ss
./tutorial/guide.ss
./tutorial/animal.ss
x move swl:startup from teventloop.ss to init.ss so that it follows menu.ss
actually seems to make more sense there anyway.
x trying to figure out why apps/automata/tm.ss doesn't want to work as module w/ imports
x looks like option.ss has to be module-ified so it's compiled w/ local import of
the swl modules
x get rid of worrier.ss and its uses
x when repl dies, it should kill the newline semaphore thread
- not sure why it takes so long to fall away by itself
(seems like you have to start a new repl in order to force
it to reclaim the old one --- perhaps the new
repl is overwriting some inadvertently global thread
parameter that was hanging onto the previous repl)
x (fixed) Annoying bug:
- have to import swl:oop at top-level in order to get create of
SWL classes to work in:
(let ()
(import swl:oop) ; wouldn't mind this so much, but doesn't work
(import swl:macros)
(create <toplevel> with (title: "testing")))
- looks like perhaps <base> isn't visible to them but it somehow is
when we import at top level
((<base>
'make-instance
#{|##shh-its-a-secret##<toplevel>| |/Rbftrn2D4<U$\\<=|}
(() #{handle |/SF+~0Xx0bQnK\\*|}
#f
()
()
()
(swl:fallback-queue)
#f
(lambda (#{x |/SF+~0Xx0bQnK\\+|}) #t))))
x maybe we can fix this by placing the class definitions within a
module that explicitly imports swl:oop
x (fixed) we get infinite loop trying to expand guide.ss unless import swl:oop
- looks like the generics are going berzerk because we haven't done
an import swl:oop for the macros
- yes. problem is we expand into (define-syntax name ...)
where the macro produces a reference to name --- normally ok since
the reference is in the context of send macro but if swl:oop isn't
there, the expander thinks its an application and hits the id macro again
and again
- maybe we could put the macros in a module that imports swl:oop
x changing preferences for one <repl> window shouldn't change it for the others unless
you say save preferences, and then changes should only affect new instances that we
open
- seems like we need to make preferences local to widgets and make the save-preferences
method actually flush them to the global cache and the disk
- then preference lookup always goes to the local widget store first and if neceesary
goes to the global cache
- one possibility is to have the application init guy store away an alist for this
instance of the app to modify. it would load and copy the global list.
- ie. set-prefs-key would init the prefs key and reset the options list
- also need some method for apps to set preferences
- but then we need a save preferences method
- concern is that we could have several different widgets in a hierarchy
that would have to be notified
- maybe we want to create a preferences object
instead of (prefs-tag: '<repl>)
instead of (prefs-entry: (make-prefs-store '<repl>))
- whether or not we have separate external object for prefs store,
it's probably more convenient to have SWL methods for dealing w/
prefs:
; put these at tk-object level?
; would need subclasses to implement a get-parent method (e.g. <menu>, others already have it)
(load-prefs self tag) loads tagged prefs and creates local cache
marks this widget as the root of prefs tree
so that children delegate to this widget
for all the other methods
(save-prefs! self tag) saves local prefs in global cache and disk under tag
(set-pref! self key val) stores val under key in local cache
(get-pref self key default) fetch from local cache
x (fixed) out-of-memory error while trying to open viewer
- oops, looks like we weren't loading all files that the
require thing normally would have loaded
- wait. it looks like we're having issues with the "SWL Error"
window that's supposed to pop up for background errors
x seems that this is some consequence of compile-file + visit instead of
compile-file + load
x REPL BUG
while trying to enter the following in repl, the line indent code seems to have gone
haywire and indented to beginning of line --- wouldn't let me backup in editing, etc.
after I'd hit enter on the last line you see below:
* AH HA! it's because we were looking for a particular error message
and it's coming in a little differently now (ie. because we don't have
exceptions it was hacked)