POV-Ray : Newsgroups : povray.bugreports : alpha.9945627 "Constant" rounded : Re: alpha.9945627 "Constant" rounded Server Time
25 Apr 2024 19:04:31 EDT (-0400)
  Re: alpha.9945627 "Constant" rounded  
From: William F Pokorny
Date: 2 Aug 2021 07:30:25
Message: <6107d751$1@news.povray.org>
On 8/1/21 7:02 AM, William F Pokorny wrote:
...
> 
> The ini parsing is somehow different than the command line parsing :-(.
> 
> Hmmm. I guess povray doesn't die during the actual ini parsing of the 
> string, maybe it just marks the type incorrectly as a float.
> 
...

OK. After a day banging around in code and wrapper scripts. On my Ubuntu 
20.04 system and I expect most unix/linux/osx, you can declare multiple 
strings and constants on the command line and in ini files - no matter 
the recent >v3.6 branch. Constants (excepting, for now, the upcoming 
povr branch) support only single float precision or a little less.

--- The ini files need to look like:

declare=D1=1.0123456789012348
declare='S1="Heard.a"'
declare=D2=2.0123456789012345
declare='S2="bump and"'
declare=D3=3.0123456789012342
declare='S3=" jumped=up = 2 times "'

--- The command line. Note extra quotes where spaces in string. The back 
slash escaped newline characters are not strictly needed and used for 
clarity.

p380b1 +mv3.8 +iFloatAndStrings.inc \
       declare=D1=1.0123456789012348 \
       declare=\'S1=\"Heard.a\"\' \
       declare=D2=2.0123456789012345 \
       declare=\'S2=\""bump and"\"\' \
       declare=D3=3.0123456789012342 \
       declare=\'S3=\""jumped up = 2 times"\"\'

--- The simplifications and complications

The povr branch - for some fix in the past I've not run down - allows 
simpler and more conventional command line quoting:

povr +mv3.8 +iFloatAndStrings.inc \
     declare=D1=1.0123456789012348 \
     declare=S1=\"Heard.a\" \
     declare=D2=2.0123456789012345 \
     declare=S2=\""bump and"\" \
     declare=D3=3.0123456789012342 \
     declare=S3=\""jumped up = two times"\"

There are wrapper script complications which had me chasing my backside 
for the better part of yesterday when you have strings with spaces. You 
must set the IFS (Internal Field Separator) environment variable in such 
scripts to newline characters.

With shell / 'sh' povray wrapper scripts this is done by adding two 
lines ahead of the use of the $@ argument passing / pass-through. Note, 
there is below, an invisible newline character between the single quotes.

IFS='
'

In bash / 'bash' povray wrapper scripts you need to add a similar 
setting with a single line ahead of the $@ use:

IFS=$'\n'

Expect other shell languages would need adjustments too and there are 
probably alternate methods to preserver the spaces. I'm a hack at shell 
wrapper scripts.

Bill P.


Post a reply to this message

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