diff options
-rw-r--r-- | 073next-token.subx | 327 | ||||
-rwxr-xr-x | apps/assort | bin | 39000 -> 40124 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 31336 -> 32460 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 31895 -> 33019 bytes | |||
-rwxr-xr-x | apps/dquotes | bin | 44204 -> 45328 bytes | |||
-rwxr-xr-x | apps/factorial | bin | 30348 -> 31472 bytes | |||
-rwxr-xr-x | apps/handle | bin | 31202 -> 32326 bytes | |||
-rwxr-xr-x | apps/hex | bin | 41393 -> 42517 bytes | |||
-rwxr-xr-x | apps/pack | bin | 51686 -> 52810 bytes | |||
-rwxr-xr-x | apps/sigils | bin | 52840 -> 52840 bytes | |||
-rw-r--r-- | apps/sigils.subx | 327 | ||||
-rwxr-xr-x | apps/survey | bin | 48283 -> 49407 bytes | |||
-rwxr-xr-x | apps/tests | bin | 37812 -> 38936 bytes |
13 files changed, 327 insertions, 327 deletions
diff --git a/073next-token.subx b/073next-token.subx index 36cd56a0..a2969496 100644 --- a/073next-token.subx +++ b/073next-token.subx @@ -1164,4 +1164,331 @@ test-skip-chars-not-matching-whitespace-in-slice: # end c3/return +# update line->read to ')' +# line->read ends at ')' +skip-until-close-paren: # line : (address stream) + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # . save registers + 50/push-eax + 51/push-ecx + 52/push-edx + # ecx = line + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx + # eax = skip-until-close-paren-in-slice(&line->data[line->read], &line->data[line->write]) + # . . push &line->data[line->write] + 8b/copy 1/mod/*+disp8 1/rm32/ecx . . 2/r32/edx 8/disp8 . # copy *(ecx+8) to edx + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx 0xc/disp8 . # copy ecx+edx+12 to edx + 52/push-edx + # . . push &line->data[line->read] + 8b/copy 1/mod/*+disp8 1/rm32/ecx . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx 0xc/disp8 . # copy ecx+edx+12 to edx + 52/push-edx + # . . call + e8/call skip-until-close-paren-in-slice/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # line->read = eax - line->data + 29/subtract 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # subtract ecx from eax + 2d/subtract-from-eax 0xc/imm32 + 89/copy 1/mod/*+disp8 1/rm32/ecx . . 0/r32/eax 4/disp8 . # copy eax to *(ecx+4) +$skip-until-close-paren:end: + # . restore registers + 5a/pop-to-edx + 59/pop-to-ecx + 58/pop-to-eax + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +test-skip-until-close-paren: + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # setup + # . clear-stream(_test-input-stream) + # . . push args + 68/push _test-input-stream/imm32 + # . . call + e8/call clear-stream/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # . write(_test-input-stream, "*(abc) def") + # . indices: 0123 45 + # . . push args + 68/push "*(abc) def"/imm32 + 68/push _test-input-stream/imm32 + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # precondition: line->read == 0 + # . . push args + 68/push "F - test-skip-until-close-paren/precondition"/imm32 + 68/push 0/imm32 + b8/copy-to-eax _test-input-stream/imm32 + ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # skip-until-close-paren(_test-input-stream) + # . . push args + 68/push _test-input-stream/imm32 + # . . call + e8/call skip-until-close-paren/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # check-ints-equal(line->read, 5, msg) + # . . push args + 68/push "F - test-skip-until-close-paren"/imm32 + 68/push 5/imm32 + b8/copy-to-eax _test-input-stream/imm32 + ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +test-skip-until-close-paren-ignores-spaces: + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # setup + # . clear-stream(_test-input-stream) + # . . push args + 68/push _test-input-stream/imm32 + # . . call + e8/call clear-stream/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # . write(_test-input-stream, "*(a b)/yz") + # . . push args + 68/push "*(a b)/yz"/imm32 + 68/push _test-input-stream/imm32 + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # precondition: line->read == 0 + # . . push args + 68/push "F - test-skip-until-close-paren-ignores-spaces/precondition"/imm32 + 68/push 0/imm32 + b8/copy-to-eax _test-input-stream/imm32 + ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # skip-until-close-paren(_test-input-stream) + # . . push args + 68/push _test-input-stream/imm32 + # . . call + e8/call skip-until-close-paren/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # check-ints-equal(line->read, 5, msg) + # . . push args + 68/push "F - test-skip-until-close-paren-ignores-spaces"/imm32 + 68/push 5/imm32 + b8/copy-to-eax _test-input-stream/imm32 + ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +test-skip-until-close-paren-works-from-mid-stream: + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # setup + # . clear-stream(_test-input-stream) + # . . push args + 68/push _test-input-stream/imm32 + # . . call + e8/call clear-stream/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # . write(_test-input-stream, "0 *(a b)/yz") + # . . push args + 68/push "0 *(a b)/yz"/imm32 + 68/push _test-input-stream/imm32 + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # precondition: _test-input-stream->read == 2 + c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 2/imm32 # copy to *(eax+4) + # skip-until-close-paren(_test-input-stream) + # . . push args + 68/push _test-input-stream/imm32 + # . . call + e8/call skip-until-close-paren/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp + # check-ints-equal(_test-input-stream->read, 7, msg) + # . . push args + 68/push "F - test-skip-until-close-paren-works-from-mid-stream"/imm32 + 68/push 7/imm32 + b8/copy-to-eax _test-input-stream/imm32 + ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +skip-until-close-paren-in-slice: # curr : (address byte), end : (address byte) -> new_curr/eax + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # . save registers + 51/push-ecx + 52/push-edx + # ecx = curr + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx + # edx = end + 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx + # eax = 0 + 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax + # skip initial dquote + 41/increment-ecx +$skip-until-close-paren-in-slice:loop: + # if (curr >= end) break + 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . . # compare ecx with edx + 73/jump-if-greater-unsigned-or-equal $skip-until-close-paren-in-slice:break/disp8 + # AL = *curr + 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . . # copy byte at *ecx to AL +$skip-until-close-paren-in-slice:check-close: + # if (eax == ')') break + 3d/compare-eax-and 0x29/imm32/close-paren + 74/jump-if-equal $skip-until-close-paren-in-slice:break/disp8 + # ++curr + 41/increment-ecx + eb/jump $skip-until-close-paren-in-slice:loop/disp8 +$skip-until-close-paren-in-slice:break: + # return curr + 89/copy 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # copy ecx to eax +$skip-until-close-paren-in-slice:end: + # . restore registers + 5a/pop-to-edx + 59/pop-to-ecx + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +test-skip-until-close-paren-in-slice: + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # setup: (eax..ecx) = "*(abc) def" + b8/copy-to-eax "*(abc) def"/imm32 + 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx + 05/add-to-eax 4/imm32 + # eax = skip-until-close-paren-in-slice(eax, ecx) + # . . push args + 51/push-ecx + 50/push-eax + # . . call + e8/call skip-until-close-paren-in-slice/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # check-ints-equal(ecx-eax, 5, msg) # eax is at the ')' + # . . push args + 68/push "F - test-skip-until-close-paren-in-slice"/imm32 + 68/push 5/imm32 + # . . push ecx-eax + 29/subtract 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . . # subtract eax from ecx + 51/push-ecx + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +test-skip-until-close-paren-in-slice-ignores-spaces: + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # setup: (eax..ecx) = "*(a b)/yz" + b8/copy-to-eax "*(a b)/yz"/imm32 + 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx + 05/add-to-eax 4/imm32 + # eax = skip-until-close-paren-in-slice(eax, ecx) + # . . push args + 51/push-ecx + 50/push-eax + # . . call + e8/call skip-until-close-paren-in-slice/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # check-ints-equal(ecx-eax, 4, msg) # eax is at the ')' + # . . push args + 68/push "F - test-skip-until-close-paren-in-slice-ignores-spaces"/imm32 + 68/push 4/imm32 + # . . push ecx-eax + 29/subtract 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . . # subtract eax from ecx + 51/push-ecx + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + +test-skip-until-close-paren-in-slice-stops-at-end: + # . prolog + 55/push-ebp + 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp + # setup: (eax..ecx) = "*(abc" # unbalanced dquote + b8/copy-to-eax "*(abc"/imm32 + 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx + 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx + 05/add-to-eax 4/imm32 + # eax = skip-until-close-paren-in-slice(eax, ecx) + # . . push args + 51/push-ecx + 50/push-eax + # . . call + e8/call skip-until-close-paren-in-slice/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp + # check-ints-equal(ecx-eax, 0, msg) # skipped to end of slice + # . . push args + 68/push "F - test-skip-until-close-paren-in-slice-stops-at-end"/imm32 + 68/push 0/imm32 + # . . push ecx-eax + 29/subtract 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . . # subtract eax from ecx + 51/push-ecx + # . . call + e8/call check-ints-equal/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp + # . epilog + 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp + 5d/pop-to-ebp + c3/return + # . . vim:nowrap:textwidth=0 diff --git a/apps/assort b/apps/assort index b3353818..3fb6e4c4 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index 3dfd2971..ca3a28c8 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index b22a1c59..407ddf8d 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/dquotes b/apps/dquotes index 86b2aaa0..fd9dbbb1 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/factorial b/apps/factorial index 5bf9c44c..6a003c8c 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/handle b/apps/handle index 7e32773d..bedc525b 100755 --- a/apps/handle +++ b/apps/handle Binary files differdiff --git a/apps/hex b/apps/hex index 4c73dd2b..460cf737 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/pack b/apps/pack index 0b07aca3..6d282e11 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/sigils b/apps/sigils index a26d299c..04242e25 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/sigils.subx b/apps/sigils.subx index aaf67833..4d8ec55f 100644 --- a/apps/sigils.subx +++ b/apps/sigils.subx @@ -4029,333 +4029,6 @@ $emit-indirect-disp32:end: 5d/pop-to-ebp c3/return -# update line->read to ')' -# line->read ends at ')' -skip-until-close-paren: # line : (address stream) - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # . save registers - 50/push-eax - 51/push-ecx - 52/push-edx - # ecx = line - 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx - # eax = skip-until-close-paren-in-slice(&line->data[line->read], &line->data[line->write]) - # . . push &line->data[line->write] - 8b/copy 1/mod/*+disp8 1/rm32/ecx . . 2/r32/edx 8/disp8 . # copy *(ecx+8) to edx - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx 0xc/disp8 . # copy ecx+edx+12 to edx - 52/push-edx - # . . push &line->data[line->read] - 8b/copy 1/mod/*+disp8 1/rm32/ecx . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ecx 2/index/edx . 2/r32/edx 0xc/disp8 . # copy ecx+edx+12 to edx - 52/push-edx - # . . call - e8/call skip-until-close-paren-in-slice/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # line->read = eax - line->data - 29/subtract 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # subtract ecx from eax - 2d/subtract-from-eax 0xc/imm32 - 89/copy 1/mod/*+disp8 1/rm32/ecx . . 0/r32/eax 4/disp8 . # copy eax to *(ecx+4) -$skip-until-close-paren:end: - # . restore registers - 5a/pop-to-edx - 59/pop-to-ecx - 58/pop-to-eax - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -test-skip-until-close-paren: - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # setup - # . clear-stream(_test-input-stream) - # . . push args - 68/push _test-input-stream/imm32 - # . . call - e8/call clear-stream/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . write(_test-input-stream, "*(abc) def") - # . indices: 0123 45 - # . . push args - 68/push "*(abc) def"/imm32 - 68/push _test-input-stream/imm32 - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # precondition: line->read == 0 - # . . push args - 68/push "F - test-skip-until-close-paren/precondition"/imm32 - 68/push 0/imm32 - b8/copy-to-eax _test-input-stream/imm32 - ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # skip-until-close-paren(_test-input-stream) - # . . push args - 68/push _test-input-stream/imm32 - # . . call - e8/call skip-until-close-paren/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # check-ints-equal(line->read, 5, msg) - # . . push args - 68/push "F - test-skip-until-close-paren"/imm32 - 68/push 5/imm32 - b8/copy-to-eax _test-input-stream/imm32 - ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -test-skip-until-close-paren-ignores-spaces: - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # setup - # . clear-stream(_test-input-stream) - # . . push args - 68/push _test-input-stream/imm32 - # . . call - e8/call clear-stream/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . write(_test-input-stream, "*(a b)/yz") - # . . push args - 68/push "*(a b)/yz"/imm32 - 68/push _test-input-stream/imm32 - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # precondition: line->read == 0 - # . . push args - 68/push "F - test-skip-until-close-paren-ignores-spaces/precondition"/imm32 - 68/push 0/imm32 - b8/copy-to-eax _test-input-stream/imm32 - ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # skip-until-close-paren(_test-input-stream) - # . . push args - 68/push _test-input-stream/imm32 - # . . call - e8/call skip-until-close-paren/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # check-ints-equal(line->read, 5, msg) - # . . push args - 68/push "F - test-skip-until-close-paren-ignores-spaces"/imm32 - 68/push 5/imm32 - b8/copy-to-eax _test-input-stream/imm32 - ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -test-skip-until-close-paren-works-from-mid-stream: - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # setup - # . clear-stream(_test-input-stream) - # . . push args - 68/push _test-input-stream/imm32 - # . . call - e8/call clear-stream/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . write(_test-input-stream, "0 *(a b)/yz") - # . . push args - 68/push "0 *(a b)/yz"/imm32 - 68/push _test-input-stream/imm32 - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # precondition: _test-input-stream->read == 2 - c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 2/imm32 # copy to *(eax+4) - # skip-until-close-paren(_test-input-stream) - # . . push args - 68/push _test-input-stream/imm32 - # . . call - e8/call skip-until-close-paren/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # check-ints-equal(_test-input-stream->read, 7, msg) - # . . push args - 68/push "F - test-skip-until-close-paren-works-from-mid-stream"/imm32 - 68/push 7/imm32 - b8/copy-to-eax _test-input-stream/imm32 - ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -skip-until-close-paren-in-slice: # curr : (address byte), end : (address byte) -> new_curr/eax - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # . save registers - 51/push-ecx - 52/push-edx - # ecx = curr - 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx - # edx = end - 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx - # eax = 0 - 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax - # skip initial dquote - 41/increment-ecx -$skip-until-close-paren-in-slice:loop: - # if (curr >= end) break - 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . . # compare ecx with edx - 73/jump-if-greater-unsigned-or-equal $skip-until-close-paren-in-slice:break/disp8 - # AL = *curr - 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . . # copy byte at *ecx to AL -$skip-until-close-paren-in-slice:check-close: - # if (eax == ')') break - 3d/compare-eax-and 0x29/imm32/close-paren - 74/jump-if-equal $skip-until-close-paren-in-slice:break/disp8 - # ++curr - 41/increment-ecx - eb/jump $skip-until-close-paren-in-slice:loop/disp8 -$skip-until-close-paren-in-slice:break: - # return curr - 89/copy 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # copy ecx to eax -$skip-until-close-paren-in-slice:end: - # . restore registers - 5a/pop-to-edx - 59/pop-to-ecx - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -test-skip-until-close-paren-in-slice: - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # setup: (eax..ecx) = "*(abc) def" - b8/copy-to-eax "*(abc) def"/imm32 - 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx - 05/add-to-eax 4/imm32 - # eax = skip-until-close-paren-in-slice(eax, ecx) - # . . push args - 51/push-ecx - 50/push-eax - # . . call - e8/call skip-until-close-paren-in-slice/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # check-ints-equal(ecx-eax, 5, msg) # eax is at the ')' - # . . push args - 68/push "F - test-skip-until-close-paren-in-slice"/imm32 - 68/push 5/imm32 - # . . push ecx-eax - 29/subtract 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . . # subtract eax from ecx - 51/push-ecx - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -test-skip-until-close-paren-in-slice-ignores-spaces: - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # setup: (eax..ecx) = "*(a b)/yz" - b8/copy-to-eax "*(a b)/yz"/imm32 - 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx - 05/add-to-eax 4/imm32 - # eax = skip-until-close-paren-in-slice(eax, ecx) - # . . push args - 51/push-ecx - 50/push-eax - # . . call - e8/call skip-until-close-paren-in-slice/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # check-ints-equal(ecx-eax, 4, msg) # eax is at the ')' - # . . push args - 68/push "F - test-skip-until-close-paren-in-slice-ignores-spaces"/imm32 - 68/push 4/imm32 - # . . push ecx-eax - 29/subtract 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . . # subtract eax from ecx - 51/push-ecx - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - -test-skip-until-close-paren-in-slice-stops-at-end: - # . prolog - 55/push-ebp - 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # setup: (eax..ecx) = "*(abc" # unbalanced dquote - b8/copy-to-eax "*(abc"/imm32 - 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx - 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx - 05/add-to-eax 4/imm32 - # eax = skip-until-close-paren-in-slice(eax, ecx) - # . . push args - 51/push-ecx - 50/push-eax - # . . call - e8/call skip-until-close-paren-in-slice/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # check-ints-equal(ecx-eax, 0, msg) # skipped to end of slice - # . . push args - 68/push "F - test-skip-until-close-paren-in-slice-stops-at-end"/imm32 - 68/push 0/imm32 - # . . push ecx-eax - 29/subtract 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . . # subtract eax from ecx - 51/push-ecx - # . . call - e8/call check-ints-equal/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # . epilog - 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp - 5d/pop-to-ebp - c3/return - # assumes 'in' starts with optional '+' or '-', optional whitespace, and an unsigned integer # returns the value of the integer # side-effect: modifies 'in' to skip past the integer diff --git a/apps/survey b/apps/survey index 933087ee..3a7123a9 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/tests b/apps/tests index 02cbc643..c1893650 100755 --- a/apps/tests +++ b/apps/tests Binary files differ |