diff options
Diffstat (limited to 'linux/crenshaw2-1.subx')
-rw-r--r-- | linux/crenshaw2-1.subx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/linux/crenshaw2-1.subx b/linux/crenshaw2-1.subx index 5b70e53f..41e3ad4e 100644 --- a/linux/crenshaw2-1.subx +++ b/linux/crenshaw2-1.subx @@ -186,7 +186,7 @@ $compile:end: # 'in' (rest). We leave the next byte from 'in' into 'Look' on exit. get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr stream byte), ed: (addr exit-descriptor) # pseudocode: - # if (!is-digit?(Look)) expected(ed, err, "integer") + # if (!digit?(Look)) expected(ed, err, "integer") # if out->write >= out->size # write(err, "Error: too many digits in number\n") # stop(ed, 1) @@ -207,12 +207,12 @@ get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # - if (is-digit?(Look)) expected(ed, err, "integer") - # . eax = is-digit?(Look) + # - if (digit?(Look)) expected(ed, err, "integer") + # . eax = digit?(Look) # . . push args ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Look/disp32 . # push *Look # . . call - e8/call is-digit?/disp32 + e8/call digit?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . if (eax == false) @@ -528,7 +528,7 @@ $get-char:end: 5d/pop-to-ebp c3/return -is-digit?: # c: int -> eax: boolean +digit?: # c: int -> eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -536,13 +536,13 @@ is-digit?: # c: int -> eax: boolean b8/copy-to-eax 0/imm32 # if (c < '0') return false 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 0x30/imm32 # compare *(ebp+8) - 7c/jump-if-< $is-digit?:end/disp8 + 7c/jump-if-< $digit?:end/disp8 # if (c > '9') return false 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 0x39/imm32 # compare *(ebp+8) - 7f/jump-if-> $is-digit?:end/disp8 + 7f/jump-if-> $digit?:end/disp8 # otherwise return true b8/copy-to-eax 1/imm32 -$is-digit?:end: +$digit?:end: # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp |