26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C.2.2<br />

Error handling<br />

<strong>The</strong>re are two types of errors that may be encountered while processing a RIB input stream:<br />

syntactic errors and semantic errors. Syntactic errors occur when the stream of tokens fails to<br />

form a syntactically legal statement or request. For example, a syntactic error occurs when<br />

a required parameter is missing, or when a string is left unterminated. Semantic errors<br />

occur when a syntactically legal statement contains incorrect data; e.g., when a parameter<br />

that must be non-negative is specified to be -1.<br />

RIB defines a number of syntactic errors and a limited number of semantic errors. In theory<br />

RIB should be responsible only for syntactic errors. However, due to the weak typing of<br />

programming languages such as C, semantic errors that can not be easily recognized within<br />

the <strong>RenderMan</strong> <strong>Interface</strong> software are checked at the RIB level. For example, RIB checks<br />

arrays that are to be converted to matrices to be sure they have 16 values.<br />

Table C.2 shows the set of errors recognized by RIB. Detailed descriptions of the errors are<br />

given below.<br />

All errors encountered by a RIB interpreter require some associated action to be performed.<br />

In the case of syntax errors, if input processing is to be continued, the input scanner must<br />

resynchronize itself with the input stream. This synchronization is done by reading and<br />

discarding tokens from the input stream until a valid RIB request token is encountered.<br />

That is, any tokens between the point of the syntax error and the next request token are<br />

discarded. <strong>The</strong> protocol has been designed so that no more than one request (along with<br />

any associated parameters) must be discarded when recovering from an error.<br />

Errors are handled in one of three ways:<br />

• <strong>The</strong>y are ignored and the rendering process will proceed to its completion no matter<br />

what input stream is provided.<br />

• <strong>The</strong>y cause diagnostic messages to be generated on the renderer’s standard error<br />

stream, but they are otherwise ignored (the default).<br />

• <strong>The</strong> first error causes a diagnostic message to be generated and the renderer terminates<br />

immediately without creating an image.<br />

If the RIB interpreter is acting as a network server, in direct communication with a client<br />

application, the interpreter may send parsing error signals back to the client. <strong>The</strong>se signals<br />

take the form of the following RIB requests, though they are not valid in the client-to-server<br />

stream. None of these error requests have arguments. Note that some errors may not be<br />

recognized immediately by a RIB interpreter upon parsing a request. This may be due to<br />

buffering or queuing built into the interface between the intepreter and the renderer. In a<br />

client-server environment this may have implications for the client application.<br />

arraytoobig<br />

<strong>The</strong> interpreter was unable to allocate sufficient memory to store an<br />

array specified in the input stream. This error is dependent on the<br />

interpreter’s implementation. Good implementations of a RIB interpreter<br />

support arrays as large as memory will permit.<br />

180

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!