File: environment-description-syntax.html

package info (click to toggle)
ctpl 0.3.4%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,340 kB
  • sloc: sh: 12,160; ansic: 5,879; python: 159; makefile: 124; sed: 16
file content (188 lines) | stat: -rw-r--r-- 9,631 bytes parent folder | download | duplicates (4)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CTPL Reference Manual: Environment description syntax</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="CTPL Reference Manual">
<link rel="up" href="ch01.html" title="CTPL overview">
<link rel="prev" href="ch01s03.html" title="Templates syntax">
<link rel="next" href="ch01s05.html" title="Input and output encoding">
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ch01s03.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ch01s05.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="environment-description-syntax"></a>Environment description syntax</h2></div></div></div>
<p>
        The environment descriptions (that can be read by
        <a class="link" href="ctpl-CtplEnviron.html#ctpl-environ-add-from-stream" title="ctpl_environ_add_from_stream ()">ctpl_environ_add_from_stream()</a>
        and friends) contains any number of symbol-value pairs that have the
        following syntax:
        </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">&lt;</span>symbol<span class="gtkdoc opt">&gt; = &lt;</span>value<span class="gtkdoc opt">&gt;;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
        where <code class="code">&lt;symbol&gt;</code> is a
        <a class="link" href="environment-description-syntax.html#environment-description-syntax-symbol" title="Symbol">valid
        symbol</a> and <code class="code">&lt;value&gt;</code> is a
        <a class="link" href="environment-description-syntax.html#environment-description-syntax-value" title="Value">valid value</a>.
        Apart the four required parts (symbol, equal sign, value, semicolon),
        there can be any number of
        <a class="link" href="environment-description-syntax.html#environment-description-syntax-blank" title="Blanks">blank
        characters</a> and
        <a class="link" href="environment-description-syntax.html#environment-description-syntax-comment" title="Comments">comments</a>
        before, between and after them.
      </p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="environment-description-syntax-symbol"></a>Symbol</h3></div></div></div>
<p>
          The symbol part is composed of any alphanumeric characters and
          underscore, repeated any number of times.
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="environment-description-syntax-value"></a>Value</h3></div></div></div>
<p>
          There are 3 supported value types:
          </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>
                Numbers, as read by
                <a class="link" href="ctpl-CtplInputStream.html#ctpl-input-stream-read-number" title="ctpl_input_stream_read_number ()">ctpl_input_stream_read_number()</a>.
              </p></li>
<li class="listitem"><p>
                Strings, as read by
                <a class="link" href="ctpl-CtplInputStream.html#ctpl-input-stream-read-string-literal" title="ctpl_input_stream_read_string_literal ()">ctpl_input_stream_read_string_literal()</a>.
              </p></li>
<li class="listitem">
<p>
                Arrays of any of these 3 types of values. Arrays start with an
                opening square bracket (<code class="code">[</code>) and end with a closing
                square bracket (<code class="code">]</code>). The values in the array are
                separated by a comma (<code class="code">,</code>).
                There can be any number of values (but at least one), which may
                be of any type, including arrays as well.
              </p>
<div class="example">
<a name="id-1.2.5.4.2.1.3.2"></a><p class="title"><b>Example 5. A sample array</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">[</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="number">3</span><span class="gtkdoc opt">,</span> <span class="string">&quot;more&quot;</span><span class="gtkdoc opt">, [</span><span class="number">42</span><span class="gtkdoc opt">,</span> <span class="number">84</span><span class="gtkdoc opt">,</span> <span class="number">126</span><span class="gtkdoc opt">]]</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<br class="example-break">
</li>
</ul></div>
<p>
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="environment-description-syntax-blank"></a>Blanks</h3></div></div></div>
<p>
          Blank characters are not interpreted and may appear anywhere
          nothing is expected, e.g. between the identifier and the equal sign.
          The blank characters are space, tab, vertical tab, newline and
          carriage return.
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="environment-description-syntax-comment"></a>Comments</h3></div></div></div>
<p>
          Comments are special segments that don't get interpreted. Such
          segments start with a number sign (<code class="code">#</code>) that is not part
          of any other construct (such as a string literal), and ends at the
          following end of line.
        </p>
<p>
          Comments can be useful to add extra information to explain an element,
          to separate different parts or to disable a part of the description
          without actually removing it.
        </p>
<div class="example">
<a name="id-1.2.5.6.4"></a><p class="title"><b>Example 6. A small comment</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc"># This is a comment</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<br class="example-break">
</div>
<div class="example">
<a name="id-1.2.5.7"></a><p class="title"><b>Example 7. An environment description example</b></p>
<div class="example-contents">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc ppc"># This is an example that shows some environment description syntax.</span>
<span class="gtkdoc ppc"># It does not show everything (there are more supported numeric constructs for</span>
<span class="gtkdoc ppc"># example), but it covers a pretty good part of it.</span>

foo         <span class="gtkdoc opt">=</span> <span class="string">&quot;string value&quot;</span><span class="gtkdoc opt">;</span>
<span class="gtkdoc ppc"># This is a comment</span>
bar         <span class="gtkdoc opt">=</span> <span class="number">42</span><span class="gtkdoc opt">;</span> <span class="gtkdoc ppc"># An important number!</span>
str         <span class="gtkdoc opt">=</span> <span class="string">&quot;a more</span>
<span class="string">               complex</span><span class="gtkdoc esc">\&quot;</span> <span class="string">string&quot;</span><span class="gtkdoc opt">;</span>
array       <span class="gtkdoc opt">= [</span><span class="number">1</span><span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">,</span> <span class="string">&quot;hello&quot;</span><span class="gtkdoc opt">, [</span><span class="string">&quot;world&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;dolly&quot;</span><span class="gtkdoc opt">]];</span>
real_number <span class="gtkdoc opt">=</span> <span class="number">2.12e-9</span><span class="gtkdoc opt">;</span>
hex_number  <span class="gtkdoc opt">=</span> <span class="number">0xffe2</span><span class="gtkdoc opt">;</span> <span class="gtkdoc ppc"># 65506</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

</div>
<br class="example-break">
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.21</div>
</body>
</html>