chiark / gitweb /
hostside: more length for bavarian
[trains.git] / layout / layout-data.h
1 /*
2  */
3 /* The output from the layout processing system to the control
4  * software, describing the layout and the trains, is a data structure
5  * as described in this header file, in <name-of-layout>.layout-data.o
6  * (where <name-of-layout> is currently `ours').
7  *
8  * Alternatively, <name-of-layout>.redacted.forsafety contains data in
9  * the form described at the top of redactgraph.c.
10  */
11
12 #ifndef LAYOUT_DATA_H
13 #define LAYOUT_DATA_H
14
15 /*========== basic types etc. ==========*/
16
17 typedef int TrainNum;
18 typedef int SegmentNum;
19 typedef int MovPosComb;
20 typedef int BoardObject;
21 typedef int Small;
22 typedef short SegmentNumInMap;
23
24 typedef double Speed;
25 typedef int Distance;
26
27 typedef enum {
28   mfk_none,
29   mfk_point,
30   mfk_relay,
31   /* must also add new entries to movpos.c:methods[] and topology-dump.c */
32   /* only entries up to here are used by movpos.c, since only
33    *  the n_fixedmovfeats entries use mfk_ifxed. */
34   mfk_fixed
35 } MovFeatKind;
36
37 /*========== data from config files and layout cad/cam ==========*/
38
39 typedef struct {
40   unsigned next_backwards:1;
41   SegmentNum next;
42 } SegmentLinkInfo;
43
44 typedef struct {
45   const char *pname;
46   MovFeatKind kind;
47   Small posns;             /* for mfk_fixed: is the actual position */
48   MovPosComb weight;       /* for mfk_fixed: is 0 */
49   const BoardObject *boob; /* for mfk_fixed: is 0 */
50 } MovFeatInfo;
51
52 typedef struct {
53   const char *pname;
54   Distance dist;
55   SegmentLinkInfo link[2]; /* 0: forwards; 1: backwards */
56 } SegPosCombInfo;
57
58 typedef struct {
59   const char *pname;
60   unsigned invertible:1, interferes_polarity_opposed:1;
61   Small n_movfeats, n_fixedmovfeats;
62   const MovFeatInfo *movfeats; /* first n_movfeats then n_fixedmovfeats */
63   MovPosComb n_poscombs;
64   const SegPosCombInfo *poscombs;
65   BoardObject sense, invert;
66   SegmentNum interferes;
67   unsigned char interferes_movposcomb_map;
68 } SegmentInfo;
69
70 /* This data array has no sentinel member.  Use the info_nsegments
71  * constant.  Alternatively, it is legal to sed out everything from
72  * <name-of-layout>.layout-data.c from the first #include onwards, and
73  * this will give a definition of NUM_SEGMENTS.
74  */
75
76 extern const SegmentNum info_nsegments;
77 extern const SegmentInfo info_segments[];
78 extern const SegmentNumInMap info_segmentmap[];
79 extern const int info_segmentmaplen;
80
81 extern const BoardObject info_maxreverse; /* max. reverse + 1 */
82
83 #define NOTA(thing) (-1)
84 #define SOMEP(x) ((x) >= 0)
85
86 #endif /*LAYOUT_DATA_H*/