Previous page Next page

User Message Directives

With the addition of conditional and loop directives, the POV-Ray language has the potential to be more like an actual programming language. This means that it will be necessary to have some way to see what is going on when trying to debug loops and conditionals. To fulfill this need we have added the ability to print text messages to the screen. You have a choice of five different text streams to use including the ability to generate a fatal error if you find it necessary. Limited formatting is available for strings output by this method.

Text Message Streams

The syntax for a text message is any of the following:

TEXT_STREAM_DIRECTIVE:
#debug STRING |
#error STRING |
#render STRING |
#statistics STRING |
#warning STRING

Where STRING is any valid string of text including string identifiers or functions which return strings. For example:

 #switch (clock*360)

  #range (0,180)

   #render "Clock in 0 to 180 range\n"

  #break

  #range (180,360)

   #render "Clock in 180 to 360 range\n"

  #break

  #else

   #warning "Clock outside expected range\n"

   #warning concat("Value is:",str(clock*360,5,0),"\n")

 #end

There are seven distinct text streams that POV-Ray uses for output. You may output only to five of them. On some versions of POV-Ray, each stream is designated by a particular color. Text from these streams are displayed whenever it is appropriate so there is often an intermixing of the text. The distinction is only important if you choose to turn some of the streams off or to direct some of the streams to text files. On some systems you may be able to review the streams separately in their own scroll-back buffer. See "Directing Text Streams to Files" for details on re-directing the streams to a text file.

Here is a description of how POV-Ray uses each stream. You may use them for whatever purpose you want except note that use of the #error stream causes a fatal error after the text is displayed.

Debug: This stream displays debugging messages. It was primarily designed for developers but this and other streams may also be used by the user to display messages from within their scene files.

Fatal: This stream displays fatal error messages. After displaying this text, POV-Ray will terminate. When the error is a scene parsing error, you may be shown several lines of scene text that leads up to the error.

Render: This stream displays information about what options you have specified to render the scene. It includes feedback on all of the major options such as scene name, resolution, animation settings, anti-aliasing and others.

Statistics: This stream displays statistics after a frame is rendered. It includes information about the number of rays traced, the length of time of the processing and other information.

Warning: This stream displays warning messages during the parsing of scene files and other warnings. Despite the warning, POV-Ray can continue to render the scene.

The banner and status streams can not be accessed by the user.

Text Formatting

Some escape sequences are available to include non-printing control characters in your text. These sequences are similar to those used in string literals in the C programming language. The sequences are:

"\a"

Bell or alarm,

0x07

"\b"

Backspace,

0x08

"\f"

Form feed,

0x0C

"\n"

New line (line feed)

0x0A

"\r"

Carriage return

0x0D

"\t"

Horizontal tab

0x09

"\v"

Vertical tab

0x0B

"\0"

Null

0x00

"\\"

Backslash

0x5C

"\'"

Single quote

0x27

"\""

Double quote

0x22

For example:

 #debug "This is one line.\nBut this is another"

Depending on what platform you are using, they may not be fully supported for console output. However they will appear in any text file if you re-direct a stream to a file.

Note that most of these control characters only apply in text message directives and #write directives which write strings They are not implemented for other string usage in POV-Ray such as text objects or file names.

Previous page Next page