allow terms to be more complicated
This commit is contained in:
parent
262824b214
commit
d74f349e27
5 changed files with 60 additions and 77 deletions
16
04a/in04
16
04a/in04
|
@ -331,11 +331,9 @@ function memchr
|
|||
argument mem
|
||||
argument c
|
||||
local p
|
||||
local a
|
||||
p = mem
|
||||
:memchr_loop
|
||||
a = *1p
|
||||
if a == c goto memchr_loop_end
|
||||
if *1p == c goto memchr_loop_end
|
||||
p += 1
|
||||
goto memchr_loop
|
||||
:memchr_loop_end
|
||||
|
@ -343,12 +341,10 @@ function memchr
|
|||
|
||||
function strlen
|
||||
argument s
|
||||
local c
|
||||
local p
|
||||
p = s
|
||||
:strlen_loop
|
||||
c = *1p
|
||||
if c == 0 goto strlen_loop_end
|
||||
if *1p == 0 goto strlen_loop_end
|
||||
p += 1
|
||||
goto strlen_loop
|
||||
:strlen_loop_end
|
||||
|
@ -414,9 +410,7 @@ function fputn
|
|||
function fputc
|
||||
argument fd
|
||||
argument c
|
||||
local p
|
||||
p = &c
|
||||
syscall(1, fd, p, 1)
|
||||
syscall(1, fd, &c, 1)
|
||||
return
|
||||
|
||||
function putc
|
||||
|
@ -428,10 +422,8 @@ function putc
|
|||
function fgetc
|
||||
argument fd
|
||||
local c
|
||||
local p
|
||||
c = 0
|
||||
p = &c
|
||||
syscall(0, fd, p, 1)
|
||||
syscall(0, fd, &c, 1)
|
||||
return c
|
||||
|
||||
; read a line from fd as a null-terminated string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue