POV-Ray : Newsgroups : povray.bugreports : String literals can only be 125 characters long Server Time
22 Dec 2024 18:27:07 EST (-0500)
  String literals can only be 125 characters long (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: Samuel van Egmond
Subject: String literals can only be 125 characters long
Date: 2 Jun 1999 20:57:38
Message: <3755c4f2.0@news.povray.org>
Hi,

Found another minor one, string literals don't seem to behave as the
documentation says:

   String literals begin with a double quote mark '"' which is followed by
up to 256 printable ASCII characters and are terminated by another double
quote mark.

This string literal contains 126 X's and fails while parsing with a string
too long error:
#declare
Test="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

By the way, the documentation doesn't state how long strings can become, you
can concat strings to over 256 characters, I tried to over 2,000,000 which
seems to work fine. Which also provides the workaround for the bug above.

Still using NT4 with the standard binaries.

Samuel


Post a reply to this message

From: Nieminen Mika
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 04:16:24
Message: <37562bc8.0@news.povray.org>
I still wonder why all these limitations in povray. String literals
limited to 256 characters (or 125 or whatever), nested #includes
limited to about 10, recursive #macros limited to something, number
of parameters to a #macro limited to some number...
  Why?
  It should be very easy to parse a string literal without length limitations
(compilers do). Just count the number of characters, allocate that amount
of memory and copy it there.
  Unlimited #macro recursion and nested #includes should also be possible
(although for some strange reason most compilers have also a nested
#include limit; but afaik there's no limit for recursive macros). Just
make a stack data structure.
  The parameters to a #macro could be a list.

  There's no limitation for number of objects, triangles in a mesh, etc.
Why there should be limitation in this kind of things?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Spider
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 14:43:08
Message: <3756BE97.170380A@bahnhof.se>
Samuel van Egmond wrote:
> By the way, the documentation doesn't state how long strings can become, you
> can concat strings to over 256 characters, I tried to over 2,000,000 which
> seems to work fine. Which also provides the workaround for the bug above.
Not true..

Try to use the sub (hmm, substring, can't remember it's function now) to
print the string. even if a concat loop works, the print doesn't..

#declare S = "."
#declare N = 100000;
#declare M = 0;
#while(M<N)
  #declare S = concat(S,".")
  #declare M = M +1;
#end

#declare M = 0;
#while(M<N)
  #debug concat("\r",substr(S,0,M))
  #declare M = M +1;
#end


this should show it....

//Spider


Post a reply to this message

From: Samuel van Egmond
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 16:28:56
Message: <3756d778.0@news.povray.org>
You are a very funny spider!!!

Good one....

Samuel.

Spider wrote in message <375### [at] bahnhofse>...
>Samuel van Egmond wrote:
>> By the way, the documentation doesn't state how long strings can become,
you
>> can concat strings to over 256 characters, I tried to over 2,000,000
which
>> seems to work fine. Which also provides the workaround for the bug above.
>Not true..
>
>Try to use the sub (hmm, substring, can't remember it's function now) to
>print the string. even if a concat loop works, the print doesn't..
>
>#declare S = "."
>#declare N = 100000;
>#declare M = 0;
>#while(M<N)
>  #declare S = concat(S,".")
>  #declare M = M +1;
>#end
>
>#declare M = 0;
>#while(M<N)
>  #debug concat("\r",substr(S,0,M))
>  #declare M = M +1;
>#end
>
>
>this should show it....
>
>//Spider


Post a reply to this message

From: Samuel van Egmond
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 16:45:22
Message: <3756db52.0@news.povray.org>
My thoughts exactly,  I just hope I don't run into too many of them.

Samuel

Nieminen Mika wrote in message <37562bc8.0@news.povray.org>...
>  I still wonder why all these limitations in povray. String literals
>limited to 256 characters (or 125 or whatever), nested #includes
>limited to about 10, recursive #macros limited to something, number
>of parameters to a #macro limited to some number...
>  Why?
>  It should be very easy to parse a string literal without length
limitations
>(compilers do). Just count the number of characters, allocate that amount
>of memory and copy it there.
>  Unlimited #macro recursion and nested #includes should also be possible
>(although for some strange reason most compilers have also a nested
>#include limit; but afaik there's no limit for recursive macros). Just
>make a stack data structure.
>  The parameters to a #macro could be a list.
>
>  There's no limitation for number of objects, triangles in a mesh, etc.
>Why there should be limitation in this kind of things?
>
>--
>main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
>):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Spider
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 17:15:09
Message: <3756E239.7A71B7@bahnhof.se>
Samuel van Egmond wrote:
> 
> You are a very funny spider!!!
> 
> Good one....
> 
> Samuel.
LMAO .... 
Actually, there are several bugs in the concat() code.. parser not
caring for end ) in some cases, not error reporting and some other
stuff.

//Spider


Post a reply to this message

From: Ralf Muschall
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 19:59:12
Message: <37570887.B1E1021C@t-online.de>
Nieminen Mika wrote:

>   Why?
>   It should be very easy to parse a string literal without length limitations
> (compilers do). Just count the number of characters, allocate that amount

Probably because nobody wanted to write such a function,
ANSI libc.a does not contain one, and POV was written in a
time before GNU hackers told that all limits are evil.
AFAIK glibc has an extension (getline) which does the job.

Ralf


Post a reply to this message

From: Jon A  Cruz
Subject: Re: String literals can only be 125 characters long
Date: 3 Jun 1999 23:46:18
Message: <37573DE7.941E0077@geocities.com>
Spider wrote:

> Samuel van Egmond wrote:
> >
> > You are a very funny spider!!!
> >
> > Good one....
> >
> > Samuel.
> LMAO ....
> Actually, there are several bugs in the concat() code.. parser not
> caring for end ) in some cases, not error reporting and some other
> stuff.
>
> //Spider

so, should I go in and tweak all the string handling to deal in Unicode,
and also take out the limits while I'm in there?


Post a reply to this message

From: Nieminen Mika
Subject: Re: String literals can only be 125 characters long
Date: 4 Jun 1999 04:19:12
Message: <37577df0.0@news.povray.org>
Ralf Muschall <rmu### [at] t-onlinede> wrote:
: Probably because nobody wanted to write such a function,
: ANSI libc.a does not contain one, and POV was written in a
: time before GNU hackers told that all limits are evil.
: AFAIK glibc has an extension (getline) which does the job.

  filepos=ftell(InFile);
  for(i=StartingQuoteIndex+1; getc(InFile)!='"'; i++);
  fseek(filepos);
  char* String=malloc(i-StartingQuoteIndex-1);
  fgets(String, i-StartingQuoteIndex-1, InFile);

  What's so difficult here?

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Spider
Subject: Re: String literals can only be 125 characters long
Date: 4 Jun 1999 08:04:21
Message: <3757B2A1.6409084E@bahnhof.se>
"Jon A. Cruz" wrote:
> 
> Spider wrote:
> 
> > Samuel van Egmond wrote:
> > >
> > > You are a very funny spider!!!
> > >
> > > Good one....
> > >
> > > Samuel.
> > LMAO ....
> > Actually, there are several bugs in the concat() code.. parser not
> > caring for end ) in some cases, not error reporting and some other
> > stuff.
> >
> > //Spider
> 
> so, should I go in and tweak all the string handling to deal in Unicode,
> and also take out the limits while I'm in there?
please do! 

//Spider


Post a reply to this message

Goto Latest 10 Messages Next 6 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.