diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-03-19 22:41:34 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-03-20 17:31:38 -0700 |
commit | 3fcc2371ec0587d6ab793962bca51fbc8130b2b3 (patch) | |
tree | c59d12644f03138773513afa127937623dc62a4f /subx/apps | |
parent | 938185b33ccf30aa8aa20bf8cc22073e140697bf (diff) | |
download | mu-3fcc2371ec0587d6ab793962bca51fbc8130b2b3.tar.gz |
5009
Diffstat (limited to 'subx/apps')
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 2 | ||||
-rw-r--r-- | subx/apps/crenshaw2-1b.subx | 4 | ||||
-rw-r--r-- | subx/apps/hex.subx | 6 | ||||
-rw-r--r-- | subx/apps/pack.subx | 24 |
4 files changed, 18 insertions, 18 deletions
diff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index 8acdde59..46785b16 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -201,7 +201,7 @@ $compile:end: 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 out->write >= out->length # write(err, "Error: too many digits in number\n") # stop(ed, 1) # out->data[out->write] = LSB(Look) diff --git a/subx/apps/crenshaw2-1b.subx b/subx/apps/crenshaw2-1b.subx index 55689cca..c599206c 100644 --- a/subx/apps/crenshaw2-1b.subx +++ b/subx/apps/crenshaw2-1b.subx @@ -203,13 +203,13 @@ get-num: # in : (address buffered-file), out : (address stream), err : fd or (a # pseudocode: # 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. # diff --git a/subx/apps/hex.subx b/subx/apps/hex.subx index 69f426e7..138b63c0 100644 --- a/subx/apps/hex.subx +++ b/subx/apps/hex.subx @@ -72,7 +72,7 @@ $main:end: # the main entry point convert: # in : (address buffered-file), out : (address buffered-file), err : (address buffered-file), ed : (address exit-descriptor) -> <void> # pseudocode: - # repeatedly + # while true # EAX = convert-next-octet(in, err, ed) # if (EAX == Eof) break # write-byte(out, AL) @@ -488,7 +488,7 @@ $test-convert-next-octet-aborts-on-single-hex-byte:end: # abort on any other byte scan-next-byte: # in : (address buffered-file), err : (address buffered-file), ed : (address exit-descriptor) -> byte-or-Eof/EAX # pseudocode: - # repeatedly + # while true # EAX = read-byte(in) # if (EAX == Eof) return EAX # if (is-hex-digit?(EAX)) return EAX @@ -1412,7 +1412,7 @@ $test-scan-next-byte-aborts-on-invalid-byte:end: skip-until-newline: # in : (address buffered-file) -> <void> # pseudocode: # push EAX - # repeatedly: + # while true # EAX = read-byte(in) # if (EAX == Eof) break # if (EAX == 0x0a) break diff --git a/subx/apps/pack.subx b/subx/apps/pack.subx index 003bc5d5..1db79722 100644 --- a/subx/apps/pack.subx +++ b/subx/apps/pack.subx @@ -87,12 +87,12 @@ convert: # in : (address buffered-file), out : (address buffered-file) -> <void # pseudocode: # var line = new-stream(512, 1) # var in-code? = false - # repeatedly + # while true # clear-stream(line) # read-line(in, line) # if (line->write == 0) break # end of file # var word-slice = next-word(line) - # if (slice-empty?(word-slice)) # whitespace + # if slice-empty?(word-slice) # whitespace # write-stream-buffered(out, line) # else if (slice-equal?(word-slice, "==")) # word-slice = next-word(line) @@ -463,24 +463,24 @@ test-convert-passes-segment-headers-through: convert-code-segment: # in : (address buffered-file), out : (address buffered-file) -> <void> # pseudocode: # var line = new-stream(512, 1) - # repeatedly + # while true # clear-stream(line) # EAX = read-line(in, line) # if (EAX == Eof) break # word-slice = next-word(line) - # if (slice-equal?(word-slice, "==")) + # if slice-equal?(word-slice, "==") # return # convert-instruction(line, out) convert-data-segment: # in : (address buffered-file), out : (address buffered-file) -> <void> # pseudocode: # var line = new-stream(512, 1) - # repeatedly + # while true # clear-stream(line) # EAX = read-line(in, line) # if (EAX == Eof) break # word-slice = next-word(line) - # if (slice-equal?(word-slice, "==")) + # if slice-equal?(word-slice, "==") # return # convert-data-word(line, out) @@ -488,7 +488,7 @@ convert-data-segment: # in : (address buffered-file), out : (address buffered-f # read first word as opcode and write-slice # if 0f or f2 or f3 read second opcode and write-slice # if 'f2 0f' or 'f3 0f' read third opcode and write-slice -# while true: +# while true # word-slice = next-word # if empty(word-slice) break # if has metadata 'mod', parse into mod @@ -496,7 +496,7 @@ convert-data-segment: # in : (address buffered-file), out : (address buffered-f # if has metadata 'r32', parse into r32 # if has metadata 'subop', parse into r32 # if at least one of the 3 was present, print-byte -# while true: +# while true # word-slice = next-word # if empty(word-slice) break # if has metadata 'base', parse into base @@ -504,13 +504,13 @@ convert-data-segment: # in : (address buffered-file), out : (address buffered-f # if has metadata 'scale', parse into scale # if at least one of the 3 was present, print-byte # parse errors => <abort> -# while true: +# while true # word-slice = next-word # if empty(word-slice) break # if has metadata 'disp8', emit as 1 byte # if has metadata 'disp16', emit as 2 bytes # if has metadata 'disp32', emit as 4 bytes -# while true: +# while true # word-slice = next-word # if empty(word-slice) break # if has metadata 'imm8', emit @@ -536,7 +536,7 @@ convert-data-segment: # in : (address buffered-file), out : (address buffered-f convert-instruction: # line : (address stream byte), out : (address buffered-file) -> <void> # pseudocode: # word-slice = next-word - # if (starts-with(word-slice, "#")) # comments + # if starts-with(word-slice, "#") # comments # write-stream-buffered(out, line) # ... # @@ -905,7 +905,7 @@ has-metadata?: # word : (address slice), s : (address string) -> EAX : boolean # pseudocode: # var twig : &slice = next-token-from-slice(word->start, word->end, '/') # skip name # curr = twig->end - # while true: + # while true # twig = next-token-from-slice(curr, word->end, '/') # if (twig.empty()) break # if (slice-equal?(twig, s)) return true |