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