about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--apps/assort.subx14
-rw-r--r--apps/braces.subx8
-rw-r--r--apps/calls.subx4
-rw-r--r--apps/dquotes.subx6
-rw-r--r--apps/mulisp.subx2
-rw-r--r--apps/pack.subx2
-rw-r--r--apps/sigils.subx4
-rwxr-xr-xapps/surveybin52000 -> 52001 bytes
-rw-r--r--apps/survey.subx39
-rw-r--r--apps/tests.subx4
10 files changed, 39 insertions, 44 deletions
diff --git a/apps/assort.subx b/apps/assort.subx
index c423bc14..e78cde41 100644
--- a/apps/assort.subx
+++ b/apps/assort.subx
@@ -88,7 +88,7 @@ $subx-assort-main:end:
 
 subx-assort:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode:
-    #   var table : (address stream) = new-stream(10 rows, 8 bytes each)
+    #   var table : (address stream {string, (address stream byte)} 10/rows)
     #   read-segments(in, table)
     #   write-segments(out, table)
     #
@@ -97,7 +97,7 @@ subx-assort:  # in : (address buffered-file), out : (address buffered-file)
     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
     # . save registers
     51/push-ecx
-    # var table/ecx : (address stream byte) = stream(10 * 8)
+    # var table/ecx : (address stream byte 10*8)
     81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x50/imm32        # subtract from esp
     68/push  0x50/imm32/length
     68/push  0/imm32/read
@@ -453,8 +453,8 @@ test-subx-assort:
 # beware: leaks memory (one name per segment read)
 read-segments:  # in : (address buffered-file), table : (address stream {string, (address stream byte)})
     # pseudocode:
-    #   var curr-segment = null
-    #   var line = new-stream(512, 1)
+    #   var curr-segment : (handle stream byte) = 0
+    #   var line : (stream byte 512)
     #   while true
     #     clear-stream(line)
     #     read-line-buffered(in, line)
@@ -470,7 +470,7 @@ read-segments:  # in : (address buffered-file), table : (address stream {string,
     #       curr-segment = *segment-slot
     #       if curr-segment != 0
     #         continue
-    #       curr-segment = new-stream(Segment-size)
+    #       curr-segment = new-stream(Heap, Segment-size, 1)
     #       *segment-slot = curr-segment
     #     rewind-stream(line)
     #     write-stream(curr-segment, line)  # abort if curr-segment overflows
@@ -494,7 +494,7 @@ read-segments:  # in : (address buffered-file), table : (address stream {string,
     52/push-edx
     53/push-ebx
     56/push-esi
-    # var line/ecx : (address stream byte) = stream(512)
+    # var line/ecx : (stream byte 512)
     81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x200/imm32       # subtract from esp
     68/push  0x200/imm32/length
     68/push  0/imm32/read
@@ -724,7 +724,7 @@ $read-segments:check-for-segment-header:
     e8/call  leaky-get-or-insert-slice/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
-    # curr-segment = *segment-slot
+    # var curr-segment/ebx : (handle stream byte) = *segment-slot
     8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           3/r32/ebx   .               .                 # copy *eax to ebx
     # if (curr-segment != 0) continue
     81          7/subop/compare     3/mod/direct    3/rm32/ebx    .           .             .           .           .               0/imm32           # compare ebx
diff --git a/apps/braces.subx b/apps/braces.subx
index aaae30e5..f1fcdaf4 100644
--- a/apps/braces.subx
+++ b/apps/braces.subx
@@ -77,8 +77,8 @@ $subx-braces-main:end:
 
 subx-braces:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode:
-    #   var line = new-stream(512, 1)
-    #   var label-stack : (address stack) = new-stack(32*4)  # at most 32 levels of nesting
+    #   var line : (stream byte 512)
+    #   var label-stack : (stack address 32)  # at most 32 levels of nesting
     #   var next-label-id : int = 1
     #   while true
     #     clear-stream(line)
@@ -123,13 +123,13 @@ subx-braces:  # in : (address buffered-file), out : (address buffered-file)
     57/push-edi
     # esi = in
     8b/-> *(ebp+8) 6/r32/esi
-    # var line/ecx : (address stream byte) = stream(512)
+    # var line/ecx : (stream byte 512)
     81 5/subop/subtract %esp 0x200/imm32
     68/push 0x200/imm32/length
     68/push 0/imm32/read
     68/push 0/imm32/write
     89/<- %ecx 4/r32/esp
-    # var label-stack/edx : (address stack)
+    # var label-stack/edx : (stack int 32)
     81 5/subop/subtract %esp 0x80/imm32
     68/push 0x80/imm32/length
     68/push 0/imm32/top
diff --git a/apps/calls.subx b/apps/calls.subx
index 5a306dbc..f6de6c7f 100644
--- a/apps/calls.subx
+++ b/apps/calls.subx
@@ -77,8 +77,8 @@ $subx-calls-main:end:
 
 subx-calls:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode:
-    #   var line = new-stream(512, 1)
-    #   var words : (address stream slice) = new-stream(16, 8)  # at most function name and 15 args
+    #   var line : (stream byte 512)
+    #   var words : (stream slice 16)  # at most function name and 15 args
     #   while true
     #     clear-stream(line)
     #     read-line-buffered(in, line)
diff --git a/apps/dquotes.subx b/apps/dquotes.subx
index 0f50f752..7e6318cb 100644
--- a/apps/dquotes.subx
+++ b/apps/dquotes.subx
@@ -62,7 +62,7 @@ $subx-dquotes-main:interactive:
     # configure ed to really exit()
     # . ed->target = 0
     c7          0/subop/copy        0/mod/direct    0/rm32/eax    .           .             .           .           .               0/imm32           # copy to *eax
-    # subx-dquotes(Stdin, 1/stdout, 2/stderr, ed)
+    # subx-dquotes(Stdin, Stdout, Stderr, ed)
     # . . push args
     50/push-eax/ed
     68/push  Stderr/imm32
@@ -84,8 +84,8 @@ $subx-dquotes-main:end:
 
 subx-dquotes:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode:
-    #   var line = new-stream(512, 1)
-    #   var new-data-segment = new-stream(Heap, Segment-size, 1)
+    #   var line : (stream byte 512)
+    #   var new-data-segment : (handle stream byte) = new-stream(Heap, Segment-size, 1)
     #   write(new-data-segment, "== data\n")
     #   while true
     #     clear-stream(line)
diff --git a/apps/mulisp.subx b/apps/mulisp.subx
index 74f8098c..c2d27a08 100644
--- a/apps/mulisp.subx
+++ b/apps/mulisp.subx
@@ -110,7 +110,7 @@ lisp-read:  # in : (address buffered-file) -> eax : (address cell)
     89/<- %ebp 4/r32/esp
     # . save registers
     51/push-ecx
-    # var s/ecx : (address stream) = new-stream(512)
+    # var s/ecx : (stream byte 512)
     81 5/subop/subtract %esp 0x200/imm32
     68/push 0x200/imm32/size
     68/push 0/imm32/read
diff --git a/apps/pack.subx b/apps/pack.subx
index 5917f735..64d81611 100644
--- a/apps/pack.subx
+++ b/apps/pack.subx
@@ -99,7 +99,7 @@ $subx-pack-main:end:
 
 subx-pack:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode:
-    #   var line = new-stream(512, 1)
+    #   var line : (stream byte 512)
     #   var in-code? = false
     #   while true
     #     clear-stream(line)
diff --git a/apps/sigils.subx b/apps/sigils.subx
index 62ce5b19..1721c266 100644
--- a/apps/sigils.subx
+++ b/apps/sigils.subx
@@ -106,7 +106,7 @@ $subx-sigils-main:end:
 #   *x + 34                 -> error: base+disp addressing must be within '()'
 subx-sigils:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode:
-    #   var line = new-stream(512, 1)
+    #   var line : (stream byte 512)
     #   while true
     #     clear-stream(line)
     #     read-line-buffered(in, line)
@@ -141,7 +141,7 @@ subx-sigils:  # in : (address buffered-file), out : (address buffered-file)
     51/push-ecx
     52/push-edx
     53/push-ebx
-    # var line/ecx : (address stream byte) = stream(512)
+    # var line/ecx : (stream byte 512)
     81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x200/imm32       # subtract from esp
     68/push  0x200/imm32/length
     68/push  0/imm32/read
diff --git a/apps/survey b/apps/survey
index 70303562..87e509c9 100755
--- a/apps/survey
+++ b/apps/survey
Binary files differdiff --git a/apps/survey.subx b/apps/survey.subx
index e4ebba13..87d519f3 100644
--- a/apps/survey.subx
+++ b/apps/survey.subx
@@ -117,8 +117,8 @@ subx-survey:  # infile : (address buffered-file), out : (address buffered-file)
     # pseudocode
     #   var in : (address stream byte) = stream(4096)
     #   slurp(infile, in)
-    #   var segments = new-stream(10 rows, 16 bytes each)
-    #   var labels = new-stream(Max-labels rows, 16 bytes each)
+    #   var segments : (stream segment-info 10)
+    #   var labels : (stream label-info Max-labels)
     #   compute-offsets(in, segments, labels)
     #   compute-addresses(segments, labels)
     #   rewind-stream(in)
@@ -630,7 +630,7 @@ compute-offsets:  # in : (address stream), segments : (address stream {string, s
     #
     # pseudocode:
     #   curr-segment-name : (address string) = 0
