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 55/push-ebp
859 89/<- %ebp 4/r32/esp
860
861 50/push-eax
862 51/push-ecx
863 56/push-esi
864 57/push-edi
865
866 8b/-> *(ebp+8) 6/r32/esi
867
868 8b/-> *(ebp+0xc) 7/r32/edi
869
870
871 68/push 0x20/imm32/space
872 ff 6/subop/push *(ebp+8)
873
874 e8/call skip-chars-matching/disp32
875
876 81 0/subop/add %esp 8/imm32
877 $next-word-string-or-expression-without-metadata:check0:
878
879
880 8b/-> *(esi+4) 1/r32/ecx
881
882 3b/compare<- *esi 1/r32/ecx
883 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:error0/disp32
884 $next-word-string-or-expression-without-metadata:check-for-comment:
885
886 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
887 89/<- *edi 0/r32/eax
888
889
890 31/xor-with %eax 0/r32/eax
891 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
892
893 3d/compare-eax-and 0x23/imm32/pound
894 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-string-literal/disp8
895 $next-word-string-or-expression-without-metadata:comment:
896
897 8b/-> *esi 0/r32/eax
898 8d/copy-address *(esi+eax+0xc) 0/r32/eax
899 89/<- *(edi+4) 0/r32/eax
900
901 8b/-> *esi 0/r32/eax
902 89/<- *(esi+4) 0/r32/eax
903
904 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
905 $next-word-string-or-expression-without-metadata:check-for-string-literal:
906
907 3d/compare-eax-and 0x22/imm32/dquote
908 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-expression/disp8
909 $next-word-string-or-expression-without-metadata:string-literal:
910
911
912 56/push-esi
913
914 e8/call skip-string/disp32
915
916 81 0/subop/add %esp 4/imm32
917
918 8b/-> *(esi+4) 1/r32/ecx
919 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
920 89/<- *(edi+4) 0/r32/eax
921
922 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
923 $next-word-string-or-expression-without-metadata:check-for-expression:
924
925 3d/compare-eax-and 0x2a/imm32/asterisk
926 75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-end-of-call/disp8
927
928 8a/copy-byte *(esi+ecx+0xd) 0/r32/AL
929 3d/compare-eax-and 0x20/imm32/space
930 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error1/disp32
931
932 3d/compare-eax-and 0x28/imm32/open-paren
933 0f 85/jump-if-!= $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp32
934 $next-word-string-or-expression-without-metadata:paren:
935
936
937 56/push-esi
938
939 e8/call skip-until-close-paren/disp32
940
941 81 0/subop/add %esp 4/imm32
942
943
944 8b/-> *(esi+4) 1/r32/ecx
945 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
946
947 3d/compare-eax-and 0x29/imm32/close-paren
948 0f 85/jump-if-!= $next-word-string-or-expression-without-metadata:error2/disp32
949
950 ff 0/subop/increment *(esi+4)
951
952 8b/-> *(esi+4) 1/r32/ecx
953 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
954 89/<- *(edi+4) 0/r32/eax
955
956 e9/jump $next-word-string-or-expression-without-metadata:end/disp32
957 $next-word-string-or-expression-without-metadata:check-for-end-of-call:
958
959 3d/compare-eax-and 0x29/imm32/close-paren
960 75/jump-if-!= $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp8
961
962 ff 0/subop/increment *(esi+4)
963
964
965
966 8b/-> *(esi+4) 1/r32/ecx
967
968 3b/compare<- *esi 1/r32/ecx
969 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:return-eol/disp32
970
971
972 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
973
974 3d/compare-eax-and 0x2f/imm32/slash
975 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error3/disp32
976
977
978 56/push-esi
979
980 e8/call skip-chars-matching-whitespace/disp32
981
982 81 0/subop/add %esp 4/imm32
983
984
985 8b/-> *(esi+4) 1/r32/ecx
986
987 3b/compare<- *esi 1/r32/ecx
988 0f 8d/jump-if->= $next-word-string-or-expression-without-metadata:return-eol/disp32
989
990
991 8b/-> *(esi+4) 1/r32/ecx
992 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
993
994 3d/compare-eax-and 0x23/imm32/pound
995 74/jump-if-= $next-word-string-or-expression-without-metadata:return-eol/disp8
996
997 e9/jump $next-word-string-or-expression-without-metadata:error4/disp32
998 $next-word-string-or-expression-without-metadata:regular-word-without-metadata:
999
1000
1001 8b/-> *(esi+4) 1/r32/ecx
1002
1003 3b/compare<- *esi 1/r32/ecx
1004 7d/jump-if->= $next-word-string-or-expression-without-metadata:regular-word-break/disp8
1005
1006
1007 8b/-> *(esi+4) 1/r32/ecx
1008 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL
1009
1010 3d/compare-eax-and 0x20/imm32/space
1011 74/jump-if-= $next-word-string-or-expression-without-metadata:regular-word-break/disp8
1012
1013 3d/compare-eax-and 0x29/imm32/close-paren
1014 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:regular-word-break/disp32
1015
1016 3d/compare-eax-and 0x2f/imm32/slash
1017 0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error5/disp32
1018
1019 ff 0/subop/increment *(esi+4)
1020
1021 e9/jump $next-word-string-or-expression-without-metadata:regular-word-without-metadata/disp32
1022 $next-word-string-or-expression-without-metadata:regular-word-break:
1023
1024 8b/-> *(esi+4) 1/r32/ecx
1025 8d/copy-address *(esi+ecx+0xc) 0/r32/eax
1026 89/<- *(edi+4) 0/r32/eax
1027 eb/jump $next-word-string-or-expression-without-metadata:end/disp8
1028 $next-word-string-or-expression-without-metadata:return-eol:
1029
1030 c7 0/subop/copy *edi 0/imm32
1031 c7 0/subop/copy *(edi+4) 0/imm32
1032 $next-word-string-or-expression-without-metadata:end:
1033
1034 5f/pop-to-edi
1035 5e/pop-to-esi
1036 59/pop-to-ecx
1037 58/pop-to-eax
1038
1039 89/<- %esp 5/r32/ebp
1040 5d/pop-to-ebp
1041 c3/return
1042
1043 $next-word-string-or-expression-without-metadata:error0:
1044
1045
1046
1047 68/push "error: missing final ')' in '"/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 56/push-esi
1056 68/push Stderr/imm32
1057
1058 e8/call write-stream-data/disp32
1059
1060 81 0/subop/add %esp 8/imm32
1061
1062
1063 68/push "'"/imm32
1064 68/push Stderr/imm32
1065
1066 e8/call write-buffered/disp32
1067
1068 81 0/subop/add %esp 8/imm32
1069
1070
1071 68/push Stderr/imm32
1072
1073 e8/call flush/disp32
1074
1075 81 0/subop/add %esp 4/imm32
1076
1077 bb/copy-to-ebx 1/imm32
1078 e8/call syscall_exit/disp32
1079
1080
1081 $next-word-string-or-expression-without-metadata:error1:
1082
1083
1084
1085 68/push "error: no space allowed after '*' in '"/imm32
1086 68/push Stderr/imm32
1087
1088 e8/call write-buffered/disp32
1089
1090 81 0/subop/add %esp 8/imm32
1091
1092
1093 56/push-esi
1094 68/push Stderr/imm32
1095
1096 e8/call write-stream-data/disp32
1097
1098 81 0/subop/add %esp 8/imm32
1099
1100
1101 68/push "'"/imm32
1102 68/push Stderr/imm32
1103
1104 e8/call write-buffered/disp32
1105
1106 81 0/subop/add %esp 8/imm32
1107
1108
1109 68/push Stderr/imm32
1110
1111 e8/call flush/disp32
1112
1113 81 0/subop/add %esp 4/imm32
1114
1115 bb/copy-to-ebx 1/imm32
1116 e8/call syscall_exit/disp32
1117
1118
1119 $next-word-string-or-expression-without-metadata:error2:
1120
1121
1122
1123 68/push "error: *(...) expression must be all on a single line in '"/imm32
1124 68/push Stderr/imm32
1125
1126 e8/call write-buffered/disp32
1127
1128 81 0/subop/add %esp 8/imm32
1129
1130
1131 56/push-esi
1132 68/push Stderr/imm32
1133
1134 e8/call write-stream-data/disp32
1135
1136 81 0/subop/add %esp 8/imm32
1137
1138
1139 68/push "'"/imm32
1140 68/push Stderr/imm32
1141
1142 e8/call write-buffered/disp32
1143
1144 81 0/subop/add %esp 8/imm32
1145
1146
1147 68/push Stderr/imm32
1148
1149 e8/call flush/disp32
1150
1151 81 0/subop/add %esp 4/imm32
1152
1153 bb/copy-to-ebx 1/imm32
1154 e8/call syscall_exit/disp32
1155
1156
1157 $next-word-string-or-expression-without-metadata:error3:
1158
1159
1160
1161 68/push "error: no metadata after calls; just use a comment (in '"/imm32
1162 68/push Stderr/imm32
1163
1164 e8/call write-buffered/disp32
1165
1166 81 0/subop/add %esp 8/imm32
1167
1168
1169 56/push-esi
1170 68/push Stderr/imm32
1171
1172 e8/call write-stream-data/disp32
1173
1174 81 0/subop/add %esp 8/imm32
1175
1176
1177 68/push "')"/imm32
1178 68/push Stderr/imm32
1179
1180 e8/call write-buffered/disp32
1181
1182 81 0/subop/add %esp 8/imm32
1183
1184
1185 68/push Stderr/imm32
1186
1187 e8/call flush/disp32
1188
1189 81 0/subop/add %esp 4/imm32
1190
1191 bb/copy-to-ebx 1/imm32
1192 e8/call syscall_exit/disp32
1193
1194
1195 $next-word-string-or-expression-without-metadata:error4:
1196
1197
1198
1199 68/push "error: unexpected text after end of call in '"/imm32
1200 68/push Stderr/imm32
1201
1202 e8/call write-buffered/disp32
1203
1204 81 0/subop/add %esp 8/imm32
1205
1206
1207 56/push-esi
1208 68/push Stderr/imm32
1209
1210 e8/call write-stream-data/disp32
1211
1212 81 0/subop/add %esp 8/imm32
1213
1214
1215 68/push "'"/imm32
1216 68/push Stderr/imm32
1217
1218 e8/call write-buffered/disp32
1219
1220 81 0/subop/add %esp 8/imm32
1221
1222
1223 68/push Stderr/imm32
1224
1225 e8/call flush/disp32
1226
1227 81 0/subop/add %esp 4/imm32
1228
1229 bb/copy-to-ebx 1/imm32
1230 e8/call syscall_exit/disp32
1231
1232
1233 $next-word-string-or-expression-without-metadata:error5:
1234
1235
1236
1237 68/push "error: no metadata anywhere in calls (in '"/imm32
1238 68/push Stderr/imm32
1239
1240 e8/call write-buffered/disp32
1241
1242 81 0/subop/add %esp 8/imm32
1243
1244
1245 56/push-esi
1246 68/push Stderr/imm32
1247
1248 e8/call write-stream-data/disp32
1249
1250 81 0/subop/add %esp 8/imm32
1251
1252
1253 68/push "')"/imm32
1254 68/push Stderr/imm32
1255
1256 e8/call write-buffered/disp32
1257
1258 81 0/subop/add %esp 8/imm32
1259
1260
1261 68/push Stderr/imm32
1262
1263 e8/call flush/disp32
1264
1265 81 0/subop/add %esp 4/imm32
1266
1267 bb/copy-to-ebx 1/imm32
1268 e8/call syscall_exit/disp32
1269
1270
1271 test-next-word-string-or-expression-without-metadata:
1272
1273 55/push-ebp
1274 89/<- %ebp 4/r32/esp
1275
1276
1277
1278 68/push _test-input-stream/imm32
1279
1280 e8/call clear-stream/disp32
1281
1282 81 0/subop/add %esp 4/imm32
1283
1284 68/push 0/imm32/end
1285 68/push 0/imm32/start
1286 89/<- %ecx 4/r32/esp
1287
1288
1289 68/push " ab"/imm32
1290 68/push _test-input-stream/imm32
1291
1292 e8/call write/disp32
1293
1294 81 0/subop/add %esp 8/imm32
1295
1296
1297 51/push-ecx
1298 68/push _test-input-stream/imm32
1299
1300 e8/call next-word-string-or-expression-without-metadata/disp32
1301
1302 81 0/subop/add %esp 8/imm32
1303
1304
1305 68/push "F - test-next-word-string-or-expression-without-metadata/updates-stream-read-correctly"/imm32
1306 68/push 4/imm32
1307 b8/copy-to-eax _test-input-stream/imm32
1308 ff 6/subop/push *(eax+4)
1309
1310 e8/call check-ints-equal/disp32
1311
1312 81 0/subop/add %esp 0xc/imm32
1313
1314
1315
1316 68/push "F - test-next-word-string-or-expression-without-metadata: start"/imm32
1317 68/push 0xe/imm32
1318
1319 8b/-> *ecx 0/r32/eax
1320 81 5/subop/subtract %eax _test-input-stream/imm32
1321 50/push-eax
1322
1323 e8/call check-ints-equal/disp32
1324
1325 81 0/subop/add %esp 0xc/imm32
1326
1327
1328
1329 68/push "F - test-next-word-string-or-expression-without-metadata: end"/imm32
1330 68/push 0x10/imm32
1331
1332 8b/-> *(ecx+4) 0/r32/eax
1333 81 5/subop/subtract %eax _test-input-stream/imm32
1334 50/push-eax
1335
1336 e8/call check-ints-equal/disp32
1337
1338 81 0/subop/add %esp 0xc/imm32
1339
1340 89/<- %esp 5/r32/ebp
1341 5d/pop-to-ebp
1342 c3/return
1343
1344 test-next-word-string-or-expression-without-metadata-returns-whole-comment:
1345
1346 55/push-ebp
1347 89/<- %ebp 4/r32/esp
1348
1349
1350
1351 68/push _test-input-stream/imm32
1352
1353 e8/call clear-stream/disp32
1354
1355 81 0/subop/add %esp 4/imm32
1356
1357 68/push 0/imm32/end
1358 68/push 0/imm32/start
1359 89/<- %ecx 4/r32/esp
1360
1361
1362 68/push " # a"/imm32
1363 68/push _test-input-stream/imm32
1364
1365 e8/call write/disp32
1366
1367 81 0/subop/add %esp 8/imm32
1368
1369
1370 51/push-ecx
1371 68/push _test-input-stream/imm32
1372
1373 e8/call next-word-string-or-expression-without-metadata/disp32
1374
1375 81 0/subop/add %esp 8/imm32
1376
1377
1378 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment/updates-stream-read-correctly"/imm32
1379 68/push 5/imm32
1380 b8/copy-to-eax _test-input-stream/imm32
1381 ff 6/subop/push *(eax+4)
1382
1383 e8/call check-ints-equal/disp32
1384
1385 81 0/subop/add %esp 0xc/imm32
1386
1387
1388
1389 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment: start"/imm32
1390 68/push 0xe/imm32
1391
1392 8b/-> *ecx 0/r32/eax
1393 81 5/subop/subtract %eax _test-input-stream/imm32
1394 50/push-eax
1395
1396 e8/call check-ints-equal/disp32
1397
1398 81 0/subop/add %esp 0xc/imm32
1399
1400
1401
1402 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-comment: end"/imm32
1403 68/push 0x11/imm32
1404
1405 8b/-> *(ecx+4) 0/r32/eax
1406 81 5/subop/subtract %eax _test-input-stream/imm32
1407 50/push-eax
1408
1409 e8/call check-ints-equal/disp32
1410
1411 81 0/subop/add %esp 0xc/imm32
1412
1413 89/<- %esp 5/r32/ebp
1414 5d/pop-to-ebp
1415 c3/return
1416
1417 test-next-word-string-or-expression-without-metadata-returns-string-literal:
1418
1419 55/push-ebp
1420 89/<- %ebp 4/r32/esp
1421
1422
1423
1424 68/push _test-input-stream/imm32
1425
1426 e8/call clear-stream/disp32
1427
1428 81 0/subop/add %esp 4/imm32
1429
1430 68/push 0/imm32/end
1431 68/push 0/imm32/start
1432 89/<- %ecx 4/r32/esp
1433
1434
1435 68/push " \"a b\" "/imm32
1436 68/push _test-input-stream/imm32
1437
1438 e8/call write/disp32
1439
1440 81 0/subop/add %esp 8/imm32
1441
1442
1443 51/push-ecx
1444 68/push _test-input-stream/imm32
1445
1446 e8/call next-word-string-or-expression-without-metadata/disp32
1447
1448 81 0/subop/add %esp 8/imm32
1449
1450
1451
1452 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-literal: start"/imm32
1453 68/push 0xd/imm32
1454
1455 8b/-> *ecx 0/r32/eax
1456 81 5/subop/subtract %eax _test-input-stream/imm32
1457 50/push-eax
1458
1459 e8/call check-ints-equal/disp32
1460
1461 81 0/subop/add %esp 0xc/imm32
1462
1463
1464
1465 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-literal: end"/imm32
1466 68/push 0x12/imm32
1467
1468 8b/-> *(ecx+4) 0/r32/eax
1469 81 5/subop/subtract %eax _test-input-stream/imm32
1470 50/push-eax
1471
1472 e8/call check-ints-equal/disp32
1473
1474 81 0/subop/add %esp 0xc/imm32
1475
1476 89/<- %esp 5/r32/ebp
1477 5d/pop-to-ebp
1478 c3/return
1479
1480 test-next-word-string-or-expression-without-metadata-returns-string-with-escapes:
1481
1482 55/push-ebp
1483 89/<- %ebp 4/r32/esp
1484
1485
1486
1487 68/push _test-input-stream/imm32
1488
1489 e8/call clear-stream/disp32
1490
1491 81 0/subop/add %esp 4/imm32
1492
1493 68/push 0/imm32/end
1494 68/push 0/imm32/start
1495 89/<- %ecx 4/r32/esp
1496
1497
1498 68/push " \"a\\\"b\""/imm32
1499 68/push _test-input-stream/imm32
1500
1501 e8/call write/disp32
1502
1503 81 0/subop/add %esp 8/imm32
1504
1505
1506 51/push-ecx
1507 68/push _test-input-stream/imm32
1508
1509 e8/call next-word-string-or-expression-without-metadata/disp32
1510
1511 81 0/subop/add %esp 8/imm32
1512
1513
1514
1515 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-with-escapes: start"/imm32
1516 68/push 0xd/imm32
1517
1518 8b/-> *ecx 0/r32/eax
1519 81 5/subop/subtract %eax _test-input-stream/imm32
1520 50/push-eax
1521
1522 e8/call check-ints-equal/disp32
1523
1524 81 0/subop/add %esp 0xc/imm32
1525
1526
1527
1528 68/push "F - test-next-word-string-or-expression-without-metadata-returns-string-with-escapes: end"/imm32
1529 68/push 0x13/imm32
1530
1531 8b/-> *(ecx+4) 0/r32/eax
1532 81 5/subop/subtract %eax _test-input-stream/imm32
1533 50/push-eax
1534
1535 e8/call check-ints-equal/disp32
1536
1537 81 0/subop/add %esp 0xc/imm32
1538
1539 89/<- %esp 5/r32/ebp
1540 5d/pop-to-ebp
1541 c3/return
1542
1543 test-next-word-string-or-expression-without-metadata-returns-whole-expression:
1544
1545 55/push-ebp
1546 89/<- %ebp 4/r32/esp
1547
1548
1549
1550 68/push _test-input-stream/imm32
1551
1552 e8/call clear-stream/disp32
1553
1554 81 0/subop/add %esp 4/imm32
1555
1556 68/push 0/imm32/end
1557 68/push 0/imm32/start
1558 89/<- %ecx 4/r32/esp
1559
1560
1561 68/push " *(a b) "/imm32
1562 68/push _test-input-stream/imm32
1563
1564 e8/call write/disp32
1565
1566 81 0/subop/add %esp 8/imm32
1567
1568
1569 51/push-ecx
1570 68/push _test-input-stream/imm32
1571
1572 e8/call next-word-string-or-expression-without-metadata/disp32
1573
1574 81 0/subop/add %esp 8/imm32
1575
1576
1577
1578 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-expression: start"/imm32
1579 68/push 0xd/imm32
1580
1581 8b/-> *ecx 0/r32/eax
1582 81 5/subop/subtract %eax _test-input-stream/imm32
1583 50/push-eax
1584
1585 e8/call check-ints-equal/disp32
1586
1587 81 0/subop/add %esp 0xc/imm32
1588
1589
1590
1591 68/push "F - test-next-word-string-or-expression-without-metadata-returns-whole-expression: end"/imm32
1592 68/push 0x13/imm32
1593
1594 8b/-> *(ecx+4) 0/r32/eax
1595 81 5/subop/subtract %eax _test-input-stream/imm32
1596 50/push-eax
1597
1598 e8/call check-ints-equal/disp32
1599
1600 81 0/subop/add %esp 0xc/imm32
1601
1602 89/<- %esp 5/r32/ebp
1603 5d/pop-to-ebp
1604 c3/return
1605
1606 test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren:
1607
1608 55/push-ebp
1609 89/<- %ebp 4/r32/esp
1610
1611
1612
1613 68/push _test-input-stream/imm32
1614
1615 e8/call clear-stream/disp32
1616
1617 81 0/subop/add %esp 4/imm32
1618
1619 68/push 0/imm32/end
1620 68/push 0/imm32/start
1621 89/<- %ecx 4/r32/esp
1622
1623
1624 68/push " ) "/imm32
1625 68/push _test-input-stream/imm32
1626
1627 e8/call write/disp32
1628
1629 81 0/subop/add %esp 8/imm32
1630
1631
1632 51/push-ecx
1633 68/push _test-input-stream/imm32
1634
1635 e8/call next-word-string-or-expression-without-metadata/disp32
1636
1637 81 0/subop/add %esp 8/imm32
1638
1639
1640 68/push "F - test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren: start"/imm32
1641 68/push 0/imm32
1642 ff 6/subop/push *ecx
1643
1644 e8/call check-ints-equal/disp32
1645
1646 81 0/subop/add %esp 0xc/imm32
1647
1648
1649 68/push "F - test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-close-paren: end"/imm32
1650 68/push 0/imm32
1651 ff 6/subop/push *(ecx+4)
1652
1653 e8/call check-ints-equal/disp32
1654
1655 81 0/subop/add %esp 0xc/imm32
1656
1657 89/<- %esp 5/r32/ebp
1658 5d/pop-to-ebp
1659 c3/return
1660
1661 test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren:
1662
1663 55/push-ebp
1664 89/<- %ebp 4/r32/esp
1665
1666
1667
1668 68/push _test-input-stream/imm32
1669
1670 e8/call clear-stream/disp32
1671
1672 81 0/subop/add %esp 4/imm32
1673
1674 68/push 0/imm32/end
1675 68/push 0/imm32/start
1676 89/<- %ecx 4/r32/esp
1677
1678
1679 68/push " ) # abc "/imm32
1680 68/push _test-input-stream/imm32
1681
1682 e8/call write/disp32
1683
1684 81 0/subop/add %esp 8/imm32
1685
1686
1687 51/push-ecx
1688 68/push _test-input-stream/imm32
1689
1690 e8/call next-word-string-or-expression-without-metadata/disp32
1691
1692 81 0/subop/add %esp 8/imm32
1693
1694
1695 68/push "F - test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren: start"/imm32
1696 68/push 0/imm32
1697 ff 6/subop/push *ecx
1698
1699 e8/call check-ints-equal/disp32
1700
1701 81 0/subop/add %esp 0xc/imm32
1702
1703
1704 68/push "F - test-next-word-string-or-expression-without-metadata-handles-comment-after-trailing-close-paren: end"/imm32
1705 68/push 0/imm32
1706 ff 6/subop/push *(ecx+4)
1707
1708 e8/call check-ints-equal/disp32
1709
1710 81 0/subop/add %esp 0xc/imm32
1711
1712 89/<- %esp 5/r32/ebp
1713 5d/pop-to-ebp
1714 c3/return
1715
1716 test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren:
1717
1718 55/push-ebp
1719 89/<- %ebp 4/r32/esp
1720
1721
1722
1723 68/push _test-input-stream/imm32
1724
1725 e8/call clear-stream/disp32
1726
1727 81 0/subop/add %esp 4/imm32
1728
1729 68/push 0/imm32/end
1730 68/push 0/imm32/start
1731 89/<- %ecx 4/r32/esp
1732
1733
1734 68/push " )\n"/imm32
1735 68/push _test-input-stream/imm32
1736
1737 e8/call write/disp32
1738
1739 81 0/subop/add %esp 8/imm32
1740
1741
1742 51/push-ecx
1743 68/push _test-input-stream/imm32
1744
1745 e8/call next-word-string-or-expression-without-metadata/disp32
1746
1747 81 0/subop/add %esp 8/imm32
1748
1749
1750 68/push "F - test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren: start"/imm32
1751 68/push 0/imm32
1752 ff 6/subop/push *ecx
1753
1754 e8/call check-ints-equal/disp32
1755
1756 81 0/subop/add %esp 0xc/imm32
1757
1758
1759 68/push "F - test-next-word-string-or-expression-without-metadata-handles-newline-after-trailing-close-paren: end"/imm32
1760 68/push 0/imm32
1761 ff 6/subop/push *(ecx+4)
1762
1763 e8/call check-ints-equal/disp32
1764
1765 81 0/subop/add %esp 0xc/imm32
1766
1767 89/<- %esp 5/r32/ebp
1768 5d/pop-to-ebp
1769 c3/return
1770
1771 test-next-word-string-or-expression-without-metadata-stops-at-close-paren:
1772
1773 55/push-ebp
1774 89/<- %ebp 4/r32/esp
1775
1776
1777
1778 68/push _test-input-stream/imm32
1779
1780 e8/call clear-stream/disp32
1781
1782 81 0/subop/add %esp 4/imm32
1783
1784 68/push 0/imm32/end
1785 68/push 0/imm32/start
1786 89/<- %ecx 4/r32/esp
1787
1788
1789 68/push " abc) # def"/imm32
1790 68/push _test-input-stream/imm32
1791
1792 e8/call write/disp32
1793
1794 81 0/subop/add %esp 8/imm32
1795
1796
1797 51/push-ecx
1798 68/push _test-input-stream/imm32
1799
1800 e8/call next-word-string-or-expression-without-metadata/disp32
1801
1802 81 0/subop/add %esp 8/imm32
1803
1804
1805
1806 68/push "F - test-next-word-string-or-expression-without-metadata-stops-at-close-paren: start"/imm32
1807 68/push 0xd/imm32
1808
1809 8b/-> *ecx 0/r32/eax
1810 81 5/subop/subtract %eax _test-input-stream/imm32
1811 50/push-eax
1812
1813 e8/call check-ints-equal/disp32
1814
1815 81 0/subop/add %esp 0xc/imm32
1816
1817
1818
1819 68/push "F - test-next-word-string-or-expression-without-metadata-stops-at-close-paren: end"/imm32
1820 68/push 0x10/imm32
1821
1822 8b/-> *(ecx+4) 0/r32/eax
1823 81 5/subop/subtract %eax _test-input-stream/imm32
1824 50/push-eax
1825
1826 e8/call check-ints-equal/disp32
1827
1828 81 0/subop/add %esp 0xc/imm32
1829
1830 89/<- %esp 5/r32/ebp
1831 5d/pop-to-ebp
1832 c3/return