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