Subversion Repositories svn1-original

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 root 1
/*************************************************************************
2
*           Copyright (C) 1995 Embedded Solutions
3
*                       All rights reserved
4
*
5
* file:     hdrs/structs.h
6
*
7
* purpose:  Structures used throughout the marathon program suite
8
*
9
* programmer: David Purdie
10
*
11
* revision  date        by      reason
12
*   00.0    27/01/95    DDP     Tidies up the program and formatted the file
13
*
14
**************************************************************************/
15
#include    <time.h>
16
 
17
typedef unsigned char  uchar;
18
typedef unsigned int   uint;
19
typedef unsigned long  ulong;
20
typedef unsigned char  bool;
21
typedef unsigned short ushort;
22
 
23
#ifdef __MINGW32__
24
#define MPACKED  __attribute__ ((packed))
25
#define FILL1   char    dummy;
26
#define FILL1a  char    dummya;
27
#define LONG_FILE_NAMES
28
#else
29
#define MPACKED
30
#define FILL1
31
#define FILL1a
32
#endif
33
 
34
/*
35
**  Create three types of SEX to handle for the unknown
36
*/
37
typedef ushort sex_type /* MPACKED */;
38
 
39
typedef enum sex_enum
40
    { unknown, male, female }
41
sex_type_old;
42
 
43
 
44
/*
45
**  Define types of data
46
*/
47
typedef enum class_enum
48
    { Digit, Alphanum, Alpha, AlphnumUpper }
49
class_type;
50
 
51
/*
52
**  Leg error information
53
*/
54
typedef struct
55
    {
56
        short       leg,                         /* Leg with error */
57
                    type;                        /* Type of error */
58
    }
59
ty_check_error;
60
 
61
/*
62
**  Describe team numbers by a range. Start .. End
63
*/
64
typedef struct
65
    {
66
        short       start;                       /* First team number in group */
67
        short       end;                         /* Last team number in group */
68
    }
69
ty_t_def;
70
 
71
/*
72
**  Describe the time of each leg
73
*/
74
typedef struct
75
    {
76
        time_t      start,                      /* Start time of leg */
77
                    end,                        /* End time of leg */
78
                    elapsed;                    /* Elapsed time */
79
        short       l_place,                    /* Place in leg */
80
                    le_place,                   /* Place at leg end */
81
                    lc_place,                   /* Place in leg for class */
82
                    lec_place;                  /* Place at leg end for class */
83
        char        manual;                     /* Flag for manual start time */
84
        FILL1
85
    } MPACKED
86
leg_type ;
87
 
88
 
89
/*
90
**  Details for each team member
91
*/
92
typedef struct
93
    {
94
        char        name[MAX_PERSON_NAME + 1];   /* Persons name */
95
        ushort      legs[MAX_LEGS + 1];          /* Runs in these legs */
96
        sex_type    sex;                         /* Type of sex */
45 - 97
        uchar       age;                         /* Age of person */
1 root 98
    } MPACKED
99
memb_type;
100
 
101
/*
102
**  Team based flags
103
*/
104
typedef struct
105
    {
106
        bool        valid;                       /* Data valid flag */
107
        bool        bad_times;                   /* Legs times not fully defined */
108
        bool        disqualified;                /* Team has been disqualified */
109
        bool        non_equestrian;              /* Team is special : non-equestrian */
110
    } MPACKED
111
team_flags ;                                      /* Flag word */
112
 
113
/*
114
**  Team information
115
*/
116
typedef struct
117
    {
118
        short       numb;                        /* Team number */
119
        char        name[MAX_TM_NAME + 1];       /* Team name */
120
        FILL1
121
        leg_type    leg [MAX_LEGS + 1];          /* Timing structure for each leg */
122
        memb_type   members[MAX_MEMB];           /* Team members */
123
        short       class;                       /* Team class index */
124
        short       country;                     /* Team country index */
125
        team_flags  flags;                       /* Flag word */
126
    } MPACKED
127
team_type ;
128
 
129
/*
130
**  Class information
131
*/
132
typedef struct
133
    {
134
        char        abr[3];                         /* Team class - short name */
135
        char        full_name[LEN_CLASS_NAME + 1];  /* Long class name */
136
        time_t      start;                          /* Start time for each class */
137
    }
138
ty_t_class;
139
 
140
/*
141
**  Country information
142
*/
143
typedef struct
144
    {
145
        char        abr[5];                          /* Country short name */
146
        char        full_name[LEN_CNTRY_NAME + 1] ;  /* Full country name */
147
#ifdef __MINGW32__
148
        char        dummy;
149
#endif
150
    }
151
ty_t_country ;
152
 
153
 
154
/*
155
**  Define a data structure that contains ALL the configuration
156
**  information. This allows the configuration process to be performed
157
**  on a local copy of the data structure before installing it
158
**
159
**  The order of this structure is somewhat erratic as it has grown
160
*/
161
typedef struct
162
    {
163
        char        event_name[MAX_EVENT_NAME + 1]; /* Name of the event */
164
        char        leg_name[MAX_LEGS][MAX_LEG_NAME + 1];   /* Names of each leg */
165
        ty_t_def    t_def[MAX_TMS_SPLIT];        /* Team defintion data */
166
        short       num_legs;                    /* Number of legs in use */
167
        short       num_teams;                   /* Number of entries in team def array */
168
        short       max_team;                    /* Max team number */
169
        short       min_team;                    /* Min team number */
170
        ty_t_class  team_class[MAX_CLASS];       /* Define team classes */
171
        short       num_class;                   /* Number of classes */
172
        ty_t_country country_name[MAX_COUNTRY];  /* Define country names */
173
        short       num_countries;               /* Number of countries */
174
        char        addendum[20];                /* Name of ledgend addendum file */
175
        char        datafilename[8];             /* Name of the data file */
176
 
177
        char        nonequestrian_class_abr[3];  /* The non-equestrian class abr */
178
        short       nonequestrian_class;         /* Index of non-equestrian class */
179
        short       equestrian_leg;              /* The Equestrian leg - only used if nonequestrian_class */
180
 
181
        short       lines_per_page;              /* .txt file printing */
182
        short       perf_skip;                   /* .txt file printing */
183
 
184
        short       class_winners[MAX_CLASS];    /* Winners for each class */
185
        char        hall_fame[MAX_FAME][MAX_PERSON_NAME + 1];   /* Names */
186
        short       num_fame;                   /* Number of fame numbers */
187
    }
188
MARA_CFG;
189
 
190
 
191
/*
192
**  Menu entry
193
*/
194
typedef struct
195
    {
196
        char        key;                         /* Key to accept entry */
197
        char       *prompt;                      /* User prompt */
198
        void        ( *doit ) ( void );          /* Pointer to a function */
199
    }
200
menu_table;
201
 
202
/*
203
**  The following structure is used to do the prelim leg sort
204
*/
205
typedef struct
206
    {
207
        short       team;                        /* Team number */
208
        time_t      start;                       /* Start time for team */
209
        time_t      leg[MAX_LEGS + 1];           /* Times at end of each leg */
210
        time_t      lege[MAX_LEGS + 1];          /* Times leg elapsed times */
211
        short       place;                       /* Place at end of each leg */
212
        short       class;                       /* Team class */
213
        team_flags  flags;                       /* Team flags */
214
    }
215
ty_s_data;
216
 
217
/*
218
**  Auxillary sort data
219
*/
220
typedef struct
221
    {
222
        short       team;                        /* Team number */
223
        short       l_place[MAX_LEGS + 1];       /* Place within each leg */
224
        short       le_place[MAX_LEGS + 1];      /* Place at end of each leg */
225
        short       lc_place[MAX_LEGS + 1];      /* Place within leg - class */
226
        short       lec_place[MAX_LEGS + 1];     /* Place at end of each leg - class */
227
    }
228
ty_s_aux;
229
 
230
typedef struct
231
    {
232
        short       numb;                        /* Team number */
233
        time_t      start;                       /* Leg-N start time */
234
        team_flags  flags;                       /* Flag word */
235
    }
236
t_legs;
237
 
238
typedef struct
239
{
240
    int         total;                          /* Total */
241
    int         disqualified;                   /* Those disqualified */
242
    int         non_equestrian;                 /* Those on Non-E */
243
} t_class_sum_entry;
244
 
245
typedef struct
246
{
247
    t_class_sum_entry   class[MAX_CLASS];       /* Per class data */
248
    t_class_sum_entry   total;                  /* Totals */
249
} t_class_summary;
250
 
18 david 251
typedef struct
252
{
253
    char        name[MAX_PERSON_NAME + 1];
254
    ushort      leg;
255
    ushort      team;
256
    short       class;
257
    char        multi;
258
} ty_s_namedata;
1 root 259
 
260
/********************************* EOF ***********************************/