1 Locations, angles, etc.
3 Key type is a `loc', which is a named location (absolute, 2D) and
4 direction (at the location). Angles are generally positive
5 anticlockwise; bearings are angles measured from East. The origin is
11 -<identifier> reverse the sense (ie, 180 degrees off)
13 <identifier> simply the named location
14 -<identifier> reverse the sense (ie, 180 degrees off)
15 O![-]<identifier> the location from the specified object
16 in whatever coordinate system that object
18 ^O![-]<identifier> the same, but the object is flipped
19 N-S first (see `part' and `objflip')
20 Quantity (length/angle)
22 Angle units: d (degrees,default) r (radians)
23 Length units: mm (default) cm m
24 Identifiers (of locs and objects) start with lc letter, then
25 alphanums and underscores
30 Defines loc P given coordinates (distances) and absolute bearing
33 Defines loc T: start at loc F, go forward L, translate right R,
34 turn left A (defaults are all 0).
36 segment [K*] [[-]S0 D0 ...] [-]Sn
37 Specifies that arcs and lines in layer kind K are part of subsegment
38 Sn. `-' preceding the segment indicates that the Q rail is on the
39 left as the line is drawn; without `-' the T rail is on the left.
41 If additional Di and Si are provided then each Si apart from the
42 last is followed by a distance Di saying how much track it applies
43 to; the first D0 of track is part of subsegment S0, the next D1 of
44 track is part of the next subsegment S1, and so on, with the last
45 subsegment Sn (without a distance restriction) being used for track
46 beyond that. Each segment command resets the distance counter, and
47 it is not an error for there to be unused subsegment specs in a
48 segment command. For these distances, only track whose subsegment
49 encoding is actually drawn counts.
51 If a part or object is used, then the arcs and lines inside it are
52 processed for subsegments as if they appeared directly.
54 A subsegment is a specification of:
55 * The named electrically separate track segment of which
56 this track forms part.
57 * If this track is part of one possible configuration of a
58 junction or point, the moveable feature name and configuration
59 number. Any one junction or point is one moveable feature and
60 must be associated with and form part of one track segment.
61 Moveable segments must be entirely contained within objects or
62 parts (ie, one moveable segment cannot span multiple parts).
63 Configuration numbers should start at 0 and be allocated densely.
65 Subsegment specs Si are
68 N is the segment name (alphanumeric, may be empty)
69 M is the moveable feature name (alphabetic, nonempty)
70 P is the moveable feature position (numeric, nonempty, 0-indexed)
71 If N is empty and MP is omitted then / must be present.
72 Underscore (`_') counts as a letter.
74 If a segment command occurs in a part or object, N is appended to
75 the N in force at the start of the part or object, and in this
76 case the segment will be set back to the last one from the list
77 in force when the object was entered, as if the object had merely
78 drawn an infinite amount of track.
80 At the start of processing at the toplevel, the empty-named fixed
81 subsegment is in use. The empty-named top-level segment indicates
82 that the subsegment is unspecified, unknown or absent. All segments
83 defined by objects at whose invocation the empty-named top-level
84 segment is in force, are also assigned to the empty segment.
88 Maps specified (sub)segments or moveable feature(s) S to
89 consequently defined (sub)segments or moveable features D. This is
90 primarily intended so that parts' internal segment and feature names
91 can be remapped to correspond to the layout naming scheme.
95 N N' remaps an entire segment including all features
96 N/M M' remaps a particular moveable feature; N is the
97 unmapped name (if applicable)
99 The effect is that (sub)segments or features used in segment
100 commands are translated when the segment command is read; the
101 specified names (S) are those which the segment command would
104 Where segmap is used outside a part or object, the mappings apply to
105 the segment names which would result at the toplevel. When segmap
106 is used inside a part or object, the mappings apply to the segment
107 names defined within the part (perhaps by its subparts). Ie, the
108 mapping operates on the segment names visible at the level at which
109 segmap is used (and thus several segmaps at different levels may
110 operate on a signal segment name, in sequence).
112 Mappings in later segmap commands replace earlier mappings at the
115 The remapping may coalesce otherwise-distinct segments.
118 K is layer kind (letters and `_', may be empty), L is a layer depth
119 (digits, or `=' meaning current layer, or `*' meaning output layer;
120 default for L is `='; default KL at start of file is `layer 5').
121 Controls drawing style, by selecting appropriate parts of the track
122 and locs to draw, according to element selection rules. Default
124 K result (description) result (element letters)
125 empty default track RLMNasco
126 `s' nothing (`silent') -
127 `l' centrelines only CLMNarso
128 other everything ARSCLMNO
130 extend F T len L [R] length L
131 extend F T upto U [R] s.t. perpendicular at T passes through U
132 extend F T ang A R subtending directionally A
133 extend F T uptoang A R s.t. direction at T is A
134 extend F T parallel U R s.t. direction at T is same as at U
135 Draws an arc or line from loc F, defining the other end as loc T.
136 If length R specified, draws an arc of radius R; R +ve curves to the
137 right; R -ve to the left.
140 Joins one existing loc, F, to another, T. F's direction points to
141 the new track; T's away - ie the added track leaves F in F's
142 direction and arrives at T in T's direction. R is the minimum curve
143 radius allowed. S selects from the available solutions, and may be
145 long prefer longer length solution
146 short prefer shorter length solution
147 right|left prefer mostly bending to the left resp. right
148 beginright|beginleft prefer first bend to the right
149 endright|endleft prefer final bend to the right
150 [!]twoarcs prefer [not] two circular arcs of equal radius
151 [!]arcline prefer [not] one line and an arc of max radius
152 [!]arcsline prefer [not] line between two arcs of min radius
153 [!]loop prefer [not] loop (arcsline, arc of same sense)
154 [!]cross prefer [not] cross (arcsline 2 senses, or twoarcs)
155 if this doesn't resolve, will pick the shortest.
160 Defines the object or part O. Inside the definition, the commands
161 do not draw when the object is being defined. The object has its
162 own coordinate space and its own location namespace. `defpart'
163 defines a `part', which is like an object except that:
164 * showlibrary lists only parts, not objects
165 * the -e and -E command line options distinguish parts and objects
167 part N [^]O [F [A]] [FR AR ...]
169 Places an instance of object or part O. The loc defined inside O as
170 F (`formal parameter', F must be just <identifier>) is placed at
171 existing loc A (`actual parameter').
173 Both objects (defined with defobj) and parts (defined with defpart)
174 may be placed with either command ! Whether it's a part or an obj
175 depends on the definition, not on the use - the use is just
176 different syntaxes for the same kind of operation, and where the
177 features offered by both `part' and `obj[flip]' overlap the
178 behaviour is identical.
180 If `part N ^O' or `objflip' is used, rather than `part N O' or
181 `obj', then the object is placed with object-space y coordinates
182 negated (ie, it is mirrored so that the object's North exchanges
185 For `part', each FR (`formal result') and AR (`actual result')
186 specifies that the loc FR inside O is exported into the calling
187 namespace as a new loc AR. Either FR or AR may start with `-'.
188 Also, each loc L inside O is exported into the calling namespace as a
189 new loc N_L (unless N_L already exists). If A is not specified then
192 For `obj[flip]' if prefix P (syntax is that of an identifier) is
193 specified, each other loc L inside O is exported into the calling
194 namespace as a new loc PL (unless PL already exists). P may be `='
195 to indicate an empty prefix (default is not to export locs).
198 Map segment S to colours using postscript commands P... (which
199 should be a postscript fragment to modify the graphics state,
200 typically `N setgray' or the like. This is used for the drawing
201 element Q (see below). S should be the bare segment (no movfeat).
204 Notes that segment S (which should not specify a movfeat) has
205 an end at this location. This is fed back from extractgraph's run
206 on a previous result of running layout, and used to determine where
207 to place the segment labels for E. NOT YET IMPLEMENTED
211 -D turn on debug (level 1) } currently only debug levels are
212 -Dnnn set debug level to nnn } 0 (none) and 1 (some), default=0
214 -lL output for layer L (digits, or `*' for any) (default: *)
216 -S<scale> set scale divider to <scale> (default is 7.0, ie
217 output is 1/7 actual size)
219 -P<xp>x<yp> output physical page (<xp>,<yp>). xp and yp are
220 integers specifying the number of pages to shift by
221 in each direction. xp is multiplied by 270mm; yp
222 is multiplied by 190mm.
224 -e<layersel>[ARSCcLlDdMNOm]...
225 Turn on and off drawing of elements in groups.
226 These are abbreviations for various -E... options.
230 S rails and sleepers only aRScgd
231 C centrelines only arsCgd
232 c swept area and ticks only Arscgd
233 r no lines drawn at all arsc
235 L label top-level locs (turns on bars for them too) LMg
236 l do not label any locs l
238 D label all distances D
239 d do not label any distances
240 bars at locs (thick lines perp to track dir'n)
241 M bars for top-level locs only Mnog
242 N bars for top-level locs and those in obj's MNog
243 O bars for everything, including those inside parts MNOg
244 m no bars (turns off labelling too) mnol
246 G draw only subsegment encoding Garcslmno
248 -E<layersel>[ARSCLDMNOarscldmno]...
249 enable (capitals) or disable (lowercase) drawing of
251 A draw track swept area, with ticks
253 Q draw track segment fills according to segcmap
254 S draw track sleepers
255 C draw track centrelines
257 D label distances along the track
258 M mark locs with a bar
259 N mark locs with a bar in objs
260 O mark locs with a bar in parts
261 G draw subsegment encoding
263 -q quiet: do not print info to stderr
264 (default: prints bounding box, at the moment)
266 [-GL output segment colour map request list ]
267 [ use with -eG or -EG to write out the list of subsegment ]
268 [ specs which will need colours, one per line (and not ]
269 [ necessarily only once each) ]
270 -GL, -GR, -GP are to do with segment encoding and subsegment specs
271 and that kind of thing. The comment above is the most useful
272 documentation and is out of date. See also layout's argument
273 parser, segencolayers.gen-make, Makefile, segcmap.h, segcmapassign,
276 <layersel> (for -e and -E) works as follows:
278 When file says `layer KL', default drawing element set is set
279 depending on K and L (see description of `layer' command), using last
280 specified -l layer. Then all -e/-E options are scanned, in order,
281 and each one that matches modifies the drawing element set.
283 <layersel> is GN[D][C][V]. It matches `layer KL' iff the glob
284 pattern G (which may be empty) matches the whole of K, and layer
285 restriction N[D]C matches L. C is several identical `=', `+' or `-';
286 D+ matches L iff L>=D; D++ iff L>D; D+++ iff L>D+1 and so on; D-
287 matches L iff L<=D; D-- iff L<D; etc.; D= matches L iff L==D; D== iff
288 D-1<=L<=D+1; D=== iff D-2<=L<=D+2; etc. If D is omitted the current
289 layer (from the most recent -l option) is used (or `5' if current
290 layer is `*'). N may be empty or `~'; the latter simply inverts the
291 sense of the match. If C is omitted then `=' is assumed. If the
292 final output layer is `*' then we pretend, for the moment, that L was
293 D. N[D][C][V] may be N[=]* to match, or not match, all layers.
295 If V is present then C must be exactly one character and it is as if
296 V (must be an integer) copies of C were specified.
299 Special comments in PostScript:
302 a command C with args A is read for execution in scope S
304 point L in scope S has coords X Y and angle A
305 %L bbox width W (L..R)
306 %L bbox height H (B..T)
307 bounding box, giving width W, height H, left L, right R,
308 bottom B and top T. Includes full swept area of track,
309 but only at locs (so curves which bend outside bounding
310 box don't get counted)
311 %L bbox no locs, no bbox
312 there were no locs, so there is no bounding box
313 usu because input file was just obj defns and showlibrary
314 %L segmentpart I KL [-]S D X0 Y0 A0 X1 Y1 A1
315 records that a piece of subsegment S is drawn in the subsegment
316 encoding. The piece is of length D, in layer KL (which may be
317 the empty string, depending on layer configurations), and runs
318 from the loc X0,Y0,A0 to X1,Y1,A1. I is a counter which starts
319 at 0 and is simply there to help cross-reference between
320 various programs and formats.
323 O! when defining object or part O
324 N:T scope T but inside part (introduced with `part') N } when
325 O::T scope T but inside obj (introduced with `obj[flip]') O } placing
329 layout-data.h for info regarding layout data deliverables for use by
330 control and UI software
331 redactgraph.c, extractgraph for info regarding extraction and
332 preparation of those deliverables