interpret/src/flight.h

73 lines
1.9 KiB
C

#ifndef OMIT_BASE /* <!-- base */
#define LAUNCH_TYPE \
X(MotorCarTow),\
X(Winch),\
X(AeroTow)
#define X(type) type
enum launch_type { LAUNCH_TYPE };
#undef X
#define X(type) #type
static const char *launch_type_string[] = { LAUNCH_TYPE };
#undef X
#undef LAUNCH_TYPE
#define FLIGHT_TYPE \
X(Glider),\
X(Power)
#define X(type) type
enum flight_type { FLIGHT_TYPE };
#undef X
#define X(type) #type
static const char *flight_type_string[] = { FLIGHT_TYPE };
#undef X
#undef FLIGHT_TYPE
struct glider {
struct substring type, reg, launch;
enum launch_type how;
unsigned height_ft, pilot_min, dual_min, instr_min;
struct substring remarks;
};
struct power {
struct substring type, reg, launch, landing, pilot, copilot;
unsigned dual_min, pilot_min, ifrsim_min, ifr_min;
struct substring remarks;
};
struct flight {
enum { GLIDER, POWER } type;
union { struct glider glider; struct power power; };
};
/*void kjvcite_to_string(const union kjvcite, char (*)[12]);*/
#else /* base --><!-- !base */
#undef OMIT_BASE
#endif /* !base --> */
#ifndef OMIT_INTERNAL /* <!-- external */
struct tree_flight_node;
struct tree_flight_tree { struct tree_flight_node *node; unsigned height; };
struct flight_tree { struct tree_flight_tree root; };
struct tree_flight_ref { struct tree_flight_node *node; unsigned height, idx; };
struct tree_flight_iterator {
struct tree_flight_tree *root; struct tree_flight_ref ref; int seen;
};
struct flight_tree_iterator { struct tree_flight_iterator _; };
#else /* external --><!-- internal */
#undef OMIT_INTERNAL
#endif /* internal --> */
#ifndef OMIT_PROTO /* <!-- proto */
#include <stddef.h>
struct flights { struct flight_tree flights; };
struct flights flights(void);
void flights_(struct flights *);
int flights_is_valid(const struct flights *);
int flights_add(struct flights *, const struct flight);
const char *flight_to_string(const struct flight *);
#else /* proto --><!-- !proto */
#undef OMIT_PROTO
#endif /* !proto --> */