about summary refs log tree commit diff stats
path: root/doc/uml/134530.diagram
blob: 82785c7fe4da4f1aa44a519366d59e2a1f83ca7f (plain) (blame)
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
format 70

classcanvas 128002 class_ref 148738 // Action
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 151 121 2000
end
classcanvas 128130 class_ref 148866 // Command
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 212 31 2000
end
classcanvas 128258 class_ref 148994 // CommandList
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 338 18 2000
end
classcanvas 128642 class_ref 149122 // Environment
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 99 305 2000
end
classcanvas 128770 class_ref 149250 // curses
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 118 611 2000
end
classcanvas 128898 class_ref 149378 // FM
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 143 185 2000
end
classcanvas 129154 class_ref 128002 // Displayable
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 325 408 2000
end
classcanvas 129666 class_ref 135426 // Console
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 627 149 2006
end
classcanvas 129922 class_ref 128130 // UI
  draw_all_relations default hide_attributes default hide_operations yes hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 366 235 2006
end
classcanvas 130178 class_ref 128386 // DisplayableContainer
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 299 311 2012
end
classcanvas 131458 class_ref 155906 // FileSystemObject
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 71 416 2000
end
classcanvas 131842 class_ref 128258 // DefaultUI
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 325 129 2012
end
classcanvas 132610 class_ref 156034 // Widget
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 509 237 2017
end
classcanvas 133250 class_ref 135170 // BrowserColumn
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 553 430 2023
end
classcanvas 133506 class_ref 135042 // TitleBar
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 646 391 2023
end
classcanvas 136322 class_ref 162690 // os
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 54 566 2000
end
packagecanvas 136578 
  package_ref 134530 // builtin
    xyzwh 29 522 2006 225 181
end
note 137346 "\"outer world\""
  xyzwh 123 566 2011 117 37
classcanvas 137602 class_ref 175746 // Pager
  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
  xyz 537 333 2028
end
relationcanvas 129026 relation_ref 156162 // <generalisation>
  decenter_begin 466
  from ref 128898 z 2001 to ref 128002
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 129538 relation_ref 162946 // <aggregation>
  from ref 128258 z 2001 to ref 128130
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130306 relation_ref 128386 // <generalisation>
  decenter_begin 441
  decenter_end 407
  from ref 130178 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130434 relation_ref 135938 // <aggregation>
  decenter_begin 603
  decenter_end 631
  from ref 130178 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130562 relation_ref 128258 // <generalisation>
  from ref 129922 z 2007 to ref 130178
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 130946 relation_ref 169730 // <unidirectional association>
  from ref 128130 z 2001 to point 180 56
  line 137218 z 2001 to ref 128002
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131202 relation_ref 169986 // <association>
  decenter_begin 514
  from ref 129154 z 2001 to ref 128770
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131586 relation_ref 170242 // <aggregation>
  decenter_begin 351
  from ref 128642 z 2001 to ref 131458
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131714 relation_ref 170370 // <association>
  from ref 128642 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 131970 relation_ref 128002 // <generalisation>
  from ref 131842 z 2007 to ref 129922
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 132354 relation_ref 170498 // <association>
  decenter_begin 435
  decenter_end 347
  from ref 131842 z 2013 to ref 128258
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 132738 relation_ref 170754 // <generalisation>
  decenter_end 126
  from ref 132610 z 2001 to point 493 430
  line 137474 z 2001 to ref 129154
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 132866 relation_ref 170882 // <generalisation>
  from ref 129666 z 2007 to ref 132610
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 133634 relation_ref 171010 // <generalisation>
  from ref 133506 z 2018 to ref 132610
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 133762 relation_ref 177922 // <unidirectional association>
  decenter_end 569
  from ref 128898 z 2001 to ref 128642
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 135170 relation_ref 178050 // <unidirectional association>
  from ref 128898 z 2013 to ref 131842
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 136450 relation_ref 184706 // <association>
  from ref 136322 z 2001 to ref 131458
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 136834 relation_ref 170626 // <association>
  from ref 129666 z 2007 to point 564 94
  line 137090 z 2007 to ref 128258
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 137730 relation_ref 191234 // <generalisation>
  from ref 137602 z 2029 to ref 132610
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
relationcanvas 137858 relation_ref 191362 // <generalisation>
  from ref 133250 z 2029 to ref 137602
  no_role_a no_role_b
  no_multiplicity_a no_multiplicity_b
