|
DO and string length
At 15:52 16.10.98 -0700, jd wrote:
>I think the quesion is "how big can strings be"...?
>
>If so, then fields, richText, scripts, "value" have 32K limits. ("do" has a
>255-char limit, if memory serves.)
>
This remark worried me since sometimes I use DO with rather long arguments and
without checking/testing for any maximum length. Apparently there is nothing
to worry about. The 255 char limit seems to be limited to the MessWin while in
a handler DO doesn't have that limit. At least I experienced no problem
(dfw 6.02,Nt4Sp3,runmode="Author") with a parameter of 192.019 chars length.
Below is my test, the simple time check reveals that the slowness of the DO
statement is neglectable compared to the slowness of string concatenation.
on machDo times
-- this handler test the limits of DO
if voidP(times) then set times = 12001
set cmd = "global x" & RETURN
set cmd = cmd & "set x = " & Quote
set t1= the ticks
set counter = 1
repeat while counter < times
set cmd = cmd & "0123456789abcdef"
set counter = counter + 1
end repeat
set t2=the ticks
put t2 - t1
set cmd = cmd & Quote
set cmd.Anz = the number of chars of cmd
do cmd
set t3=the ticks
put t3 - t2
global x
set x.anz = the number of chars of x
-- this output was to test if any chars would be cut at the end
-- there are 19 chars in the do-able string which are not 'pure' data
put cmd.anz - x.anz,cmd.anz, x.anz
end
-- Welcome to Director --
-- "Now loading LINGO.INI 17.10.98 21:33 "
-- "This computer is running in 16-bit color depth."
machdo
-- 2209
-- 7
-- 19 192019 192000
|