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