/************************************************************************* * 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 * **************************************************************************/ #ifndef __structs_h__ #define __structs_h__ #include typedef unsigned char uchar; typedef unsigned int uint; typedef unsigned long ulong; //typedef unsigned char bool; typedef unsigned short ushort; #if defined(__MINGW32__) || defined(__GNUC__) #define MPACKED __attribute__ ((packed)) #define FILL1 char dummy; #define FILL1a char dummya; #define LONG_FILE_NAMES #else #define MPACKED #define FILL1 #define FILL1a #endif /* ** Type of report */ typedef enum report_type_enum { text = 0, html = 1, printed = 2 } report_type; /* ** 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 */ uchar age; /* Age of person */ } 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:1; /* Team is special : non-equestrian */ bool vet_check:1; /* Team Disqual - Failed vet check */ bool notInFastest:1; /* Exclude from fastest team calc */ bool notInLP:1; /* Not included in Leg Placing */ } 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 teamclass; /* 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 */ #if defined(__MINGW32__) || defined(__GNUC__) 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 */ // const 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 teamclass; /* Team class */ team_flags flags; /* Team flags */ bool isNeData; } 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 */ short lq_place[MAX_LEGS + 1]; /* Place within leg - assuming NE class */ short leq_place[MAX_LEGS + 1]; /* Place at end of each leg - assuming NE class */ short lcq_place[MAX_LEGS + 1]; /* Place within leg - class, subclass NE */ short lecq_place[MAX_LEGS + 1]; /* Place at end of each leg - class, subclass NE */ } 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 valid; /* Valid entries */ int valid_ne; /* Valid NE entries: Can be winners */ int valid_ev; /* Valid Full Event entries: Can be winners */ int disqualified; /* Those disqualified */ int non_equestrian; /* Those on Non-E */ int vet_check; /* Those that failed the vet check */ } t_class_sum_entry; typedef struct { t_class_sum_entry teamclass[MAX_CLASS]; /* Per class data */ t_class_sum_entry total; /* Totals */ } t_class_summary; typedef struct { char name[MAX_PERSON_NAME + 1]; ushort leg; ushort team; short teamclass; char multi; } ty_s_namedata; /* ** A structure to hold statistical information */ typedef struct { int team[MAX_LEGS + 1][MAX_CLASS + 1]; struct { int team[MAX_LEGS + 1][MAX_CLASS + 1]; time_t time[MAX_LEGS + 1][MAX_CLASS + 1]; } fast; time_t average[MAX_LEGS + 1][MAX_CLASS + 1]; } ty_stats; /********************************* EOF ***********************************/ #endif