Debian Codegraph @

opcodes/ifdef.xml

raw symbols SCIP
1
2 <refentry id="ifdef">
3 <indexterm id="IndexIfdefOrch"><primary>&num;ifdef</primary><secondary>orchestra</secondary></indexterm>
4
5 <indexterm id="IndexIfdef"><primary>&num;ifdef</primary></indexterm>
6 <refentryinfo><title>Orchestra Syntax:Macros</title></refentryinfo>
7 <refmeta>
8 <refentrytitle>&num;ifdef</refentrytitle>
9 </refmeta>
10
11
12
13 <refnamediv>
14 <refname>&num;ifdef</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 &num; and &dollar; 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 a macro is defined then <emphasis>&num;ifdef</emphasis> can
29 incorporate text into an orchestra upto the next
30 <emphasis>&num;end</emphasis>.
31 </para>
32
33 </refsect1>
34
35 <refsect1>
36 <title>Syntax</title>
37 <synopsis><command>&num;ifdef</command> NAME</synopsis>
38 <synopsis>....</synopsis>
39 <synopsis><command>&num;else</command>&#160;</synopsis>
40 <synopsis>....</synopsis>
41 <synopsis><command>&num;end</command>&#160;</synopsis>
42 </refsect1>
43
44 <refsect1>
45 <title>Performance</title>
46 <para>
47 Note that the <emphasis>&num;ifdef</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 #ifdef form.</title>
58
59 <programlisting>
60 <emphasis role="omacro">#define</emphasis> debug ##
61 <emphasis role="oblock">instr</emphasis> 1
62 <emphasis role="omacro">#ifdef</emphasis> debug
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 <para>
76 Here is another example of the #ifdef conditional. It uses the file <ulink url="examples/ifdef.csd"><citetitle>ifdef.csd</citetitle></ulink>.
77
78 <example>
79 <title>Detailed example of the #ifdef form.</title>
80 <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
81 <xi:include href="examples-xml/ifdef.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
82 </example>
83 </para>
84 </refsect1>
85
86 <refsect1>
87 <title>See also</title>
88 <para><link linkend="OrchMacros"><citetitle>Orchestra Macros</citetitle></link></para>
89 </refsect1>
90
91 <refsect1>
92 <title>Credits</title>
93 <para>
94 <simplelist>
95 <member>Author: &namejohn;</member>
96 <member>University of Bath/Codemist Ltd.</member>
97 <member>Bath, UK</member>
98 <member>April 2005</member>
99 </simplelist>
100 </para>
101
102 <para>New in Csound5 (and 4.23f13)</para>
103 </refsect1>
104 </refentry>