chiark / gitweb /
new embryonic program "safety"
[trains.git] / hostside / safety.h
1 /**/
2
3 #ifndef SAFETY_H
4 #define SAFETY_H
5
6 typedef unsigned short TrainIx;
7 typedef unsigned short SegmentIx;
8
9 typedef struct {
10   SegmentIx foremost;
11   unsigned justarrived:1, reverse:1;
12   unsigned char speed; /* non-negative, units of 4mm/s */
13 } Train;
14
15 typedef struct {
16   unsigned present_now:1, present_future:1,
17     detectable_now:1, detectable_future:1;
18   TrainIx owner;
19   /*polarity?*/
20 } Segment;
21
22 #include "layoutinfo.h"
23
24 typedef struct {
25   Train trains[NUM_TRAINS];
26   Segment segments[NUM_SEGMENTS];
27 } State;
28
29 #endif /*SAFETY_H*/