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 | |
parent | 938185b33ccf30aa8aa20bf8cc22073e140697bf (diff) | |
download | mu-3fcc2371ec0587d6ab793962bca51fbc8130b2b3.tar.gz |
5009
Diffstat (limited to 'subx')
-rw-r--r-- | subx/054string-equal.subx | 2 | ||||
-rw-r--r-- | subx/058stream-equal.subx | 8 | ||||
-rw-r--r-- | subx/067write-buffered.subx | 2 | ||||
-rw-r--r-- | subx/071read-line.subx | 2 | ||||
-rw-r--r-- | subx/072slice.subx | 2 | ||||
-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 | ||||
-rw-r--r-- | subx/examples/ex11.subx | 2 |
10 files changed, 27 insertions, 27 deletions
diff --git a/subx/054string-equal.subx b/subx/054string-equal.subx index f5818e79..e2df6019 100644 --- a/subx/054string-equal.subx +++ b/subx/054string-equal.subx @@ -20,7 +20,7 @@ string-equal?: # s : (address string), benchmark : (address string) -> EAX : bo # i = 0 # currs = s->data # currb = benchmark->data - # while (i < s->length) + # while i < s->length # c1 = *currs # c2 = *currb # if (c1 != c2) return false diff --git a/subx/058stream-equal.subx b/subx/058stream-equal.subx index 4716db39..27ecd10a 100644 --- a/subx/058stream-equal.subx +++ b/subx/058stream-equal.subx @@ -235,10 +235,10 @@ next-stream-line-equal?: # f : (address stream), s : (address string) -> EAX : # pseudocode: # currf = f->read # bound: f->write # currs = 0 # bound : s->length - # while true: - # if (currf >= f->write) + # while true + # if currf >= f->write # return currs >= s->length - # if (f[currf] == '\n') + # if f[currf] == '\n' # ++currf # return currs >= s->length # if (currs >= s->length) return false # the current line of f still has data to match @@ -249,7 +249,7 @@ next-stream-line-equal?: # f : (address stream), s : (address string) -> EAX : # collapsing the two branches that can return true: # currf = f->read # bound: f->write # currs = 0 # bound : s->length - # while true: + # while true # if (currf >= f->write) break # if (f[currf] == '\n') break # if (currs >= s->length) return false # the current line of f still has data to match diff --git a/subx/067write-buffered.subx b/subx/067write-buffered.subx index 76ae4313..343aa364 100644 --- a/subx/067write-buffered.subx +++ b/subx/067write-buffered.subx @@ -18,7 +18,7 @@ write-buffered: # f : (address buffered-file), msg : (address array byte) -> <v # in = msg->data # inend = &msg->data[msg->length] # while (in < inend) - # if (f->write >= f->length) + # if f->write >= f->length # flush(f) # clear-stream(f) # c = *in diff --git a/subx/071read-line.subx b/subx/071read-line.subx index b16170b6..c0d01e7d 100644 --- a/subx/071read-line.subx +++ b/subx/071read-line.subx @@ -15,7 +15,7 @@ # just abort if 's' is too small read-line: # f : (address buffered-file), s : (address stream byte) -> <void> # pseudocode: - # loop: + # while true # if (s->write >= s->length) abort # if (f->read >= f->write) populate stream from file # if (f->write == 0) break diff --git a/subx/072slice.subx b/subx/072slice.subx index d9576d89..0e3d0c00 100644 --- a/subx/072slice.subx +++ b/subx/072slice.subx @@ -102,7 +102,7 @@ slice-equal?: # s : (address slice), p : (address string) -> EAX : boolean # maxs = s->end # if (maxs - currs != p->length) return false # currp = p->data - # while (currs < maxs) + # while currs < maxs # if (*currs != *currp) return false # ++currs # ++currp 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 diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index a40c68d4..5f069ca8 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -34,7 +34,7 @@ kernel-string-equal?: # s : null-terminated ascii string, benchmark : length-pr # s1 = s # s2 = benchmark->data # i = 0 - # while (i < n) + # while i < n # c1 = *s1 # c2 = *s2 # if (c1 == 0) return false |