chiark / gitweb /
merge changes from trunk into our branch; cvs up -j branchpoint-hostside-wip-2006...
[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 } MovFeatKind;
29
30 /*========== data from config files and layout cad/cam ==========*/
31
32 typedef struct {
33   unsigned next_backwards:1;
34   SegmentNum next;
35 } SegmentLinkInfo;
36
37 typedef struct {
38   const char *pname;
39   MovFeatKind kind;
40   Small posns;
41   MovPosComb weight;
42   const BoardObject *boob;
43 } MovFeatInfo;
44
45 typedef struct {
46   const char *pname;
47   Distance dist;
48   SegmentLinkInfo backwards, forwards;
49 } SegPosCombInfo;
50
51 typedef struct {
52   const char *pname;
53   unsigned invertible:1;
54   Small n_movfeats;
55   const MovFeatInfo *movfeats;
56   MovPosComb n_poscombs;
57   const SegPosCombInfo *poscombs;
58   BoardObject sense, invert;
59 } SegmentInfo;
60
61 /* This data array has no sentinel member.  Use the info_nsegments
62  * constant.  Alternatively, it is legal to sed out everything from
63  * <name-of-layout>.layout-data.c from the first #include onwards, and
64  * this will give a definition of NUM_SEGMENTS.
65  */
66
67 extern const SegmentNum info_nsegments;
68 extern const SegmentInfo info_segments[];
69
70 extern const BoardObject info_maxreverse; /* max. reverse + 1 */
71
72 #define NOTA(x) (-1)
73 #define SOMEP(x) ((x) >= 0)
74
75 #endif /*LAYOUT_DATA_H*/