POV-Ray : Newsgroups : povray.general : number of macro params Server Time
15 Nov 2024 05:17:12 EST (-0500)
  number of macro params (Message 1 to 5 of 5)  
From: Margus Ramst
Subject: number of macro params
Date: 9 Mar 1999 20:32:14
Message: <36e5cb9e.0@news.povray.org>
I discovered that a macro cannot take more than 19 parameters. I have not
seen
this limitation mentioned in the docs.
Example:

#macro Test(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T)
#declare X=1;
#end

Test(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)

This returns "too many parameters"
Reduce the number of params by one and it parses just fine. Any ideas as to
why this is so?

Margus


Post a reply to this message

From: Nieminen Mika
Subject: Re: number of macro params
Date: 10 Mar 1999 05:54:47
Message: <36e64f77.0@news.povray.org>
Margus Ramst <mar### [at] peakeduee> wrote:
: I discovered that a macro cannot take more than 19 parameters. I have not
: seen
: this limitation mentioned in the docs.

: Reduce the number of params by one and it parses just fine. Any ideas as to
: why this is so?

  Perhaps it's just a given limit just like the limit of maximum nested
macro calls and nested #includes (I personally don't understand why such
limits have to be set).
  It surely should be documented.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/


Post a reply to this message

From: Rudy Velthuis
Subject: Re: number of macro params
Date: 10 Mar 1999 12:23:33
Message: <36e6aa95.0@news.povray.org>
Nieminen Mika schrieb in Nachricht <36e64f77.0@news.povray.org>...
>Margus Ramst <mar### [at] peakeduee> wrote:
>: I discovered that a macro cannot take more than 19 parameters. I have not
>: seen
>: this limitation mentioned in the docs.
>
>: Reduce the number of params by one and it parses just fine. Any ideas as
to
>: why this is so?
>
>  Perhaps it's just a given limit just like the limit of maximum nested
>macro calls and nested #includes (I personally don't understand why such
>limits have to be set).
>  It surely should be documented.


Yes it should.

Could it be (I didn't look at the code yet), that somewhere there is an
array of that size, which will hold pointers to the parameters? Must be
something like it, I guess. Perhaps a larger sized array would do the trick.
I don't think more than, say, 255 or 256 parameters will be necessary. And
propably not more than a nesting level for includes or macros of 256 either
<g>.

BTW, who needs more than 2 year digits in a date? <vbg>.
--
Rudy Velthuis


Post a reply to this message

From: Nieminen Mika
Subject: Re: number of macro params
Date: 10 Mar 1999 12:29:36
Message: <36e6ac00.0@news.povray.org>
Rudy Velthuis <rve### [at] gmxnet> wrote:
: Could it be (I didn't look at the code yet), that somewhere there is an
: array of that size, which will hold pointers to the parameters? Must be
: something like it, I guess. Perhaps a larger sized array would do the trick.
: I don't think more than, say, 255 or 256 parameters will be necessary. And
: propably not more than a nesting level for includes or macros of 256 either
: <g>.

  Memory can be allocated dynamically. That's why there's no limit on how
many triangles a mesh can contain, for example.

: BTW, who needs more than 2 year digits in a date? <vbg>.

  Which year comes after 1999?
  Of course 19100.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp -*/


Post a reply to this message

From: Rudy Velthuis
Subject: Re: number of macro params
Date: 10 Mar 1999 12:50:13
Message: <36e6b0d5.0@news.povray.org>
Nieminen Mika schrieb in Nachricht <36e6ac00.0@news.povray.org>...

>  Memory can be allocated dynamically. That's why there's no limit on how
>many triangles a mesh can contain, for example.

Memory can be allocated from the heap, I know. But I guess this limit is
really the size of an array. Why did they pose a limit otherwise?

Now, to show it, I extracted the povray code (I wanted to do that once
anyway), did a grep over it and guess what I found (in tokenize.h):

<QUOTE>

#define MAX_PARAMETER_LIST 20

[snip]

struct Pov_Macro_Struct
{
  char *Macro_Name;
  char *Macro_Filename;
  long Macro_Pos,Macro_Line_No,Macro_End;
  int Num_Of_Pars;
  char *Par_Name[MAX_PARAMETER_LIST];
};
</QUOTE>


>: BTW, who needs more than 2 year digits in a date? <vbg>.
>
>  Which year comes after 1999?
>  Of course 19100.


Oh, I see. So we need 3 digits after all?

--
Rudy Velthuis


Post a reply to this message

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