/************************************************************************* * Copyright (C) 1995 Embedded Solutions * All rights reserved * * file: hdrs/structs.h * * purpose: Structures used throughout the marathon program suite * * programmer: David Purdie * * revision date by reason * 00.0 27/01/95 DDP Tidies up the program and formatted the file * **************************************************************************/ #include typedef unsigned char uchar; typedef unsigned int uint; typedef unsigned long ulong; typedef unsigned char bool; typedef unsigned short ushort; #ifdef __MINGW32__ #define MPACKED __attribute__ ((packed)) #define FILL1 char dummy; #define FILL1a char dummya; #define LONG_FILE_NAMES #else #define MPACKED #define FILL1 #define FILL1a #endif /* ** Create three types of SEX to handle for the unknown */ typedef ushort sex_type /* MPACKED */; typedef enum sex_enum { unknown, male, female } sex_type_old; /* ** Define types of data */ typedef enum class_enum { Digit, Alphanum, Alpha, AlphnumUpper } class_type; /* ** Leg error information */ typedef struct { short leg, /* Leg with error */ type; /* Type of error */ } ty_check_error; /* ** Describe team numbers by a range. Start .. End */ typedef struct { short start; /* First team number in group */ short end; /* Last team number in group */ } ty_t_def; /* ** Describe the time of each leg */ typedef struct { time_t start, /* Start time of leg */ end, /* End time of leg */ elapsed; /* Elapsed time */ short l_place, /* Place in leg */ le_place, /* Place at leg end */ lc_place, /* Place in leg for class */ lec_place; /* Place at leg end for class */ char manual; /* Flag for manual start time */ FILL1 } MPACKED leg_type ; /* ** Details for each team member */ typedef struct { char name[MAX_PERSON_NAME + 1]; /* Persons name */ ushort legs[MAX_LEGS + 1]; /* Runs in these legs */ sex_type sex; /* Type of sex */ FILL1 } MPACKED memb_type; /* ** Team based flags */ typedef struct { bool valid; /* Data valid flag */ bool bad_times; /* Legs times not fully defined */ bool disqualified; /* Team has been disqualified */ bool non_equestrian; /* Team is special : non-equestrian */ } MPACKED team_flags ; /* Flag word */ /* ** Team information */ typedef struct { short numb; /* Team number */ char name[MAX_TM_NAME + 1]; /* Team name */ FILL1 leg_type leg [MAX_LEGS + 1]; /* Timing structure for each leg */ memb_type members[MAX_MEMB]; /* Team members */ short class; /* Team class index */ short country; /* Team country index */ team_flags flags; /* Flag word */ } MPACKED team_type ; /* ** Class information */ typedef struct { char abr[3]; /* Team class - short name */ char full_name[LEN_CLASS_NAME + 1]; /* Long class name */ time_t start; /* Start time for each class */ } ty_t_class; /* ** Country information */ typedef struct { char abr[5]; /* Country short name */ char full_name[LEN_CNTRY_NAME + 1] ; /* Full country name */ #ifdef __MINGW32__ char dummy; #endif } ty_t_country ; /* ** Define a data structure that contains ALL the configuration ** information. This allows the configuration process to be performed ** on a local copy of the data structure before installing it ** ** The order of this structure is somewhat erratic as it has grown */ typedef struct { char event_name[MAX_EVENT_NAME + 1]; /* Name of the event */ char leg_name[MAX_LEGS][MAX_LEG_NAME + 1]; /* Names of each leg */ ty_t_def t_def[MAX_TMS_SPLIT]; /* Team defintion data */ short num_legs; /* Number of legs in use */ short num_teams; /* Number of entries in team def array */ short max_team; /* Max team number */ short min_team; /* Min team number */ ty_t_class team_class[MAX_CLASS]; /* Define team classes */ short num_class; /* Number of classes */ ty_t_country country_name[MAX_COUNTRY]; /* Define country names */ short num_countries; /* Number of countries */ char addendum[20]; /* Name of ledgend addendum file */ char datafilename[8]; /* Name of the data file */ char nonequestrian_class_abr[3]; /* The non-equestrian class abr */ short nonequestrian_class; /* Index of non-equestrian class */ short equestrian_leg; /* The Equestrian leg - only used if nonequestrian_class */ short lines_per_page; /* .txt file printing */ short perf_skip; /* .txt file printing */ short class_winners[MAX_CLASS]; /* Winners for each class */ char hall_fame[MAX_FAME][MAX_PERSON_NAME + 1]; /* Names */ short num_fame; /* Number of fame numbers */ } MARA_CFG; /* ** Menu entry */ typedef struct { char key; /* Key to accept entry */ char *prompt; /* User prompt */ void ( *doit ) ( void ); /* Pointer to a function */ } menu_table; /* ** The following structure is used to do the prelim leg sort */ typedef struct { short team; /* Team number */ time_t start; /* Start time for team */ time_t leg[MAX_LEGS + 1]; /* Times at end of each leg */ time_t lege[MAX_LEGS + 1]; /* Times leg elapsed times */ short place; /* Place at end of each leg */ short class; /* Team class */ team_flags flags; /* Team flags */ } ty_s_data; /* ** Auxillary sort data */ typedef struct { short team; /* Team number */ short l_place[MAX_LEGS + 1]; /* Place within each leg */ short le_place[MAX_LEGS + 1]; /* Place at end of each leg */ short lc_place[MAX_LEGS + 1]; /* Place within leg - class */ short lec_place[MAX_LEGS + 1]; /* Place at end of each leg - class */ } ty_s_aux; typedef struct { short numb; /* Team number */ time_t start; /* Leg-N start time */ team_flags flags; /* Flag word */ } t_legs; typedef struct { int total; /* Total */ int disqualified; /* Those disqualified */ int non_equestrian; /* Those on Non-E */ } t_class_sum_entry; typedef struct { t_class_sum_entry class[MAX_CLASS]; /* Per class data */ t_class_sum_entry total; /* Totals */ } t_class_summary; /********************************* EOF ***********************************/