about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--059stop.subx2
-rw-r--r--078table.subx37
-rwxr-xr-xapps/assortbin35848 -> 35948 bytes
-rwxr-xr-xapps/crenshaw2-1bin29582 -> 29682 bytes
-rwxr-xr-xapps/crenshaw2-1bbin30141 -> 30241 bytes
-rwxr-xr-xapps/dquotesbin42404 -> 42504 bytes
-rwxr-xr-xapps/factorialbin28594 -> 28694 bytes
-rwxr-xr-xapps/handlebin29448 -> 29548 bytes
-rwxr-xr-xapps/hexbin38241 -> 38341 bytes
-rwxr-xr-xapps/packbin48534 -> 48634 bytes
-rwxr-xr-xapps/surveybin45131 -> 45231 bytes
-rwxr-xr-xapps/testsbin34660 -> 34760 bytes
12 files changed, 34 insertions, 5 deletions
diff --git a/059stop.subx b/059stop.subx
index 64444314..7fc99a27 100644
--- a/059stop.subx
+++ b/059stop.subx
@@ -144,7 +144,7 @@ test-stop-skips-returns-on-exit:
     # restore args
     58/pop-to-EAX
     # check that _test-stop-1 tried to call exit(1)
-    # check-ints-equal(ed->value, 2, msg)  # i.e. stop was called with value 1
+    # . check-ints-equal(ed->value, 2, msg)  # i.e. stop was called with value 1
     # . . push args
     68/push  "F - test-stop-skips-returns-on-exit"/imm32
     68/push  2/imm32
diff --git a/078table.subx b/078table.subx
index 09903f81..0a6e7c57 100644
--- a/078table.subx
+++ b/078table.subx
@@ -922,7 +922,7 @@ $test-leaky-get-or-insert-slice:end:
     5d/pop-to-EBP
     c3/return
 
-# if no row is found, stop using 'ed'
+# if no row is found, stop(ed)
 get-or-stop:  # table : (address stream {string, _}), key : (address string), row-size : int,
               # abort-message-prefix : (address string), err : (address buffered-file), ed : (address exit-descriptor)
               # -> EAX : (address _)
@@ -994,7 +994,7 @@ $get-or-stop:stop:
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
     # . write-buffered(err, error)
     # . . push args
-    68/push  ": get: key not found: "/imm32
+    68/push  ": get-or-stop: key not found: "/imm32
     ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0x18/disp8      .                 # push *(EBP+24)
     # . . call
     e8/call  write-buffered/disp32
@@ -1018,7 +1018,7 @@ $get-or-stop:stop:
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
     # . stop(ed, 1)
     # . . push args
-    bb/copy-to-EBX  1/imm32
+    68/push  1/imm32
     ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0x1c/disp8      .                 # push *(EBP+28)
     # . . call
     e8/call  stop/disp32
@@ -1035,7 +1035,7 @@ test-get-or-stop:
     # . prolog
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - setup
+    # setup
     # . clear-stream(_test-error-stream)
     # . . push args
     68/push  _test-error-stream/imm32
@@ -1093,6 +1093,7 @@ $test-get-or-stop:success:
     e8/call  get-or-stop/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x18/imm32        # add to ESP
+$test-get-or-stop:success-assertion:
     # check-ints-equal(EAX - table->data, 4, msg)
     # . check-ints-equal(EAX - table, 16, msg)
     # . . push args
@@ -1104,6 +1105,34 @@ $test-get-or-stop:success:
     e8/call  check-ints-equal/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+$test-get-or-stop:failure:
+    # EAX = get-or-stop(table, "data", row-size=8, msg, _test-error-buffered-file, ed)
+    # . . push args
+    52/push-EDX/ed
+    68/push  _test-error-buffered-file/imm32
+    68/push  "foo"/imm32
+    68/push  8/imm32/row-size
+    68/push  "data"/imm32
+    51/push-ECX
+    # . . call
+    e8/call  get-or-stop/disp32
+    # registers except ESP may be clobbered at this point
+    # restore register args, discard others
+    59/pop-to-ECX
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x10/imm32        # add to ESP
+    5a/pop-to-EDX
+$test-get-or-stop:failure-assertion:
+    # check that get-or-stop tried to call stop(1)
+    # . check-ints-equal(ed->value, 2, msg)
+    # . . push args
+    68/push  "F - test-get-or-stop/1"/imm32
+    68/push  2/imm32
+    # . . push ed->value
+    ff          6/subop/push        1/mod/*+disp8   2/rm32/EDX    .           .             .           .           4/disp8         .                 # push *(EDX+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
 $test-get-or-stop:end:
     # . epilog
     # don't restore ESP from EBP; manually reclaim locals
diff --git a/apps/assort b/apps/assort
index 5a4ff14e..97660d3c 100755
--- a/apps/assort
+++ b/apps/assort
Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1
index a1919314..4b8559fd 100755
--- a/apps/crenshaw2-1
+++ b/apps/crenshaw2-1
Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b
index e806dd96..f1f34232 100755
--- a/apps/crenshaw2-1b
+++ b/apps/crenshaw2-1b
Binary files differdiff --git a/apps/dquotes b/apps/dquotes
index 156efcf6..1ccfd2a7 100755
--- a/apps/dquotes
+++ b/apps/dquotes
Binary files differdiff --git a/apps/factorial b/apps/factorial
index ef2f24a7..b7b51d79 100755
--- a/apps/factorial
+++ b/apps/factorial
Binary files differdiff --git a/apps/handle b/apps/handle
index 2243ab53..9ed11054 100755
--- a/apps/handle
+++ b/apps/handle
Binary files differdiff --git a/apps/hex b/apps/hex
index d0472e49..7bf66c63 100755
--- a/apps/hex
+++ b/apps/hex
Binary files differdiff --git a/apps/pack b/apps/pack
index 1174a82a..ead510f0 100755
--- a/apps/pack
+++ b/apps/pack
Binary files differdiff --git a/apps/survey b/apps/survey
index f23e4590..6ca419a6 100755
--- a/apps/survey
+++ b/apps/survey
Binary files differdiff --git a/apps/tests b/apps/tests
index 193bb969..cfb1fbe7 100755
--- a/apps/tests
+++ b/apps/tests
Binary files differ