| 1 |
Description of File Formats for Config and ChunkDesc files. |
|---|
| 2 |
|
|---|
| 3 |
- Notes on parsing: |
|---|
| 4 |
|
|---|
| 5 |
Reserved words/tokens: |
|---|
| 6 |
|
|---|
| 7 |
in Config files: |
|---|
| 8 |
end |
|---|
| 9 |
true |
|---|
| 10 |
false |
|---|
| 11 |
yes |
|---|
| 12 |
no |
|---|
| 13 |
in ChunkDesc files: |
|---|
| 14 |
chunk |
|---|
| 15 |
end |
|---|
| 16 |
string |
|---|
| 17 |
double |
|---|
| 18 |
int |
|---|
| 19 |
boolean |
|---|
| 20 |
1. In order to have words that the parser will think are tokens interpreted |
|---|
| 21 |
as strings, surround them with quotes (""). This is also necessary |
|---|
| 22 |
in order to have strings with whitespace considered as single strings. |
|---|
| 23 |
2. bug - there's no way to include quotes inside a quoted string. (Is this |
|---|
| 24 |
possible in non-quoted strings?). |
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
II. Description of ChunkDesc (ConfigChunk Description) files. |
|---|
| 28 |
|
|---|
| 29 |
A ChunkDesc file includes descriptions of different kinds of |
|---|
| 30 |
ConfigChunks. It is a way to configure the configuration system itself. |
|---|
| 31 |
For example, here are two entries that you might find in a ChunkDesc file: |
|---|
| 32 |
|
|---|
| 33 |
chunk flockobirds |
|---|
| 34 |
port string 1 port "serial port address" |
|---|
| 35 |
offset double 3 offset "tracker coord offset from origin" |
|---|
| 36 |
baudrate int 1 baud "serial port rate" |
|---|
| 37 |
end |
|---|
| 38 |
|
|---|
| 39 |
chunk display |
|---|
| 40 |
name string 1 name "descriptive name" |
|---|
| 41 |
origin double 3 origin "other help text" |
|---|
| 42 |
size int 2 size "" |
|---|
| 43 |
SGIpipe int 1 SGIpipe "" |
|---|
| 44 |
xdisplay string 1 xdisplay "" |
|---|
| 45 |
stereo bool 1 stereo "" |
|---|
| 46 |
lowerleft double 3 lowerleft "" |
|---|
| 47 |
lowerright double 3 lowerright "" |
|---|
| 48 |
upperleft double 3 upperleft "" |
|---|
| 49 |
end |
|---|
| 50 |
|
|---|
| 51 |
The first entry defines a chunk type called "flockobirds" that contains |
|---|
| 52 |
three properties ("port", "offset", and "baudrate"). The second defines |
|---|
| 53 |
a chunktype called "display" which contains 9 properties. |
|---|
| 54 |
Each property has a type - for example, the values that "port" can take |
|---|
| 55 |
will be strings, such as "/dev/ttyd45", while baudrate will always have |
|---|
| 56 |
integer values. |
|---|
| 57 |
It is possible for a property to have a set of values. For example, |
|---|
| 58 |
the "display" chunk's "lowerleft", "lowerright", and "upperleft" |
|---|
| 59 |
properties are meant to represent positions in 3d space. These can be |
|---|
| 60 |
represented by a sequence of three doubles for the x, y, and z coordinates. |
|---|
| 61 |
The number of values a property supports is listed directly to the right |
|---|
| 62 |
of the type - the "3" in the line for "lowerleft", or the "1" for "stereo." |
|---|
| 63 |
If a property might have a variable number of entries (perhaps as a list |
|---|
| 64 |
of active displays, or such), use the number -1. |
|---|
| 65 |
The fourth word on each property line is the actual token to be used to |
|---|
| 66 |
represent this property when reading/writing config files. Most often this |
|---|
| 67 |
will be the same as the name of the property (which is used internally for |
|---|
| 68 |
querying a ConfigChunk), but the options is provided to make the config |
|---|
| 69 |
files more flexible or readable. |
|---|
| 70 |
The last thing on a property line is a help string. If the help string |
|---|
| 71 |
contains spaces or is empty, it must be in quotes. |
|---|
| 72 |
|
|---|
| 73 |
For int type properties, there is also an optional set of enumeration |
|---|
| 74 |
values, which can be placed between the token name and the help string. |
|---|
| 75 |
For example: |
|---|
| 76 |
|
|---|
| 77 |
chunk C2Setup |
|---|
| 78 |
ActiveWalls int -1 ActiveWalls { front back left right top |
|---|
| 79 |
bottom } "list of walls to show" |
|---|
| 80 |
|
|---|
| 81 |
then in a config file, instead of having to say "ActiveWalls { 0 3 4 }" |
|---|
| 82 |
you can say, more intuitively, "ActiveWalls { front right top }". Values |
|---|
| 83 |
in an enum start at 0, but can also be explicitly stated: |
|---|
| 84 |
|
|---|
| 85 |
ActiveWalls int -1 ActiveWalls { front=3 back left right=0 } "" |
|---|
| 86 |
|
|---|
| 87 |
then the values assigned to each enumeration item will be 3,4,5, and 0, |
|---|
| 88 |
from left to right. |
|---|
| 89 |
|
|---|
| 90 |
In addition to the explicitly listed properties, every chunktype has a |
|---|
| 91 |
property called "type", which has a single string value. This provides a |
|---|
| 92 |
way to query for the type of the ConfigChunk. For our examples above, the |
|---|
| 93 |
values of the "type" property would be "flockobirds" and "display", |
|---|
| 94 |
respectively. |
|---|
| 95 |
Once all the properties for a particular chunk have been listed, the |
|---|
| 96 |
symbol "end" is used to close the description. |
|---|
| 97 |
|
|---|
| 98 |
Here's the standard form of a ConfigDesc entry: |
|---|
| 99 |
|
|---|
| 100 |
chunk <typename> |
|---|
| 101 |
<property1> <type> <numentries> <token> |
|---|
| 102 |
<property2> ... |
|---|
| 103 |
... |
|---|
| 104 |
<propertyn> ... |
|---|
| 105 |
end |
|---|
| 106 |
|
|---|
| 107 |
<Typename> can be any string value (that hasn't already been defined as a |
|---|
| 108 |
typename). <Propertyx> can be any string, except "type" (and all the |
|---|
| 109 |
property names for a given chunk type should be unique). <Numentries> is |
|---|
| 110 |
an integer, greater than 0 or -1. <Token> is any string (although all tokens |
|---|
| 111 |
in a given chunk type should be unique). |
|---|
| 112 |
|
|---|
| 113 |
A ChunkDesc file is simply zero or more of these entries, followed by |
|---|
| 114 |
a final "end". |
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
III. Description of ConfigChunk files |
|---|
| 118 |
|
|---|
| 119 |
A config file is zero or more ConfigChunk entries terminated with the word |
|---|
| 120 |
"end". Here are some example chunks: |
|---|
| 121 |
|
|---|
| 122 |
display |
|---|
| 123 |
name "c2 rear wall" |
|---|
| 124 |
XDisplay ":0.0" |
|---|
| 125 |
stereo false |
|---|
| 126 |
sgipipe 1 |
|---|
| 127 |
size { 9 12 } |
|---|
| 128 |
lowerleft { 3.4 6.555 9.9 } |
|---|
| 129 |
origin { 3.3 1.0 5.5 } |
|---|
| 130 |
end |
|---|
| 131 |
|
|---|
| 132 |
display |
|---|
| 133 |
name "c2 Front Wall" |
|---|
| 134 |
XDisplay ":0.0" |
|---|
| 135 |
stereo true |
|---|
| 136 |
end |
|---|
| 137 |
|
|---|
| 138 |
c2setup |
|---|
| 139 |
c2width 3.3 |
|---|
| 140 |
walls { front left right top bottom } |
|---|
| 141 |
c2height 3.5 |
|---|
| 142 |
end |
|---|
| 143 |
|
|---|
| 144 |
end |
|---|
| 145 |
|
|---|
| 146 |
|
|---|