chiark / gitweb /
print object numbers in hex
[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 long MovPosComb;
20 typedef long Speed;
21 typedef int BoardObject;
22 typedef int Small;
23 typedef int Distance;
24
25 typedef enum {
26   mfk_none,
27   mfk_point
28   /* must also add new entries to movpos.c:methodinfos */
29 } MovFeatKind;
30
31 /*========== data from config files and layout cad/cam ==========*/
32
33 typedef struct {
34   unsigned next_backwards:1;
35   SegmentNum next;
36 } SegmentLinkInfo;
37
38 typedef struct {
39   const char *pname;
40   MovFeatKind kind;
41   Small posns;
42   MovPosComb weight;
43   const BoardObject *boob;
44 } MovFeatInfo;
45
46 typedef struct {
47   const char *pname;
48   Distance dist;
49   SegmentLinkInfo backwards, forwards;
50 } SegPosCombInfo;
51
52 typedef struct {
53   const char *pname;
54   unsigned invertible:1;
55   Small n_movfeats;
56   const MovFeatInfo *movfeats;
57   MovPosComb n_poscombs;
58   const SegPosCombInfo *poscombs;
59   BoardObject sense, invert;
60 } SegmentInfo;
61
62 /* This data array has no sentinel member.  Use the info_nsegments
63  * constant.  Alternatively, it is legal to sed out everything from
64  * <name-of-layout>.layout-data.c from the first #include onwards, and
65  * this will give a definition of NUM_SEGMENTS.
66  */
67
68 extern const SegmentNum info_nsegments;
69 extern const SegmentInfo info_segments[];
70
71 extern const BoardObject info_maxreverse; /* max. reverse + 1 */
72
73 #define NOTA(thing) (-1)
74 #define SOMEP(x) ((x) >= 0)
75
76 #endif /*LAYOUT_DATA_H*/