aUCBLogo Demos and Tests / convert_lwob_example
to convert_lwob_example
clearText
fn="example_for_lwob.txt
openRead fn
setReader fn
out=[]
while [not eof?]
[ l=readRawLine
if not empty? l
[ l=butFirst l
]
while [(count l) > 8]
[ l=bf l
f=items 1 8 l
if xdigits? f
[ repeat 4
[ l2=items 1 2 f
out=fput toInt l2 16 out
f=bf bf f
]
]
ifelse (count l) > 8
[ l=items 9 count l l
][ break
]
]
]
setReader []
close fn
out=reverse uint8array out
setItems 235 out "maple.jpg
out.21=0x1f
w=(word char out)
fn="example_for_lwob.lwo
openWriteBin fn
setWriter fn
setCharConversion fn 0
typeBin w
setWriter []
close fn
end
to xdigits? s
local [i]
for [i 1 [count s]]
[ if not xdigit? s.i
[ output false
]
]
output true
end