about summary refs log tree commit diff stats
path: root/subx/apps
diff options
context:
space:
mode:
Diffstat (limited to 'subx/apps')
-rwxr-xr-xsubx/apps/crenshaw2-1bin17612 -> 17607 bytes
-rw-r--r--subx/apps/crenshaw2-1.subx16
-rwxr-xr-xsubx/apps/crenshaw2-1bbin18171 -> 18166 bytes
-rw-r--r--subx/apps/crenshaw2-1b.subx22
-rwxr-xr-xsubx/apps/factorialbin16530 -> 16525 bytes
-rw-r--r--subx/apps/factorial.subx2
-rwxr-xr-xsubx/apps/handlebin17323 -> 17318 bytes
-rwxr-xr-xsubx/apps/hexbin20591 -> 20586 bytes
-rw-r--r--subx/apps/hex.subx32
-rwxr-xr-xsubx/apps/packbin20768 -> 20763 bytes
-rw-r--r--subx/apps/pack.subx24
11 files changed, 48 insertions, 48 deletions
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index 3391c314..73a34441 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx
index 7c279955..3fe51fd7 100644
--- a/subx/apps/crenshaw2-1.subx
+++ b/subx/apps/crenshaw2-1.subx
@@ -37,7 +37,7 @@
 # main: run tests if necessary, call 'compile' if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if argc > 1 and argv[1] == "test" then return run_tests()
+    # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
     7e/jump-if-lesser-or-equal  $run-main/disp8
@@ -199,8 +199,8 @@ $compile:end:
 # 'in' into it on exit.
 get-num:  # in : (address buffered-file), out : (address stream), err : fd or (address stream), ed : (address exit-descriptor) -> <void>
     # pseudocode:
-    #   if !is-digit?(Look) expected(ed, err, "integer")
-    #   if out->write >= out->length
+    #   if (!is-digit?(Look)) expected(ed, err, "integer")
+    #   if (out->write >= out->length)
     #     write(err, "Error: too many digits in number\n")
     #     stop(ed, 1)
     #   out->data[out->write] = LSB(Look)
@@ -221,7 +221,7 @@ get-num:  # in : (address buffered-file), out : (address stream), err : fd or (a
     # . prolog
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if is-digit?(Look) expected(ed, err, "integer")
+    # - if (is-digit?(Look)) expected(ed, err, "integer")
     # . EAX = is-digit?(Look)
     # . . push args
     ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Look/disp32     .                 # push *Look
@@ -229,7 +229,7 @@ get-num:  # in : (address buffered-file), out : (address stream), err : fd or (a
     e8/call  is-digit?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . if EAX == 0
+    # . if (EAX == 0)
     3d/compare-EAX  0/imm32
     75/jump-if-not-equal  $get-num:main/disp8
     # . expected(ed, err, "integer")
