1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
|
<!-- This file copyright Persistence of Vision Raytracer Pty. Ltd. 2003-2004 -->
<html>
<head>
<!-- NOTE: In order to users to help find information about POV-Ray using -->
<!-- web search engines, we ask you to *not* let them index documentation -->
<!-- mirrors because effectively, when searching, users will get hundreds -->
<!-- of results containing the same information! For this reason, the two -->
<!-- meta tags below disable archiving and indexing of this page by all -->
<!-- search engines that support these meta tags. -->
<meta content="noarchive" name="robots">
<meta content="noindex" name="robots">
<meta content="no-cache" http-equiv="Pragma">
<meta content="0" http-equiv="expires">
<title>3.8.4 Language Directives</title>
<link href="povray35.css" rel="stylesheet" type="text/css">
</head>
<body>
<table class="NavBar" width="100%">
<tr>
<td align="left" nowrap="" valign="middle" width="32">
<a href="s_155.html"><img alt="previous" border="0" src="prev.png"></a>
</td>
<td align="left" valign="middle" width="30%">
<a href="s_155.html">3.8.3 Language Basics</a>
</td>
<td align="center" valign="middle">
<strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.8.4
Language Directives</strong>
</td>
<td align="right" valign="middle" width="30%">
<a href="s_157.html">3.8.5 Transformations</a>
</td>
<td align="right" nowrap="" valign="middle" width="32">
<a href="s_157.html"><img alt="next" border="0" src="next.png"></a>
</td>
</tr>
</table>
<h3><a name="s03_08_04">3.8.4 </a>Language Directives</h3>
<a name="s03_08_04_i1"><a name="quickref, language directives"></a><a name="s03_08_04_i2"><a name="s03_08_04_i3">
<dl class="Syntax">
<dt class="SubDesc">
Control the parsing of sections of the scene file:
<dt>
LANGUAGE_DIRECTIVE:
<dd>
<code>INCLUDE_DIRECTIVE | IDENTIFIER_DECLARATION | UNDEF_DIRECTIVE | FOPEN_DIRECTIVE | FCLOSE_DIRECTIVE |
READ_DIRECTIVE | WRITE_DIRECTIVE | DEFAULT_DIRECTIVE | VERSION_DIRECTIVE | IF_DIRECTIVE | IFDEF_DIRECTIVE |
IFNDEF_DIRECTIVE | SWITCH_DIRECTIVE | WHILE_DIRECTIVE | TEXT_STREAM_DIRECTIVE | MACRO_DEFINITION</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_01">3.8.4.1 </a>File Inclusion</h4>
<a name="s03_08_04_01_i1"><a name="quickref, file inclusion"></a><a name="s03_08_04_01_i2">
<dl class="Syntax">
<dt class="SubDesc">
Insert content of another scene file:
<dt>
INCLUDE_DIRECTIVE:
<dd>
<code><strong>#include</strong> FILE_NAME</code>
<dd class="ItemNote">
File inclusion may be nested at most 10 levels deep.
<dt>
FILE_NAME:
<dd>
<code>STRING</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_02">3.8.4.2 </a>Identifier Declaration</h4>
<a name="s03_08_04_02_i1"><a name="quickref, identifier declaration"></a><a name="s03_08_04_02_i2">
<dl class="Syntax">
<dt class="SubDesc">
Create an identifier for a value, object, etc.
<dt>
IDENTIFIER_DECLARATION:
<dd>
<code><strong>#declare</strong> IDENTIFIER <strong>=</strong> RVALUE [<strong>;</strong>] |<br> <strong>#local</strong>
IDENTIFIER <strong>=</strong> RVALUE [<strong>;</strong>]</code>
<dd class="ItemNote">
Up to 127 characters, starting with a letter, consisting of letters, digits and/or the
underscore. The semicolon is required for a FLOAT, VECTOR or COLOR declaration.
<dt>
RVALUE:
<dd>
<code>FLOAT | VECTOR | COLOR | USER_FUNCTION | STRING | ARRAY_REFERENCE | SPLINE | TRANSFORM | CAMERA | LIGHT |
OBJECT | MATERIAL | INTERIOR | TEXTURE | TEXTURE_MAP | PIGMENT | COLOR_MAP | PIGMENT_MAP | NORMAL | SLOPE_MAP |
NORMAL_MAP | FINISH | MEDIA | DENSITY | DENSITY_MAP | FOG | RAINBOW | SKY_SPHERE</code>
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Destroy an identifier:
<dt>
UNDEF_DIRECTIVE:
<dd>
<code><strong>#undef</strong> IDENTIFIER</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_03">3.8.4.3 </a>File Input/Output</h4>
<a name="s03_08_04_03_i1"><a name="quickref, file i/o"></a><a name="s03_08_04_03_i2">
<dl class="Syntax">
<dt class="SubDesc">
Open a text file:
<dt>
FOPEN_DIRECTIVE:
<dd>
<code><strong>#fopen</strong> FILE_HANDLE_IDENTIFIER FILE_NAME OPEN_TYPE</code>
<dt>
OPEN_TYPE:
<dd>
<code><strong>read</strong> | <strong>write</strong> | <strong>append</strong></code>
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Close a text file:
<dt>
FCLOSE_DIRECTIVE:
<dd>
<code><strong>#fclose</strong> FILE_HANDLE_IDENTIFIER</code>
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Read string, float and/or vector values from a text file:
<dt>
READ_DIRECTIVE:
<dd>
<code><strong>#read (</strong> FILE_HANDLE_IDENTIFIER, DATA_IDENTIFIER [, DATA_IDENTIFIER]... <strong>)</strong></code>
<dd class="ItemNote">
Use <strong>defined(</strong>FILE_HANDLE_IDENTIFIER<strong>)</strong> to detect end-of-file
after a read.
<dt>
DATA_IDENTIFIER:
<dd>
<code>UNDECLARED_IDENTIFIER | FLOAT_IDENTIFIER | VECTOR_IDENTIFIER | STRING_IDENTIFIER | ARRAY_REFERENCE</code>
<dd class="ItemNote">
May read a value into an array reference if the array element's type has already been
established.
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Write string, float and/or vector values to a text file:
<dt>
WRITE_DIRECTIVE:
<dd>
<code><strong>#write (</strong> FILE_HANDLE_IDENTIFIER, DATA_ITEM [, DATA_ITEM]... <strong>)</strong></code>
<dt>
DATA_ITEM:
<dd>
<code>FLOAT | VECTOR | STRING</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_04">3.8.4.4 </a>Default Texture</h4>
<a name="s03_08_04_04_i1"><a name="quickref, default texture"></a><a name="s03_08_04_04_i2">
<dl class="Syntax">
<dt class="SubDesc">
Specify a default texture, pigment, normal or finish:
<dt>
DEFAULT_DIRECTIVE:
<dd>
<code><strong>#default {</strong> DEFAULT_ITEM <strong>}</strong></code>
<dt>
DEFAULT_ITEM:
<dd>
<code>PLAIN_TEXTURE | PIGMENT | NORMAL | FINISH</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_05">3.8.4.5 </a>Version Identfier</h4>
<a name="s03_08_04_05_i1"><a name="quickref, version"></a><a name="s03_08_04_05_i2"><a name="s03_08_04_05_i3">
<dl class="Syntax">
<dt class="SubDesc">
Specify the POV-Ray compatibility version number:
<dt>
VERSION_DIRECTIVE:
<dd>
<code><strong>#version</strong> FLOAT<strong>;</strong></code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_06">3.8.4.6 </a>Control Flow Directives</h4>
<a name="s03_08_04_06_i1"><a name="quickref, conditional directives"></a><a name="s03_08_04_06_i2">
<dl class="Syntax">
<dt class="SubDesc">
Conditionally parse a section of the scene file, depending on a boolean expression:
<dt>
IF_DIRECTIVE:
<dd>
<code><strong>#if (</strong> BOOL <strong>)</strong> TOKENS [<strong>#else</strong> TOKENS] <strong>#end</strong></code>
<dt>
TOKENS:
<dd>
Any number of POV-Ray keywords, identifiers, values and/or punctuation.
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Conditionally parse a section of the scene file, depending on the existence of an identifier:
<dt>
IFDEF_DIRECTIVE:
<dd>
<code><strong>#ifdef (</strong> IDENTIFIER <strong>)</strong> TOKENS [<strong>#else</strong> TOKENS] <strong>#end</strong></code>
<dt>
IFNDEF_DIRECTIVE:
<dd>
<code><strong>#ifndef (</strong> IDENTIFIER <strong>)</strong> TOKENS [<strong>#else</strong> TOKENS] <strong>#end</strong></code>
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Conditionally parse a section of the scene file, depending on the value of a float expression:
<dt>
SWITCH_DIRECTIVE:
<dd>
<code><strong>#switch (</strong> FLOAT <strong>)</strong> SWITCH_CLAUSE... [<strong>#else</strong> TOKENS] <strong>#end</strong></code>
<dt>
SWITCH_CLAUSE:
<dd>
<code><strong>#case (</strong> FLOAT <strong>)</strong> TOKENS [<strong>#break</strong>] |<br> <strong>#range (</strong>
F_LOW, F_HIGH <strong>)</strong> TOKENS [<strong>#break</strong>]</code>
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Repeat a section of the scene file while a boolean condition is true:
<dt>
WHILE_DIRECTIVE:
<dd>
<code><strong>#while (</strong><a href="s_155.html#s03_08_03_01"> LOGICAL_EXPRESSION </a><strong>)</strong>
TOKENS <strong>#end</strong></code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_07">3.8.4.7 </a>Message Streams</h4>
<a name="s03_08_04_07_i1"><a name="quickref, message streams"></a><a name="s03_08_04_07_i2">
<dl class="Syntax">
<dt class="SubDesc">
Send a message to a text stream:
<dt>
TEXT_STREAM_DIRECTIVE:
<dd>
<code><strong>#debug</strong> STRING | <strong>#error</strong> STRING | <strong>#warning</strong> STRING</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_08">3.8.4.8 </a>Macro</h4>
<a name="s03_08_04_08_i1"><a name="quickref, macros"></a><a name="s03_08_04_08_i2"><a name="s03_08_04_08_i3">
<dl class="Syntax">
<dt class="SubDesc">
Define a macro:
<dt>
MACRO_DEFINITION:
<dd>
<code><strong>#macro</strong> MACRO_IDENTIFIER <strong>(</strong> [PARAM_IDENTIFIER [, PARAM_IDENTIFIER]...] <strong>)</strong>
TOKENS <strong>#end</strong></code>
<dd class="ItemNote">
A parameter identifier may not be repeated in the list.
</dl>
<dl class="Syntax">
<dt class="SubDesc">
Invoke a macro:
<dt>
MACRO_INVOCATION:
<dd>
<code>MACRO_IDENTIFIER <strong>(</strong> [ACTUAL_PARAM [, ACTUAL_PARAM]...] <strong>)</strong></code>
<dt>
ACTUAL_PARAM:
<dd>
<code>IDENTIFIER | <a href="s_156.html#s03_08_04_02">RVALUE</a></code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<h4><a name="s03_08_04_09">3.8.4.9 </a>Embedded Directives</h4>
<a name="s03_08_04_09_i1"><a name="quickref, embedded directives"></a>
<dl class="Syntax">
<dt class="SubDesc">
Some directives may be embedded in CAMERA, LIGHT, OBJECT and ATMOSPHERIC_EFFECT statements.
However, the directives should only include items (if any) that are valid for a given statement. Also, they should
not disrupt the required order of items, where applicable.
<dt>
EMBEDDED_DIRECTIVE:
<dd>
<code>IDENTIFIER_DECLARATION | UNDEF_DIRECTIVE | READ_DIRECTIVE | WRITE_DIRECTIVE | IF_DIRECTIVE |
IFDEF_DIRECTIVE | IFNDEF_DIRECTIVE | SWITCH_DIRECTIVE | WHILE_DIRECTIVE | TEXT_STREAM_DIRECTIVE</code>
</dl>
<p>
<a href="s_153.html#s03_08_01">Quick Reference Contents</a>
</p>
<br>
<table class="NavBar" width="100%">
<tr>
<td align="left" nowrap="" valign="middle" width="32">
<a href="s_155.html"><img alt="previous" border="0" src="prev.png"></a>
</td>
<td align="left" valign="middle" width="30%">
<a href="s_155.html">3.8.3 Language Basics</a>
</td>
<td align="center" valign="middle">
<strong>3.8.4 Language Directives</strong>
</td>
<td align="right" valign="middle" width="30%">
<a href="s_157.html">3.8.5 Transformations</a>
</td>
<td align="right" nowrap="" valign="middle" width="32">
<a href="s_157.html"><img alt="next" border="0" src="next.png"></a>
</td>
</tr>
</table>
</body> </html>
|