RE: Faster..less memory
- Posted by jordah ferguson <jorfergie03 at yahoo.com> Oct 28, 2002
- 556 views
hi Kat, > Note this won't support the current strtok-v2 release, which allows > deparsing > on multiple separators at once. Neither will it support v3, which has > another > trick,, err, ability. > > Kat hi Kat, Actually, that is a very easy hack. The main point of this code fragment was to simulate how things would be if we had a STRING type in Euphoria. Faster & less memory!! if the routine, doesn't make it to strtok v3 is not a main concern, just the fact that its better in all ways matters :) i'll update it to conform with that in ver 2.0 thx. Jordah > > 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 > > > >