@@ -259,7 +259,7 @@ $get-num:main:
     8b/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           1/r32/ECX   .               .                 # copy *EDI to ECX
     # EDX = out->length
     8b/copy                         1/mod/*+disp8   7/rm32/EDI    .           .             .           2/r32/EDX   8/disp8         .                 # copy *(EDI+8) to EDX
-    # if out->write >= out->length error
+    # if (out->write >= out->length) error
     39/compare                      3/mod/direct    2/rm32/EDX    .           .             .           1/r32/ECX   .               .                 # compare EDX with ECX
     7d/jump-if-lesser  $get-num:stage2/disp8
     # . error(ed, err, msg)  # TODO: show full number
@@ -559,10 +559,10 @@ is-digit?:  # c : int -> EAX : boolean
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # EAX = false
     b8/copy-to-EAX  0/imm32
-    # if c < '0' return false
+    # if (c < '0') return false
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         0x30/imm32        # compare *(EBP+8)
     7c/jump-if-lesser  $is-digit?:end/disp8
-    # if c > '9' return false
+    # if (c > '9') return false
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         0x39/imm32        # compare *(EBP+8)
     7f/jump-if-greater  $is-digit?:end/disp8
     # otherwise return true
diff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b
index 24c37657..80c9e4f0 100755
--- a/subx/apps/crenshaw2-1b
+++ b/subx/apps/crenshaw2-1b
Binary files differdiff --git a/subx/apps/crenshaw2-1b.subx b/subx/apps/crenshaw2-1b.subx
index 0df86a68..4fc2680b 100644
--- a/subx/apps/crenshaw2-1b.subx
+++ b/subx/apps/crenshaw2-1b.subx
@@ -37,7 +37,7 @@
 # main: run tests if necessary, call 'compile' if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if argc > 1 and argv[1] == "test" then return run_tests()
+    # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
     7e/jump-if-lesser-or-equal  $run-main/disp8
@@ -200,15 +200,15 @@ $compile:end:
 # 'in' (rest). We leave the next byte from 'in' into 'Look' on exit.
 get-num:  # in : (address buffered-file), out : (address stream), err : fd or (address stream), ed : (address exit-descriptor) -> <void>
     # pseudocode:
-    #   if !is-digit?(Look) expected(ed, err, "integer")
+    #   if (!is-digit?(Look)) expected(ed, err, "integer")
     #   do
-    #     if out->write >= out->length
+    #     if (out->write >= out->length)
     #       write(err, "Error: too many digits in number\n")
     #       stop(ed, 1)
     #     out->data[out->write] = LSB(Look)
     #     ++out->write
     #     Look = get-char(in)
-    #   while is-digit?(Look)
+    #   while (is-digit?(Look))
     # This is complicated because I don't want to hard-code the error strategy in
     # a general helper like write-byte. Maybe I should just create a local helper.
     #
@@ -226,7 +226,7 @@ get-num:  # in : (address buffered-file), out : (address stream), err : fd or (a
     # . prolog
     55/push-EBP
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if is-digit?(Look) expected(ed, err, "integer")
+    # - if (is-digit?(Look)) expected(ed, err, "integer")
     # . EAX = is-digit?(Look)
     # . . push args
     ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Look/disp32     .                 # push *Look
@@ -234,7 +234,7 @@ get-num:  # in : (address buffered-file), out : (address stream), err : fd or (a
     e8/call  is-digit?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . if EAX == 0
+    # . if (EAX == 0)
     3d/compare-EAX  0/imm32
     75/jump-if-not-equal  $get-num:main/disp8
     # . expected(ed, err, "integer")
@@ -265,7 +265,7 @@ $get-num:main:
     # EDX = out->length
     8b/copy                         1/mod/*+disp8   7/rm32/EDI    .           .             .           2/r32/EDX   8/disp8         .                 # copy *(EDI+8) to EDX
 $get-num:loop:
-    # if out->write >= out->length error
+    # if (out->write >= out->length) error
     39/compare                      3/mod/direct    2/rm32/EDX    .           .             .           1/r32/ECX   .               .                 # compare EDX with ECX
     7d/jump-if-lesser  $get-num:loop-stage2/disp8
     # . error(ed, err, msg)  # TODO: show full number
@@ -291,7 +291,7 @@ $get-num:loop-stage2:
     e8/call  get-char/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # if is-digit?(Look) loop
+    # if (is-digit?(Look)) loop
     # . EAX = is-digit?(Look)
     # . . push args
     ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Look/disp32     .                 # push *Look
@@ -299,7 +299,7 @@ $get-num:loop-stage2:
     e8/call  is-digit?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . if EAX loop
+    # . if (EAX != 0) loop
     3d/compare-EAX  0/imm32
     0f 85/jump-if-not-equal  $get-num:loop/disp32
 $get-num:loop-end:
@@ -756,10 +756,10 @@ is-digit?:  # c : int -> EAX : boolean
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # EAX = false
     b8/copy-to-EAX  0/imm32
-    # if c < '0' return false
+    # if (c < '0') return false
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         0x30/imm32        # compare *(EBP+8)
     7c/jump-if-lesser  $is-digit?:end/disp8
-    # if c > '9' return false
+    # if (c > '9') return false
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         0x39/imm32        # compare *(EBP+8)
     7f/jump-if-greater  $is-digit?:end/disp8
     # otherwise return true
diff --git a/subx/apps/factorial b/subx/apps/factorial
index 01112b12..83a5e14f 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/apps/factorial.subx b/subx/apps/factorial.subx
index a239d419..912285e2 100644
--- a/subx/apps/factorial.subx
+++ b/subx/apps/factorial.subx
@@ -21,7 +21,7 @@
 # main:
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if argc > 1 and argv[1] == "test" then return run_tests()
+    # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
     7e/jump-if-lesser-or-equal  $run-main/disp8
diff --git a/subx/apps/handle b/subx/apps/handle
index 164fbd1a..d79ed98e 100755
--- a/subx/apps/handle
+++ b/subx/apps/handle
Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex
index 5edc02a3..a9500830 100755
--- a/subx/apps/hex
+++ b/subx/apps/hex
Binary files differdiff --git a/subx/apps/hex.subx b/subx/apps/hex.subx
index 2c1606ed..d841fd8b 100644
--- a/subx/apps/hex.subx
+++ b/subx/apps/hex.subx
@@ -25,7 +25,7 @@
 # main: run tests if necessary, convert stdin if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if argc > 1 and argv[1] == "test" then return run_tests()
+    # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
     7e/jump-if-lesser-or-equal  $run-main/disp8
@@ -73,7 +73,7 @@ convert:  # in : (address buffered-file), out : (address buffered-file), err : (
     # pseudocode:
     #   repeatedly
     #     EAX = convert-next-octet(in, err, ed)
-    #     if EAX == 0xffffffff break  # eof
+    #     if (EAX == 0xffffffff) break  # eof
     #     write-byte(out, AL)
     #   flush(out)
     #
@@ -92,7 +92,7 @@ $convert:loop:
     e8/call  convert-next-octet/disp32
     # . . discard first 2 args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
-    # if EAX == 0xffffffff break
+    # if (EAX == 0xffffffff) break
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0xffffffff/imm32  # compare EAX
     74/jump-if-equal  $convert:loop-end/disp8
     # write-byte(out, AL)
@@ -489,10 +489,10 @@ scan-next-byte:  # in : (address buffered-file), err : (address buffered-file),
     # pseudocode:
     #   repeatedly
     #     EAX = read-byte(in)
-    #     if EAX == 0xffffffff return EAX
-    #     if is-hex-digit?(EAX) return EAX
-    #     if EAX == ' ' or '\t' or '\n' continue
-    #     if EAX == '#' skip-until-newline(in)
+    #     if (EAX == 0xffffffff) return EAX
+    #     if (is-hex-digit?(EAX)) return EAX
+    #     if (EAX == ' ' or '\t' or '\n') continue
+    #     if (EAX == '#') skip-until-newline(in)
     #     else error-byte(ed, err, "invalid byte: " EAX)
     #
     # . prolog
@@ -510,7 +510,7 @@ $scan-next-byte:loop:
     # if (EAX == 0xffffffff) return EAX
     3d/compare-with-EAX  0xffffffff/imm32
     74/jump-if-equal  $scan-next-byte:end/disp8
-    # if is-hex-digit?(EAX) return EAX
+    # if (is-hex-digit?(EAX)) return EAX
     # . save EAX for now
     50/push-EAX
     # . is-hex-digit?(EAX)
@@ -527,17 +527,17 @@ $scan-next-byte:loop:
     # . check whether to return
     75/jump-if-not-equal  $scan-next-byte:end/disp8
 $scan-next-byte:check1:
-    # if EAX == ' ' continue
+    # if (EAX == ' ') continue
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0x20/imm32        # compare EAX
     74/jump-if-equal  $scan-next-byte:loop/disp8
-    # if EAX == '\t' continue
+    # if (EAX == '\t') continue
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0x9/imm32         # compare EAX
     74/jump-if-equal  $scan-next-byte:loop/disp8
-    # if EAX == '\n' continue
+    # if (EAX == '\n') continue
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0xa/imm32         # compare EAX
     74/jump-if-equal  $scan-next-byte:loop/disp8
 $scan-next-byte:check2:
-    # if EAX == '#' skip-until-newline(in)
+    # if (EAX == '#') skip-until-newline(in)
     3d/compare-with-EAX  0x23/imm32
     75/jump-if-not-equal  $scan-next-byte:check3/disp8
     # . skip-until-newline(in)
@@ -1413,8 +1413,8 @@ skip-until-newline:  # in : (address buffered-file) -> <void>
     #   push EAX
     #   repeatedly:
     #     EAX = read-byte(in)
-    #     if EAX == 0xffffffff break
-    #     if EAX == 0x0a break
+    #     if (EAX == 0xffffffff) break
+    #     if (EAX == 0x0a) break
     #   pop EAX
     # . prolog
     55/push-EBP
@@ -1429,10 +1429,10 @@ $skip-until-newline:loop:
     e8/call  read-byte/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . if EAX == 0xffffffff break
+    # . if (EAX == 0xffffffff) break
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0xffffffff/imm32  # compare EAX
     74/jump-if-equal  $skip-until-newline:end/disp8
-    # . if EAX != 0xa/newline loop
+    # . if (EAX != 0xa/newline) loop
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0xa/imm32         # compare EAX
     75/jump-if-not-equal  $skip-until-newline:loop/disp8
 $skip-until-newline:end:
diff --git a/subx/apps/pack b/subx/apps/pack
index 075dc69b..e55b170a 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differdiff --git a/subx/apps/pack.subx b/subx/apps/pack.subx
index 07988399..a27d2613 100644
--- a/subx/apps/pack.subx
+++ b/subx/apps/pack.subx
@@ -28,7 +28,7 @@
 # main: run tests if necessary, convert stdin if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # - if argc > 1 and argv[1] == "test" then return run_tests()
+    # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
     7e/jump-if-lesser-or-equal  $run-main/disp8
@@ -88,7 +88,7 @@ convert:  # in : (address buffered-file), out : (address buffered-file) -> <void
     #   repeatedly
     #     clear-stream(line)
     #     EAX = read-line(in, line)
-    #     if EAX == EOF break
+    #     if (EAX == EOF) break
     #     convert-instruction(line, out)
     #   flush(out)
     #
@@ -119,7 +119,7 @@ $convert:loop:
     e8/call  convert-instruction/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # if EAX == 0xffffffff break
+    # if (EAX == 0xffffffff) break
     3d/compare-with-EAX  0xffffffff/imm32
     74/jump-if-equal  $convert:break/disp8
     # convert-instruction(line, out)
@@ -200,10 +200,10 @@ $convert:end:
 convert-instruction:  # line : (address stream byte), out : (address buffered-file) -> <void>
     # pseudocode:
     #   word-slice = next-word
-    #   if *word-slice->start == '#'
+    #   if (*word-slice->start == '#')
     #     write-stream-buffered(out, line)
     #     return
-    #   if starts-with(word-slice, '==')
+    #   if (starts-with(word-slice, '=='))
     #     write-stream-buffered(out, line)
     #     return
     #
@@ -599,7 +599,7 @@ next-word:  # line : (address stream byte), out : (address slice)
     8b/copy                         1/mod/*+disp8   6/rm32/ESI    .           .             .           1/r32/ECX   4/disp8         .                 # copy *(ESI+4) to ECX
     8d/copy-address                 1/mod/*+disp8   4/rm32/sib    6/base/ESI  1/index/ECX   .           0/r32/EAX   0xc/disp8       .                 # copy ESI+ECX+12 to EAX
     89/copy                         0/mod/indirect  7/rm32/EDI    .           .             .           0/r32/EAX   .               .                 # copy EAX to *EDI
-    # if line->data[line->read] == '#': out->end = &line->data[line->write]), skip rest of stream and return
+    # if (line->data[line->read] == '#') out->end = &line->data[line->write]), skip rest of stream and return
     # . EAX = line->data[line->read]
     31/xor                          3/mod/direct    0/rm32/EAX    .           .             .           0/r32/EAX   .               .                 # clear EAX
     8a/copy-byte                    1/mod/*+disp8   4/rm32/sib    6/base/ESI  1/index/ECX   .           0/r32/AL    0xc/disp8       .                 # copy byte at *(ESI+ECX+12) to AL
@@ -770,8 +770,8 @@ has-metadata?:  # word : (address slice), s : (address string) -> EAX : boolean
     #   curr = twig->end
     #   while true:
     #     twig = next-token-from-slice(curr, word->end, '/')
-    #     if twig.empty() break
-    #     if slice-equal?(twig, s) return true
+    #     if (twig.empty()) break
+    #     if (slice-equal?(twig, s)) return true
     #     curr = twig->end
     #   return false
     # . prolog
@@ -813,7 +813,7 @@ $has-metadata?:loop:
     e8/call  next-token-from-slice/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x10/imm32        # add to ESP
-    # if slice-empty?(twig) return false
+    # if (slice-empty?(twig)) return false
     # . EAX = slice-empty?(twig)
     # . . push args
     57/push-EDI
@@ -824,7 +824,7 @@ $has-metadata?:loop:
     # . if (EAX != 0) return false
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0/imm32           # compare EAX
     75/compare-if-not-equal  $has-metadata?:false/disp8
-    # if slice-equal?(twig, s) return true
+    # if (slice-equal?(twig, s)) return true
     # . EAX = slice-equal?(twig, s)
     # . . push args
     ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0xc/disp8       .                 # push *(EBP+12)
@@ -1058,7 +1058,7 @@ emit:  # out : (address buffered-file), word : (address slice), width : int
     e8/call  next-token-from-slice/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x10/imm32        # add to ESP
-    # if !is-hex-int?(name) write-slice(out, word) and return
+    # if (!is-hex-int?(name)) write-slice(out, word) and return
     # . is-hex-int?(name)
     # . . push args
     57/push-EDI
@@ -1066,7 +1066,7 @@ emit:  # out : (address buffered-file), word : (address slice), width : int
     e8/call  is-hex-int?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
-    # . if EAX == 0
+    # . if (EAX == 0)
     81          7/subop/compare     3/mod/direct    0/rm32/EAX    .           .             .           .           .               0/imm32           # compare EAX
     75/jump-if-not-equal  $emit:hex-int/disp8
     # . write-slice(out, word)