Faster..less memory
Hi all,
for those of you who use strtok routines. here is a faster deparse that
uses 4 times less memory. i used to get my program running out of memory
using the old routine.
Enjoy, AND ladies and gentlemen, please start posting interesting code
fragments you come up with. cause many small cool routines are ignored
in bulky source code
Jordah Ferguson
function deparse(sequence s,integer c)
integer L1,L2,X1,X2
sequence R
atom M
L1 = length(s)
if L1 then
L2 = (L1 - 1)
for n = 1 to L1 by 1 do
L2 = L2 + length(s[n])
end for
M = machine_func(16, L2)
X1 = 0
for n = 1 to L1 by 1 do
R = s[n]
X2 = X1 + length(R)
poke(M + X1,R)
poke(M + X2,c)
X1 = X2 + 1
end for
R = peek({M,X2})
machine_proc(17,M)
return R
end if
return s
end function
|
Not Categorized, Please Help
|
|