end
end
='author Kartik K. Agaram <vc@akkartik.com> 2017-07-09 14:34:17 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2017-07-09 14:34:17 -0700 3966' href='/akkartik/mu/commit/101run_sandboxed.cc?h=main&id=ec99eb7a2aa67b55d0fdc1dcb9c40e59d8ec42a7'>ec99eb7a ^
dd9eda26 ^
09125ea2 ^
9e0f70d5 ^




87fbfc2d ^
2c3afb53 ^
5ed9bb13 ^
6dc1379b ^
b24eb476 ^
f3760b0f ^
2c3afb53 ^


b24eb476 ^
2c3afb53 ^
2c3afb53 ^
78c50205 ^
795f5244 ^
0f0d3e7a ^
2429c65c ^
75a00270 ^


87fbfc2d ^
7ecb3374 ^
f8a6721d ^
760f683f ^
5db2faeb ^
32cd40ec ^
5db2faeb ^
1ead3562 ^
32cd40ec ^
87fbfc2d ^
75a00270 ^
5f98a10c ^
5db2faeb ^

77cdc6d0 ^

1625e908 ^
77cdc6d0 ^

795f5244 ^
b17c196d ^
87fbfc2d ^
12c3ee1e ^
2429c65c ^


b2f699e1 ^
2429c65c ^





28103e50 ^
61fb1da0 ^

1625e908 ^
2429c65c ^
0f0d3e7a ^
06584c52 ^
5f98a10c ^
a0b9fa55 ^
b2f699e1 ^

0f0d3e7a ^
2429c65c ^
06584c52 ^
06584c52 ^
e00d4854 ^
06584c52 ^


5f98a10c ^
a0b9fa55 ^
b2f699e1 ^

9e0f70d5 ^


06584c52 ^


06584c52 ^
322ce34d ^
2429c65c ^





9e4f1844 ^
2429c65c ^
9e4f1844 ^
2429c65c ^
9e4f1844 ^
2429c65c ^
9e4f1844 ^
2429c65c ^
9e4f1844 ^
2429c65c ^
9e4f1844 ^
2429c65c ^
28103e50 ^

61fb1da0 ^



2429c65c ^









28103e50 ^
61fb1da0 ^

06584c52 ^

5db2faeb ^





760f683f ^
7a84094a ^
8ee53369 ^

7a84094a ^
8ee53369 ^
7a84094a ^
80df524b ^
d559f68b ^


1625e908 ^
1ead3562 ^
5db2faeb ^
5db2faeb ^
5ed9bb13 ^
3e31f29a ^

4814bf94 ^
1d13dac8 ^
1ead3562 ^
d559f68b ^
1d13dac8 ^
d559f68b ^
a0331a9b ^
1d13dac8 ^


5db2faeb ^


795f5244 ^
166e3c0d ^



5db2faeb ^


09125ea2 ^
5db2faeb ^





795f5244 ^
166e3c0d ^



5db2faeb ^








795f5244 ^
166e3c0d ^



5db2faeb ^


78c50205 ^
5db2faeb ^



05331766 ^
5f98a10c ^
05331766 ^
5f98a10c ^
05331766 ^
5f98a10c ^


05331766 ^
5f98a10c ^
5ed9bb13 ^
5f98a10c ^



7afe09fb ^
5db2faeb ^
795f5244 ^
166e3c0d ^
7afe09fb ^
166e3c0d ^

5db2faeb ^
7afe09fb ^
5db2faeb ^
e00d4854 ^
5db2faeb ^



1625e908 ^
5db2faeb ^
1625e908 ^
166e3c0d ^
1625e908 ^
166e3c0d ^

5db2faeb ^
1625e908 ^
06584c52 ^
5db2faeb ^


3f7eed6c ^
1ead3562 ^
9fdda88b ^
d559f68b ^

227c11e2 ^
9fdda88b ^



09125ea2 ^


09125ea2 ^












d35595fd ^



































3f7eed6c ^
1ead3562 ^
76d22198 ^
d559f68b ^



76d22198 ^
d559f68b ^
227c11e2 ^
76d22198 ^




5f98a10c ^
1ead3562 ^
5f98a10c ^
7a84094a ^

d559f68b ^
227c11e2 ^
0685569c ^
5f98a10c ^
0685569c ^



75a00270 ^
0685569c ^
957ca9c9 ^
1ead3562 ^
957ca9c9 ^
a0331a9b ^
7a84094a ^
957ca9c9 ^
d559f68b ^
957ca9c9 ^



d35595fd ^





3eb81335 ^
09125ea2 ^
d35595fd ^
90938fcb ^
9fdda88b ^
d35595fd ^
9fdda88b ^
b24eb476 ^
9e0f70d5 ^









76d22198 ^
78c50205 ^
8d7b228e ^
78c50205 ^
76d22198 ^

76d22198 ^
b24eb476 ^
4082acd2 ^
9fdda88b ^

d35595fd ^
9fdda88b ^
f2564285 ^
9fdda88b ^
be13beeb ^

b24eb476 ^
be13beeb ^



957ca9c9 ^
be13beeb ^
be13beeb ^

be13beeb ^


b24eb476 ^
548cd00a ^

795f5244 ^
78c50205 ^
548cd00a ^

b24eb476 ^
5f98a10c ^


5ed9bb13 ^
5f98a10c ^



5f98a10c ^
294b2ab3 ^
78c50205 ^
5f98a10c ^

b24eb476 ^
0685569c ^
0685569c ^

e00d4854 ^
0685569c ^


0cfc678f ^
e00d4854 ^
0cfc678f ^
78c50205 ^
0cfc678f ^


fda4f091 ^

0cfc678f ^



0685569c ^
f0eb3556 ^
1625e908 ^
5ed9bb13 ^
06584c52 ^
f0eb3556 ^


795f5244 ^
166e3c0d ^
f0eb3556 ^
166e3c0d ^
8d72e565 ^
e4630643 ^

78c50205 ^
9dcbec39 ^
e4630643 ^

166e3c0d ^



093036e8 ^
78c50205 ^
0f0d3e7a ^
06584c52 ^

1625e908 ^
0a2026a6 ^
f0eb3556 ^
4efc0ff3 ^
1625e908 ^
06584c52 ^
cfb142b9 ^
5ed9bb13 ^
06584c52 ^
f0eb3556 ^

06584c52 ^
5f98a10c ^
1ead3562 ^
06584c52 ^
d559f68b ^
7a84094a ^
06584c52 ^

7a84094a ^
06584c52 ^

0f0d3e7a ^




d559f68b ^
0f0d3e7a ^
7a84094a ^

0f0d3e7a ^






7a84094a ^

0f0d3e7a ^



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

                                                                          
 
                                
          
                 
                                      
                      
                     
 
                              
 
                                 
          

                                

                
                             
 










                                                                              
                                                                    
                                                              
                            
                                         
                                      
                                             
              
                                        
                                                    
                                       
                     
                                    
                                                                                                                                                  

          
                                            
                                                                                                                                                                      

          


                                                
                     
                                                                           
                                  
                       
                                
                                                     
                                
                                                   
                                              
                   
                                         



                                                                            

 




                                                                              
                       
                                        
                                                    
                            
                     
                                   
                                                




                                       
       
                                                                           
              
                                                                                  
                                   
                                                                                                 


                                           
                                                
                      
   
                                                               
                                                   
                                                 
                                    


                                                   
                                                
                                          
                           
                                                  
                                        
                          
                                       
                             
              
                  
                                         
                                             

                                                                           

                                         
                                                                                                                             

                                                                                
                                                                          
              
 
 


                                                                            
                                





                                                                    
                                                          

                                          
 
       
                                                  
                                           
                     
                                 

                                    
                             
                      
                                   
                                  
                                          


                     
                      
                                  

                                    


                                                  


                                   
                          
                                                                                                 





                                                        
                                                
                                                          
                                        
                                          
                                              
                                                      
                                      
                                      
                                      
                                      
                                                 
                                                            

                                                                  



                                                          









                                                                                                     
                                                                                                              

                                                                                                  

 





                                                                                               
                                                
                                                           

                                                  
                                                                 
                                                 
                                                     
                                                           


                                            
                              
                                                          
       
 
                                

                                                
 
                                    
          
                     
         
                                
                          


                              


                                             
                                                                          



                                       


                                                
                                                                             





                                             
                                                                        



                                       








                                                
                                                                    



                                       


                                                
                                                              



                                             
            
                                        
                                                
                                       
                   


                                                
                   
                     
                                                   



                                             
               
                                        
                                                      
                                       
                      

        
                                                
                      
                     
                                                 



                                             
                       
                                        
                                                                      
                                       
                              

        
                                                
                              
                 


        
                                                     
          
                                    

                                
                           



                                                     


                                                                  












                                     



































                                                                       
                                          
          
                                    



                                   
   
                                
                           




                               
                                            
          
                                         

                                 
                                        
                           
 
                                                           



                                
     
 
                                        
          
                                                  
                                          
               
 
                                        



                             





                                                                                                             
                                       
                                                                                                                
                                                                                     
 
       
                                                                                                            
                    
                                            









                                                                            
                                         
                                                   
                                                                          
                                                          

                 
     
                                                  
                                                        

                
                   
 
 
       

                                  
                                      



                          
                                                  
            

     


                      
                                                

                      
                                                       
                                

 
                            


                                                                                                                     
                                      



                                                  
                   
                               
                             

 
                          
                              

                                                                                                                     
                                        


                                                  
                            
                               
                   
                             


                          

                       



                          
 
 
                                                                        
                               
 


                                             
                                      
                                       
              
                                    
                                                                                                                                           

          
                                            
                                                                                                                                                                    

          



                                                
                                 
                                                      
                                                  

                                                  
                      
                                                       
                  
                                          
                       
                                         
                     
                                                   
                                                                   

        
 
                                       
          
             
                             
                          

          
                      

                              




                                                                                 
                 
                   

           






                                                                                                           

                       



                             
//: Helper for various programming environments: run arbitrary Mu code and
//: return some result in text form.

:(scenario run_interactive_code)
def main [
  1:num <- copy 0
  2:text <- new [1:num/raw <- copy 34]
  run-sandboxed 2:text
  3:num <- copy 1:num
]
+mem: storing 34 in location 3

:(scenario run_interactive_empty)
def main [
  1:text <- copy 0/unsafe
  2:text <- run-sandboxed 1:text
]
# result is null
+mem: storing 0 in location 2

//: As the name suggests, 'run-sandboxed' will prevent certain operations that
//: regular Mu code can perform.
:(before "End Globals")
bool Sandbox_mode = false;
//: for starters, users can't override 'main' when the environment is running
:(before "End Load Recipe Name")
if (Sandbox_mode && result.name == "main") {
  slurp_balanced_bracket(in);
  return -1;
}

//: run code in 'interactive mode', i.e. with errors off and return:
//:   stringified output in case we want to print it to screen
//:   any errors encountered
//:   simulated screen any prints went to
//:   any 'app' layer traces generated
:(before "End Primitive Recipe Declarations")
RUN_SANDBOXED,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "run-sandboxed", RUN_SANDBOXED);
:(before "End Primitive Recipe Checks")
case RUN_SANDBOXED: {
  if (SIZE(inst.ingredients) != 1) {
    raise << maybe(get(Recipe, r).name) << "'run-sandboxed' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
    break;
  }
  if (!is_mu_text(inst.ingredients.at(0))) {
    raise << maybe(get(Recipe, r).name) << "first ingredient of 'run-sandboxed' should be a string, but got '" << to_string(inst.ingredients.at(0)) << "'\n" << end();
    break;
  }
  break;
}
:(before "End Primitive Recipe Implementations")
case RUN_SANDBOXED: {
  bool new_code_pushed_to_stack = run_interactive(ingredients.at(0).at(0));
  if (!new_code_pushed_to_stack) {
    products.resize(5);
    products.at(0).push_back(0);
    products.at(1).push_back(trace_error_contents());
    products.at(2).push_back(0);
    products.at(3).push_back(trace_app_contents());
    products.at(4).push_back(1);  // completed
    run_code_end();
    break;  // done with this instruction
  }
  else {
    continue;  // not done with caller; don't increment current_step_index()
  }
}

//: To show results in the sandbox Mu uses a hack: it saves the products
//: returned by each instruction while Track_most_recent_products is true, and
//: keeps the most recent such result around so that it can be returned as the
//: result of a sandbox.

:(before "End Globals")
bool Track_most_recent_products = false;
int Call_depth_to_track_most_recent_products_at = 0;
string Most_recent_products;
:(before "End Reset")
Track_most_recent_products = false;
Call_depth_to_track_most_recent_products_at = 0;
Most_recent_products = "";

:(before "End Globals")
trace_stream* Save_trace_stream = NULL;
string Save_trace_file;
:(code)
// reads a string, tries to call it as code (treating it as a test), saving
// all errors.
// returns true if successfully called (no errors found during load and transform)
bool run_interactive(int address) {
  assert(contains_key(Recipe_ordinal, "interactive") && get(Recipe_ordinal, "interactive") != 0);
  // try to sandbox the run as best you can
  // todo: test this
  if (!Current_scenario) {
    for (int i = 1; i < Reserved_for_tests; ++i)
      Memory.erase(i);
  }
  string command = trim(strip_comments(read_mu_text(address)));
  Name[get(Recipe_ordinal, "interactive")].clear();
  run_code_begin(/*should_stash_snapshots*/true);
  if (command.empty()) return false;
  // don't kill the current routine on parse errors
  routine* save_current_routine = Current_routine;
  Current_routine = NULL;
  // call run(string) but without the scheduling
  load(string("recipe! interactive [\n") +
          "local-scope\n" +
          "screen:&:screen <- next-ingredient\n" +
          "$start-tracking-products\n" +
          command + "\n" +
          "$stop-tracking-products\n" +
          "return screen\n" +
       "]\n");
  transform_all();
  Current_routine = save_current_routine;
  if (trace_count("error") > 0) return false;
  // now call 'sandbox' which will run 'interactive' in a separate routine,
  // and wait for it
  if (Save_trace_stream) {
    ++Save_trace_stream->callstack_depth;
    trace(9999, "trace") << "run-sandboxed: incrementing callstack depth to " << Save_trace_stream->callstack_depth << end();
    assert(Save_trace_stream->callstack_depth < 9000);  // 9998-101 plus cushion
  }
  Current_routine->calls.push_front(call(get(Recipe_ordinal, "sandbox")));
  return true;
}

//: Carefully update all state to exactly how it was -- including snapshots.

:(before "End Globals")
bool Run_profiler_stash = false;
map<string, recipe_ordinal> Recipe_ordinal_snapshot_stash;
map<recipe_ordinal, recipe> Recipe_snapshot_stash;
map<string, type_ordinal> Type_ordinal_snapshot_stash;
map<type_ordinal, type_info> Type_snapshot_stash;
map<recipe_ordinal, map<string, int> > Name_snapshot_stash;
map<string, vector<recipe_ordinal> > Recipe_variants_snapshot_stash;
map<string, type_tree*> Type_abbreviations_snapshot_stash;
vector<scenario> Scenarios_snapshot_stash;
set<string> Scenario_names_snapshot_stash;

:(code)
void run_code_begin(bool should_stash_snapshots) {
  // stuff to undo later, in run_code_end()
  Hide_errors = true;
  Disable_redefine_checks = true;
  Run_profiler_stash = Run_profiler;
  Run_profiler = false;
  if (should_stash_snapshots)
    stash_snapshots();
  Save_trace_stream = Trace_stream;
  Trace_stream = new trace_stream;
  Trace_stream->collect_depth = App_depth;
}

void run_code_end() {
  Hide_errors = false;
  Disable_redefine_checks = false;
  Run_profiler = Run_profiler_stash;
  Run_profiler_stash = false;
//?   ofstream fout("sandbox.log");
//?   fout << Trace_stream->readable_contents("");
//?   fout.close();
  delete Trace_stream;
  Trace_stream = Save_trace_stream;
  Save_trace_stream = NULL;
  Save_trace_file.clear();
  Recipe.erase(get(Recipe_ordinal, "interactive"));  // keep past sandboxes from inserting errors
  if (!Recipe_snapshot_stash.empty())
    unstash_snapshots();
}

