POV-Ray : Newsgroups : povray.beta-test : Stream <type>_file=false ini options not working. : Re: Stream <type>_file=false ini options not working. Server Time
14 Apr 2024 13:46:57 EDT (-0400)
  Re: Stream <type>_file=false ini options not working.  
From: William F Pokorny
Date: 2 Mar 2024 09:39:50
Message: <65e33a36$1@news.povray.org>
On 3/1/24 13:32, Thorsten wrote:
> I think this is more a documentation error remaining than a missing 
> feature. All this would do is turn OFF output to a file, which already 
> will only be written if it is specified in the first place ... what does 
> work is setting this to an empty string.
> 
> However, if you wanted to implement "false" it, it should be in 
> frontend/renderfrontend.cpp method RenderFrontendBase::CreateScene
> 
> Find the line
>
if(ProcessOptions::IsTrue(UCS2toSysString(shd.streamnames[gStreamNumber[i]]).c_str())
== true)
> 
> and add a case for IsFalse that sets the 
> shd.streamnames[gStreamNumber[i]] to an empty string.

Thank you, Thorsten, for digging.

Unfortunately, your suggestion to try the empty string highlights a 
secondary bug. All of the variations below direct the stream to a 
defaulted filename of debug.out in my testing (ini forms too).

yuqk debug.pov debug_file=on
yuqk debug.pov debug_file=true
yuqk debug.pov debug_file=yes
yuqk debug.pov debug_file=1
yuqk debug.pov debug_file=
yuqk debug.pov debug_file=""
yuqk debug.pov debug_file=''

The secondary problem is ProcessOptions::IsTrue (and 
uProcessOptions::IsFalse) use ProcessOptions::Matches which needs the 
following code at the very top

    if ( ((v2[0] == 0) || (v1[0] == 0)) &&
        !((v2[0] == 0) && (v1[0] == 0)))
    {
        return false;
    }

to not, falsely, test 'true' on empty string options. With that 
secondary fix in place, the following code is testing out OK for me. 
(Ugly code formatting to avoid uglier formatting on posting of code...)

Replace:

     shd.streamnames[gStreamNumber[i]] =
         obj.GetUCS2String(gStreamTypeUtilData[i]);
     if (ProcessOptions::IsTrue(
         UCS2toSysString(shd.streamnames[gStreamNumber[i]]).c_str()
         ) == true)
         shd.streamnames[gStreamNumber[i]] =
         SysToUCS2String(gStreamDefaultFile[i]);

With:

     if (ProcessOptions::IsTrue(
         UCS2toSysString(
             obj.GetUCS2String(gStreamTypeUtilData[i])
         ).c_str()) == true)
     {
         shd.streamnames[gStreamNumber[i]] =
             SysToUCS2String(gStreamDefaultFile[i]);
     }
     else if (ProcessOptions::IsFalse(
         UCS2toSysString(
             obj.GetUCS2String(gStreamTypeUtilData[i])
         ).c_str()) == true)
     {
         // Do nothing if the string indicates false (or empty).
     }
     else
     {
         shd.streamnames[gStreamNumber[i]] =
             obj.GetUCS2String(gStreamTypeUtilData[i]);
     }

Bill P.


Post a reply to this message

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