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