#
-TARGETS= hostside
+TARGETS= hostside safety
CFLAGS= -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes \
-Wpointer-arith -Wwrite-strings -g $(OPTIMISE)
OPTIMISE= -O2
main.o: nmra-packets.h
%.c: hostside.h
+safety.o: safety.h layoutinfo.h
+
clean:
rm -f *.o $(TARGETS)
--- /dev/null
+/**/
+
+#ifndef SAFETY_H
+#define SAFETY_H
+
+typedef unsigned short TrainIx;
+typedef unsigned short SegmentIx;
+
+typedef struct {
+ SegmentIx foremost;
+ unsigned justarrived:1, reverse:1;
+ unsigned char speed; /* non-negative, units of 4mm/s */
+} Train;
+
+typedef struct {
+ unsigned present_now:1, present_future:1,
+ detectable_now:1, detectable_future:1;
+ TrainIx owner;
+ /*polarity?*/
+} Segment;
+
+#include "layoutinfo.h"
+
+typedef struct {
+ Train trains[NUM_TRAINS];
+ Segment segments[NUM_SEGMENTS];
+} State;
+
+#endif /*SAFETY_H*/