hex.print_ptr_lineΒΆ
Prints bytes from the pointed buffer, until a '\n' or a 0-byte (EOF); writes the byte count into len[:w/4].
A terminating '\n' is printed too (a terminating 0-byte is not); either way len excludes it.
SignatureΒΆ
def print_ptr_line ptr, len @ loop, doprint, donl, stop, pptr, bytebuf, nl, end { ... }
Defined in hex/strings.fj β lines 57β79 (view on GitHub).
ComplexityΒΆ
Time:
len(w(0.75@+5) + 29@+41)Space:
w(2.25@+45) + 28@+220
See the complexity glossary for what @, w, dw, dbit, n mean.
Requires initΒΆ
The following must be initialised before this macro is invoked:
hex.init and stl.ptr_init (or stl.startup_and_init_all).
SourceΒΆ
Click to view the macro body
def print_ptr_line ptr, len @ loop, doprint, donl, stop, pptr, bytebuf, nl, end {
.mov w/4, pptr, ptr
.zero w/4, len
loop:
.read_byte bytebuf, pptr
.if0 2, bytebuf, stop // 0-byte terminator: stop (no newline)
.cmp 2, bytebuf, nl, doprint, donl, doprint // '\n' terminator: print it, then stop
doprint:
.print bytebuf
.ptr_inc pptr
.inc w/4, len
;loop
donl:
stl.output '\n'
;stop
stop:
;end
pptr: .vec w/4
bytebuf: .vec 2
nl: .vec 2, '\n'
end:
}
Depends onΒΆ
β Previous: hex.print_ptr_text