diff --git a/103kernel-string-equal.subx b/103kernel-string-equal.subx index bcfd1848..7e1b9d6f 100644 --- a/103kernel-string-equal.subx +++ b/103kernel-string-equal.subx @@ -28,7 +28,7 @@ Entry: # run all tests 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx e8/call syscall_exit/disp32 -kernel-string-equal?: # s: (addr kernel-string), benchmark: (addr array byte) -> eax: boolean +kernel-string-equal?: # s: (addr kernel-string), benchmark: (addr array byte) -> result/eax: boolean # pseudocode: # n = benchmark->size # s1 = s diff --git a/105string-equal.subx b/105string-equal.subx index d193bb2d..783a7dd9 100644 --- a/105string-equal.subx +++ b/105string-equal.subx @@ -12,7 +12,7 @@ Entry: # run all tests 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx e8/call syscall_exit/disp32 -string-equal?: # s: (addr array byte), benchmark: (addr array byte) -> eax: boolean +string-equal?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean # pseudocode: # if (s->size != benchmark->size) return false # return string-starts-with?(s, benchmark) @@ -54,7 +54,7 @@ $string-equal?:end: 5d/pop-to-ebp c3/return -string-starts-with?: # s: (addr array byte), benchmark: (addr array byte) -> eax: boolean +string-starts-with?: # s: (addr array byte), benchmark: (addr array byte) -> result/eax: boolean # pseudocode: # if (s->size < benchmark->size) return false # currs = s->data diff --git a/109stream-equal.subx b/109stream-equal.subx index b3bd9b95..e7bb9487 100644 --- a/109stream-equal.subx +++ b/109stream-equal.subx @@ -6,7 +6,7 @@ # . 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 # compare all the data in a stream (ignoring the read pointer) -stream-data-equal?: # f: (addr stream byte), s: (addr array byte) -> eax: boolean +stream-data-equal?: # f: (addr stream byte), s: (addr array byte) -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -227,7 +227,7 @@ $check-stream-equal:end: # on success, set f->read to after the next newline # on failure, leave f->read unmodified # this function is usually used only in tests, so we repeatedly write f->read -next-stream-line-equal?: # f: (addr stream byte), s: (addr array byte) -> eax: boolean +next-stream-line-equal?: # f: (addr stream byte), s: (addr array byte) -> result/eax: boolean # pseudocode: # currf = f->read # bound: f->write # currs = 0 # bound: s->size diff --git a/118parse-hex.subx b/118parse-hex.subx index 83fcabe3..ebbd4e4e 100644 --- a/118parse-hex.subx +++ b/118parse-hex.subx @@ -6,7 +6,7 @@ # . 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 -is-hex-int?: # in: (addr slice) -> eax: boolean +is-hex-int?: # in: (addr slice) -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -698,7 +698,7 @@ test-parse-hex-int-from-slice-negative: 5d/pop-to-ebp c3/return -is-hex-digit?: # c: byte -> eax: boolean +is-hex-digit?: # c: byte -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/120allocate.subx b/120allocate.subx index 4778b3ed..9e8dfce0 100644 --- a/120allocate.subx +++ b/120allocate.subx @@ -253,7 +253,7 @@ test-allocate-raw-success: 5d/pop-to-ebp c3/return -lookup: # h: (handle T) -> eax: (addr T) +lookup: # h: (handle T) -> result/eax: (addr T) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -455,7 +455,7 @@ _pending-test-lookup-failure: c3/return # when comparing handles, just treat them as pure values -handle-equal?: # a: handle, b: handle -> eax: boolean +handle-equal?: # a: handle, b: handle -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/123slice.subx b/123slice.subx index 3809f34e..c3a4943a 100644 --- a/123slice.subx +++ b/123slice.subx @@ -6,7 +6,7 @@ # . 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 -slice-empty?: # s: (addr slice) -> eax: boolean +slice-empty?: # s: (addr slice) -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -117,7 +117,7 @@ test-slice-empty-if-start-greater-than-end: 5d/pop-to-ebp c3/return -slice-equal?: # s: (addr slice), p: (addr array byte) -> eax: boolean +slice-equal?: # s: (addr slice), p: (addr array byte) -> result/eax: boolean # pseudocode: # if (p == 0) return (s == 0) # currs = s->start @@ -484,7 +484,7 @@ test-slice-equal-with-null: 5d/pop-to-ebp c3/return -slice-starts-with?: # s: (addr slice), head: (addr array byte) -> eax: boolean +slice-starts-with?: # s: (addr slice), head: (addr array byte) -> result/eax: boolean # pseudocode # hsize = head->size # if (hsize > s->end - s->start) return false diff --git a/126write-int-decimal.subx b/126write-int-decimal.subx index 0b980f54..4c0194e9 100644 --- a/126write-int-decimal.subx +++ b/126write-int-decimal.subx @@ -303,7 +303,7 @@ test-write-int32-decimal-negative-multiple-digits: # . end c3/return -is-decimal-digit?: # c: byte -> eax: boolean +is-decimal-digit?: # c: byte -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/128subx-words.subx b/128subx-words.subx index 6f93e421..e1e737a0 100644 --- a/128subx-words.subx +++ b/128subx-words.subx @@ -5,7 +5,7 @@ # . 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 -has-metadata?: # word: (addr slice), s: (addr string) -> eax: boolean +has-metadata?: # word: (addr slice), s: (addr string) -> result/eax: boolean # pseudocode: # var twig: &slice = next-token-from-slice(word->start, word->end, '/') # skip name # curr = twig->end @@ -275,7 +275,7 @@ test-has-metadata-multiple-false: #: - if it starts with '0x' it's treated as a number. (redundant) #: - if it's two characters long, it can't be a name. Either it's a hex #: byte, or it raises an error. -is-valid-name?: # in: (addr slice) -> eax: boolean +is-valid-name?: # in: (addr slice) -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -532,7 +532,7 @@ test-is-valid-name-starts-with-digit: 5d/pop-to-ebp c3/return -is-label?: # word: (addr slice) -> eax: boolean +is-label?: # word: (addr slice) -> result/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/131table.subx b/131table.subx index 4507b10d..018e37ef 100644 --- a/131table.subx +++ b/131table.subx @@ -23,7 +23,7 @@ # . 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 # if no row is found, abort -get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, abort-message-prefix: (addr array byte) -> eax: (addr T) +get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, abort-message-prefix: (addr array byte) -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -207,7 +207,7 @@ $test-get:end: c3/return # if no row is found, abort -get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, abort-message-prefix: (addr array byte) -> eax: (addr T) +get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, abort-message-prefix: (addr array byte) -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -418,7 +418,7 @@ $test-get-slice:end: # if no row is found, save 'key' to the next available row # if there are no rows free, abort # return the address of the value -get-or-insert: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> eax: (addr T) +get-or-insert: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -703,7 +703,7 @@ $test-get-or-insert:end: # if no row is found, save 'key' to the next available row # if there are no rows free, abort # return the address of the value -get-or-insert-handle: # table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> eax: (addr T) +get-or-insert-handle: # table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> result/eax: (addr T) # pseudocode: # var curr: (addr handle stream) = table->data # var max: (addr byte) = &table->data[table->write] @@ -1019,7 +1019,7 @@ $test-get-or-insert-handle:end: # if no row is found, save 'key' in the next available row # if there are no rows free, abort -get-or-insert-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> eax: (addr T) +get-or-insert-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -1324,7 +1324,7 @@ $test-get-or-insert-slice:end: # if no row is found, stop(ed) get-or-stop: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, # abort-message-prefix: (addr array byte), err: (addr buffered-file), ed: (addr exit-descriptor) - # -> eax: (addr T) + # -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -1550,7 +1550,7 @@ $test-get-or-stop:end: # if no row is found, stop(ed) get-slice-or-stop: # table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int, # abort-message-prefix: (addr string), err: (addr buffered-file), ed: (addr exit-descriptor) - # -> eax: (addr _) + # -> result/eax: (addr _) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -1797,7 +1797,7 @@ $test-get-slice-or-stop:end: c3/return # if no row is found, return null (0) -maybe-get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> eax: (addr T) +maybe-get: # table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] @@ -1962,7 +1962,7 @@ $test-maybe-get:end: c3/return # if no row is found, return null (0) -maybe-get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> eax: (addr T) +maybe-get-slice: # table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> result/eax: (addr T) # pseudocode: # curr = table->data # max = &table->data[table->write] diff --git a/133subx-widths.subx b/133subx-widths.subx index 8a3142b3..1ad41bdf 100644 --- a/133subx-widths.subx +++ b/133subx-widths.subx @@ -8,7 +8,7 @@ # . 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 -compute-width: # word: (addr array byte) -> eax: int +compute-width: # word: (addr array byte) -> result/eax: int # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -42,7 +42,7 @@ $compute-width:end: 5d/pop-to-ebp c3/return -compute-width-of-slice: # s: (addr slice) -> eax: int +compute-width-of-slice: # s: (addr slice) -> result/eax: int # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/301array-equal.subx b/301array-equal.subx index fea70997..c799f814 100644 --- a/301array-equal.subx +++ b/301array-equal.subx @@ -2,7 +2,7 @@ == code -array-equal?: # a: (addr array int), b: (addr array int) -> eax: boolean +array-equal?: # a: (addr array int), b: (addr array int) -> result/eax: boolean # pseudocode: # asize = a->size # if (asize != b->size) return false diff --git a/305keyboard.subx b/305keyboard.subx index 04c49784..5c05be6b 100644 --- a/305keyboard.subx +++ b/305keyboard.subx @@ -119,7 +119,7 @@ $enable-keyboard-type-mode:end: 5d/pop-to-ebp c3/return -read-key: # -> eax: byte +read-key: # -> result/eax: byte # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp