POV-Ray : Newsgroups : povray.beta-test : bug with parse_string Server Time
31 Oct 2024 23:18:53 EDT (-0400)
  bug with parse_string (Message 1 to 2 of 2)  
From:
Subject: bug with parse_string
Date: 25 Sep 2001 06:15:41
Message: <9pk0rto8s07dnm320f5m503aqu43ak6g3p@4ax.com>
yesterday I promised bug and now I fund shortest version for report

platform: POV35b4 on PII233 128 MB with NT4 SP6

the bug is not connected with parse_string but with second inclusion
of the same file with different content (parse_string macro is example
of such usage)

here is script: for bug

//<SDL>
#include "strings.inc"
#macro Parse_Macro(Name,Params,Content)
  #local String=concat(
    "#macro ",Name,"(",Params,")\n",
      Content,
    "#end\n")
  Parse_String(String)
#end

Parse_Macro("Sphere","Center,Radius","sphere{Center,Radius}")
Sphere(0,1)
Parse_Macro("Box","P1,P2","box{P1,P2}")
Sphere(1,2)
//</SDL>

here is output:

File: parse_string.tmp  Line: 2
Warning: No pigment type given.

File: parse_string.tmp  Line: 1

Sphere(1,2)} <----ERROR

Parse Error: Expected 'object or directive', } found instead

there is no '}' char
it looks like first macro concatenated with second one
some kind of not cleared streams/string or something

anybody can confirm ?

ABX


Post a reply to this message

From: Rune
Subject: Re: bug with parse_string
Date: 1 Nov 2001 09:10:12
Message: <3be157c4@news.povray.org>

> yesterday I promised bug and now I fund shortest
> version for report

First of all, as you say, this bug is not caused by the parse_string macro.
Thus the subject line of the message "bug with parse_string" is *very*
misleading. Please use descriptive subject lines.

Now let's look at the problem.

Here's some code that produces the problem without using parse_string at
all:

// start of scene
#fopen File "file.tmp" write
#write(File,"#macro Box (C1,C2) box{C1,C2} #end\n")
#fclose File
#include "file.tmp"

#fopen File "file.tmp" write
#write(File,"")
#fclose File
#include "file.tmp"

Box(<1,1,1>,<2,2,2>)
// end of scene

We basically write a macro to a file and then overwrites that file with
something else.

Macros work by parsing the code inside the macro. When that code isn't there
anymore, then the macro can't be called correctly.

I would say that this is not a bug but a limitation, so I can't confirm the
bug.

Rune
--
3D images and anims, include files, tutorials and more:
Rune's World:    http://rsj.mobilixnet.dk (updated June 26)
POV-Ray Users:   http://rsj.mobilixnet.dk/povrayusers/
POV-Ray Webring: http://webring.povray.co.uk


Post a reply to this message

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