about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
Diffstat (limited to 'subx')
-rw-r--r--subx/050write_stderr.subx6
-rw-r--r--subx/051test.subx11
-rwxr-xr-xsubx/apps/crenshaw2-1bin2258 -> 2522 bytes
-rwxr-xr-xsubx/apps/factorialbin2256 -> 2520 bytes
-rwxr-xr-xsubx/test_layers10
5 files changed, 27 insertions, 0 deletions
diff --git a/subx/050write_stderr.subx b/subx/050write_stderr.subx
index 51fd5a80..0eb402df 100644
--- a/subx/050write_stderr.subx
+++ b/subx/050write_stderr.subx
@@ -4,6 +4,12 @@
 # op          subop               mod             rm32          base        index         scale       r32
 # 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
+# main:  (manual test if this is the last file loaded)
+  # exit(0) -- we don't bother testing write-stderr just yet
+  bb/copy-to-EBX  0/imm32
+  b8/copy-to-EAX  1/imm32
+  cd/syscall  0x80/imm8
+
 write-stderr:  # s : (address array byte) -> <void>
   # prolog
   55/push-EBP
diff --git a/subx/051test.subx b/subx/051test.subx
index f60ba158..1e3968bf 100644
--- a/subx/051test.subx
+++ b/subx/051test.subx
@@ -4,6 +4,17 @@
 # op          subop               mod             rm32          base        index         scale       r32
 # 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 
+# main:  (manual test if this is the last file loaded)
+  # check-ints-equal(34, 34) == 1
+  68/push  34/imm32
+  68/push  34/imm32
+  e8/call  check-ints-equal/disp32
+  81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+  # exit(0)
+  bb/copy-to-EBX  0/imm32
+  b8/copy-to-EAX  1/imm32
+  cd/syscall  0x80/imm8
+
 # print msg to stderr if a != b, otherwise print "."
 check-ints-equal:  # (a : int, b : int, msg : (address array byte)) -> boolean
   # prolog
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index dfd1442c..f551dbf9 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial
index 3127b5c1..5b7811bc 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/test_layers b/subx/test_layers
index bd1d8b33..51fa905f 100755
--- a/subx/test_layers
+++ b/subx/test_layers
@@ -1,11 +1,21 @@
 #!/bin/bash
 # Repeatedly stop building until successive layers, and run all tests built.
+#
+# Assumes .subx files all come after .cc files.
 
 set -e
 
 cd `dirname $0`
+# add C++ files one at a time
 for f in [0-9]*cc
 do
   echo "=== $f"
   ./build_and_test_until $f  ||  exit 1
 done
+
+# add SubX files one at a time
+for f in [0-9]*.subx
+do
+  echo "=== $f"
+  CFLAGS=-g ./subx translate $(../enumerate/enumerate --until $f |grep '\.subx$') -o foo  &&  ./subx run foo
+done