// keep sync'd with save_snapshots and restore_snapshots
void stash_snapshots() {
  assert(Recipe_ordinal_snapshot_stash.empty());
  Recipe_ordinal_snapshot_stash = Recipe_ordinal_snapshot;
  assert(Recipe_snapshot_stash.empty());
  Recipe_snapshot_stash = Recipe_snapshot;
  assert(Type_ordinal_snapshot_stash.empty());
  Type_ordinal_snapshot_stash = Type_ordinal_snapshot;
  assert(Type_snapshot_stash.empty());
  Type_snapshot_stash = Type_snapshot;
  assert(Name_snapshot_stash.empty());
  Name_snapshot_stash = Name_snapshot;
  assert(Recipe_variants_snapshot_stash.empty());
  Recipe_variants_snapshot_stash = Recipe_variants_snapshot;
  assert(Type_abbreviations_snapshot_stash.empty());
  Type_abbreviations_snapshot_stash = Type_abbreviations_snapshot;
  assert(Scenarios_snapshot_stash.empty());
  Scenarios_snapshot_stash = Scenarios_snapshot;
  assert(Scenario_names_snapshot_stash.empty());
  Scenario_names_snapshot_stash = Scenario_names_snapshot;
  save_snapshots();
}
void unstash_snapshots() {
  restore_snapshots();
  Recipe_ordinal_snapshot = Recipe_ordinal_snapshot_stash;  Recipe_ordinal_snapshot_stash.clear();
  Recipe_snapshot = Recipe_snapshot_stash;  Recipe_snapshot_stash.clear();
  Type_ordinal_snapshot = Type_ordinal_snapshot_stash;  Type_ordinal_snapshot_stash.clear();
  Type_snapshot = Type_snapshot_stash;  Type_snapshot_stash.clear();
  Name_snapshot = Name_snapshot_stash;  Name_snapshot_stash.clear();
  Recipe_variants_snapshot = Recipe_variants_snapshot_stash;  Recipe_variants_snapshot_stash.clear();
  Type_abbreviations_snapshot = Type_abbreviations_snapshot_stash;  Type_abbreviations_snapshot_stash.clear();
  Scenarios_snapshot = Scenarios_snapshot_stash;  Scenarios_snapshot_stash.clear();
  Scenario_names_snapshot = Scenario_names_snapshot_stash;  Scenario_names_snapshot_stash.clear();
}

:(before "End Load Recipes")
load(string(
"recipe interactive [\n") +  // just a dummy version to initialize the Recipe_ordinal and so on
"]\n" +
"recipe sandbox [\n" +
  "local-scope\n" +
  "screen:&:screen <- new-fake-screen 30, 5\n" +
  "routine-id:num <- start-running interactive, screen\n" +
  "limit-time routine-id, 100000/instructions\n" +
  "wait-for-routine routine-id\n" +
  "instructions-run:num <- number-of-instructions routine-id\n" +
  "stash instructions-run [instructions run]\n" +
  "sandbox-state:num <- routine-state routine-id\n" +
  "completed?:bool <- equal sandbox-state, 1/completed\n" +
  "output:text <- $most-recent-products\n" +
  "errors:text <- save-errors\n" +
  "stashes:text <- save-app-trace\n" +
  "$cleanup-run-sandboxed\n" +
  "return output, errors, screen, stashes, completed?\n" +
"]\n");

//: adjust errors in the sandbox
:(before "End maybe(recipe_name) Special-cases")
if (recipe_name == "interactive") return "";

:(scenario run_interactive_comments)
def main [
  1:text <- new [# ab
add 2, 2]
  2:text <- run-sandboxed 1:text
  3:@:char <- copy *2:text
]
+mem: storing 52 in location 4

:(before "End Primitive Recipe Declarations")
_START_TRACKING_PRODUCTS,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "$start-tracking-products", _START_TRACKING_PRODUCTS);
:(before "End Primitive Recipe Checks")
case _START_TRACKING_PRODUCTS: {
  break;
}
:(before "End Primitive Recipe Implementations")
case _START_TRACKING_PRODUCTS: {
  Track_most_recent_products = true;
  Call_depth_to_track_most_recent_products_at = SIZE(Current_routine->calls);
  break;
}

:(before "End Primitive Recipe Declarations")
_STOP_TRACKING_PRODUCTS,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "$stop-tracking-products", _STOP_TRACKING_PRODUCTS);
:(before "End Primitive Recipe Checks")
case _STOP_TRACKING_PRODUCTS: {
  break;
}
:(before "End Primitive Recipe Implementations")
case _STOP_TRACKING_PRODUCTS: {
  Track_most_recent_products = false;
  break;
}

:(before "End Primitive Recipe Declarations")
_MOST_RECENT_PRODUCTS,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "$most-recent-products", _MOST_RECENT_PRODUCTS);
:(before "End Primitive Recipe Checks")
case _MOST_RECENT_PRODUCTS: {
  break;
}
:(before "End Primitive Recipe Implementations")
case _MOST_RECENT_PRODUCTS: {
  products.resize(1);
  products.at(0).push_back(new_mu_text(Most_recent_products));
  break;
}

:(before "End Primitive Recipe Declarations")
SAVE_ERRORS,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "save-errors", SAVE_ERRORS);
:(before "End Primitive Recipe Checks")
case SAVE_ERRORS: {
  break;
}
:(before "End Primitive Recipe Implementations")
case SAVE_ERRORS: {
  products.resize(1);
  products.at(0).push_back(trace_error_contents());
  break;
}

:(before "End Primitive Recipe Declarations")
SAVE_APP_TRACE,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "save-app-trace", SAVE_APP_TRACE);
:(before "End Primitive Recipe Checks")
case SAVE_APP_TRACE: {
  break;
}
:(before "End Primitive Recipe Implementations")
case SAVE_APP_TRACE: {
  products.resize(1);
  products.at(0).push_back(trace_app_contents());
  break;
}

:(before "End Primitive Recipe Declarations")
_CLEANUP_RUN_SANDBOXED,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "$cleanup-run-sandboxed", _CLEANUP_RUN_SANDBOXED);
:(before "End Primitive Recipe Checks")
case _CLEANUP_RUN_SANDBOXED: {
  break;
}
:(before "End Primitive Recipe Implementations")
case _CLEANUP_RUN_SANDBOXED: {
  run_code_end();
  break;
}

:(scenario "run_interactive_converts_result_to_text")
def main [
  # try to interactively add 2 and 2
  1:text <- new [add 2, 2]
  2:text <- run-sandboxed 1:text
  10:@:char <- copy *2:text
]
# first letter in the output should be '4' in unicode
+mem: storing 52 in location 11

:(scenario "run_interactive_ignores_products_in_nested_functions")
def main [
  1:text <- new [foo]
  2:text <- run-sandboxed 1:text
  10:@:char <- copy *2:text
]
def foo [
  20:num <- copy 1234
  {
    break
    reply 5678
  }
]
# no product should have been tracked
+mem: storing 0 in location 10

:(scenario "run_interactive_ignores_products_in_previous_instructions")
def main [
  1:text <- new [
    add 1, 1  # generates a product
    foo]  # no products
  2:text <- run-sandboxed 1:text
  10:@:char <- copy *2:text
]
def foo [
  20:num <- copy 1234
  {
    break
    reply 5678
  }
]
# no product should have been tracked
+mem: storing 0 in location 10

:(scenario "run_interactive_remembers_products_before_final_label")
def main [
  1:text <- new [
    add 1, 1  # generates a product
    +foo]  # no products
  2:text <- run-sandboxed 1:text
  10:@:char <- copy *2:text
]
def foo [
  20:num <- copy 1234
  {
    break
    reply 5678
  }
]
# product tracked
+mem: storing 50 in location 11

:(scenario "run_interactive_returns_text")
def main [
  # try to interactively add 2 and 2
  1:text <- new [
    x:text <- new [a]
    y:text <- new [b]
    z:text <- append x:text, y:text
  ]
  2:text <- run-sandboxed 1:text
  10:@:char <- copy *2:text
]
# output contains "ab"
+mem: storing 97 in location 11
+mem: storing 98 in location 12

:(scenario "run_interactive_returns_errors")
def main [
  # run a command that generates an error
  1:text <- new [x:num <- copy 34
get x:num, foo:offset]
  2:text, 3:text <- run-sandboxed 1:text
  10:@:char <- copy *3:text
]
# error should be "unknown element foo in container number"
+mem: storing 117 in location 11
+mem: storing 110 in location 12
+mem: storing 107 in location 13
+mem: storing 110 in location 14
# ...

:(scenario run_interactive_with_comment)
def main [
  # 2 instructions, with a comment after the first
  1:&:@:num <- new [a:num <- copy 0  # abc
b:num <- copy 0
]
  2:text, 3:text <- run-sandboxed 1:text
]
# no errors
+mem: storing 0 in location 3

