|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Sorry, I didn't look hard enough. I used Context Help by right-clicking on
strlen within a scene file and it claimed not to have it even though I knew
it was a function. Using Scene help button in WinPOV found it fine.
Bob H.
"Ron Parker" <ron### [at] povrayorg> wrote in message
news:slr### [at] fwicom...
> On Thu, 22 Feb 2001 07:10:17 -0600, Bob H. wrote:
> >Why isn't there a strlen() in the documentation? :-)
>
> There is, but it's not with the string functions. It returns a numeric
> value, so it's with the float functions:
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
>
> It seems that the one who wrote that part of the doc thought that the
> indexing starts from 0 and ends at strlen(S)-1, as in C.
>
> Perhaps the problem is not in the documentation, but in povray. In my
> opinion this behaviour is a bit inconsistent. Array indexing starts from 0.
>
But don't forget that in Pascal/Delphi it works the other way:
copy('ABCDEF', 3, 2)
returns 'CD'.
Both ways have their advantages, i would keep it the way it is now.
Christoph
--
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Rune <run### [at] inamecom> wrote:
> In the POV-Ray documentation on the page about string functions the
> following is stated:
>> substr(S,P,L) Sub-string from S. Returns a string that is
>> a subset of the characters in parameter S starting at the
>> position specified by the integer value P for a length
>> specified by the integer value L. For example
>> substr("ABCDEFGHI",4,2) evaluates to the string "EF".
>> If P+L>strlen(S) an error occurs.
> However, there are two errors. The last but one line should read:
>> substr("ABCDEFGHI",4,2) evaluates to the string "DE".
> And the last line should read:
>> If P+L+1>strlen(S) an error occurs.
> Or something like that.
> Can anybody confirm?
> And is this a known bug?
This is C style, counting from 0 rather than 1, which is what arrays do.
Have you tried the program to see what it does? Does it count from 1 or 0?
If it goes from 1, then I see it as a bug in the program, not the docs,
because it's inconsistent.
Speaking of manual bugs, can anyone confirm that the #range feature for
#switch is actually lower < value <= upper and not lower <= value <= upper
like it says in the manual?
Geoff
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Geoff Wedig wrote:
>
> Speaking of manual bugs, can anyone confirm that the #range feature for
> #switch is actually lower < value <= upper and not lower <= value <= upper
> like it says in the manual?
The doc is correct.
#switch( var)
#range (1, 10)
box{ 0, 1 pigment{ color rgb 1 }}
#else
sphere{ 0, 1 pigment { color rgb <1,0,0> }}
#end
creates a white box when var=1, not a red sphere as you think it would.
>
> Geoff
--
Francois Labreque | //\\ Wear an ASCII ribbon!
flabreque | || ||
@ | \\// Support the campain
videotron.ca \\ against HTML e-mail
//\\ and news!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Christoph Hormann <chr### [at] gmxde> wrote:
: Both ways have their advantages, i would keep it the way it is now.
The problem is that it can cause confusion.
If someone is used to use substr() and then starts using arrays he will
probably be confused at first and think that also in arrays the indexing
starts from 1. And the other way around.
It's the same type of confusion as caused by functions taking radians and
rotate taking degrees...
--
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););} /*- Warp -*/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Francois Labreque <fla### [at] videotronca> wrote:
> Geoff Wedig wrote:
>>
>> Speaking of manual bugs, can anyone confirm that the #range feature for
>> #switch is actually lower < value <= upper and not lower <= value <= upper
>> like it says in the manual?
> The doc is correct.
> #switch( var)
> #range (1, 10)
> box{ 0, 1 pigment{ color rgb 1 }}
> #else
> sphere{ 0, 1 pigment { color rgb <1,0,0> }}
> #end
> creates a white box when var=1, not a red sphere as you think it would.
Hmm, then something else must be funny, because when I do
// Define a bunch of stuff.
#switch(clock)
#range(0, 9)
#define stuff
#break
#range(10, 20)
#define stuff
#break
#end
The 10th frame doesn't get any definitions from the switch, which is why I
mentioned this. I had to set it to range(9.5, 20) to get it to work right.
So what else might be causing this?
Geoff
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Francois Labreque" <fla### [at] videotronca> wrote in message
news:3A952F9F.43B9E767@videotron.ca...
>
> Geoff Wedig wrote:
> >
> > Speaking of manual bugs, can anyone confirm that the #range feature for
> > #switch is actually lower < value <= upper and not lower <= value <=
upper
> > like it says in the manual?
>
> The doc is correct.
>
> #switch( var)
> #range (1, 10)
> box{ 0, 1 pigment{ color rgb 1 }}
> #else
> sphere{ 0, 1 pigment { color rgb <1,0,0> }}
> #end
>
> creates a white box when var=1, not a red sphere as you think it would.
Nope, sorry. Not so it would seem. It is 1 to 10 inclusive but you need a
#break ahead of the #else otherwise you actually get both objects. In
MegaPov anyway.
Bob H.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 22 Feb 2001 12:31:32 -0500, Geoff Wedig wrote:
>#switch(clock)
>
> #range(0, 9)
> #define stuff
> #break
> #range(10, 20)
> #define stuff
> #break
>
>#end
>
>The 10th frame doesn't get any definitions from the switch, which is why I
>mentioned this. I had to set it to range(9.5, 20) to get it to work right.
>
>So what else might be causing this?
roundoff error?
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ron Parker <ron### [at] povrayorg> wrote:
> On 22 Feb 2001 12:31:32 -0500, Geoff Wedig wrote:
>>#switch(clock)
>>
>> #range(0, 9)
>> #define stuff
>> #break
>> #range(10, 20)
>> #define stuff
>> #break
>>
>>#end
>>
>>The 10th frame doesn't get any definitions from the switch, which is why I
>>mentioned this. I had to set it to range(9.5, 20) to get it to work right.
>>
>>So what else might be causing this?
> roundoff error?
Not in this case. I'm dealing strictly with integers.
Geoff
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On 22 Feb 2001 13:10:38 -0500, Geoff Wedig wrote:
>> roundoff error?
>
>Not in this case. I'm dealing strictly with integers.
Are you sure clock is an integer?
--
Ron Parker http://www2.fwi.com/~parkerr/traces.html
My opinions. Mine. Not anyone else's.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |