POV-Ray : Newsgroups : povray.bugreports : Bug with parsing declared transforms Server Time
23 Dec 2024 11:55:17 EST (-0500)
  Bug with parsing declared transforms (Message 1 to 1 of 1)  
From: Ron Parker
Subject: Bug with parsing declared transforms
Date: 8 Jan 1999 11:58:35
Message: <3696393b.0@news.povray.org>
A copy of this message has been forwarded to Chris Young.

I have found what appears to be either a documentation bug or a bug in 
the parser.  The documentation claims that the syntax for transform
is as follows:

   TRANSFORMATION:

      rotate <Rotate_Amt> | 
      scale <Scale_Amt> | 
      translate <Translate_Amt> | 
      transform TRANSFORM_IDENTIFIER | 
      matrix <Val00, Val01, Val02, 
         Val10, Val11, Val12, 
         Val20, Val21, Val22, 
         Val30, Val31, Val32>

   TRANSFORM_DECLARATION:

      #declare IDENTIFIER = transform{ TRANSFORMATION... } | 
      #local IDENTIFIER = transform{ TRANSFORMATION... }

This seems to say that a construction of the form
 
  #declare XX=transform { rotate 45 * y }
  #declare YY=transform { transform XX rotate 5*x }

is allowed, but in fact the parser does not recognize the transform
keyword inside a transform block.  I tried to work around this by
using just the transform identifier as follows:

  #declare XX=transform { rotate 45 * y }
  #declare YY=transform { XX rotate 5*x }

but that doesn't work either because of the EXIT in the following case
in Parse_Transform:

     CASE(TRANSFORM_ID_TOKEN)
       Compose_Transforms (New, (TRANSFORM *)Token.Data);
       EXIT
     END_CASE

So, either the documentation is wrong, or the code is.  My vote is that
the code is wrong, and should be fixed to match the documentation by 
adding the following (untested) case to Parse_Transform:

     CASE (TRANSFORM_TOKEN)
       GET(TRANSFORM_ID_TOKEN)
       Compose_Transforms(New, (TRANSFORM *)Token.Data);
     END_CASE

Also, it doesn't appear that it would hurt anything to remove that EXIT.


Post a reply to this message

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