-
Notifications
You must be signed in to change notification settings - Fork 0
/
workbook.ps
9297 lines (9246 loc) · 236 KB
/
workbook.ps
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
%!PS-Adobe-3.0
%%BoundingBox: 18 36 594 756
%%Title: Enscript Output
%%Creator: GNU Enscript 1.6.5.2
%%CreationDate: Wed Feb 20 18:18:55 2013
%%Orientation: Portrait
%%Pages: (atend)
%%DocumentMedia: Letter 612 792 0 () ()
%%DocumentNeededResources: (atend)
%%EndComments
%%BeginProlog
%%BeginResource: procset Enscript-Prolog 1.6.5 2
%
% Procedures.
%
/_S { % save current state
/_s save def
} def
/_R { % restore from saved state
_s restore
} def
/S { % showpage protecting gstate
gsave
showpage
grestore
} bind def
/MF { % fontname newfontname -> - make a new encoded font
/newfontname exch def
/fontname exch def
/fontdict fontname findfont def
/newfont fontdict maxlength dict def
fontdict {
exch
dup /FID eq {
% skip FID pair
pop pop
} {
% copy to the new font dictionary
exch newfont 3 1 roll put
} ifelse
} forall
newfont /FontName newfontname put
% insert only valid encoding vectors
encoding_vector length 256 eq {
newfont /Encoding encoding_vector put
} if
newfontname newfont definefont pop
} def
/MF_PS { % fontname newfontname -> - make a new font preserving its enc
/newfontname exch def
/fontname exch def
/fontdict fontname findfont def
/newfont fontdict maxlength dict def
fontdict {
exch
dup /FID eq {
% skip FID pair
pop pop
} {
% copy to the new font dictionary
exch newfont 3 1 roll put
} ifelse
} forall
newfont /FontName newfontname put
newfontname newfont definefont pop
} def
/SF { % fontname width height -> - set a new font
/height exch def
/width exch def
findfont
[width 0 0 height 0 0] makefont setfont
} def
/SUF { % fontname width height -> - set a new user font
/height exch def
/width exch def
/F-gs-user-font MF
/F-gs-user-font width height SF
} def
/SUF_PS { % fontname width height -> - set a new user font preserving its enc
/height exch def
/width exch def
/F-gs-user-font MF_PS
/F-gs-user-font width height SF
} def
/M {moveto} bind def
/s {show} bind def
/Box { % x y w h -> - define box path
/d_h exch def /d_w exch def /d_y exch def /d_x exch def
d_x d_y moveto
d_w 0 rlineto
0 d_h rlineto
d_w neg 0 rlineto
closepath
} def
/bgs { % x y height blskip gray str -> - show string with bg color
/str exch def
/gray exch def
/blskip exch def
/height exch def
/y exch def
/x exch def
gsave
x y blskip sub str stringwidth pop height Box
gray setgray
fill
grestore
x y M str s
} def
/bgcs { % x y height blskip red green blue str -> - show string with bg color
/str exch def
/blue exch def
/green exch def
/red exch def
/blskip exch def
/height exch def
/y exch def
/x exch def
gsave
x y blskip sub str stringwidth pop height Box
red green blue setrgbcolor
fill
grestore
x y M str s
} def
% Highlight bars.
/highlight_bars { % nlines lineheight output_y_margin gray -> -
gsave
setgray
/ymarg exch def
/lineheight exch def
/nlines exch def
% This 2 is just a magic number to sync highlight lines to text.
0 d_header_y ymarg sub 2 sub translate
/cw d_output_w cols div def
/nrows d_output_h ymarg 2 mul sub lineheight div cvi def
% for each column
0 1 cols 1 sub {
cw mul /xp exch def
% for each rows
0 1 nrows 1 sub {
/rn exch def
rn lineheight mul neg /yp exch def
rn nlines idiv 2 mod 0 eq {
% Draw highlight bar. 4 is just a magic indentation.
xp 4 add yp cw 8 sub lineheight neg Box fill
} if
} for
} for
grestore
} def
% Line highlight bar.
/line_highlight { % x y width height gray -> -
gsave
/gray exch def
Box gray setgray fill
grestore
} def
% Column separator lines.
/column_lines {
gsave
.1 setlinewidth
0 d_footer_h translate
/cw d_output_w cols div def
1 1 cols 1 sub {
cw mul 0 moveto
0 d_output_h rlineto stroke
} for
grestore
} def
% Column borders.
/column_borders {
gsave
.1 setlinewidth
0 d_footer_h moveto
0 d_output_h rlineto
d_output_w 0 rlineto
0 d_output_h neg rlineto
closepath stroke
grestore
} def
% Do the actual underlay drawing
/draw_underlay {
ul_style 0 eq {
ul_str true charpath stroke
} {
ul_str show
} ifelse
} def
% Underlay
/underlay { % - -> -
gsave
0 d_page_h translate
d_page_h neg d_page_w atan rotate
ul_gray setgray
ul_font setfont
/dw d_page_h dup mul d_page_w dup mul add sqrt def
ul_str stringwidth pop dw exch sub 2 div ul_h_ptsize -2 div moveto
draw_underlay
grestore
} def
/user_underlay { % - -> -
gsave
ul_x ul_y translate
ul_angle rotate
ul_gray setgray
ul_font setfont
0 0 ul_h_ptsize 2 div sub moveto
draw_underlay
grestore
} def
% Page prefeed
/page_prefeed { % bool -> -
statusdict /prefeed known {
statusdict exch /prefeed exch put
} {
pop
} ifelse
} def
% Wrapped line markers
/wrapped_line_mark { % x y charwith charheight type -> -
/type exch def
/h exch def
/w exch def
/y exch def
/x exch def
type 2 eq {
% Black boxes (like TeX does)
gsave
0 setlinewidth
x w 4 div add y M
0 h rlineto w 2 div 0 rlineto 0 h neg rlineto
closepath fill
grestore
} {
type 3 eq {
% Small arrows
gsave
.2 setlinewidth
x w 2 div add y h 2 div add M
w 4 div 0 rlineto
x w 4 div add y lineto stroke
x w 4 div add w 8 div add y h 4 div add M
x w 4 div add y lineto
w 4 div h 8 div rlineto stroke
grestore
} {
% do nothing
} ifelse
} ifelse
} def
% EPSF import.
/BeginEPSF {
/b4_Inc_state save def % Save state for cleanup
/dict_count countdictstack def % Count objects on dict stack
/op_count count 1 sub def % Count objects on operand stack
userdict begin
/showpage { } def
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
/languagelevel where {
pop languagelevel
1 ne {
false setstrokeadjust false setoverprint
} if
} if
} bind def
/EndEPSF {
count op_count sub { pos } repeat % Clean up stacks
countdictstack dict_count sub { end } repeat
b4_Inc_state restore
} bind def
% Check PostScript language level.
/languagelevel where {
pop /gs_languagelevel languagelevel def
} {
/gs_languagelevel 1 def
} ifelse
%%EndResource
%%BeginResource: procset Enscript-Encoding-88591 1.6.5 2
/encoding_vector [
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/space /exclam /quotedbl /numbersign
/dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus
/comma /hyphen /period /slash
/zero /one /two /three
/four /five /six /seven
/eight /nine /colon /semicolon
/less /equal /greater /question
/at /A /B /C
/D /E /F /G
/H /I /J /K
/L /M /N /O
/P /Q /R /S
/T /U /V /W
/X /Y /Z /bracketleft
/backslash /bracketright /asciicircum /underscore
/quoteleft /a /b /c
/d /e /f /g
/h /i /j /k
/l /m /n /o
/p /q /r /s
/t /u /v /w
/x /y /z /braceleft
/bar /braceright /tilde /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef
/space /exclamdown /cent /sterling
/currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft
/logicalnot /hyphen /registered /macron
/degree /plusminus /twosuperior /threesuperior
/acute /mu /paragraph /bullet
/cedilla /onesuperior /ordmasculine /guillemotright
/onequarter /onehalf /threequarters /questiondown
/Agrave /Aacute /Acircumflex /Atilde
/Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis
/Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute
/Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex
/Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde
/adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis
/igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute
/ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex
/udieresis /yacute /thorn /ydieresis
] def
%%EndResource
%%EndProlog
%%BeginSetup
%%IncludeResource: font Courier-Bold
/HFpt_w 10 def
/HFpt_h 10 def
/Courier-Bold /HF-gs-font MF
/HF /HF-gs-font findfont [HFpt_w 0 0 HFpt_h 0 0] makefont def
/Courier-Bold /F-gs-font MF
/F-gs-font 12 12 SF
/#copies 1 def
% Pagedevice definitions:
gs_languagelevel 1 gt {
<<
/PageSize [612 792]
>> setpagedevice
} if
%%BeginResource: procset Enscript-Header-simple 1.6.5 2
/do_header { % print default simple header
gsave
d_header_x d_header_y HFpt_h 3 div add translate
HF setfont
user_header_p {
5 0 moveto user_header_left_str show
d_header_w user_header_center_str stringwidth pop sub 2 div
0 moveto user_header_center_str show
d_header_w user_header_right_str stringwidth pop sub 5 sub
0 moveto user_header_right_str show
} {
5 0 moveto fname show
45 0 rmoveto fmodstr show
45 0 rmoveto pagenumstr show
} ifelse
grestore
} def
%%EndResource
/d_page_w 576 def
/d_page_h 720 def
/d_header_x 0 def
/d_header_y 705 def
/d_header_w 576 def
/d_header_h 15 def
/d_footer_x 0 def
/d_footer_y 0 def
/d_footer_w 576 def
/d_footer_h 0 def
/d_output_w 576 def
/d_output_h 705 def
/cols 1 def
%%EndSetup
%%Page: (1) 1
%%BeginPageSetup
_S
18 36 translate
/pagenum 1 def
/fname (core/scheduler.scm) def
/fdir (core) def
/ftail (scheduler.scm) def
% User defined strings:
/fmodstr (Tue Jul 20 18:31:36 2010) def
/pagenumstr (1) def
/user_header_p false def
/user_footer_p false def
%%EndPageSetup
do_header
5 690 M
(;;; ----------------------------------------------------------------------) s
5 677 M
(;;; Copyright 2009 Massachusetts Institute of Technology.) s
5 664 M
(;;; ----------------------------------------------------------------------) s
5 651 M
(;;; This file is part of Propagator Network Prototype.) s
5 638 M
(;;; ) s
5 625 M
(;;; Propagator Network Prototype is free software; you can) s
5 612 M
(;;; redistribute it and/or modify it under the terms of the GNU) s
5 599 M
(;;; General Public License as published by the Free Software) s
5 586 M
(;;; Foundation, either version 3 of the License, or \(at your option\)) s
5 573 M
(;;; any later version.) s
5 560 M
(;;; ) s
5 547 M
(;;; Propagator Network Prototype is distributed in the hope that it) s
5 534 M
(;;; will be useful, but WITHOUT ANY WARRANTY; without even the implied) s
5 521 M
(;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.) s
5 508 M
(;;; See the GNU General Public License for more details.) s
5 495 M
(;;; ) s
5 482 M
(;;; You should have received a copy of the GNU General Public License) s
5 469 M
(;;; along with Propagator Network Prototype. If not, see) s
5 456 M
(;;; <http://www.gnu.org/licenses/>.) s
5 443 M
(;;; ----------------------------------------------------------------------) s
5 417 M
(\(declare \(usual-integrations make-cell cell?\)\)) s
5 391 M
(;;;; Basic scheduling system) s
5 365 M
(;;; This scheduler maintains a list of jobs that need to be run. Each) s
5 352 M
(;;; job is a thunk. Jobs are run serially and are not preempted.) s
5 339 M
(;;; When a job exits \(normally\) it is forgotten and the next job is) s
5 326 M
(;;; run. The jobs are permitted to schedule additional jobs,) s
5 313 M
(;;; including rescheduling themselves. Jobs are presumed idempotent,) s
5 300 M
(;;; and specifically it is assumed acceptable not to count how many) s
5 287 M
(;;; times a given job \(by eq?-ness\) was scheduled, but merely that it) s
5 274 M
(;;; was scheduled. When the scheduler runs out of jobs, it returns) s
5 261 M
(;;; the symbol 'DONE to its caller.) s
5 235 M
(;;; The scheduler supplies an escape mechanism: running the procedure) s
5 222 M
(;;; ABORT-PROCESS, with a value, will terminate the entire job run,) s
5 209 M
(;;; and return the supplied value to the scheduler's caller.) s
5 196 M
(;;; Subsequent calls to the scheduler without first scheduling more) s
5 183 M
(;;; jobs will also return that same value. If ABORT-PROCESS is called) s
5 170 M
(;;; outside the dynamic extent of a run, it deschedules any jobs that) s
5 157 M
(;;; might be scheduled and saves the value for future reference as) s
5 144 M
(;;; above.) s
5 118 M
(;;; This scheduler is meant as a low-level support for the propagator) s
5 105 M
(;;; network in this prototype. In that use case, the jobs would be) s
5 92 M
(;;; propagators that the network knows need to be run. Any cells in) s
5 79 M
(;;; the network are invisible to the scheduler, but presumably help) s
5 66 M
(;;; the network schedule more propagators to run \(namely those that) s
5 53 M
(;;; may be interested in the cell's goings on\).) s
_R
S
%%Page: (2) 2
%%BeginPageSetup
_S
18 36 translate
/pagenum 2 def
/fname (core/scheduler.scm) def
/fdir (core) def
/ftail (scheduler.scm) def
% User defined strings:
/fmodstr (Tue Jul 20 18:31:36 2010) def
/pagenumstr (2) def
/user_header_p false def
/user_footer_p false def
%%EndPageSetup
do_header
5 677 M
(;;; The main public interface is) s
5 664 M
(;;; \(initialize-scheduler\) clear all scheduler state) s
5 651 M
(;;; \(alert-propagators jobs\) schedule a list \(or set\) of jobs) s
5 638 M
(;;; \(alert-all-propagators!\) reschedule all jobs ever scheduled) s
5 625 M
(;;; \(run\) run scheduled jobs until done) s
5 612 M
(;;; \(abort-process x\) terminate the run returning x) s
5 586 M
(;;; The scheduler also provides) s
5 573 M
(;;; \(with-independent-scheduler thunk\)) s
5 560 M
(;;; Run thunk in a fresh scheduler, then restore current scheduler.) s
5 547 M
(;;; \(make-scheduler\) ) s
5 534 M
(;;; Mutation point that can be configured to expriment with) s
5 521 M
(;;; different scheduling strategies.) s
5 508 M
(;;; \(execute-propagator propagator\)) s
5 495 M
(;;; Execute a propagator immediately rather than scheduling it for) s
5 482 M
(;;; later. Use judiciously.) s
5 469 M
(;;; \(all-propagators\)) s
5 456 M
(;;; Returns a list of all known propagators. Mainly for debugging) s
5 443 M
(;;; a propagator network.) s
5 417 M
(\(define *scheduler*\)) s
5 404 M
(\(define *abort-process*\)) s
5 391 M
(\(define *last-value-of-run*\)) s
5 378 M
(\(define *propagators-ever-alerted*\)) s
5 352 M
(;; This is a mutation point, if one wants to play with different kinds) s
5 339 M
(;; of schedulers. The default is round-robin, below.) s
5 326 M
(\(define \(make-scheduler\) \(make-round-robin-scheduler\)\)) s
5 300 M
(\(define \(initialize-scheduler\)) s
5 287 M
( \(set! *scheduler* \(make-scheduler\)\)) s
5 274 M
( \(set! *abort-process* #f\)) s
5 261 M
( \(set! *last-value-of-run* 'done\)) s
5 248 M
( \(set! *propagators-ever-alerted* \(make-eq-oset\)\)) s
5 235 M
( 'ok\)) s
5 209 M
(\(define \(with-independent-scheduler thunk\)) s
5 196 M
( \(fluid-let \(\(*scheduler* #f\)) s
5 183 M
( \(*abort-process* #f\)) s
5 170 M
( \(*last-value-of-run* #f\)) s
5 157 M
( \(*propagators-ever-alerted* #f\)\)) s
5 144 M
( \(initialize-scheduler\)) s
5 131 M
( \(thunk\)\)\)) s
5 105 M
(\(define \(execute-propagator propagator\)) s
5 92 M
( \(propagator\)\)) s
_R
S
%%Page: (3) 3
%%BeginPageSetup
_S
18 36 translate
/pagenum 3 def
/fname (core/scheduler.scm) def
/fdir (core) def
/ftail (scheduler.scm) def
% User defined strings:
/fmodstr (Tue Jul 20 18:31:36 2010) def
/pagenumstr (3) def
/user_header_p false def
/user_footer_p false def
%%EndPageSetup
do_header
5 677 M
(\(define \(alert-propagators propagators\)) s
5 664 M
( \(for-each) s
5 651 M
( \(lambda \(propagator\)) s
5 638 M
( \(if \(not \(procedure? propagator\)\)) s
5 625 M
( \(error "Alerting a non-procedure" propagator\)\)) s
5 612 M
( \(oset-insert *propagators-ever-alerted* propagator\)) s
5 599 M
( \(\(*scheduler* 'alert-one\) propagator\)\)) s
5 586 M
( \(listify propagators\)\)) s
5 573 M
( #f\)) s
5 560 M
(\(define alert-propagator alert-propagators\)) s
5 534 M
(\(define \(all-propagators\)) s
5 521 M
( \(oset-members *propagators-ever-alerted*\)\)) s
5 495 M
(\(define \(alert-all-propagators!\)) s
5 482 M
( \(for-each \(*scheduler* 'alert-one\) \(all-propagators\)\)\)) s
5 456 M
(\(define \(with-process-abortion thunk\)) s
5 443 M
( \(call-with-current-continuation) s
5 430 M
( \(lambda \(k\)) s
5 417 M
( \(fluid-let \(\(*abort-process* k\)\)) s
5 404 M
( \(thunk\)\)\)\)\)) s
5 378 M
(\(define termination-trace #f\)) s
5 352 M
(\(define \(abort-process value\)) s
5 339 M
( \(if termination-trace) s
5 326 M
( \(ppc `\(calling abort-process with ,value and ,*abort-process*\)\)\)) s
5 313 M
( \(if *abort-process*) s
5 300 M
( ;; if the propagator is running) s
5 287 M
( \(begin \(*scheduler* 'clear!\)) s
5 274 M
( \(*abort-process* value\)\)) s
5 261 M
( ;; if the user is setting up state) s
5 248 M
( \(begin \(*scheduler* 'clear!\)) s
5 235 M
( \(set! *last-value-of-run* value\)\)\)\)) s
5 209 M
(\(define \(run\)) s
5 196 M
( \(define \(do-run\)) s
5 183 M
( \(*scheduler* 'run\)\)) s
5 170 M
( \(if \(not \(*scheduler* 'done?\)\)) s
5 157 M
( \(set! *last-value-of-run* \(with-process-abortion do-run\)\)\)) s
5 144 M
( *last-value-of-run*\)) s
_R
S
%%Page: (4) 4
%%BeginPageSetup
_S
18 36 translate
/pagenum 4 def
/fname (core/scheduler.scm) def
/fdir (core) def
/ftail (scheduler.scm) def
% User defined strings:
/fmodstr (Tue Jul 20 18:31:36 2010) def
/pagenumstr (4) def
/user_header_p false def
/user_footer_p false def
%%EndPageSetup
do_header
5 677 M
(\(define \(make-oset-scheduler policy\)) s
5 664 M
( \(let \(\(propagators-left \(make-eq-oset\)\)\)) s
5 651 M
( \(define \(run-alerted\)) s
5 638 M
( \(if \(any-alerted?\)) s
5 625 M
( \(begin) s
5 612 M
( \(policy propagators-left\)) s
5 599 M
( \(run-alerted\)\)) s
5 586 M
( 'done\)\)) s
5 560 M
( \(define \(alert-one propagator\)) s
5 547 M
( \(oset-insert propagators-left propagator\)\)) s
5 521 M
( \(define \(clear!\)) s
5 508 M
( \(oset-clear! propagators-left\)\)) s
5 482 M
( \(define \(any-alerted?\)) s
5 469 M
( \(< 0 \(oset-count propagators-left\)\)\)) s
5 443 M
( \(define \(me message\)) s
5 430 M
( \(cond \(\(eq? message 'run\) \(run-alerted\)\)) s
5 417 M
( \(\(eq? message 'alert-one\) alert-one\)) s
5 404 M
( \(\(eq? message 'clear!\) \(clear!\)\)) s
5 391 M
( \(\(eq? message 'done?\) \(not \(any-alerted?\)\)\)\)\)) s
5 378 M
( me\)\)) s
5 352 M
(\(define \(round-robin-policy propagators-left\)) s
5 339 M
( \(let \(\(temp \(oset-members propagators-left\)\)\)) s
5 326 M
( \(oset-clear! propagators-left\)) s
5 313 M
( \(for-each \(lambda \(propagator\)) s
5 300 M
( \(execute-propagator propagator\)\)) s
5 287 M
( temp\)\)\)) s
5 261 M
(\(define \(stack-policy propagators-left\)) s
5 248 M
( \(execute-propagator \(oset-pop! propagators-left\)\)\)) s
5 222 M
(\(define \(make-round-robin-scheduler\)) s
5 209 M
( \(make-oset-scheduler round-robin-policy\)\)) s
5 183 M
(\(define \(make-stack-scheduler\)) s
5 170 M
( \(make-oset-scheduler stack-policy\)\)) s
_R
S
%%Page: (5) 5
%%BeginPageSetup
_S
18 36 translate
/pagenum 5 def
/fname (core/scheduler.scm) def
/fdir (core) def
/ftail (scheduler.scm) def
% User defined strings:
/fmodstr (Tue Jul 20 18:31:36 2010) def
/pagenumstr (5) def
/user_header_p false def
/user_footer_p false def
%%EndPageSetup
do_header
5 677 M
(\(define \(make-fast-slow-scheduler fast-policy slow-policy\)) s
5 664 M
( \(let \(\(propagators-left \(make-eq-oset\)\)) s
5 651 M
( \(slow-propagators \(make-eq-oset\)\)\)) s
5 638 M
( \(define \(run-alerted\)) s
5 625 M
( \(cond \(\(any-normal?\)) s
5 612 M
( \(fast-policy propagators-left\)) s
5 599 M
( \(run-alerted\)\)) s
5 586 M
( \(\(any-slow?\)) s
5 573 M
( \(slow-policy slow-propagators\)) s
5 560 M
( \(run-alerted\)\)) s
5 547 M
( \(else 'done\)\)\)) s
5 521 M
( \(define \(alert-one propagator\)) s
5 508 M
( \(if \(tagged-slow? propagator\)) s
5 495 M
( \(oset-insert slow-propagators propagator\)) s
5 482 M
( \(oset-insert propagators-left propagator\)\)\)) s
5 456 M
( \(define \(clear!\)) s
5 443 M
( \(oset-clear! propagators-left\)) s
5 430 M
( \(oset-clear! slow-propagators\)\)) s
5 404 M
( \(define \(any-alerted?\)) s
5 391 M
( \(or \(any-normal?\) \(any-slow?\)\)\)) s
5 365 M
( \(define \(any-normal?\)) s
5 352 M
( \(< 0 \(oset-count propagators-left\)\)\)) s
5 326 M
( \(define \(any-slow?\)) s
5 313 M
( \(< 0 \(oset-count slow-propagators\)\)\)) s
5 287 M
( \(define \(me message\)) s
5 274 M
( \(cond \(\(eq? message 'run\) \(run-alerted\)\)) s
5 261 M
( \(\(eq? message 'alert-one\) alert-one\)) s
5 248 M
( \(\(eq? message 'clear!\) \(clear!\)\)) s
5 235 M
( \(\(eq? message 'done?\) \(not \(any-alerted?\)\)\)\)\)) s
5 222 M
( me\)\)) s
5 196 M
(\(define \(tagged-slow? thing\)) s
5 183 M
( \(eq-get thing 'slow\)\)) s
5 157 M
(\(define \(tag-slow! thing\)) s
5 144 M
( \(eq-put! thing 'slow #t\)) s
5 131 M
( thing\)) s
5 105 M
(;;; These schedulers were much worse than round-robin on the slow) s
5 92 M
(;;; examples when tagging amb-choose propagators as slow.) s
5 79 M
(\(define \(make-two-stack-scheduler\)) s
5 66 M
( \(make-fast-slow-scheduler stack-policy stack-policy\)\)) s
5 53 M
(\(define \(make-robin-stack-scheduler\)) s
5 40 M
( \(make-fast-slow-scheduler round-robin-policy stack-policy\)\)) s
5 27 M
(\(define \(make-two-robin-scheduler\)) s
5 14 M
( \(make-fast-slow-scheduler round-robin-policy round-robin-policy\)\)) s
_R
S
%%Page: (-) 6
S
%%Page: (1) 7
%%BeginPageSetup
_S
18 36 translate
/pagenum 1 def
/fname (core/metadata.scm) def
/fdir (core) def
/ftail (metadata.scm) def
% User defined strings:
/fmodstr (Mon Aug 02 14:37:02 2010) def
/pagenumstr (1) def
/user_header_p false def
/user_footer_p false def
%%EndPageSetup
do_header
5 690 M
(;;; ----------------------------------------------------------------------) s
5 677 M
(;;; Copyright 2010 Alexey Radul.) s
5 664 M
(;;; ----------------------------------------------------------------------) s
5 651 M
(;;; This file is part of Propagator Network Prototype.) s
5 638 M
(;;; ) s
5 625 M
(;;; Propagator Network Prototype is free software; you can) s
5 612 M
(;;; redistribute it and/or modify it under the terms of the GNU) s
5 599 M
(;;; General Public License as published by the Free Software) s
5 586 M
(;;; Foundation, either version 3 of the License, or \(at your option\)) s
5 573 M
(;;; any later version.) s
5 560 M
(;;; ) s
5 547 M
(;;; Propagator Network Prototype is distributed in the hope that it) s
5 534 M
(;;; will be useful, but WITHOUT ANY WARRANTY; without even the implied) s
5 521 M
(;;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.) s
5 508 M
(;;; See the GNU General Public License for more details.) s
5 495 M
(;;; ) s
5 482 M
(;;; You should have received a copy of the GNU General Public License) s
5 469 M
(;;; along with Propagator Network Prototype. If not, see) s
5 456 M
(;;; <http://www.gnu.org/licenses/>.) s
5 443 M
(;;; ----------------------------------------------------------------------) s
5 417 M
(\(declare \(usual-integrations make-cell cell?\)\)) s
5 391 M
(;;;; Network Metadata) s
5 365 M
(;;; The purpose of this steaming pile is to allow the collection of) s
5 352 M
(;;; metadata sufficient to traverse and inspect a running propagator) s
5 339 M
(;;; network, for the purpose of debugging it. As an extreme case,) s
5 326 M
(;;; extensions/draw.scm uses the collected metadata to draw pictures) s
5 313 M
(;;; of \(small, simple\) networks in dot and yFiles.) s
5 287 M
(\(define \(propagator-inputs propagator\)) s
5 274 M
( \(or \(eq-get propagator 'inputs\)) s
5 261 M