-    #   var line = new-stream(512, 1)
+    #   var line : (stream byte 512)
     #   while true                                  # line loop
     #     clear-stream(line)
     #     read-line(in, line)
@@ -688,25 +688,19 @@ compute-offsets:  # in : (address stream), segments : (address stream {string, s
     c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           compute-offsets:file-offset/disp32  0/imm32               # copy to *compute-offsets:word-slice
     # segment-offset = 0
     c7          0/subop/copy        0/mod/indirect  5/rm32/.disp32            .             .           .           compute-offsets:segment-offset/disp32  0/imm32            # copy to *compute-offsets:word-slice
-    # line/ecx = new-stream(512, 1)
-    # . eax = new-stream(512, 1)
-    # . . push args
-    68/push  1/imm32
-    68/push  0x200/imm32
-    68/push  Heap/imm32
-    # . . call
-    e8/call  new-stream/disp32
-    # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
-    # . line/ecx = eax
-    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           0/r32/eax   .               .                 # copy eax to ecx
+    # var line/ecx : (stream byte 512)
+    81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x200/imm32       # subtract from esp
+    68/push  0x200/imm32/length
+    68/push  0/imm32/read
+    68/push  0/imm32/write
+    89/copy                         3/mod/direct    1/rm32/ecx    .           .             .           4/r32/esp   .               .                 # copy esp to ecx
 $compute-offsets:line-loop:
-    # clear-stream(line/ecx)
+    # clear-stream(line)
     51/push-ecx
     e8/call  clear-stream/disp32
     # . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
-    # read-line(in, line/ecx)
+    # read-line(in, line)
     51/push-ecx
     ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           8/disp8         .                 # push *(ebp+8)
     e8/call  read-line/disp32
@@ -752,7 +746,7 @@ $compute-offsets:line-loop:
 $compute-offsets:word-loop:
     # edx = word-slice
     ba/copy-to-edx  compute-offsets:word-slice/imm32
-    # next-word(line/ecx, word-slice/edx)
+    # next-word(line, word-slice/edx)
     52/push-edx
     51/push-ecx
     e8/call  next-word/disp32
@@ -900,7 +894,7 @@ $compute-offsets:case-segment-header:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x14/imm32        # add to esp
 $compute-offsets:construct-next-segment:
-    # next-word(line/ecx, segment-tmp)
+    # next-word(line, segment-tmp)
     68/push  compute-offsets:segment-tmp/imm32
     51/push-ecx
     e8/call  next-word/disp32
@@ -967,7 +961,7 @@ $compute-offsets:update-curr-segment-name:
     # . if (eax == 0) abort
     3d/compare-eax-and  0/imm32
     0f 84/jump-if-equal  $compute-offsets:abort/disp32
-    # next-word(line/ecx, segment-tmp)
+    # next-word(line, segment-tmp)
     68/push  compute-offsets:segment-tmp/imm32
     51/push-ecx
     e8/call  next-word/disp32
@@ -1169,6 +1163,7 @@ $compute-offsets:break-line-loop:
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x14/imm32        # add to esp
 $compute-offsets:end:
     # . reclaim locals
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x20c/imm32       # add to esp
     # . restore registers
     5f/pop-to-edi
     5e/pop-to-esi
@@ -1930,7 +1925,7 @@ $emit-output:end:
 emit-segments:  # in : (address stream), out : (address buffered-file), segments : (address stream {string, segment-info}), labels : (address stream {string, label-info})
     # pseudocode:
     #   var offset-of-next-instruction = 0
-    #   var line = new-stream(512, 1)
+    #   var line : (stream byte 512)
     #   line-loop:
     #   while true
     #     clear-stream(line)
@@ -1992,7 +1987,7 @@ emit-segments:  # in : (address stream), out : (address buffered-file), segments
     53/push-ebx
     56/push-esi
     57/push-edi
-    # var line/ecx : (address stream byte) = stream(512)
+    # var line/ecx : (stream byte 512)
     81          5/subop/subtract    3/mod/direct    4/rm32/esp    .           .             .           .           .               0x200/imm32       # subtract from esp
     68/push  0x200/imm32/length
     68/push  0/imm32/read
diff --git a/apps/tests.subx b/apps/tests.subx
index 4e407d50..f6b3fb55 100644
--- a/apps/tests.subx
+++ b/apps/tests.subx
@@ -70,8 +70,8 @@ $subx-tests-main:end:
 subx-gen-run-tests:  # in : (address buffered-file), out : (address buffered-file)
     # pseudocode
     #   bool tests-found = false
-    #   var line = new-stream(512, 1)
-    #   var new-code-segment = new-stream(Segment-size, 1)
+    #   var line : (stream byte 512)
+    #   var new-code-segment : (handle stream byte) = new-stream(Segment-size, 1)
     #   write(new-code-segment, "\n== code\n")
     #   write(new-code-segment, "run-tests:\n")
     #   while true