Norman Dunbar wrote:
Ok, it's silly season !

I've written a small test program to generate another single line PRINT
statement and found that the limit is 2,746 items in a print statement will
be printed BUT any more than this will simply refuse to print or list. All
you get is a blank screen.

The one line was simply :

1000 PRINT '1'; '2'; '3'; '4'; ......... '2746';

I tried with other max numbers but 2,746 was the final value that actually
allowed the print to work. Any more and print gave up as did LIST.

The total line length of the raw text (ie not in internal format) was 20,872
bytes.

Cheers,
Norman.

You nearly caught me out there - I tried working it out, and it seemed not to come out as what I expected, until I noticed all the unneccesary spaces in your line.

Tokenised lines are organised in 2 byte words.
A tokenised line is restricted to 32766 bytes, as they use a signed word on each line that records the differnec between this line's length and the previous line's lengtn (so the program can be traversed both forwards and backwards).
A line with a line number then contains it's line number tozen word and a word containing the line number.
The tokenised part of your line therefor looks like:

<line number token>
<line number>
<PRINT token>
<String token, with dilimiter '>
<String length (1)>
<'1', padded to a word>
<seperator token (;)>
<space token (count = 1)>
<String token>
<string length (10>
<'2'>
<Space token>
...
<String token>
<length 4>
<'27'>
<'46'>
<eol token>

(Note that there are no <space tokens>s after the line number or PRINT tokens, as these are auto-generated. I very rarely put un-neccessary spaces in my SB code, 'cos I know how much space they eat up.)

So we have 2647 * 6 words, 98 * 4 words + 7 words = 15380 words.
To add one more entry would take another 6 words, and go over the limit.
Offhand, I forgot what the parser does if the line gets too long. I've had a look in Minerva, to find my comment that says:

N.B. The following assumes that the token list is never longer
than 32766, but I guess that's fairly reasonable... lwr

I.e. there's wasn't a check on people doing strange things, and I chose not to bother to add one. I suspect I know what happens when you do go over the limit. In the process of "editting" the line into the program, it will be sign extending the line length, with pretty disastrous consequnces!

As a final comment, for even worst cases. "PRINT ;;;;;;;..." would have fallen over at about 16380 semicolons. Even better(worser?) "PRINT .1;.1;.1;,1..." would have toppled at a line length of about 12280 (3/8 of 32766). That's the worse case you can get.

--
Lau
http://www.bergbland.info
Get a domain from http://oneandone.co.uk/xml/init?k_id=5165217 and I'll get the commission!

Reply via email to