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
371
372
373
374
375 55/push-ebp
376 89/<- %ebp 4/r32/esp
377
378 50/push-eax
379 51/push-ecx
380 52/push-edx
381 56/push-esi
382
383 8b/-> *(ebp+0xc) 6/r32/esi
384
385
386 8b/-> *esi 1/r32/ecx
387 81 5/subop/subtract %ecx 8/imm32
388 0f 8c/jump-if-< $emit-call:error1/disp32
389
390 8d/copy-address *(esi+ecx+0xc) 1/r32/ecx
391
392 8d/copy-address *(esi+0xc) 2/r32/edx
393
394 $emit-call:push-loop:
395
396 39/compare %ecx 2/r32/edx
397 0f 8e/jump-if-<= $emit-call:call-instruction/disp32
398
399
400
401 68/push "%x"/imm32
402 51/push-ecx
403
404 e8/call slice-starts-with?/disp32
405
406 81 0/subop/add %esp 8/imm32
407
408 3d/compare-eax-and 0/imm32/false
409 74/jump-if-= $emit-call:push-int/disp8
410
411
412
413 68/push "81 5/subop/subtract %esp 4/imm32\n"/imm32
414 ff 6/subop/push *(ebp+8)
415
416 e8/call write-buffered/disp32
417
418 81 0/subop/add %esp 8/imm32
419
420
421 68/push "f3 0f 11/<- *esp "/imm32
422 ff 6/subop/push *(ebp+8)
423
424 e8/call write-buffered/disp32
425
426 81 0/subop/add %esp 8/imm32
427
428
429 8b/-> *ecx 0/r32/eax
430 8a/copy-byte *(eax+4) 0/r32/eax
431 81 4/subop/and %eax 0xff/imm32
432
433 50/push-eax
434 ff 6/subop/push *(ebp+8)
435
436 e8/call write-byte-buffered/disp32
437
438 81 0/subop/add %esp 8/imm32
439
440 68/push "/x32\n"/imm32
441 ff 6/subop/push *(ebp+8)
442
443 e8/call write-buffered/disp32
444
445 81 0/subop/add %esp 8/imm32
446
447 e9/jump $emit-call:next-push/disp32
448 $emit-call:push-int:
449
450
451 8b/-> *ecx 0/r32/eax
452
453 8b/-> *eax 0/r32/eax
454 81 4/subop/and %eax 0xff/imm32
455
456 3d/compare-eax-and 0x25/imm32/percent
457 74/jump-if-= $emit-call:push-rm32/disp8
458
459 3d/compare-eax-and 0x2a/imm32/asterisk
460 74/jump-if-= $emit-call:push-rm32/disp8
461 $emit-call:push-imm32:
462
463
464 68/push "68/push "/imm32
465 ff 6/subop/push *(ebp+8)
466
467 e8/call write-buffered/disp32
468
469 81 0/subop/add %esp 8/imm32
470
471
472 51/push-ecx
473 ff 6/subop/push *(ebp+8)
474
475 e8/call write-slice-buffered/disp32
476
477 81 0/subop/add %esp 8/imm32
478
479 68/push "/imm32\n"/imm32
480 ff 6/subop/push *(ebp+8)
481
482 e8/call write-buffered/disp32
483
484 81 0/subop/add %esp 8/imm32
485
486 eb/jump $emit-call:next-push/disp8
487 $emit-call:push-rm32:
488
489
490 68/push "ff 6/subop/push "/imm32
491 ff 6/subop/push *(ebp+8)
492
493 e8/call write-buffered/disp32
494
495 81 0/subop/add %esp 8/imm32
496
497
498 51/push-ecx
499 ff 6/subop/push *(ebp+8)
500
501 e8/call write-slice-buffered/disp32
502
503 81 0/subop/add %esp 8/imm32
504
505 68/push Newline/imm32
506 ff 6/subop/push *(ebp+8)
507
508 e8/call write-buffered/disp32
509
510 81 0/subop/add %esp 8/imm32
511 $emit-call:next-push:
512
513 81 5/subop/subtract %ecx 8/imm32
514
515 e9/jump $emit-call:push-loop/disp32
516 $emit-call:call-instruction:
517
518 68/push "e8/call "/imm32
519 ff 6/subop/push *(ebp+8)
520
521 e8/call write-buffered/disp32
522
523 81 0/subop/add %esp 8/imm32
524
525
526 51/push-ecx
527 ff 6/subop/push *(ebp+8)
528
529 e8/call write-slice-buffered/disp32
530
531 81 0/subop/add %esp 8/imm32
532
533 68/push "/disp32\n"/imm32
534 ff 6/subop/push *(ebp+8)
535
536 e8/call write-buffered/disp32
537
538 81 0/subop/add %esp 8/imm32
539 $emit-call:pop-instruction:
540
541 68/push "81 0/subop/add %esp "/imm32
542 ff 6/subop/push *(ebp+8)
543
544 e8/call write-buffered/disp32
545
546 81 0/subop/add %esp 8/imm32
547
548
549 8b/-> *esi 0/r32/eax
550 c1/shift 7/subop/arith-right %eax 1/imm8
551 2d/subtract-from-eax 4/imm32
552 50/push-eax
553 ff 6/subop/push *(ebp+8)
554
555 e8/call write-int32-hex-buffered/disp32
556
557 81 0/subop/add %esp 8/imm32
558
559 68/push "/imm32\n"/imm32
560 ff 6/subop/push *(ebp+8)
561
562 e8/call write-buffered/disp32
563
564 81 0/subop/add %esp 8/imm32
565 $emit-call:end:
566
567 5e/pop-to-esi
568 5a/pop-to-edx
569 59/pop-to-ecx
570 58/pop-to-eax
571
572 89/<- %esp 5/r32/ebp
573 5d/pop-to-ebp
574 c3/return
575
576 $emit-call:error1:
577
578
579
580 68/push "error: calls.subx: '()' is not a valid call"/imm32
581 68/push Stderr/imm32
582
583 e8/call write-buffered/disp32
584
585 81 0/subop/add %esp 8/imm32
586
587
588 68/push Stderr/imm32
589
590 e8/call flush/disp32
591
592 81 0/subop/add %esp 4/imm32
593
594 bb/copy-to-ebx 1/imm32
595 e8/call syscall_exit/disp32
596
597
598 test-subx-calls-passes-most-lines-through:
599
600 55/push-ebp
601 89/<- %ebp 4/r32/esp
602
603
604
605 68/push _test-input-stream/imm32
606
607 e8/call clear-stream/disp32
608
609 81 0/subop/add %esp 4/imm32
610
611
612 68/push $_test-input-buffered-file->buffer/imm32
613
614 e8/call clear-stream/disp32
615
616 81 0/subop/add %esp 4/imm32
617
618
619 68/push _test-output-stream/imm32
620
621 e8/call clear-stream/disp32
622
623 81 0/subop/add %esp 4/imm32
624
625
626 68/push $_test-output-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 "== abcd 0x1\n"/imm32
634 68/push _test-input-stream/imm32
635
636 e8/call write/disp32
637
638 81 0/subop/add %esp 8/imm32
639
640
641 68/push _test-output-buffered-file/imm32
642 68/push _test-input-buffered-file/imm32
643
644 e8/call subx-calls/disp32
645
646 81 0/subop/add %esp 8/imm32
647
648
649
650 68/push _test-output-buffered-file/imm32
651
652 e8/call flush/disp32
653
654 81 0/subop/add %esp 4/imm32
655
656
657 68/push "F - test-subx-calls-passes-most-lines-through"/imm32
658 68/push "== abcd 0x1\n"/imm32
659 68/push _test-output-stream/imm32
660
661 e8/call check-stream-equal/disp32
662
663 81 0/subop/add %esp 0xc/imm32
664
665 89/<- %esp 5/r32/ebp
666 5d/pop-to-ebp
667 c3/return
668
669 test-subx-calls-processes-calls:
670
671 55/push-ebp
672 89/<- %ebp 4/r32/esp
673
674
675
676 68/push _test-input-stream/imm32
677
678 e8/call clear-stream/disp32
679
680 81 0/subop/add %esp 4/imm32
681
682
683 68/push $_test-input-buffered-file->buffer/imm32
684
685 e8/call clear-stream/disp32
686
687 81 0/subop/add %esp 4/imm32
688
689
690 68/push _test-output-stream/imm32
691
692 e8/call clear-stream/disp32
693
694 81 0/subop/add %esp 4/imm32
695
696
697 68/push $_test-output-buffered-file->buffer/imm32
698
699 e8/call clear-stream/disp32
700
701 81 0/subop/add %esp 4/imm32
702
703
704 68/push "(foo %eax)\n"/imm32
705 68/push _test-input-stream/imm32
706
707 e8/call write/disp32
708
709 81 0/subop/add %esp 8/imm32
710
711
712 68/push _test-output-buffered-file/imm32
713 68/push _test-input-buffered-file/imm32
714
715 e8/call subx-calls/disp32
716
717 81 0/subop/add %esp 8/imm32
718
719
720
721 68/push _test-output-buffered-file/imm32
722
723 e8/call flush/disp32
724
725 81 0/subop/add %esp 4/imm32
726 +-- 33 lines: #? # dump _test-output-stream -----------------------------------------------------------------------------------------------------------------------------------------
759
760
761 68/push "F - test-subx-calls-processes-calls: comment"/imm32
762 68/push "# . (foo %eax)"/imm32
763 68/push _test-output-stream/imm32
764
765 e8/call check-next-stream-line-equal/disp32
766
767 81 0/subop/add %esp 0xc/imm32
768
769
770 68/push "F - test-subx-calls-processes-calls: arg 0"/imm32
771 68/push "ff 6/subop/push %eax"/imm32
772 68/push _test-output-stream/imm32
773
774 e8/call check-next-stream-line-equal/disp32
775
776 81 0/subop/add %esp 0xc/imm32
777
778
779 68/push "F - test-subx-calls-processes-calls: call"/imm32
780 68/push "e8/call foo/disp32"/imm32
781 68/push _test-output-stream/imm32
782
783 e8/call check-next-stream-line-equal/disp32
784
785 81 0/subop/add %esp 0xc/imm32
786
787
788 68/push "F - test-subx-calls-processes-calls: pops"/imm32
789 68/push "81 0/subop/add %esp 0x00000004/imm32"/imm32
790 68/push _test-output-stream/imm32
791
792 e8/call check-next-stream-line-equal/disp32
793
794 81 0/subop/add %esp 0xc/imm32
795
796 89/<- %esp 5/r32/ebp
797 5d/pop-to-ebp
798 c3/return
799
800 next-word-string-or-expression-without-metadata:
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860 55/push-ebp
861 89/<- %ebp 4/r32/esp
862
863 50/push-eax
864 51/push-ecx
865 56/push-esi
866 57/push-edi
867
868 8b/-> *(ebp+8) 6/r32/esi
869
870 8b/-> *(ebp+0xc) 7/r32/edi
871
872
873 68/push 0x20/imm32/space
874 ff 6/subop/push *(ebp+8)
875
876 e8/call skip-chars-matching/disp32
877
878 81 0/subop/add %esp 8/imm32
879 $next-word-string-or-expression-without-metadata:check0:
880
881
882 8b/-> *(esi+4) 1/r32/ecx
883
884 3b/compare<- *esi 1/r32/ecx
885 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:error0/disp32
886 $next-word-string-or-expression-without-metadata:check-for-comment:
887
888 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
889 89/<- *edi 0/r32/eax
890
891
892 31/xor-with %eax 0/r32/eax
893 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
894
895 3d/compare-eax-and 0x23/imm32/pound
896 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-string-literal/disp8
897 $next-word-string-or-expression-without-metadata:comment:
898
899 8b/-> *esi 0/r32/eax
900 8d/copy-address *(esi+eax+0xc) 0/r32/eax
901 89/<- *(edi+4) 0/r32/eax
902
903 8b/-> *esi 0/r32/eax
904 89/<- *(esi+4) 0/r32/eax
905
906 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
907 $next-word-string-or-expression-without-metadata:check-for-string-literal:
908
909 3d/compare-eax-and 0x22/imm32/dquote
910 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-expression/disp8
911 $next-word-string-or-expression-without-metadata:string-literal:
912
913
914 56/push-esi
915
916 e8/call skip-string/disp32
917
918 81 0/subop/add %esp 4/imm32
919
920 8b/-> *(esi+4) 1/r32/ecx
921 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
922 89/<- *(edi+4) 0/r32/eax
923
924 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
925 $next-word-string-or-expression-without-metadata:check-for-expression:
926
927 3d/compare-eax-and 0x2a/imm32/asterisk
928 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-open-paren/disp8
929
930 8a/copy-byte *(esi+ecx+0xd) 0/r32/AL
931 3d/compare-eax-and 0x20/imm32/space
932 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error1/disp32
933
934 3d/compare-eax-and 0x28/imm32/open-paren
935 0f 85/jump-if-!= $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp32
936 $next-word-string-or-expression-without-metadata:paren:
937
938
939 56/push-esi
940
941 e8/call skip-until-close-paren/disp32
942
943 81 0/subop/add %esp 4/imm32
944
945
946 8b/-> *(esi+4) 1/r32/ecx
947 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
948
949 3d/compare-eax-and 0x29/imm32/close-paren
950 0f 85/jump-if-!= $next-word-string-or-expression-without-metadata:error2/disp32
951
952 ff 0/subop/increment *(esi+4)
953
954 8b/-> *(esi+4) 1/r32/ecx
955 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
956 89/<- *(edi+4) 0/r32/eax
957
958 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
959 $next-word-string-or-expression-without-metadata:check-for-open-paren:
960
961 3d/compare-eax-and 0x28/imm32/open-paren
962 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error4a/disp32
963 $next-word-string-or-expression-without-metadata:check-for-end-of-call:
964
965 3d/compare-eax-and 0x29/imm32/close-paren
966 75/jump-if-!= $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp8
967
968 ff 0/subop/increment *(esi+4)
969
970
971
972 8b/-> *(esi+4) 1/r32/ecx
973
974 3b/compare<- *esi 1/r32/ecx
975 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:return-eol/disp32
976
977
978 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
979
980 3d/compare-eax-and 0x2f/imm32/slash
981 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error3/disp32
982
983
984 56/push-esi
985
986 e8/call skip-chars-matching-whitespace/disp32
987
988 81 0/subop/add %esp 4/imm32
989
990
991 8b/-> *(esi+4) 1/r32/ecx
992
993 3b/compare<- *esi 1/r32/ecx
994 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:return-eol/disp32
995
996
997 8b/-> *(esi+4) 1/r32/ecx
998 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
999
1000 3d/compare-eax-and 0x23/imm32/pound
1001 74/jump-if-= $next-word-string-or-expression-without-metadata:return-eol/disp8
1002
1003 e9/jump $next-word-string-or-expression-without-metadata:error4/disp32
1004 $next-word-string-or-expression-without-metadata:regular-word-without-metadata:
1005
1006
1007 8b/-> *(esi+4) 1/r32/ecx
1008
1009 3b/compare<- *esi 1/r32/ecx
1010 7d/jump-if->= $next-word-string-or-expression-without-metadata:regular-word-break/disp8
1011
1012
1013 8b/-> *(esi+4) 1/r32/ecx
1014 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
1015
1016 3d/compare-eax-and 0x20/imm32/space
1017 74/jump-if-= $next-word-string-or-expression-without-metadata:regular-word-break/disp8
1018
1019 3d/compare-eax-and 0x29/imm32/close-paren
1020 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:regular-word-break/disp32
1021
1022 3d/compare-eax-and 0x2f/imm32/slash
1023 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error5/disp32
1024
1025 ff 0/subop/increment *(esi+4)
1026
1027 e9/jump $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp32
1028 $next-word-string-or-expression-without-metadata:regular-word-break:
1029
1030 8b/-> *(esi+4) 1/r32/ecx
1031 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
1032 89/<- *(edi+4) 0/r32/eax
1033 eb/jump $next-word-string-or-expression-without-metadata:end/disp8
1034 $next-word-string-or-expression-without-metadata:return-eol:
1035
1036 c7 0/subop/copy *edi 0/imm32
1037 c7 0/subop/copy *(edi+4) 0/imm32
1038 $next-word-string-or-expression-without-metadata:end:
1039
1040 5f/pop-to-edi
1041 5e/pop-to-esi
1042 59/pop-to-ecx
1043 58/pop-to-eax
1044
1045 89/<- %esp 5/r32/ebp
1046 5d/pop-to-ebp
1047 c3/return
1048
1049 $next-word-string-or-expression-without-metadata:error0:
1050
1051
1052
1053 68/push "error: missing final ')' in '"/imm32
1054 68/push Stderr/imm32
1055
1056 e8/call write-buffered/disp32
1057
1058 81 0/subop/add %esp 8/imm32
1059
1060
1061 56/push-esi
1062 68/push Stderr/imm32
1063
1064 e8/call write-stream-data/disp32
1065
1066 81 0/subop/add %esp 8/imm32
1067
1068
1069 68/push "'"/imm32
1070 68/push Stderr/imm32
1071
1072 e8/call write-buffered/disp32
1073
1074 81 0/subop/add %esp 8/imm32
1075
1076
1077 68/push Stderr/imm32
1078
1079 e8/call flush/disp32
1080
1081 81 0/subop/add %esp 4/imm32
1082
1083 bb/copy-to-ebx 1/imm32
1084 e8/call syscall_exit/disp32
1085
1086
1087 $next-word-string-or-expression-without-metadata:error1:
1088
1089
1090
1091 68/push "error: no space allowed after '*' in '"/imm32
1092 68/push Stderr/imm32
1093
1094 e8/call write-buffered/disp32
1095
1096 81 0/subop/add %esp 8/imm32
1097
1098
1099 56/push-esi
1100 68/push Stderr/imm32
1101
1102 e8/call write-stream-data/disp32
1103
1104 81 0/subop/add %esp 8/imm32
1105
1106
1107 68/push "'"/imm32
1108 68/push Stderr/imm32
1109
1110 e8/call write-buffered/disp32
1111
1112 81 0/subop/add %esp 8/imm32
1113
1114
1115 68/push Stderr/imm32
1116
1117 e8/call flush/disp32
1118
1119 81 0/subop/add %esp 4/imm32
1120
1121 bb/copy-to-ebx 1/imm32
1122 e8/call syscall_exit/disp32
1123
1124
1125 $next-word-string-or-expression-without-metadata:error2:
1126
1127
1128
1129 68/push "error: *(...) expression must be all on a single line in '"/imm32
1130 68/push Stderr/imm32
1131
1132 e8/call write-buffered/disp32
1133
1134 81 0/subop/add %esp 8/imm32
1135
1136
1137 56/push-esi
1138 68/push Stderr/imm32
1139
1140 e8/call write-stream-data/disp32
1141
1142 81 0/subop/add %esp 8/imm32
1143
1144
1145 68/push "'"/imm32
1146 68/push Stderr/imm32
1147
1148 e8/call write-buffered/disp32
1149
1150 81 0/subop/add %esp 8/imm32
1151
1152
1153 68/push Stderr/imm32
1154
1155 e8/call flush/disp32
1156
1157 81 0/subop/add %esp 4/imm32
1158
1159 bb/copy-to-ebx 1/imm32
1160 e8/call syscall_exit/disp32
1161
1162
1163 $next-word-string-or-expression-without-metadata:error3:
1164
1165
1166
1167 68/push "error: no metadata after calls; just use a comment (in '"/imm32
1168 68/push Stderr/imm32
1169
1170 e8/call write-buffered/disp32
1171
1172 81 0/subop/add %esp 8/imm32
1173
1174
1175 56/push-esi
1176 68/push Stderr/imm32
1177
1178 e8/call write-stream-data/disp32
1179
1180 81 0/subop/add %esp 8/imm32
1181
1182
1183 68/push "')"/imm32
1184 68/push Stderr/imm32
1185
1186 e8/call write-buffered/disp32
1187
1188 81 0/subop/add %esp 8/imm32
1189
1190
1191 68/push Stderr/imm32
1192
1193 e8/call flush/disp32
1194
1195 81 0/subop/add %esp 4/imm32
1196
1197 bb/copy-to-ebx 1/imm32
1198 e8/call syscall_exit/disp32
1199
1200
1201 $next-word-string-or-expression-without-metadata:error4a:
1202
1203
1204
1205 68/push "error: unexpected '(' within call in '"/imm32
1206 68/push Stderr/imm32
1207
1208 e8/call write-buffered/disp32
1209
1210 81 0/subop/add %esp 8/imm32
1211
1212
1213 56/push-esi
1214 68/push Stderr/imm32
1215
1216 e8/call write-stream-data/disp32
1217
1218 81 0/subop/add %esp 8/imm32
1219
1220
1221 68/push "'\n"/imm32
1222 68/push Stderr/imm32
1223
1224 e8/call write-buffered/disp32
1225
1226 81 0/subop/add %esp 8/imm32
1227
1228
1229 68/push Stderr/imm32
1230
1231 e8/call flush/disp32
1232
1233 81 0/subop/add %esp 4/imm32
1234
1235 bb/copy-to-ebx 1/imm32
1236 e8/call syscall_exit/disp32
1237
1238
1239 $next-word-string-or-expression-without-metadata:error4:
1240
1241
1242
1243 68/push "error: unexpected text after end of call in '"/imm32
1244 68/push Stderr/imm32
1245
1246 e8/call write-buffered/disp32
1247
1248 81 0/subop/add %esp 8/imm32
1249
1250
1251 56/push-esi
1252 68/push Stderr/imm32
1253
1254 e8/call write-stream-data/disp32
1255
1256 81 0/subop/add %esp 8/imm32
1257
1258
1259 68/push "'"/imm32
1260 68/push Stderr/imm32
1261
1262 e8/call write-buffered/disp32
1263
1264 81 0/subop/add %esp 8/imm32
1265
1266
1267 68/push Stderr/imm32
1268
1269 e8/call flush/disp32
1270
1271 81 0/subop/add %esp 4/imm32
1272
1273 bb/copy-to-ebx 1/imm32
1274 e8/call syscall_exit/disp32
1275
1276
1277 $next-word-string-or-expression-without-metadata:error5:
1278
1279
1280
1281 68/push "error: no metadata anywhere in calls (in '"/imm32
1282 68/push Stderr/imm32
1283
1284 e8/call write-buffered/disp32
1285
1286 81 0/subop/add %esp 8/imm32
1287
1288
1289 56/push-esi
1290 68/push Stderr/imm32
1291
1292 e8/call write-stream-data/disp32
1293
1294 81 0/subop/add %esp 8/imm32
1295
1296
1297 68/push "')"/imm32
1298 68/push Stderr/imm32
1299
1300 e8/call write-buffered/disp32
1301
1302 81 0/subop/add %esp 8/imm32
1303
1304
1305 68/push Stderr/imm32
1306
1307 e8/call flush/disp32
1308
1309 81 0/subop/add %esp 4/imm32
1310
1311 bb/copy-to-ebx 1/imm32
1312 e8/call syscall_exit/disp32
1313
1314
1315 test-next-word-string-or-expression-without-metadata:
1316
1317 55/push-ebp
1318 89/<- %ebp 4/r32/esp
1319
1320
1321
1322 68/push _test-input-stream/imm32
1323
1324 e8/call clear-stream/disp32
1325
1326 81 0/subop/add %esp 4/imm32
1327
1328 68/push 0/imm32/end
1329 68/push 0/imm32/start
1330 89/<- %ecx 4/r32/esp
1331
1332
1333 68/push " ab"/imm32
1334 68/push _test-input-stream/imm32
1335
1336 e8/call write/disp32
1337
1338 81 0/subop/add %esp 8/imm32
1339
1340
1341 51/push-ecx
1342 68/push _test-input-stream/imm32
1343
1344 e8/call next-word-string-or-expression-without-metadata/disp32
1345
1346 81 0/subop/add %esp 8/imm32
1347
1348
1349 68/push "F - test-next-word-string-or-expression-without-metadata/updates-stream-read-correctly"/imm32
1350 68/push 4/imm32
1351 b8/copy-to-eax _test-input-stream/imm32
1352 ff 6/subop/push *(eax+4)
1353
1354 e8/call check-ints-equal/disp32
1355
1356 81 0/subop/add %esp 0xc/imm32
1357
1358
1359
1360 68/push "F - test-next-word-string-or-expression-without-metadata: start"/imm32
1361 68/push 0xe/imm32
1362
1363 8b/-> *ecx 0/r32/eax
1364 81 5/subop/subtract %eax _test-input-stream/imm32
1365 50/push-eax
1366
1367 e8/call check-ints-equal/disp32
1368
1369 81 0/subop/add %esp 0xc/imm32
1370
1371
1372
1373 68/push "F - test-next-word-string-or-expression-without-metadata: end"/imm32
1374 68/push 0x10/imm32
1375
1376 8b/-> *(ecx+4) 0/r32/eax
1377 81 5/subop/subtract %eax _test-input-stream/imm32
1378 50/push-eax
1379
1380 e8/call check-ints-equal/disp32
1381
1382 81 0/subop/add %esp 0xc/imm32
1383
1384 89/<- %esp 5/r32/ebp
1385 5d/pop-to-ebp
1386 c3/return
1387
1388 test-next-word-string-or-expression-without-metadata-returns-whole-comment:
1389
1390 55/push-ebp
1391 89/<- %ebp 4/r32/esp
1392
1393
1394
1395 68/push _test-input-stream/imm32
1396
1397 e8/call clear-stream/disp32
1398
1399 81 0/subop/add %esp 4/imm32
1400
1401 68/push 0/imm32/end
1402 68/push 0/imm32/start
1403 89/<- %ecx 4/r32/esp
1404
1405
1406 68/push " # a"/imm32
1407 68/push _test-input-stream/imm32
1408
1409 e8/call write/disp32
1410
1411 81 0/subop/add %esp 8/imm32
1412
1413
1414 51/push-ecx
1415 68/push _test-input-stream/imm32
1416
1417 e8/call next-word-string-or-expression-without-metadata/disp32
1418
1419 81 0/subop/add %esp 8/imm32
1420
1421
1422 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment/updates-stream-read-correctly"/imm32
1423 68/push 5/imm32
1424 b8/copy-to-eax _test-input-stream/imm32
1425 ff 6/subop/push *(eax+4)
1426
1427 e8/call check-ints-equal/disp32
1428
1429 81 0/subop/add %esp 0xc/imm32
1430
1431
1432
1433 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment: start"/imm32
1434 68/push 0xe/imm32
1435
1436 8b/-> *ecx 0/r32/eax
1437 81 5/subop/subtract %eax _test-input-stream/imm32
1438 50/push-eax
1439
1440 e8/call check-ints-equal/disp32
1441
1442 81 0/subop/add %esp 0xc/imm32
1443
1444
1445
1446 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment: end"/imm32
1447 68/push 0x11/imm32
1448
1449 8b/-> *(ecx+4) 0/r32/eax
1450 81 5/subop/subtract %eax _test-input-stream/imm32
1451 50/push-eax
1452
1453 e8/call check-ints-equal/disp32
1454
1455 81 0/subop/add %esp 0xc/imm32
1456
1457 89/<- %esp 5/r32/ebp
1458 5d/pop-to-ebp
1459 c3/return
1460
1461 test-next-word-string-or-expression-without-metadata-returns-string-literal:
1462
1463 55/push-ebp
1464 89/<- %ebp 4/r32/esp
1465
1466
1467
1468 68/push _test-input-stream/imm32
1469
1470 e8/call clear-stream/disp32
1471
1472 81 0/subop/add %esp 4/imm32
1473
1474 68/push 0/imm32/end
1475 68/push 0/imm32/start
1476 89/<- %ecx 4/r32/esp
1477
1478
1479 68/push " \"a b\" "/imm32
1480 68/push _test-input-stream/imm32
1481
1482 e8/call write/disp32
1483
1484 81 0/subop/add %esp 8/imm32
1485
1486
1487 51/push-ecx
1488 68/push _test-input-stream/imm32
1489
1490 e8/call next-word-string-or-expression-without-metadata/disp32
1491
1492 81 0/subop/add %esp 8/imm32
1493
1494
1495
1496 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-literal: start"/imm32
1497 68/push 0xd/imm32
1498
1499 8b/-> *ecx 0/r32/eax
1500 81 5/subop/subtract %eax _test-input-stream/imm32
1501 50/push-eax
1502
1503 e8/call check-ints-equal/disp32
1504
1505 81 0/subop/add %esp 0xc/imm32
1506
1507
1508
1509 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-literal: end"/imm32
1510 68/push 0x12/imm32
1511
1512 8b/-> *(ecx+4) 0/r32/eax
1513 81 5/subop/subtract %eax _test-input-stream/imm32
1514 50/push-eax
1515
1516 e8/call check-ints-equal/disp32
1517
1518 81 0/subop/add %esp 0xc/imm32
1519
1520 89/<- %esp 5/r32/ebp
1521 5d/pop-to-ebp
1522 c3/return
1523
1524 test-next-word-string-or-expression-without-metadata-returns-string-with-escapes:
1525
1526 55/push-ebp
1527 89/<- %ebp 4/r32/esp
1528
1529
1530
1531 68/push _test-input-stream/imm32
1532
1533 e8/call clear-stream/disp32
1534
1535 81 0/subop/add %esp 4/imm32
1536
1537 68/push 0/imm32/end
1538 68/push 0/imm32/start
1539 89/<- %ecx 4/r32/esp
1540
1541
1542 68/push " \"a\\\"b\""/imm32
1543 68/push _test-input-stream/imm32
1544
1545 e8/call write/disp32
1546
1547 81 0/subop/add %esp 8/imm32
1548
1549
1550 51/push-ecx
1551 68/push _test-input-stream/imm32
1552
1553 e8/call next-word-string-or-expression-without-metadata/disp32
1554
1555 81 0/subop/add %esp 8/imm32
1556
1557
1558
1559 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-with-escapes: start"/imm32
1560 68/push 0xd/imm32
1561
1562 8b/-> *ecx 0/r32/eax
1563 81 5/subop/subtract %eax _test-input-stream/imm32
1564 50/push-eax
1565
1566 e8/call check-ints-equal/disp32
1567
1568 81 0/subop/add %esp 0xc/imm32
1569
1570
1571
1572 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-with-escapes: end"/imm32
1573 68/push 0x13/imm32
1574
1575 8b/-> *(ecx+4) 0/r32/eax
1576 81 5/subop/subtract %eax _test-input-stream/imm32
1577 50/push-eax
1578
1579 e8/call check-ints-equal/disp32
1580
1581 81 0/subop/add %esp 0xc/imm32
1582
1583 89/<- %esp 5/r32/ebp
1584 5d/pop-to-ebp
1585 c3/return
1586
1587 test-next-word-string-or-expression-without-metadata-returns-whole-expression:
1588
1589 55/push-ebp
1590 89/<- %ebp 4/r32/esp
1591
1592
1593
1594 68/push _test-input-stream/imm32
1595
1596 e8/call clear-stream/disp32
1597
1598 81 0/subop/add %esp 4/imm32
1599
1600 68/push 0/imm32/end
1601 68/push 0/imm32/start
1602 89/<- %ecx 4/r32/esp
1603
1604
1605 68/push " *(a b) "/imm32
1606 68/push _test-input-stream/imm32
1607
1608 e8/call write/disp32
1609
1610 81 0/subop/add %esp 8/imm32
1611
1612
1613 51/push-ecx
1614 68/push _test-input-stream/imm32
1615
1616 e8/call next-word-string-or-expression-without-metadata/disp32
1617
1618 81 0/subop/add %esp 8/imm32
1619
1620
1621
1622 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-expression: start"/imm32
1623 68/push 0xd/imm32
1624
1625 8b/-> *ecx 0/r32/eax
1626 81 5/subop/subtract %eax _test-input-stream/imm32
1627 50/push-eax
1628
1629 e8/call check-ints-equal/disp32
1630
1631 81 0/subop/add %esp 0xc/imm32
1632
1633
1634
1635 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-expression: end"/imm32
1636 68/push 0x13/imm32
1637
1638 8b/-> *(ecx+4) 0/r32/eax
1639 81 5/subop/subtract %eax _test-input-stream/imm32
1640 50/push-eax
1641
1642 e8/call check-ints-equal/disp32
1643
1644 81 0/subop/add %esp 0xc/imm32
1645
1646 89/<- %esp 5/r32/ebp
1647 5d/pop-to-ebp
1648 c3/return
1649
1650 test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren:
1651
1652 55/push-ebp
1653 89/<- %ebp 4/r32/esp
1654
1655
1656
1657 68/push _test-input-stream/imm32
1658
1659 e8/call clear-stream/disp32
1660
1661 81 0/subop/add %esp 4/imm32
1662
1663 68/push 0/imm32/end
1664 68/push 0/imm32/start
1665 89/<- %ecx 4/r32/esp
1666
1667
1668 68/push " ) "/imm32
1669 68/push _test-input-stream/imm32
1670
1671 e8/call write/disp32
1672
1673 81 0/subop/add %esp 8/imm32
1674
1675
1676 51/push-ecx
1677 68/push _test-input-stream/imm32
1678
1679 e8/call next-word-string-or-expression-without-metadata/disp32
1680
1681 81 0/subop/add %esp 8/imm32
1682
1683
1684 68/push "F - test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren: start"/imm32
1685 68/push 0/imm32
1686 ff 6/subop/push *ecx
1687
1688 e8/call check-ints-equal/disp32
1689
1690 81 0/subop/add %esp 0xc/imm32
1691
1692
1693 68/push "F - test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren: end"/imm32
1694 68/push 0/imm32
1695 ff 6/subop/push *(ecx+4)
1696
1697 e8/call check-ints-equal/disp32
1698
1699 81 0/subop/add %esp 0xc/imm32
1700
1701 89/<- %esp 5/r32/ebp
1702 5d/pop-to-ebp
1703 c3/return
1704
1705 test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren:
1706
1707 55/push-ebp
1708 89/<- %ebp 4/r32/esp
1709
1710
1711
1712 68/push _test-input-stream/imm32
1713
1714 e8/call clear-stream/disp32
1715
1716 81 0/subop/add %esp 4/imm32
1717
1718 68/push 0/imm32/end
1719 68/push 0/imm32/start
1720 89/<- %ecx 4/r32/esp
1721
1722
1723 68/push " ) # abc "/imm32
1724 68/push _test-input-stream/imm32
1725
1726 e8/call write/disp32
1727
1728 81 0/subop/add %esp 8/imm32
1729
1730
1731 51/push-ecx
1732 68/push _test-input-stream/imm32
1733
1734 e8/call next-word-string-or-expression-without-metadata/disp32
1735
1736 81 0/subop/add %esp 8/imm32
1737
1738
1739 68/push "F - test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren: start"/imm32
1740 68/push 0/imm32
1741 ff 6/subop/push *ecx
1742
1743 e8/call check-ints-equal/disp32
1744
1745 81 0/subop/add %esp 0xc/imm32
1746
1747
1748 68/push "F - test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren: end"/imm32
1749 68/push 0/imm32
1750 ff 6/subop/push *(ecx+4)
1751
1752 e8/call check-ints-equal/disp32
1753
1754 81 0/subop/add %esp 0xc/imm32
1755
1756 89/<- %esp 5/r32/ebp
1757 5d/pop-to-ebp
1758 c3/return
1759
1760 test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren:
1761
1762 55/push-ebp
1763 89/<- %ebp 4/r32/esp
1764
1765
1766
1767 68/push _test-input-stream/imm32
1768
1769 e8/call clear-stream/disp32
1770
1771 81 0/subop/add %esp 4/imm32
1772
1773 68/push 0/imm32/end
1774 68/push 0/imm32/start
1775 89/<- %ecx 4/r32/esp
1776
1777
1778 68/push " )\n"/imm32
1779 68/push _test-input-stream/imm32
1780
1781 e8/call write/disp32
1782
1783 81 0/subop/add %esp 8/imm32
1784
1785
1786 51/push-ecx
1787 68/push _test-input-stream/imm32
1788
1789 e8/call next-word-string-or-expression-without-metadata/disp32
1790
1791 81 0/subop/add %esp 8/imm32
1792
1793
1794 68/push "F - test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren: start"/imm32
1795 68/push 0/imm32
1796 ff 6/subop/push *ecx
1797
1798 e8/call check-ints-equal/disp32
1799
1800 81 0/subop/add %esp 0xc/imm32
1801
1802
1803 68/push "F - test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren: end"/imm32
1804 68/push 0/imm32
1805 ff 6/subop/push *(ecx+4)
1806
1807 e8/call check-ints-equal/disp32
1808
1809 81 0/subop/add %esp 0xc/imm32
1810
1811 89/<- %esp 5/r32/ebp
1812 5d/pop-to-ebp
1813 c3/return
1814
1815 test-next-word-string-or-expression-without-metadata-stops-at-close-paren:
1816
1817 55/push-ebp
1818 89/<- %ebp 4/r32/esp
1819
1820
1821
1822 68/push _test-input-stream/imm32
1823
1824 e8/call clear-stream/disp32
1825
1826 81 0/subop/add %esp 4/imm32
1827
1828 68/push 0/imm32/end
1829 68/push 0/imm32/start
1830 89/<- %ecx 4/r32/esp
1831
1832
1833 68/push " abc) # def"/imm32
1834 68/push _test-input-stream/imm32
1835
1836 e8/call write/disp32
1837
1838 81 0/subop/add %esp 8/imm32
1839
1840
1841 51/push-ecx
1842 68/push _test-input-stream/imm32
1843
1844 e8/call next-word-string-or-expression-without-metadata/disp32
1845
1846 81 0/subop/add %esp 8/imm32
1847
1848
1849
1850 68/push "F - test-next-word-string-or-expression-without-metadata-stops-at-close-paren: start"/imm32
1851 68/push 0xd/imm32
1852
1853 8b/-> *ecx 0/r32/eax
1854 81 5/subop/subtract %eax _test-input-stream/imm32
1855 50/push-eax
1856
1857 e8/call check-ints-equal/disp32
1858
1859 81 0/subop/add %esp 0xc/imm32
1860
1861
1862
1863 68/push "F - test-next-word-string-or-expression-without-metadata-stops-at-close-paren: end"/imm32
1864 68/push 0x10/imm32
1865
1866 8b/-> *(ecx+4) 0/r32/eax
1867 81 5/subop/subtract %eax _test-input-stream/imm32
1868 50/push-eax
1869
1870 e8/call check-ints-equal/disp32
1871
1872 81 0/subop/add %esp 0xc/imm32
1873
1874 89/<- %esp 5/r32/ebp
1875 5d/pop-to-ebp
1876 c3/return