POV-Ray : Newsgroups : povray.beta-test : #debug message problem re: line breaks Server Time
27 Dec 2024 10:36:32 EST (-0500)
  #debug message problem re: line breaks (Message 1 to 8 of 8)  
From: Kenneth
Subject: #debug message problem re: line breaks
Date: 18 Jul 2017 08:30:01
Message: <web.596dfc7892f71496883fb31c0@news.povray.org>
(Running Windows 7 Ultimate Edition, and using v3.7.1 beta 9, but the problem
may not be specific to it.)

Some unexpected behavior with #debug messages, regarding ending line breaks (vs.
their absence). This seems to be different behavior from what I remember in
v3.6xx.

* A SINGLE #debug with NO line break at the end does not show up in 'messages.'

* TWO #debugs without the ending line breaks: only the FIRST message shows up,
not the second.

* With multiple #debugs, and no ending line breaks at all: the final message is
always missing

* Any #debugs (with no ending line breaks) that follow one WITH a line break:
the final message is always missing

* If only the FINAL #debug has an ending line break, all messages show up

* If ALL #debugs have ending line breaks, they all show up

In a nutshell, it seems that the final #debug statement in a scene file MUST
have an ending line break, or there will always be a missing message.

Try commenting-out and/or re-arranging some of the following lines, to see the
results. (Hopefully, the formatting will show up correctly.)

//----------
#version 3.71;
global_settings{assumed_gamma 1.0}

#declare my_first_value = 10;
#declare my_second_value = 20;

// no line break at end...
#debug concat("\n","V1 =  <",str(my_first_value,1,0),",
",str(my_second_value,1,0),">")

// This one WITH a line break at end...
#debug concat("\n","V2 =  <",str(my_first_value,1,0),",
",str(my_second_value,1,0),">","\n")

// no line break at end
#debug concat("\n","some constants =  <",str(30,1,2),", ",str(40,1,2),">")

// no line break at end
#debug concat("\n","MORE constants =  <",str(50,1,2),", ",str(60,1,2),">")

// no line break at end
#debug concat("\n","even MORE constants =  <",str(70,1,2),", ",str(80,1,2),">")


Post a reply to this message

From: Stephen
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 09:44:15
Message: <596e10af$1@news.povray.org>
On 7/18/2017 1:29 PM, Kenneth wrote:
> (Running Windows 7 Ultimate Edition, and using v3.7.1 beta 9, but the problem
> may not be specific to it.)
>
> Some unexpected behavior with #debug messages, regarding ending line breaks (vs.
> their absence). This seems to be different behavior from what I remember in
> v3.6xx.
>
> * A SINGLE #debug with NO line break at the end does not show up in 'messages.'
>
> * TWO #debugs without the ending line breaks: only the FIRST message shows up,
> not the second.
>
> * With multiple #debugs, and no ending line breaks at all: the final message is
> always missing
>
> * Any #debugs (with no ending line breaks) that follow one WITH a line break:
> the final message is always missing
>
> * If only the FINAL #debug has an ending line break, all messages show up
>
> * If ALL #debugs have ending line breaks, they all show up
>
> In a nutshell, it seems that the final #debug statement in a scene file MUST
> have an ending line break, or there will always be a missing message.
>
> Try commenting-out and/or re-arranging some of the following lines, to see the
> results. (Hopefully, the formatting will show up correctly.)

Win 7 Home Premium IIRC

I tried it in UberPov (Oops!)
What I found using your code. Was that after running it with the , "/n" 
at the end of the last #debug. I could put the newline at the end of any 
of the debug statements and all the lines would print. You can reset it 
back to missing the last line by not having a new line character. It had 
me going for a while.


-- 

Regards
     Stephen


Post a reply to this message

From: Bald Eagle
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 10:10:00
Message: <web.596e16098dced37cc437ac910@news.povray.org>
Kenneth,
If you search around, you will find reference to the fact that the text output
to the debug stream does not get displayed until a new line of some sort is
encountered.
Presumably each new debug statement starts it's own line, which flushes the
previous pending message to the output.
It's good practice to always end some sort of text output with a "\n"
I too, used to wonder "Where did my debug output go???"

If there was true aliasing (of commands), then you could probably do something
like
alias debug debug %1 "\n"
or whatever the unix-style command line syntax is

Perhaps invoking a #debug messaging macro that always adds a "\n" at the end
would work, if that's helpful at all...


Post a reply to this message

From: Stephen
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 10:11:37
Message: <596e1719$1@news.povray.org>
On 7/18/2017 1:29 PM, Kenneth wrote:

 >
 > In a nutshell, it seems that the final #debug statement in a scene 
file MUST
 > have an ending line break, or there will always be a missing message.
 >

POV-Ray“ for Windows - Version 3.7.0.msvc10.win64



As your findings
  But I had to start it off by putting a double new line character at 
the end of the last statement.




On 7/18/2017 2:44 PM, Stephen wrote:
> Win 7 Home Premium IIRC
>
> I tried it in UberPov (Oops!)
> What I found using your code. Was that after running it with the , "/n"
> at the end of the last #debug. I could put the newline at the end of any
> of the debug statements and all the lines would print. You can reset it
> back to missing the last line by not having a new line character. It had
> me going for a while.
>


Curiouser and curiouser!


-- 

Regards
     Stephen


Post a reply to this message

