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).
199 -D turn on debug (level 1) } currently only debug levels are
200 -Dnnn set debug level to nnn } 0 (none) and 1 (some), default=0
202 -lL output for layer L (digits, or `*' for any) (default: *)
204 -S<scale> set scale divider to <scale> (default is 7.0, ie
205 output is 1/7 actual size)
207 -P<xp>x<yp> output physical page (<xp>,<yp>). xp and yp are
208 integers specifying the number of pages to shift by
209 in each direction. xp is multiplied by 270mm; yp
210 is multiplied by 190mm.
212 -e<layersel>[ARSCcLlDdMNOm]...
213 Turn on and off drawing of elements in groups.
214 These are abbreviations for various -E... options.
218 S rails and sleepers only aRScgd
219 C centrelines only arsCgd
220 c swept area and ticks only Arscgd
221 r no lines drawn at all arsc
223 L label top-level locs (turns on bars for them too) LMg
224 l do not label any locs l
226 D label all distances D
227 d do not label any locs d
228 bars at locs (thick lines perp to track dir'n)
229 M bars for top-level locs only Mnog
230 N bars for top-level locs and those in obj's MNog
231 O bars for everything, including those inside parts MNOg
232 m no bars (turns off labelling too) mnol
234 G draw only subsegment encoding Garcslmno
236 -E<layersel>[ARSCLDMNOarscldmno]...
237 enable (capitals) or disable (lowercase) drawing of
239 A draw track swept area, with ticks
241 S draw track sleepers
242 C draw track centrelines
244 D label distances along the track
245 M mark locs with a bar
246 N mark locs with a bar in objs
247 O mark locs with a bar in parts
248 G draw subsegment encoding
250 -q quiet: do not print info to stderr
251 (default: prints bounding box, at the moment)
253 [-GL output segment colour map request list ]
254 [ use with -eG or -EG to write out the list of subsegment ]
255 [ specs which will need colours, one per line (and not ]
256 [ necessarily only once each) ]
257 -GL, -GR, -GP are to do with segment encoding and subsegment specs
258 and that kind of thing. The comment above is the most useful
259 documentation and is out of date. See also layout's argument
260 parser, segencolayers.gen-make, Makefile, segcmap.h, segcmapassign,
263 <layersel> (for -e and -E) works as follows:
265 When file says `layer KL', default drawing element set is set
266 depending on K and L (see description of `layer' command), using last
267 specified -l layer. Then all -e/-E options are scanned, in order,
268 and each one that matches modifies the drawing element set.
270 <layersel> is GN[D][C][V]. It matches `layer KL' iff the glob
271 pattern G (which may be empty) matches the whole of K, and layer
272 restriction N[D]C matches L. C is several identical `=', `+' or `-';
273 D+ matches L iff L>=D; D++ iff L>D; D+++ iff L>D+1 and so on; D-
274 matches L iff L<=D; D-- iff L<D; etc.; D= matches L iff L==D; D== iff
275 D-1<=L<=D+1; D=== iff D-2<=L<=D+2; etc. If D is omitted the current
276 layer (from the most recent -l option) is used (or `5' if current
277 layer is `*'). N may be empty or `~'; the latter simply inverts the
278 sense of the match. If C is omitted then `=' is assumed. If the
279 final output layer is `*' then we pretend, for the moment, that L was
280 D. N[D][C][V] may be N[=]* to match, or not match, all layers.
282 If V is present then C must be exactly one character and it is as if
283 V (must be an integer) copies of C were specified.
286 Special comments in PostScript:
289 a command C with args A is read for execution in scope S
291 point L in scope S has coords X Y and angle A
292 %L bbox width W (L..R)
293 %L bbox height H (B..T)
294 bounding box, giving width W, height H, left L, right R,
295 bottom B and top T. Includes full swept area of track,
296 but only at locs (so curves which bend outside bounding
297 box don't get counted)
298 %L bbox no locs, no bbox
299 there were no locs, so there is no bounding box
300 usu because input file was just obj defns and showlibrary
301 %L segmentpart I KL [-]S D X0 Y0 A0 X1 Y1 A1
302 records that a piece of subsegment S is drawn in the subsegment
303 encoding. The piece is of length D, in layer KL (which may be
304 the empty string, depending on layer configurations), and runs
305 from the loc X0,Y0,A0 to X1,Y1,A1. I is a counter which starts
306 at 0 and is simply there to help cross-reference between
307 various programs and formats.
310 O! when defining object or part O
311 N:T scope T but inside part (introduced with `part') N } when
312 O::T scope T but inside obj (introduced with `obj[flip]') O } placing
316 layout-data.h for info regarding layout data deliverables for use by
317 control and UI software
318 redactgraph.c, extractgraph for info regarding extraction and
319 preparation of those deliverables