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