| 1 | |
| 2 | <refentry id="ifndef"> |
| 3 | <indexterm id="IndexIfndefOrch"><primary>#ifndef</primary><secondary>orchestra</secondary></indexterm> |
| 4 | |
| 5 | <indexterm id="IndexIfndef"><primary>#ifndef</primary></indexterm> |
| 6 | <refentryinfo><title>Orchestra Syntax:Macros</title></refentryinfo> |
| 7 | <refmeta> |
| 8 | <refentrytitle>#ifndef</refentrytitle> |
| 9 | </refmeta> |
| 10 | |
| 11 | |
| 12 | |
| 13 | <refnamediv> |
| 14 | <refname>#ifndef</refname> |
| 15 | |
| 16 | <refpurpose> |
| 17 | Conditional reading of code. |
| 18 | </refpurpose> |
| 19 | </refnamediv> |
| 20 | |
| 21 | <refsect1> |
| 22 | <title>Description</title> |
| 23 | <para> |
| 24 | Macros are textual replacements which are made in the orchestra as it is being read. The <link linkend="OrchMacros"><citetitle>orchestra macro system</citetitle></link> in Csound is a very simple one, and uses the characters # and $ to define and call macros. This can save typing, and can lead to a coherent structure and consistent style. This is similar to, but independent of, the <link linkend="ScoreMacros"><citetitle>macro system in the score language</citetitle></link>. |
| 25 | </para> |
| 26 | |
| 27 | <para> |
| 28 | If the specified macro is not defined then <emphasis>#ifndef</emphasis> can |
| 29 | incorporate text into an orchestra upto the next |
| 30 | <emphasis>#end</emphasis>. |
| 31 | </para> |
| 32 | |
| 33 | </refsect1> |
| 34 | |
| 35 | <refsect1> |
| 36 | <title>Syntax</title> |
| 37 | <synopsis><command>#ifndef</command> NAME</synopsis> |
| 38 | <synopsis>....</synopsis> |
| 39 | <synopsis><command>#else</command> </synopsis> |
| 40 | <synopsis>....</synopsis> |
| 41 | <synopsis><command>#end</command> </synopsis> |
| 42 | </refsect1> |
| 43 | |
| 44 | <refsect1> |
| 45 | <title>Performance</title> |
| 46 | <para> |
| 47 | Note that the <emphasis>#ifndef</emphasis> can be nested, like in the C preprocessor language. |
| 48 | </para> |
| 49 | </refsect1> |
| 50 | |
| 51 | <refsect1> |
| 52 | <title>Examples</title> |
| 53 | <para> |
| 54 | Here is a simple example of the conditional. |
| 55 | |
| 56 | <example> |
| 57 | <title>Simple example of the #ifndef form.</title> |
| 58 | |
| 59 | <programlisting> |
| 60 | <emphasis role="omacro">#define</emphasis> final ## |
| 61 | <emphasis role="oblock">instr</emphasis> 1 |
| 62 | <emphasis role="omacro">#ifndef</emphasis> final |
| 63 | <emphasis role="opc">print</emphasis> "calling oscil" |
| 64 | <emphasis role="omacro">#end</emphasis> |
| 65 | a1 <emphasis role="opc">oscil</emphasis> 32000,440,1 |
| 66 | out <emphasis role="opc">a1</emphasis> |
| 67 | <emphasis role="oblock">endin</emphasis></programlisting> |
| 68 | </example> |
| 69 | |
| 70 | </para> |
| 71 | |
| 72 | </refsect1> |
| 73 | |
| 74 | <refsect1> |
| 75 | <title>See also</title> |
| 76 | <para><link linkend="OrchMacros"><citetitle>Orchestra Macros</citetitle></link></para> |
| 77 | </refsect1> |
| 78 | |
| 79 | <refsect1> |
| 80 | <title>Credits</title> |
| 81 | <para> |
| 82 | <simplelist> |
| 83 | <member>Author: &namejohn;</member> |
| 84 | <member>University of Bath/Codemist Ltd.</member> |
| 85 | <member>Bath, UK</member> |
| 86 | <member>April 2005</member> |
| 87 | </simplelist> |
| 88 | </para> |
| 89 | |
| 90 | <para>New in Csound5 (and 4.23f13)</para> |
| 91 | </refsect1> |
| 92 | </refentry> |