diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-26 21:24:43 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-26 21:24:43 -0700 |
commit | 71418907f69cd29ea9a07e7b2f80d51bcec3bba2 (patch) | |
tree | cbf157c6a6e06f58b006d9b1f1b721431bcfbbc6 | |
parent | ddcc5dfe3ace122c7a74376c8b79dbb819c13820 (diff) | |
download | mu-71418907f69cd29ea9a07e7b2f80d51bcec3bba2.tar.gz |
7115
-rw-r--r-- | 310copy-bytes.subx | 16 | ||||
-rw-r--r-- | 400.mu | 4 | ||||
-rw-r--r-- | apps/tile/gap-buffer.mu | 2 | ||||
-rw-r--r-- | apps/tile/rpn.mu | 10 |
4 files changed, 16 insertions, 16 deletions
diff --git a/310copy-bytes.subx b/310copy-bytes.subx index eed337c0..176c4c33 100644 --- a/310copy-bytes.subx +++ b/310copy-bytes.subx @@ -56,7 +56,7 @@ $copy-bytes:end: 5d/pop-to-ebp c3/return -stream-to-string: # in: (addr stream _), out: (addr handle array _) +stream-to-array: # in: (addr stream _), out: (addr handle array _) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -81,7 +81,7 @@ stream-to-string: # in: (addr stream _), out: (addr handle array _) 8d/copy-address *(eax+4) 0/r32/eax # (copy-bytes %edx %eax %ecx) -$stream-to-string:end: +$stream-to-array:end: # . restore registers 5e/pop-to-esi 5a/pop-to-edx @@ -92,7 +92,7 @@ $stream-to-string:end: 5d/pop-to-ebp c3/return -test-stream-to-string: +test-stream-to-array: # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -106,7 +106,7 @@ test-stream-to-string: 68/push 0/imm32 89/<- %ecx 4/r32/esp # - (stream-to-string _test-input-stream %ecx) + (stream-to-array _test-input-stream %ecx) (lookup *ecx *(ecx+4)) # => eax (check-strings-equal %eax "bc") # . epilogue @@ -114,9 +114,9 @@ test-stream-to-string: 5d/pop-to-ebp c3/return -# like stream-to-string but ignore surrounding quotes +# like stream-to-array but ignore surrounding quotes # we might do other stuff here later -unquote-stream-to-string: # in: (addr stream _), out: (addr handle array _) +unquote-stream-to-array: # in: (addr stream _), out: (addr handle array _) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -131,7 +131,7 @@ unquote-stream-to-string: # in: (addr stream _), out: (addr handle array _) 8b/-> *esi 1/r32/ecx 2b/subtract *(esi+4) 1/r32/ecx 81 7/subop/compare %ecx 2/imm32 - 7c/jump-if-< $unquote-stream-to-string:end/disp8 + 7c/jump-if-< $unquote-stream-to-array:end/disp8 81 5/subop/subtract %ecx 2/imm32 # allocate (allocate-array Heap %ecx *(ebp+0xc)) @@ -144,7 +144,7 @@ unquote-stream-to-string: # in: (addr stream _), out: (addr handle array _) 8d/copy-address *(eax+4) 0/r32/eax # (copy-bytes %edx %eax %ecx) -$unquote-stream-to-string:end: +$unquote-stream-to-array:end: # . restore registers 5e/pop-to-esi 5a/pop-to-edx diff --git a/400.mu b/400.mu index 87e43356..b64bc756 100644 --- a/400.mu +++ b/400.mu @@ -176,8 +176,8 @@ sig new-buffered-file out: (addr handle buffered-file) sig stream-empty? s: (addr stream _) -> result/eax: boolean sig stream-full? s: (addr stream _) -> result/eax: boolean -sig stream-to-string in: (addr stream _), out: (addr handle array _) -sig unquote-stream-to-string in: (addr stream _), out: (addr handle array _) +sig stream-to-array in: (addr stream _), out: (addr handle array _) +sig unquote-stream-to-array in: (addr stream _), out: (addr handle array _) sig stream-first s: (addr stream byte) -> result/eax: byte sig stream-final s: (addr stream byte) -> result/eax: byte diff --git a/apps/tile/gap-buffer.mu b/apps/tile/gap-buffer.mu index cfd3d02d..07ce68a3 100644 --- a/apps/tile/gap-buffer.mu +++ b/apps/tile/gap-buffer.mu @@ -31,7 +31,7 @@ fn gap-buffer-to-string self: (addr gap-buffer), out: (addr handle array byte) { var s-storage: (stream byte 0x100) var s/ecx: (addr stream byte) <- address s-storage emit-gap-buffer self, s - stream-to-string s, out + stream-to-array s, out } fn emit-gap-buffer _self: (addr gap-buffer), out: (addr stream byte) { diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu index fcfb25be..641350a6 100644 --- a/apps/tile/rpn.mu +++ b/apps/tile/rpn.mu @@ -161,7 +161,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: var s-addr/ecx: (addr stream byte) <- address s read-line-buffered file, s-addr var target/eax: (addr handle array byte) <- get target-val, text-data - stream-to-string s-addr, target + stream-to-array s-addr, target # save result into target-val var type-addr/eax: (addr int) <- get target-val, type copy-to *type-addr, 1 # string @@ -192,7 +192,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: # create binding from curr-stream to target-val var key-h: (handle array byte) var key/ecx: (addr handle array byte) <- address key-h - stream-to-string curr-stream, key + stream-to-array curr-stream, key bind-in-table bindings, key, target-val # process next line if necessary var line/eax: (addr line) <- copy scratch @@ -275,7 +275,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: break-if-= var tmp: (handle array byte) var curr-string-ah/edx: (addr handle array byte) <- address tmp - stream-to-string curr-stream, curr-string-ah # unfortunate leak + stream-to-array curr-stream, curr-string-ah # unfortunate leak var curr-string/eax: (addr array byte) <- lookup *curr-string-ah var val-storage: (handle value) var val-ah/edi: (addr handle value) <- address val-storage @@ -296,7 +296,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: break-if-!= var h: (handle array byte) var s/eax: (addr handle array byte) <- address h - unquote-stream-to-string curr-stream, s # leak + unquote-stream-to-array curr-stream, s # leak push-string-to-value-stack out, *s break $evaluate:process-word } @@ -311,7 +311,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch: # wastefully create a new input string to strip quotes var h: (handle array value) var input-ah/eax: (addr handle array byte) <- address h - unquote-stream-to-string curr-stream, input-ah # leak + unquote-stream-to-array curr-stream, input-ah # leak # wastefully parse input into int-array # TODO: support parsing arrays of other types var input/eax: (addr array byte) <- lookup *input-ah |