POV-Ray : Newsgroups : povray.beta-test : [doc] language directives quick ref : Re: [doc] language directives quick ref Server Time
29 Jul 2024 20:25:38 EDT (-0400)
  Re: [doc] language directives quick ref  
From:
Date: 14 Mar 2002 06:18:58
Message: <19019u4knn4969utlkse2bjera0svfemjg@4ax.com>
On Wed, 13 Mar 2002 21:20:19 -0600, "Robert Chaffe"
<rob### [at] earthlinknet> wrote:
> The RVALUE item is part of the ARRAY_INITIALIZER and ARRAY_ELEMENT_ASSIGNMENT items.
 In testing possible assignments of
> RVALUEs to array elements, I could not get a user-defined function item to work.

try: #local A=array[1]{function{x+y+z}}
works fine for me with beta 12

>  So I left it out of the RVALUE list.  Was
> this a bug that has been corrected?

probably

> > 10.1.4.3  File Input/Output
> >
> >   Considering discussion about array entries and final "something can be
> >   declared but not assigned" I suggest to change:
>
> I am not sure what you mean here.  Outside of arrays, I don't think there is such a
thing as an unassigned identifier.  And
> even for the arrays, it would be an unassigned element, would it not?  I cannot use
#read to read a value directly into an
> array element.  Please correct me with an example!

Try this twice - first time as is, second time with uncommented line with
array redeclaration:

  #local A=array[2]{1,2};
  #fopen File "test.txt" write
  #write(File,A[1])
  #fclose File
  //#local A=array[2];#local A[0]=1;
  #fopen File "test.txt" read
  #read(File,A[1])
  #fclose File

At first run script reads into declared (becouse symbol A[1] is known and has
memory reference) and assigned (with value 2) entry. At second run (with
uncommented line) script reads into declared but not assigned entry. Now try
this the same way:

  #local A=array[1]{1};
  #fopen File "test.txt" write
  #write(File,A[0])
  #fclose File
  // #local A=array[1];
  #fopen File "test.txt" read
  #read(File,A[0])
  #fclose File

In second run (with uncommented line) it returns parse error becouse A[0] is
not declared. It is not declared becouse it wasn't specified with first
assigment which could define type of entries in array.

> > 10.1.4.3  File Input/Output
> >
> >   I suggest to add to File Input/Output quick ref section about EOF detecting.
>
> "It does not provide definitions for the numerous keywords nor explain their usage!"

Since there are parts of possible file operations: open, read, write, close I
just found EOF detecting as another possible IO-operation. It could be
explanation of usage if it would be used in #ifdef section. But using it in
File Input/Output section is more like using #declare assigment explanation in
User Defined Functions section.

> > 10.1.4.8  Macro
>
> I am avoiding TOKENS because that includes punctuation.  Can we have a macro that
returns just a plus sign or a parenthesis?

Of course:

  #macro Plus() + #end
  #macro Open_Parenthesis() ( #end
  #macro Close_Parenthesis() ) #end
  #local C=
    Open_Parenthesis()
       2 * Open_Parenthesis() version Plus() pi Close_Parenthesis() Plus() 1
    Close_Parenthesis() ^ pi;
  #warning str(C,0,-1)

> Now that I look at this though, is it possible to have more than one RVALUE?

afaik not

ABX


Post a reply to this message

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