https://github.com/akkartik/mu/blob/master/apps/calls.subx
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 == code
26
27 Entry:
28
29 89/<- %ebp 4/r32/esp
30
31
32
33
34 68/push Heap/imm32
35 ff 6/subop/push *Heap-size
36
37 e8/call new-segment/disp32
38
39 81 0/subop/add %esp 8/imm32
40
41
42
43 81 7/subop/compare *ebp 1/imm32
44 7e/jump-if-<= $subx-calls-main:interactive/disp8
45
46
47
48 68/push "test"/imm32
49 ff 6/subop/push *(ebp+8)
50
51 e8/call kernel-string-equal?/disp32
52
53 81 0/subop/add %esp 8/imm32
54
55 3d/compare-eax-and 0/imm32/false
56 74/jump-if-= $subx-calls-main:interactive/disp8
57
58 e8/call run-tests/disp32
59
60 8b/-> *Num-test-failures 3/r32/ebx
61 eb/jump $subx-calls-main:end/disp8
62 $subx-calls-main:interactive:
63
64
65
66 68/push Stdout/imm32
67 68/push Stdin/imm32
68
69 e8/call subx-calls/disp32
70
71 81 0/subop/add %esp 8/imm32
72
73 bb/copy-to-ebx 0/imm32
74 $subx-calls-main:end:
75 b8/copy-to-eax 1/imm32/exit
76 cd/syscall 0x80/imm8
77
78 subx-calls:
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 55/push-ebp
102 89/<- %ebp 4/r32/esp
103
104 50/push-eax
105 51/push-ecx
106 52/push-edx
107 56/push-esi
108
109 81 5/subop/subtract %esp 0x200/imm32
110 68/push 0x200/imm32/length
111 68/push 0/imm32/read
112 68/push 0/imm32/write
113 89/<- %esi 4/r32/esp
114
115 81 5/subop/subtract %esp 0x80/imm32
116 68/push 0x80/imm32/length
117 68/push 0/imm32/read
118 68/push 0/imm32/write
119 89/<- %edx 4/r32/esp
120 $subx-calls:loop:
121
122
123 56/push-esi
124
125 e8/call clear-stream/disp32
126
127 81 0/subop/add %esp 4/imm32
128
129
130 56/push-esi
131 ff 6/subop/push *(ebp+8)
132
133 e8/call read-line-buffered/disp32
134
135 81 0/subop/add %esp 8/imm32
136 $subx-calls:check0:
137
138 81 7/subop/compare *esi 0/imm32
139 0f 84/jump-if-= $subx-calls:break/disp32
140
141
142 68/push 0x20/imm32/space
143 56/push-esi
144
145 e8/call skip-chars-matching/disp32
146
147 81 0/subop/add %esp 8/imm32
148
149
150 8b/-> *(esi+4) 1/r32/ecx
151
152 31/xor %eax 0/r32/eax
153 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
154
155 3d/compare-eax-and 0x28/imm32/open-paren
156 74/jump-if-= $subx-calls:convert-call/disp8
157 $subx-calls:pass-through:
158
159
160 56/push-esi
161 ff 6/subop/push *(ebp+0xc)
162
163 e8/call write-stream-data/disp32
164
165 81 0/subop/add %esp 8/imm32
166
167 eb/jump $subx-calls:loop/disp8
168 $subx-calls:convert-call:
169
170
171
172 68/push "# . "/imm32
173 ff 6/subop/push *(ebp+0xc)
174
175 e8/call write-buffered/disp32
176
177 81 0/subop/add %esp 8/imm32
178
179
180 56/push-esi
181 ff 6/subop/push *(ebp+0xc)
182
183 e8/call write-stream-data/disp32
184
185 81 0/subop/add %esp 8/imm32
186
187
188 ff 0/subop/increment *(esi+4)
189
190
191 52/push-edx
192
193 e8/call clear-stream/disp32
194
195 81 0/subop/add %esp 4/imm32
196
197
198 52/push-edx
199 56/push-esi
200
201 e8/call parse-line/disp32
202
203 81 0/subop/add %esp 8/imm32
204
205
206 52/push-edx
207 ff 6/subop/push *(ebp+0xc)
208
209 e8/call emit-call/disp32
210
211 81 0/subop/add %esp 8/imm32
212
213 e9/jump $subx-calls:loop/disp32
214 $subx-calls:break:
215
216
217 ff 6/subop/push *(ebp+0xc)
218
219 e8/call flush/disp32
220
221 81 0/subop/add %esp 4/imm32
222 $subx-calls:end:
223
224 81 0/subop/add %esp 0x298/imm32
225
226 5e/pop-to-esi
227 5a/pop-to-edx
228 59/pop-to-ecx
229 58/pop-to-eax
230
231 89/<- %esp 5/r32/ebp
232 5d/pop-to-ebp
233 c3/return
234
235 parse-line:
236
237
238
239
240
241
242
243
244
245
246 55/push-ebp
247 89/<- %ebp 4/r32/esp
248
249 51/push-ecx
250
251 68/push 0/imm32/end
252 68/push 0/imm32/start
253 89/<- %ecx 4/r32/esp
254 $parse-line:loop:
255
256
257 51/push-ecx
258 ff 6/subop/push *(ebp+8)
259
260 e8/call next-word-string-or-expression-without-metadata/disp32
261
262 81 0/subop/add %esp 8/imm32
263 $parse-line:check1:
264
265
266
267 51/push-ecx
268
269 e8/call slice-empty?/disp32
270
271 81 0/subop/add %esp 4/imm32
272
273 3d/compare-eax-and 0/imm32/false
274 0f 85/jump-if-!= $parse-line:end/disp32
275 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------
315 $parse-line:write-word:
316
317
318 ff 6/subop/push *ecx
319 ff 6/subop/push *(ebp+0xc)
320
321 e8/call write-int/disp32
322
323 81 0/subop/add %esp 8/imm32
324
325
326 ff 6/subop/push *(ecx+4)
327 ff 6/subop/push *(ebp+0xc)
328
329 e8/call write-int/disp32
330
331 81 0/subop/add %esp 8/imm32
332
333 e9/jump $parse-line:loop/disp32
334 $parse-line:end:
335
336 81 0/subop/add %esp 8/imm32
337
338 59/pop-to-ecx
339
340 89/<- %esp 5/r32/ebp
341 5d/pop-to-ebp
342 c3/return
343
344 emit-call:
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 55/push-ebp
372 89/<- %ebp 4/r32/esp
373
374 50/push-eax
375 51/push-ecx
376 52/push-edx
377 56/push-esi
378
379 8b/-> *(ebp+0xc) 6/r32/esi
380
381
382 8b/-> *esi 1/r32/ecx
383 81 5/subop/subtract %ecx 8/imm32
384 0f 8c/jump-if-< $emit-call:error1/disp32
385
386 8d/copy-address *(esi+ecx+0xc) 1/r32/ecx
387
388 8d/copy-address *(esi+0xc) 2/r32/edx
389
390 $emit-call:push-loop:
391
392 39/compare %ecx 2/r32/edx
393 0f 8e/jump-if-<= $emit-call:call-instruction/disp32
394
395
396 8b/-> *ecx 0/r32/eax
397
398 8b/-> *eax 0/r32/eax
399 81 4/subop/and %eax 0xff/imm32
400
401 3d/compare-eax-and 0x25/imm32/percent
402 74/jump-if-= $emit-call:push-rm32/disp8
403
404 3d/compare-eax-and 0x2a/imm32/asterisk
405 74/jump-if-= $emit-call:push-rm32/disp8
406 $emit-call:push-imm32:
407
408 68/push "68/push "/imm32
409 ff 6/subop/push *(ebp+8)
410
411 e8/call write-buffered/disp32
412
413 81 0/subop/add %esp 8/imm32
414
415
416 51/push-ecx
417 ff 6/subop/push *(ebp+8)
418
419 e8/call write-slice-buffered/disp32
420
421 81 0/subop/add %esp 8/imm32
422
423 68/push "/imm32\n"/imm32
424 ff 6/subop/push *(ebp+8)
425
426 e8/call write-buffered/disp32
427
428 81 0/subop/add %esp 8/imm32
429
430 eb/jump $emit-call:next-push/disp8
431 $emit-call:push-rm32:
432
433
434 68/push "ff 6/subop/push "/imm32
435 ff 6/subop/push *(ebp+8)
436
437 e8/call write-buffered/disp32
438
439 81 0/subop/add %esp 8/imm32
440
441
442 51/push-ecx
443 ff 6/subop/push *(ebp+8)
444
445 e8/call write-slice-buffered/disp32
446
447 81 0/subop/add %esp 8/imm32
448
449 68/push Newline/imm32
450 ff 6/subop/push *(ebp+8)
451
452 e8/call write-buffered/disp32
453
454 81 0/subop/add %esp 8/imm32
455 $emit-call:next-push:
456
457 81 5/subop/subtract %ecx 8/imm32
458
459 e9/jump $emit-call:push-loop/disp32
460 $emit-call:call-instruction:
461
462 68/push "e8/call "/imm32
463 ff 6/subop/push *(ebp+8)
464
465 e8/call write-buffered/disp32
466
467 81 0/subop/add %esp 8/imm32
468
469
470 51/push-ecx
471 ff 6/subop/push *(ebp+8)
472
473 e8/call write-slice-buffered/disp32
474
475 81 0/subop/add %esp 8/imm32
476
477 68/push "/disp32\n"/imm32
478 ff 6/subop/push *(ebp+8)
479
480 e8/call write-buffered/disp32
481
482 81 0/subop/add %esp 8/imm32
483 $emit-call:pop-instruction:
484
485 68/push "81 0/subop/add %esp "/imm32
486 ff 6/subop/push *(ebp+8)
487
488 e8/call write-buffered/disp32
489
490 81 0/subop/add %esp 8/imm32
491
492
493 8b/-> *esi 0/r32/eax
494 c1/shift 7/subop/arith-right %eax 1/imm8
495 2d/subtract-from-eax 4/imm32
496 50/push-eax
497 ff 6/subop/push *(ebp+8)
498
499 e8/call print-int32-buffered/disp32
500
501 81 0/subop/add %esp 8/imm32
502
503 68/push "/imm32\n"/imm32
504 ff 6/subop/push *(ebp+8)
505
506 e8/call write-buffered/disp32
507
508 81 0/subop/add %esp 8/imm32
509 $emit-call:end:
510
511 5e/pop-to-esi
512 5a/pop-to-edx
513 59/pop-to-ecx
514 58/pop-to-eax
515
516 89/<- %esp 5/r32/ebp
517 5d/pop-to-ebp
518 c3/return
519
520 $emit-call:error1:
521
522
523
524 68/push "error: calls.subx: '()' is not a valid call"/imm32
525 68/push Stderr/imm32
526
527 e8/call write-buffered/disp32
528
529 81 0/subop/add %esp 8/imm32
530
531
532 68/push Stderr/imm32
533
534 e8/call flush/disp32
535
536 81 0/subop/add %esp 4/imm32
537
538 bb/copy-to-ebx 1/imm32
539 b8/copy-to-eax 1/imm32/exit
540 cd/syscall 0x80/imm8
541
542
543 test-subx-calls-passes-most-lines-through:
544
545 55/push-ebp
546 89/<- %ebp 4/r32/esp
547
548
549
550 68/push _test-input-stream/imm32
551
552 e8/call clear-stream/disp32
553
554 81 0/subop/add %esp 4/imm32
555
556
557 68/push $_test-input-buffered-file->buffer/imm32
558
559 e8/call clear-stream/disp32
560
561 81 0/subop/add %esp 4/imm32
562
563
564 68/push _test-output-stream/imm32
565
566 e8/call clear-stream/disp32
567
568 81 0/subop/add %esp 4/imm32
569
570
571 68/push $_test-output-buffered-file->buffer/imm32
572
573 e8/call clear-stream/disp32
574
575 81 0/subop/add %esp 4/imm32
576
577
578 68/push "== abcd 0x1\n"/imm32
579 68/push _test-input-stream/imm32
580
581 e8/call write/disp32
582
583 81 0/subop/add %esp 8/imm32
584
585
586 68/push _test-output-buffered-file/imm32
587 68/push _test-input-buffered-file/imm32
588
589 e8/call subx-calls/disp32
590
591 81 0/subop/add %esp 8/imm32
592
593
594
595 68/push _test-output-buffered-file/imm32
596
597 e8/call flush/disp32
598
599 81 0/subop/add %esp 4/imm32
600
601
602 68/push "F - test-subx-calls-passes-most-lines-through"/imm32
603 68/push "== abcd 0x1\n"/imm32
604 68/push _test-output-stream/imm32
605
606 e8/call check-stream-equal/disp32
607
608 81 0/subop/add %esp 0xc/imm32
609
610 89/<- %esp 5/r32/ebp
611 5d/pop-to-ebp
612 c3/return
613
614 test-subx-calls-processes-calls:
615
616 55/push-ebp
617 89/<- %ebp 4/r32/esp
618
619
620
621 68/push _test-input-stream/imm32
622
623 e8/call clear-stream/disp32
624
625 81 0/subop/add %esp 4/imm32
626
627
628 68/push $_test-input-buffered-file->buffer/imm32
629
630 e8/call clear-stream/disp32
631
632 81 0/subop/add %esp 4/imm32
633
634
635 68/push _test-output-stream/imm32
636
637 e8/call clear-stream/disp32
638
639 81 0/subop/add %esp 4/imm32
640
641
642 68/push $_test-output-buffered-file->buffer/imm32
643
644 e8/call clear-stream/disp32
645
646 81 0/subop/add %esp 4/imm32
647
648
649 68/push "(foo %eax)\n"/imm32
650 68/push _test-input-stream/imm32
651
652 e8/call write/disp32
653
654 81 0/subop/add %esp 8/imm32
655
656
657 68/push _test-output-buffered-file/imm32
658 68/push _test-input-buffered-file/imm32
659
660 e8/call subx-calls/disp32
661
662 81 0/subop/add %esp 8/imm32
663
664
665
666 68/push _test-output-buffered-file/imm32
667
668 e8/call flush/disp32
669
670 81 0/subop/add %esp 4/imm32
671 +-- 33 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
704
705
706 68/push "F - test-subx-calls-processes-calls: comment"/imm32
707 68/push "# . (foo %eax)"/imm32
708 68/push _test-output-stream/imm32
709
710 e8/call check-next-stream-line-equal/disp32
711
712 81 0/subop/add %esp 0xc/imm32
713
714
715 68/push "F - test-subx-calls-processes-calls: arg 0"/imm32
716 68/push "ff 6/subop/push %eax"/imm32
717 68/push _test-output-stream/imm32
718
719 e8/call check-next-stream-line-equal/disp32
720
721 81 0/subop/add %esp 0xc/imm32
722
723
724 68/push "F - test-subx-calls-processes-calls: call"/imm32
725 68/push "e8/call foo/disp32"/imm32
726 68/push _test-output-stream/imm32
727
728 e8/call check-next-stream-line-equal/disp32
729
730 81 0/subop/add %esp 0xc/imm32
731
732
733 68/push "F - test-subx-calls-processes-calls: pops"/imm32
734 68/push "81 0/subop/add %esp 0x00000004/imm32"/imm32
735 68/push _test-output-stream/imm32
736
737 e8/call check-next-stream-line-equal/disp32
738
739 81 0/subop/add %esp 0xc/imm32
740
741 89/<- %esp 5/r32/ebp
742 5d/pop-to-ebp
743 c3/return
744
745 next-word-string-or-expression-without-metadata:
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 55/push-ebp
804 89/<- %ebp 4/r32/esp
805
806 50/push-eax
807 51/push-ecx
808 56/push-esi
809 57/push-edi
810
811 8b/-> *(ebp+8) 6/r32/esi
812
813 8b/-> *(ebp+0xc) 7/r32/edi
814
815
816 68/push 0x20/imm32/space
817 ff 6/subop/push *(ebp+8)
818
819 e8/call skip-chars-matching/disp32
820
821 81 0/subop/add %esp 8/imm32
822 $next-word-string-or-expression-without-metadata:check0:
823
824
825 8b/-> *(esi+4) 1/r32/ecx
826
827 3b/compare 1/r32/ecx *esi
828 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:error0/disp32
829 $next-word-string-or-expression-without-metadata:check-for-comment:
830
831 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
832 89/<- *edi 0/r32/eax
833
834
835 31/xor %eax 0/r32/eax
836 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
837
838 3d/compare-eax-and 0x23/imm32/pound
839 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-string-literal/disp8
840 $next-word-string-or-expression-without-metadata:comment:
841
842 8b/-> *esi 0/r32/eax
843 8d/copy-address *(esi+eax+0xc) 0/r32/eax
844 89/<- *(edi+4) 0/r32/eax
845
846 8b/-> *esi 0/r32/eax
847 89/<- *(esi+4) 0/r32/eax
848
849 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
850 $next-word-string-or-expression-without-metadata:check-for-string-literal:
851
852 3d/compare-eax-and 0x22/imm32/dquote
853 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-expression/disp8
854 $next-word-string-or-expression-without-metadata:string-literal:
855
856
857 56/push-esi
858
859 e8/call skip-string/disp32
860
861 81 0/subop/add %esp 4/imm32
862
863 8b/-> *(esi+4) 1/r32/ecx
864 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
865 89/<- *(edi+4) 0/r32/eax
866
867 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
868 $next-word-string-or-expression-without-metadata:check-for-expression:
869
870 3d/compare-eax-and 0x2a/imm32/asterisk
871 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-end-of-call/disp8
872
873 8a/copy-byte *(esi+ecx+0xd) 0/r32/AL
874 3d/compare-eax-and 0x20/imm32/space
875 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error1/disp32
876
877 3d/compare-eax-and 0x28/imm32/open-paren
878 0f 85/jump-if-!= $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp32
879 $next-word-string-or-expression-without-metadata:paren:
880
881
882 56/push-esi
883
884 e8/call skip-until-close-paren/disp32
885
886 81 0/subop/add %esp 4/imm32
887
888
889 8b/-> *(esi+4) 1/r32/ecx
890 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
891
892 3d/compare-eax-and 0x29/imm32/close-paren
893 0f 85/jump-if-!= $next-word-string-or-expression-without-metadata:error2/disp32
894
895 ff 0/subop/increment *(esi+4)
896
897 8b/-> *(esi+4) 1/r32/ecx
898 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
899 89/<- *(edi+4) 0/r32/eax
900
901 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
902 $next-word-string-or-expression-without-metadata:check-for-end-of-call:
903
904 3d/compare-eax-and 0x29/imm32/close-paren
905 75/jump-if-!= $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp8
906
907 ff 0/subop/increment *(esi+4)
908
909
910
911 8b/-> *(esi+4) 1/r32/ecx
912
913 3b/compare 1/r32/ecx *esi
914 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:return-eol/disp32
915
916
917 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
918
919 3d/compare-eax-and 0x2f/imm32/slash
920 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error3/disp32
921
922
923 56/push-esi
924
925 e8/call skip-chars-matching-whitespace/disp32
926
927 81 0/subop/add %esp 4/imm32
928
929
930 8b/-> *(esi+4) 1/r32/ecx
931
932 3b/compare 1/r32/ecx *esi
933 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:return-eol/disp32
934
935
936 8b/-> *(esi+4) 1/r32/ecx
937 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
938
939 3d/compare-eax-and 0x23/imm32/pound
940 74/jump-if-= $next-word-string-or-expression-without-metadata:return-eol/disp8
941
942 e9/jump $next-word-string-or-expression-without-metadata:error4/disp32
943 $next-word-string-or-expression-without-metadata:regular-word-without-metadata:
944
945
946 8b/-> *(esi+4) 1/r32/ecx
947
948 3b/compare *esi 1/r32/ecx
949 7d/jump-if->= $next-word-string-or-expression-without-metadata:regular-word-break/disp8
950
951
952 8b/-> *(esi+4) 1/r32/ecx
953 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
954
955 3d/compare-eax-and 0x20/imm32/space
956 74/jump-if-= $next-word-string-or-expression-without-metadata:regular-word-break/disp8
957
958 3d/compare-eax-and 0x29/imm32/close-paren
959 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:regular-word-break/disp32
960
961 3d/compare-eax-and 0x2f/imm32/slash
962 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error5/disp32
963
964 ff 0/subop/increment *(esi+4)
965
966 e9/jump $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp32
967 $next-word-string-or-expression-without-metadata:regular-word-break:
968
969 8b/-> *(esi+4) 1/r32/ecx
970 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
971 89/<- *(edi+4) 0/r32/eax
972 eb/jump $next-word-string-or-expression-without-metadata:end/disp8
973 $next-word-string-or-expression-without-metadata:return-eol:
974
975 c7 0/subop/copy *edi 0/imm32
976 c7 0/subop/copy *(edi+4) 0/imm32
977 $next-word-string-or-expression-without-metadata:end:
978
979 5f/pop-to-edi
980 5e/pop-to-esi
981 59/pop-to-ecx
982 58/pop-to-eax
983
984 89/<- %esp 5/r32/ebp
985 5d/pop-to-ebp
986 c3/return
987
988 $next-word-string-or-expression-without-metadata:error0:
989
990
991
992 68/push "error: missing final ')' in '"/imm32
993 68/push Stderr/imm32
994
995 e8/call write-buffered/disp32
996
997 81 0/subop/add %esp 8/imm32
998
999
1000 56/push-esi
1001 68/push Stderr/imm32
1002
1003 e8/call write-stream-data/disp32
1004
1005 81 0/subop/add %esp 8/imm32
1006
1007
1008 68/push "'"/imm32
1009 68/push Stderr/imm32
1010
1011 e8/call write-buffered/disp32
1012
1013 81 0/subop/add %esp 8/imm32
1014
1015
1016 68/push Stderr/imm32
1017
1018 e8/call flush/disp32
1019
1020 81 0/subop/add %esp 4/imm32
1021
1022 bb/copy-to-ebx 1/imm32
1023 b8/copy-to-eax 1/imm32/exit
1024 cd/syscall 0x80/imm8
1025
1026
1027 $next-word-string-or-expression-without-metadata:error1:
1028
1029
1030
1031 68/push "error: no space allowed after '*' in '"/imm32
1032 68/push Stderr/imm32
1033
1034 e8/call write-buffered/disp32
1035
1036 81 0/subop/add %esp 8/imm32
1037
1038
1039 56/push-esi
1040 68/push Stderr/imm32
1041
1042 e8/call write-stream-data/disp32
1043
1044 81 0/subop/add %esp 8/imm32
1045
1046
1047 68/push "'"/imm32
1048 68/push Stderr/imm32
1049
1050 e8/call write-buffered/disp32
1051
1052 81 0/subop/add %esp 8/imm32
1053
1054
1055 68/push Stderr/imm32
1056
1057 e8/call flush/disp32
1058
1059 81 0/subop/add %esp 4/imm32
1060
1061 bb/copy-to-ebx 1/imm32
1062 b8/copy-to-eax 1/imm32/exit
1063 cd/syscall 0x80/imm8
1064
1065
1066 $next-word-string-or-expression-without-metadata:error2:
1067
1068
1069
1070 68/push "error: *(...) expression must be all on a single line in '"/imm32
1071 68/push Stderr/imm32
1072
1073 e8/call write-buffered/disp32
1074
1075 81 0/subop/add %esp 8/imm32
1076
1077
1078 56/push-esi
1079 68/push Stderr/imm32
1080
1081 e8/call write-stream-data/disp32
1082
1083 81 0/subop/add %esp 8/imm32
1084
1085
1086 68/push "'"/imm32
1087 68/push Stderr/imm32
1088
1089 e8/call write-buffered/disp32
1090
1091 81 0/subop/add %esp 8/imm32
1092
1093
1094 68/push Stderr/imm32
1095
1096 e8/call flush/disp32
1097
1098 81 0/subop/add %esp 4/imm32
1099
1100 bb/copy-to-ebx 1/imm32
1101 b8/copy-to-eax 1/imm32/exit
1102 cd/syscall 0x80/imm8
1103
1104
1105 $next-word-string-or-expression-without-metadata:error3:
1106
1107
1108
1109 68/push "error: no metadata after calls; just use a comment (in '"/imm32
1110 68/push Stderr/imm32
1111
1112 e8/call write-buffered/disp32
1113
1114 81 0/subop/add %esp 8/imm32
1115
1116
1117 56/push-esi
1118 68/push Stderr/imm32
1119
1120 e8/call write-stream-data/disp32
1121
1122 81 0/subop/add %esp 8/imm32
1123
1124
1125 68/push "')"/imm32
1126 68/push Stderr/imm32
1127
1128 e8/call write-buffered/disp32
1129
1130 81 0/subop/add %esp 8/imm32
1131
1132
1133 68/push Stderr/imm32
1134
1135 e8/call flush/disp32
1136
1137 81 0/subop/add %esp 4/imm32
1138
1139 bb/copy-to-ebx 1/imm32
1140 b8/copy-to-eax 1/imm32/exit
1141 cd/syscall 0x80/imm8
1142
1143
1144 $next-word-string-or-expression-without-metadata:error4:
1145
1146
1147
1148 68/push "error: unexpected text after end of call in '"/imm32
1149 68/push Stderr/imm32
1150
1151 e8/call write-buffered/disp32
1152
1153 81 0/subop/add %esp 8/imm32
1154
1155
1156 56/push-esi
1157 68/push Stderr/imm32
1158
1159 e8/call write-stream-data/disp32
1160
1161 81 0/subop/add %esp 8/imm32
1162
1163
1164 68/push "'"/imm32
1165 68/push Stderr/imm32
1166
1167 e8/call write-buffered/disp32
1168
1169 81 0/subop/add %esp 8/imm32
1170
1171
1172 68/push Stderr/imm32
1173
1174 e8/call flush/disp32
1175
1176 81 0/subop/add %esp 4/imm32
1177
1178 bb/copy-to-ebx 1/imm32
1179 b8/copy-to-eax 1/imm32/exit
1180 cd/syscall 0x80/imm8
1181
1182
1183 $next-word-string-or-expression-without-metadata:error5:
1184
1185
1186
1187 68/push "error: no metadata anywhere in calls (in '"/imm32
1188 68/push Stderr/imm32
1189
1190 e8/call write-buffered/disp32
1191
1192 81 0/subop/add %esp 8/imm32
1193
1194
1195 56/push-esi
1196 68/push Stderr/imm32
1197
1198 e8/call write-stream-data/disp32
1199
1200 81 0/subop/add %esp 8/imm32
1201
1202
1203 68/push "')"/imm32
1204 68/push Stderr/imm32
1205
1206 e8/call write-buffered/disp32
1207
1208 81 0/subop/add %esp 8/imm32
1209
1210
1211 68/push Stderr/imm32
1212
1213 e8/call flush/disp32
1214
1215 81 0/subop/add %esp 4/imm32
1216
1217 bb/copy-to-ebx 1/imm32
1218 b8/copy-to-eax 1/imm32/exit
1219 cd/syscall 0x80/imm8
1220
1221
1222 test-next-word-string-or-expression-without-metadata:
1223
1224 55/push-ebp
1225 89/<- %ebp 4/r32/esp
1226
1227
1228
1229 68/push _test-input-stream/imm32
1230
1231 e8/call clear-stream/disp32
1232
1233 81 0/subop/add %esp 4/imm32
1234
1235 68/push 0/imm32/end
1236 68/push 0/imm32/start
1237 89/<- %ecx 4/r32/esp
1238
1239
1240 68/push " ab"/imm32
1241 68/push _test-input-stream/imm32
1242
1243 e8/call write/disp32
1244
1245 81 0/subop/add %esp 8/imm32
1246
1247
1248 51/push-ecx
1249 68/push _test-input-stream/imm32
1250
1251 e8/call next-word-string-or-expression-without-metadata/disp32
1252
1253 81 0/subop/add %esp 8/imm32
1254
1255
1256 68/push "F - test-next-word-string-or-expression-without-metadata/updates-stream-read-correctly"/imm32
1257 68/push 4/imm32
1258 b8/copy-to-eax _test-input-stream/imm32
1259 ff 6/subop/push *(eax+4)
1260
1261 e8/call check-ints-equal/disp32
1262
1263 81 0/subop/add %esp 0xc/imm32
1264
1265
1266
1267 68/push "F - test-next-word-string-or-expression-without-metadata: start"/imm32
1268 68/push 0xe/imm32
1269
1270 8b/-> *ecx 0/r32/eax
1271 81 5/subop/subtract %eax _test-input-stream/imm32
1272 50/push-eax
1273
1274 e8/call check-ints-equal/disp32
1275
1276 81 0/subop/add %esp 0xc/imm32
1277
1278
1279
1280 68/push "F - test-next-word-string-or-expression-without-metadata: end"/imm32
1281 68/push 0x10/imm32
1282
1283 8b/-> *(ecx+4) 0/r32/eax
1284 81 5/subop/subtract %eax _test-input-stream/imm32
1285 50/push-eax
1286
1287 e8/call check-ints-equal/disp32
1288
1289 81 0/subop/add %esp 0xc/imm32
1290
1291 89/<- %esp 5/r32/ebp
1292 5d/pop-to-ebp
1293 c3/return
1294
1295 test-next-word-string-or-expression-without-metadata-returns-whole-comment:
1296
1297 55/push-ebp
1298 89/<- %ebp 4/r32/esp
1299
1300
1301
1302 68/push _test-input-stream/imm32
1303
1304 e8/call clear-stream/disp32
1305
1306 81 0/subop/add %esp 4/imm32
1307
1308 68/push 0/imm32/end
1309 68/push 0/imm32/start
1310 89/<- %ecx 4/r32/esp
1311
1312
1313 68/push " # a"/imm32
1314 68/push _test-input-stream/imm32
1315
1316 e8/call write/disp32
1317
1318 81 0/subop/add %esp 8/imm32
1319
1320
1321 51/push-ecx
1322 68/push _test-input-stream/imm32
1323
1324 e8/call next-word-string-or-expression-without-metadata/disp32
1325
1326 81 0/subop/add %esp 8/imm32
1327
1328
1329 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment/updates-stream-read-correctly"/imm32
1330 68/push 5/imm32
1331 b8/copy-to-eax _test-input-stream/imm32
1332 ff 6/subop/push *(eax+4)
1333
1334 e8/call check-ints-equal/disp32
1335
1336 81 0/subop/add %esp 0xc/imm32
1337
1338
1339
1340 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment: start"/imm32
1341 68/push 0xe/imm32
1342
1343 8b/-> *ecx 0/r32/eax
1344 81 5/subop/subtract %eax _test-input-stream/imm32
1345 50/push-eax
1346
1347 e8/call check-ints-equal/disp32
1348
1349 81 0/subop/add %esp 0xc/imm32
1350
1351
1352
1353 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment: end"/imm32
1354 68/push 0x11/imm32
1355
1356 8b/-> *(ecx+4) 0/r32/eax
1357 81 5/subop/subtract %eax _test-input-stream/imm32
1358 50/push-eax
1359
1360 e8/call check-ints-equal/disp32
1361
1362 81 0/subop/add %esp 0xc/imm32
1363
1364 89/<- %esp 5/r32/ebp
1365 5d/pop-to-ebp
1366 c3/return
1367
1368 test-next-word-string-or-expression-without-metadata-returns-string-literal:
1369
1370 55/push-ebp
1371 89/<- %ebp 4/r32/esp
1372
1373
1374
1375 68/push _test-input-stream/imm32
1376
1377 e8/call clear-stream/disp32
1378
1379 81 0/subop/add %esp 4/imm32
1380
1381 68/push 0/imm32/end
1382 68/push 0/imm32/start
1383 89/<- %ecx 4/r32/esp
1384
1385
1386 68/push " \"a b\" "/imm32
1387 68/push _test-input-stream/imm32
1388
1389 e8/call write/disp32
1390
1391 81 0/subop/add %esp 8/imm32
1392
1393
1394 51/push-ecx
1395 68/push _test-input-stream/imm32
1396
1397 e8/call next-word-string-or-expression-without-metadata/disp32
1398
1399 81 0/subop/add %esp 8/imm32
1400
1401
1402
1403 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-literal: start"/imm32
1404 68/push 0xd/imm32
1405
1406 8b/-> *ecx 0/r32/eax
1407 81 5/subop/subtract %eax _test-input-stream/imm32
1408 50/push-eax
1409
1410 e8/call check-ints-equal/disp32
1411
1412 81 0/subop/add %esp 0xc/imm32
1413
1414
1415
1416 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-literal: end"/imm32
1417 68/push 0x12/imm32
1418
1419 8b/-> *(ecx+4) 0/r32/eax
1420 81 5/subop/subtract %eax _test-input-stream/imm32
1421 50/push-eax
1422
1423 e8/call check-ints-equal/disp32
1424
1425 81 0/subop/add %esp 0xc/imm32
1426
1427 89/<- %esp 5/r32/ebp
1428 5d/pop-to-ebp
1429 c3/return
1430
1431 test-next-word-string-or-expression-without-metadata-returns-string-with-escapes:
1432
1433 55/push-ebp
1434 89/<- %ebp 4/r32/esp
1435
1436
1437
1438 68/push _test-input-stream/imm32
1439
1440 e8/call clear-stream/disp32
1441
1442 81 0/subop/add %esp 4/imm32
1443
1444 68/push 0/imm32/end
1445 68/push 0/imm32/start
1446 89/<- %ecx 4/r32/esp
1447
1448
1449 68/push " \"a\\\"b\""/imm32
1450 68/push _test-input-stream/imm32
1451
1452 e8/call write/disp32
1453
1454 81 0/subop/add %esp 8/imm32
1455
1456
1457 51/push-ecx
1458 68/push _test-input-stream/imm32
1459
1460 e8/call next-word-string-or-expression-without-metadata/disp32
1461
1462 81 0/subop/add %esp 8/imm32
1463
1464
1465
1466 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-with-escapes: start"/imm32
1467 68/push 0xd/imm32
1468
1469 8b/-> *ecx 0/r32/eax
1470 81 5/subop/subtract %eax _test-input-stream/imm32
1471 50/push-eax
1472
1473 e8/call check-ints-equal/disp32
1474
1475 81 0/subop/add %esp 0xc/imm32
1476
1477
1478
1479 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-with-escapes: end"/imm32
1480 68/push 0x13/imm32
1481
1482 8b/-> *(ecx+4) 0/r32/eax
1483 81 5/subop/subtract %eax _test-input-stream/imm32
1484 50/push-eax
1485
1486 e8/call check-ints-equal/disp32
1487
1488 81 0/subop/add %esp 0xc/imm32
1489
1490 89/<- %esp 5/r32/ebp
1491 5d/pop-to-ebp
1492 c3/return
1493
1494 test-next-word-string-or-expression-without-metadata-returns-whole-expression:
1495
1496 55/push-ebp
1497 89/<- %ebp 4/r32/esp
1498
1499
1500
1501 68/push _test-input-stream/imm32
1502
1503 e8/call clear-stream/disp32
1504
1505 81 0/subop/add %esp 4/imm32
1506
1507 68/push 0/imm32/end
1508 68/push 0/imm32/start
1509 89/<- %ecx 4/r32/esp
1510
1511
1512 68/push " *(a b) "/imm32
1513 68/push _test-input-stream/imm32
1514
1515 e8/call write/disp32
1516
1517 81 0/subop/add %esp 8/imm32
1518
1519
1520 51/push-ecx
1521 68/push _test-input-stream/imm32
1522
1523 e8/call next-word-string-or-expression-without-metadata/disp32
1524
1525 81 0/subop/add %esp 8/imm32
1526
1527
1528
1529 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-expression: start"/imm32
1530 68/push 0xd/imm32
1531
1532 8b/-> *ecx 0/r32/eax
1533 81 5/subop/subtract %eax _test-input-stream/imm32
1534 50/push-eax
1535
1536 e8/call check-ints-equal/disp32
1537
1538 81 0/subop/add %esp 0xc/imm32
1539
1540
1541
1542 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-expression: end"/imm32
1543 68/push 0x13/imm32
1544
1545 8b/-> *(ecx+4) 0/r32/eax
1546 81 5/subop/subtract %eax _test-input-stream/imm32
1547 50/push-eax
1548
1549 e8/call check-ints-equal/disp32
1550
1551 81 0/subop/add %esp 0xc/imm32
1552
1553 89/<- %esp 5/r32/ebp
1554 5d/pop-to-ebp
1555 c3/return
1556
1557 test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren:
1558
1559 55/push-ebp
1560 89/<- %ebp 4/r32/esp
1561
1562
1563
1564 68/push _test-input-stream/imm32
1565
1566 e8/call clear-stream/disp32
1567
1568 81 0/subop/add %esp 4/imm32
1569
1570 68/push 0/imm32/end
1571 68/push 0/imm32/start
1572 89/<- %ecx 4/r32/esp
1573
1574
1575 68/push " ) "/imm32
1576 68/push _test-input-stream/imm32
1577
1578 e8/call write/disp32
1579
1580 81 0/subop/add %esp 8/imm32
1581
1582
1583 51/push-ecx
1584 68/push _test-input-stream/imm32
1585
1586 e8/call next-word-string-or-expression-without-metadata/disp32
1587
1588 81 0/subop/add %esp 8/imm32
1589
1590
1591 68/push "F - test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren: start"/imm32
1592 68/push 0/imm32
1593 ff 6/subop/push *ecx
1594
1595 e8/call check-ints-equal/disp32
1596
1597 81 0/subop/add %esp 0xc/imm32
1598
1599
1600 68/push "F - test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren: end"/imm32
1601 68/push 0/imm32
1602 ff 6/subop/push *(ecx+4)
1603
1604 e8/call check-ints-equal/disp32
1605
1606 81 0/subop/add %esp 0xc/imm32
1607
1608 89/<- %esp 5/r32/ebp
1609 5d/pop-to-ebp
1610 c3/return
1611
1612 test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren:
1613
1614 55/push-ebp
1615 89/<- %ebp 4/r32/esp
1616
1617
1618
1619 68/push _test-input-stream/imm32
1620
1621 e8/call clear-stream/disp32
1622
1623 81 0/subop/add %esp 4/imm32
1624
1625 68/push 0/imm32/end
1626 68/push 0/imm32/start
1627 89/<- %ecx 4/r32/esp
1628
1629
1630 68/push " ) # abc "/imm32
1631 68/push _test-input-stream/imm32
1632
1633 e8/call write/disp32
1634
1635 81 0/subop/add %esp 8/imm32
1636
1637
1638 51/push-ecx
1639 68/push _test-input-stream/imm32
1640
1641 e8/call next-word-string-or-expression-without-metadata/disp32
1642
1643 81 0/subop/add %esp 8/imm32
1644
1645
1646 68/push "F - test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren: start"/imm32
1647 68/push 0/imm32
1648 ff 6/subop/push *ecx
1649
1650 e8/call check-ints-equal/disp32
1651
1652 81 0/subop/add %esp 0xc/imm32
1653
1654
1655 68/push "F - test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren: end"/imm32
1656 68/push 0/imm32
1657 ff 6/subop/push *(ecx+4)
1658
1659 e8/call check-ints-equal/disp32
1660
1661 81 0/subop/add %esp 0xc/imm32
1662
1663 89/<- %esp 5/r32/ebp
1664 5d/pop-to-ebp
1665 c3/return
1666
1667 test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren:
1668
1669 55/push-ebp
1670 89/<- %ebp 4/r32/esp
1671
1672
1673
1674 68/push _test-input-stream/imm32
1675
1676 e8/call clear-stream/disp32
1677
1678 81 0/subop/add %esp 4/imm32
1679
1680 68/push 0/imm32/end
1681 68/push 0/imm32/start
1682 89/<- %ecx 4/r32/esp
1683
1684
1685 68/push " )\n"/imm32
1686 68/push _test-input-stream/imm32
1687
1688 e8/call write/disp32
1689
1690 81 0/subop/add %esp 8/imm32
1691
1692
1693 51/push-ecx
1694 68/push _test-input-stream/imm32
1695
1696 e8/call next-word-string-or-expression-without-metadata/disp32
1697
1698 81 0/subop/add %esp 8/imm32
1699
1700
1701 68/push "F - test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren: start"/imm32
1702 68/push 0/imm32
1703 ff 6/subop/push *ecx
1704
1705 e8/call check-ints-equal/disp32
1706
1707 81 0/subop/add %esp 0xc/imm32
1708
1709
1710 68/push "F - test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren: end"/imm32
1711 68/push 0/imm32
1712 ff 6/subop/push *(ecx+4)
1713
1714 e8/call check-ints-equal/disp32
1715
1716 81 0/subop/add %esp 0xc/imm32
1717
1718 89/<- %esp 5/r32/ebp
1719 5d/pop-to-ebp
1720 c3/return
1721
1722 test-next-word-string-or-expression-without-metadata-stops-at-close-paren:
1723
1724 55/push-ebp
1725 89/<- %ebp 4/r32/esp
1726
1727
1728
1729 68/push _test-input-stream/imm32
1730
1731 e8/call clear-stream/disp32
1732
1733 81 0/subop/add %esp 4/imm32
1734
1735 68/push 0/imm32/end
1736 68/push 0/imm32/start
1737 89/<- %ecx 4/r32/esp
1738
1739
1740 68/push " abc) # def"/imm32
1741 68/push _test-input-stream/imm32
1742
1743 e8/call write/disp32
1744
1745 81 0/subop/add %esp 8/imm32
1746
1747
1748 51/push-ecx
1749 68/push _test-input-stream/imm32
1750
1751 e8/call next-word-string-or-expression-without-metadata/disp32
1752
1753 81 0/subop/add %esp 8/imm32
1754
1755
1756
1757 68/push "F - test-next-word-string-or-expression-without-metadata-stops-at-close-paren: start"/imm32
1758 68/push 0xd/imm32
1759
1760 8b/-> *ecx 0/r32/eax
1761 81 5/subop/subtract %eax _test-input-stream/imm32
1762 50/push-eax
1763
1764 e8/call check-ints-equal/disp32
1765
1766 81 0/subop/add %esp 0xc/imm32
1767
1768
1769
1770 68/push "F - test-next-word-string-or-expression-without-metadata-stops-at-close-paren: end"/imm32
1771 68/push 0x10/imm32
1772
1773 8b/-> *(ecx+4) 0/r32/eax
1774 81 5/subop/subtract %eax _test-input-stream/imm32
1775 50/push-eax
1776
1777 e8/call check-ints-equal/disp32
1778
1779 81 0/subop/add %esp 0xc/imm32
1780
1781 89/<- %esp 5/r32/ebp
1782 5d/pop-to-ebp
1783 c3/return