1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
3
4<appendix id='Resource_File_Format'>
5<title>Resource File Format</title>
6<para>
7A resource file contains text representing the default resource values for an
8application or set of applications.
9</para>
10
11<para>
12The format of resource files is defined by
13<emphasis remap='I'>Xlib &mdash; C Language X Interface.</emphasis> and is reproduced here
14for convenience only.
15</para>
16
17<para>The format of a resource specification is</para>
18<informaltable frame='none'>
19  <?dbfo keep-together="always" ?>
20  <tgroup cols='2' align='left' colsep='0' rowsep='0'>
21  <colspec colwidth='0.3*' colname='c1'/>
22  <colspec colwidth='1.0*' colname='c2'/>
23  <tbody>
24    <row>
25      <entry>ResourceLine</entry>
26      <entry>= Comment | IncludeFile | ResourceSpec | &lt;empty line&gt;</entry>
27    </row>
28    <row>
29      <entry>Comment</entry>
30      <entry>=&ldquo;!&rdquo; {&lt;any character except null or newline&gt;}</entry>
31    </row>
32    <row>
33      <entry>IncludeFile</entry>
34      <entry>= &ldquo;#&rdquo; WhiteSpace &ldquo;include&rdquo; WhiteSpace FileName WhiteSpace</entry>
35    </row>
36    <row>
37      <entry>FileName</entry>
38      <entry>= &lt;valid filename for operating system&gt;</entry>
39    </row>
40    <row>
41      <entry>ResourceSpec</entry>
42      <entry>= WhiteSpace ResourceName WhiteSpace &ldquo;:&rdquo; WhiteSpace Value</entry>
43    </row>
44    <row>
45      <entry>ResourceName</entry>
46      <entry>= [Binding] {Component Binding} ComponentName</entry>
47    </row>
48    <row>
49      <entry>Binding</entry>
50      <entry>=&ldquo;.&rdquo; | &ldquo;*&rdquo;</entry>
51    </row>
52    <row>
53      <entry>WhiteSpace</entry>
54      <entry>= {&lt;space> | &lt;horizontal tab&gt;}</entry>
55    </row>
56    <row>
57      <entry>Component</entry>
58      <entry>= &ldquo;?&rdquo; | ComponentName</entry>
59    </row>
60    <row>
61      <entry>ComponentName</entry>
62      <entry>= NameChar {NameChar}</entry>
63    </row>
64    <row>
65      <entry>NameChar</entry>
66      <entry>= &ldquo;a&rdquo;&ndash;&ldquo;z&rdquo; | &ldquo;A&rdquo;&ndash;&ldquo;Z&rdquo; | &ldquo;0&rdquo;&ndash;&ldquo;9&rdquo; | &ldquo;_&rdquo; | &ldquo;-&rdquo;</entry>
67    </row>
68    <row>
69      <entry>Value</entry>
70      <entry>={&lt;any character except null or unescaped newline&gt;}</entry>
71    </row>
72  </tbody>
73  </tgroup>
74</informaltable>
75
76<para>
77Elements separated by vertical bar (|) are alternatives.
78Curly braces ({...}) indicate zero or more repetitions
79of the enclosed elements.
80Square brackets ([...]) indicate that the enclosed element is optional.
81Quotes (&ldquo;...&rdquo;) are used around literal characters.
82</para>
83
84<para>
85If the last character on a line is a backslash (\),
86that line is assumed to continue on the next line.
87</para>
88
89<para>
90To allow a Value to begin with whitespace,
91the two-character sequence &ldquo;\<emphasis remap='I'>space</emphasis>&rdquo; (backslash followed by space)
92is recognized and replaced by a space character,
93and the two-character sequence &ldquo;\<emphasis remap='I'>tab</emphasis>&rdquo;
94(backslash followed by horizontal tab)
95is recognized and replaced by a horizontal tab character.
96</para>
97<para>
98To allow a Value to contain embedded newline characters,
99the two-character sequence &ldquo;\n&rdquo; is recognized and replaced by a
100newline character.
101To allow a Value to be broken across multiple lines in a text file,
102the two-character sequence &ldquo;\<emphasis remap='I'>newline</emphasis>&rdquo;
103(backslash followed by newline) is
104recognized and removed from the value.
105</para>
106<para>
107To allow a Value to contain arbitrary character codes,
108the four-character sequence &ldquo;\<emphasis remap='I'>nnn</emphasis>&rdquo;,
109where each <emphasis remap='I'>n</emphasis> is a digit character in the range of &ldquo;0&rdquo;&ndash;&ldquo;7&rdquo;,
110is recognized and replaced with a single byte that contains
111the octal value specified by the sequence.
112Finally, the two-character sequence &ldquo;\\&rdquo; is recognized
113and replaced with a single backslash.
114</para>
115</appendix>
116