From: Le Forgeron
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 11:29:04
Message: <596e2940$1@news.povray.org>
Le 18/07/2017 à 16:07, Bald Eagle a écrit :
> Kenneth,
> If you search around, you will find reference to the fact that the text output
> to the debug stream does not get displayed until a new line of some sort is
> encountered.
> Presumably each new debug statement starts it's own line, which flushes the
> previous pending message to the output.
> It's good practice to always end some sort of text output with a "\n"
> I too, used to wonder "Where did my debug output go???"
> 
> If there was true aliasing (of commands), then you could probably do something
> like
> alias debug debug %1 "\n"
> or whatever the unix-style command line syntax is
> 
> Perhaps invoking a #debug messaging macro that always adds a "\n" at the end
> would work, if that's helpful at all...
> 

But doing so would break code that have a lot of complex thing to trace
in debug and use multiple #debug to build the various part of the
message (as opposed to using a single concat() for everything at once)


Post a reply to this message

From: clipka
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 12:28:40
Message: <596e3738$1@news.povray.org>
Am 18.07.2017 um 14:29 schrieb Kenneth:
> (Running Windows 7 Ultimate Edition, and using v3.7.1 beta 9, but the problem
> may not be specific to it.)

The behaviour should indeed be unchanged since v3.7.0.


> * A SINGLE #debug with NO line break at the end does not show up in 'messages.'

Confirmed.

> * TWO #debugs without the ending line breaks: only the FIRST message shows up,
> not the second.

Cannot confirm this one: They both shouldn't show up, and that's indeed
what I'm seeing in experiments (things might be different if the length
of both messages combined exceeds a certain length).

> * With multiple #debugs, and no ending line breaks at all: the final message is
> always missing

Confirmed.

> * Any #debugs (with no ending line breaks) that follow one WITH a line break:
> the final message is always missing

Confirmed.

> * If only the FINAL #debug has an ending line break, all messages show up

Confirmed.

> * If ALL #debugs have ending line breaks, they all show up

Confirmed.

> In a nutshell, it seems that the final #debug statement in a scene file MUST
> have an ending line break, or there will always be a missing message.

To be more precise, everything beyond the very last line break in any
`#debug` message will be missing. The background is that the parser now
sends debug output to the front-end line by line, rather than `#debug`
statement by `#debug` statement.

There are various reasons why this behaviour was chosen: One is that it
reduces overhead when a debug message is assembled from small pieces
using multiple `#debug` statements; another is that since it guarantees
that each debug output ends with a newline, it plays nice with other
messages such as warnings and errors.

This behaviour has two known side effects, which still need to be addressed:

- Any pending debug output will be discarded when parsing ends (whether
successfully or due to an error).

- Certain styles of conveying progress information won't work at all
(e.g. "Reading CSV file.............. OK").


Post a reply to this message

From: Kenneth
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 18:45:00
Message: <web.596e85938dced37c883fb31c0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 18.07.2017 um 14:29 schrieb Kenneth:

> >
> > * TWO #debugs without the ending line breaks: only the FIRST message
> > shows up, not the second.
>
> Cannot confirm this one: They both shouldn't show up, and that's indeed
> what I'm seeing in experiments (things might be different if the length
> of both messages combined exceeds a certain length).
>
Just tried that example again-- with shorter versions of the #debugs--and the
1st message still shows up. However, all my examples had a *beginning* 'new
line'. But eliminating those--like the following example(s)--results in *none*
of the messages appearing...

#debug "A message."
#debug "Another message."
#debug "A third message."

Whereas this group shows the first message (only)...
#debug "\nA message."  // has a beginning 'new line'
#debug "Another message."
#debug "A third message."

This shows the first two messages...
#debug "\nA message."
#debug "Another message.\n"
#debug "A third message."

And the following results in all three messages appearing...
#debug "A message."
#debug "Another message."
#debug "A third message.\n" // has an ending 'new line'

Here's a quirky one; only the first message appears. (I thought the 2nd message
might appear as well, but no.)
#debug concat("\n","some constants =  <",str(30,1,2),", ",str(40,1,2),">")
#debug "\nA message."
#debug "Another message."
#debug "A third message."

Of course, I don't usually write #debugs this way, because the resulting
message(s) would all be jumbled together on the same line. But it further
illustrates the complexities of the issue. In the 'old days' (v3.5 and 3.6), I
was sometimes sloppy and left out the 'new line' syntax every now and then-- and
still saw all the messages, in some form or other. But now, it looks like I need
to pay more attention! ;-)

BTW, I haven't yet tried these examples by including typical intervening SDL
code, so I don't know if that affects the outcome.


Post a reply to this message

From: Kenneth
Subject: Re: #debug message problem re: line breaks
Date: 18 Jul 2017 19:00:00
Message: <web.596e92838dced37c883fb31c0@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Kenneth,
> If you search around, you will find reference to the fact that the text output
> to the debug stream does not get displayed until a new line of some sort is
> encountered.

Hmm, I haven't seen that. (Probably because I haven't looked up the docs re:
output messages in awhile-- relying instead on my old pre-3.7 knowledge.)

> It's good practice to always end some sort of text output with a "\n"
> I too, used to wonder "Where did my debug output go???"
>

Yes, my old sloppy ways need to be updated ;-) AND... maybe the docs concerning
#debug as well. They're getting a bit 'old and crusty' and probably need a few
additions or clarifications, to reflect the 3.7xx changes that Clipka mentioned.


Post a reply to this message

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