:(after "Running One Instruction")
if (Track_most_recent_products && SIZE(Current_routine->calls) == Call_depth_to_track_most_recent_products_at
    && !current_instruction().is_label
    && current_instruction().name != "$stop-tracking-products") {
  Most_recent_products = "";
}
:(before "End Running One Instruction")
if (Track_most_recent_products && SIZE(Current_routine->calls) == Call_depth_to_track_most_recent_products_at) {
  Most_recent_products = track_most_recent_products(current_instruction(), products);
}
:(code)
string track_most_recent_products(const instruction& instruction, const vector<vector<double> >& products) {
  ostringstream out;
  for (int i = 0; i < SIZE(products); ++i) {
    // A sandbox can print a string result, but only if it is actually saved
    // to a variable in the sandbox, because otherwise the results are
    // reclaimed before the sandbox sees them. So you get these interactions
    // in the sandbox:
    //
    //    new [abc]
    //    => <address>
    //
    //    x:text <- new [abc]
    //    => abc
    if (i < SIZE(instruction.products)) {
      if (is_mu_text(instruction.products.at(i))) {
        if (!scalar(products.at(i))) continue;  // error handled elsewhere
        out << read_mu_text(products.at(i).at(0)) << '\n';
        continue;
      }
    }
    for (int j = 0; j < SIZE(products.at(i)); ++j)
      out << no_scientific(products.at(i).at(j)) << ' ';
    out << '\n';
  }
  return out.str();
}

:(code)
string strip_comments(string in) {
  ostringstream result;
  for (int i = 0; i < SIZE(in); ++i) {
    if (in.at(i) != '#') {
      result << in.at(i);
    }
    else {
      while (i+1 < SIZE(in) && in.at(i+1) != '\n')
        ++i;
    }
  }
  return result.str();
}

int stringified_value_of_location(int address) {
  // convert to string
  ostringstream out;
  out << no_scientific(get_or_insert(Memory, address));
  return new_mu_text(out.str());
}

int trace_error_contents() {
  if (!Trace_stream) return 0;
  ostringstream out;
  for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) {
    if (p->label != "error") continue;
    out << p->contents;
    if (*--p->contents.end() != '\n') out << '\n';
  }
  string result = out.str();
  truncate(result);
  if (result.empty()) return 0;
  return new_mu_text(result);
}

int trace_app_contents() {
  if (!Trace_stream) return 0;
  ostringstream out;
  for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) {
    if (p->depth != App_depth) continue;
    out << p->contents;
    if (*--p->contents.end() != '\n') out << '\n';
  }
  string result = out.str();
  if (result.empty()) return 0;
  truncate(result);
  return new_mu_text(result);
}

void truncate(string& x) {
  if (SIZE(x) > 1024) {
    x.erase(1024);
    *x.rbegin() = '\n';
    *++x.rbegin() = '.';
    *++++x.rbegin() = '.';
  }
}

//: simpler version of run-sandboxed: doesn't do any running, just loads
//: recipes and reports errors.

:(before "End Primitive Recipe Declarations")
RELOAD,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "reload", RELOAD);
:(before "End Primitive Recipe Checks")
case RELOAD: {
  if (SIZE(inst.ingredients) != 1) {
    raise << maybe(get(Recipe, r).name) << "'reload' requires exactly one ingredient, but got '" << inst.original_string << "'\n" << end();
    break;
  }
  if (!is_mu_text(inst.ingredients.at(0))) {
    raise << maybe(get(Recipe, r).name) << "first ingredient of 'reload' should be a string, but got '" << inst.ingredients.at(0).original_string << "'\n" << end();
    break;
  }
  break;
}
:(before "End Primitive Recipe Implementations")
case RELOAD: {
  restore_non_recipe_snapshots();
  string code = read_mu_text(ingredients.at(0).at(0));
  run_code_begin(/*should_stash_snapshots*/false);
  routine* save_current_routine = Current_routine;
  Current_routine = NULL;
  Sandbox_mode = true;
  vector<recipe_ordinal> recipes_reloaded = load(code);
  transform_all();
  Trace_stream->newline();  // flush trace
  Sandbox_mode = false;
  Current_routine = save_current_routine;
  products.resize(1);
  products.at(0).push_back(trace_error_contents());
  run_code_end();  // wait until we're done with the trace contents
  break;
}

:(scenario reload_continues_past_error)
def main [
  local-scope
  x:text <- new [recipe foo [
  get 1234:num, foo:offset
]]
  reload x
  1:num/raw <- copy 34
]
+mem: storing 34 in location 1

:(scenario reload_can_repeatedly_load_container_definitions)
# define a container and try to create it (merge requires knowing container size)
def main [
  local-scope
  x:text <- new [
    container foo [
      x:num
      y:num
    ]
    recipe bar [
      local-scope
      x:foo <- merge 34, 35
    ]
  ]
  # save warning addresses in locations of type 'number' to avoid spurious changes to them due to 'abandon'
  1:num/raw <- reload x
  2:num/raw <- reload x
]
# no errors on either load
+mem: storing 0 in location 1
+mem: storing 0 in location 2