Subversion Repositories svn1

Rev

Rev 383 | Details | Compare with Previous | 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
**************************************************************************/
380 david 15
#ifndef __structs_h__
16
#define __structs_h__
384 david 17
#include "consts.h"
18
#include <time.h>
1 root 19
 
20
typedef unsigned char  uchar;
21
typedef unsigned int   uint;
22
typedef unsigned long  ulong;
380 david 23
//typedef unsigned char  bool;
1 root 24
typedef unsigned short ushort;
25
 
380 david 26
#if defined(__MINGW32__) || defined(__GNUC__)
1 root 27
#define MPACKED  __attribute__ ((packed))
28
#define FILL1   char    dummy;
29
#define FILL1a  char    dummya;
30
#define LONG_FILE_NAMES
31
#else
32
#define MPACKED
384 david 33
//#define FILL1
34
//#define FILL1a
1 root 35
#endif
36
 
384 david 37
#pragma pack (push,1)
38
#define FILL1   char    dummy;
39
#define FILL1a  char    dummya;
40
 
1 root 41
/*
75 - 42
**  Type of report
43
*/
44
typedef enum report_type_enum
45
{
46
    text        = 0,
47
    html        = 1,
48
    printed     = 2
49
} report_type;
50
 
51
/*
1 root 52
**  Create three types of SEX to handle for the unknown
53
*/
54
typedef ushort sex_type /* MPACKED */;
55
 
56
typedef enum sex_enum
57
    { unknown, male, female }
58
sex_type_old;
59
 
60
 
61
/*
62
**  Define types of data
63
*/
64
typedef enum class_enum
65
    { Digit, Alphanum, Alpha, AlphnumUpper }
66
class_type;
67
 
68
/*
69
**  Leg error information
70
*/
71
typedef struct
72
    {
73
        short       leg,                         /* Leg with error */
74
                    type;                        /* Type of error */
75
    }
76
ty_check_error;
77
 
78
/*
79
**  Describe team numbers by a range. Start .. End
80
*/
81
typedef struct
82
    {
83
        short       start;                       /* First team number in group */
84
        short       end;                         /* Last team number in group */
85
    }
86
ty_t_def;
87
 
88
/*
89
**  Describe the time of each leg
90
*/
91
typedef struct
92
    {
384 david 93
        maraTime_t      start,                      /* Start time of leg */
1 root 94
                    end,                        /* End time of leg */
95
                    elapsed;                    /* Elapsed time */
96
        short       l_place,                    /* Place in leg */
97
                    le_place,                   /* Place at leg end */
98
                    lc_place,                   /* Place in leg for class */
99
                    lec_place;                  /* Place at leg end for class */
100
        char        manual;                     /* Flag for manual start time */
101
        FILL1
102
    } MPACKED
103
leg_type ;
104
 
105
 
106
/*
107
**  Details for each team member
108
*/
109
typedef struct
110
    {
111
        char        name[MAX_PERSON_NAME + 1];   /* Persons name */
112
        ushort      legs[MAX_LEGS + 1];          /* Runs in these legs */
113
        sex_type    sex;                         /* Type of sex */
45 - 114
        uchar       age;                         /* Age of person */
1 root 115
    } MPACKED
116
memb_type;
117
 
118
/*
119
**  Team based flags
120
*/
121
typedef struct
122
    {
380 david 123
    bool        valid;                          /* Data valid flag */
124
    bool        bad_times;                      /* Legs times not fully defined */
125
    bool        disqualified;                   /* Team has been disqualified */
126
    bool        non_equestrian:1;               /* Team is special : non-equestrian */
127
    bool        vet_check:1;                    /* Team Disqual - Failed vet check */
128
    bool        notInFastest:1;                 /* Exclude from fastest team calc */
129
    bool        notInLP:1;                      /* Not included in Leg Placing */
1 root 130
    } MPACKED
380 david 131
team_flags ;                                    /* Flag word */
1 root 132
 
133
/*
134
**  Team information
135
*/
136
typedef struct
137
    {
138
        short       numb;                        /* Team number */
139
        char        name[MAX_TM_NAME + 1];       /* Team name */
140
        FILL1
141
        leg_type    leg [MAX_LEGS + 1];          /* Timing structure for each leg */
142
        memb_type   members[MAX_MEMB];           /* Team members */
380 david 143
        short       teamclass;                   /* Team class index */
1 root 144
        short       country;                     /* Team country index */
145
        team_flags  flags;                       /* Flag word */
146
    } MPACKED
147
team_type ;
148
 
149
/*
150
**  Class information
151
*/
152
typedef struct
153
    {
154
        char        abr[3];                         /* Team class - short name */
155
        char        full_name[LEN_CLASS_NAME + 1];  /* Long class name */
384 david 156
        maraTime_t  start;                          /* Start time for each class */
157
        FILL1
1 root 158
    }
159
ty_t_class;
160
 
161
/*
162
**  Country information
163
*/
164
typedef struct
165
    {
166
        char        abr[5];                          /* Country short name */
167
        char        full_name[LEN_CNTRY_NAME + 1] ;  /* Full country name */
384 david 168
        FILL1
1 root 169
    }
170
ty_t_country ;
171
 
172
 
173
/*
174
**  Define a data structure that contains ALL the configuration
175
**  information. This allows the configuration process to be performed
176
**  on a local copy of the data structure before installing it
177
**
178
**  The order of this structure is somewhat erratic as it has grown
179
*/
380 david 180
//typedef struct
181
//    {
182
//        char        event_name[MAX_EVENT_NAME + 1]; /* Name of the event */
183
//        char        leg_name[MAX_LEGS][MAX_LEG_NAME + 1];   /* Names of each leg */
184
//        ty_t_def    t_def[MAX_TMS_SPLIT];        /* Team defintion data */
185
//        short       num_legs;                    /* Number of legs in use */
186
//        short       num_teams;                   /* Number of entries in team def array */
187
//        short       max_team;                    /* Max team number */
188
//        short       min_team;                    /* Min team number */
189
//        ty_t_class  team_class[MAX_CLASS];       /* Define team classes */
190
//        short       num_class;                   /* Number of classes */
191
//        ty_t_country country_name[MAX_COUNTRY];  /* Define country names */
192
//        short       num_countries;               /* Number of countries */
193
//        char        addendum[20];                /* Name of ledgend addendum file */
194
//        char        datafilename[8];             /* Name of the data file */
1 root 195
 
380 david 196
//        char        nonequestrian_class_abr[3];  /* The non-equestrian class abr */
197
//        short       nonequestrian_class;         /* Index of non-equestrian class */
198
//        short       equestrian_leg;              /* The Equestrian leg - only used if nonequestrian_class */
1 root 199
 
380 david 200
//        short       lines_per_page;              /* .txt file printing */
201
//        short       perf_skip;                   /* .txt file printing */
1 root 202
 
380 david 203
//        short       class_winners[MAX_CLASS];    /* Winners for each class */
204
//        char        hall_fame[MAX_FAME][MAX_PERSON_NAME + 1];   /* Names */
205
//        short       num_fame;                   /* Number of fame numbers */
206
//    }
207
//MARA_CFG;
1 root 208
 
209
 
210
/*
211
**  Menu entry
212
*/
380 david 213
//typedef struct
214
//    {
215
//        char        key;                         /* Key to accept entry */
216
//        const char *prompt;                      /* User prompt */
217
//        void        ( *doit ) ( void );          /* Pointer to a function */
218
//    }
219
//menu_table;
1 root 220
 
221
/*
222
**  The following structure is used to do the prelim leg sort
223
*/
224
typedef struct
225
    {
226
        short       team;                        /* Team number */
384 david 227
        maraTime_t      start;                       /* Start time for team */
228
        maraTime_t      leg[MAX_LEGS + 1];           /* Times at end of each leg */
229
        maraTime_t      lege[MAX_LEGS + 1];          /* Times leg elapsed times */
1 root 230
        short       place;                       /* Place at end of each leg */
380 david 231
        short       teamclass;                   /* Team class */
1 root 232
        team_flags  flags;                       /* Team flags */
380 david 233
        bool        isNeData;
1 root 234
    }
235
ty_s_data;
236
 
237
/*
238
**  Auxillary sort data
239
*/
240
typedef struct
241
    {
242
        short       team;                        /* Team number */
243
        short       l_place[MAX_LEGS + 1];       /* Place within each leg */
244
        short       le_place[MAX_LEGS + 1];      /* Place at end of each leg */
245
        short       lc_place[MAX_LEGS + 1];      /* Place within leg - class */
246
        short       lec_place[MAX_LEGS + 1];     /* Place at end of each leg - class */
380 david 247
 
248
        short       lq_place[MAX_LEGS + 1];      /* Place within leg - assuming NE class */
249
        short       leq_place[MAX_LEGS + 1];     /* Place at end of each leg - assuming NE class */
250
        short       lcq_place[MAX_LEGS + 1];     /* Place within leg - class, subclass NE */
251
        short       lecq_place[MAX_LEGS + 1];    /* Place at end of each leg - class, subclass NE  */
252
 
1 root 253
    }
380 david 254
 
1 root 255
ty_s_aux;
256
 
257
typedef struct
258
    {
259
        short       numb;                        /* Team number */
384 david 260
        maraTime_t      start;                       /* Leg-N start time */
1 root 261
        team_flags  flags;                       /* Flag word */
262
    }
263
t_legs;
264
 
265
typedef struct
266
{
267
    int         total;                          /* Total */
380 david 268
    int         valid;                          /* Valid entries */
269
    int         valid_ne;                       /* Valid NE entries: Can be winners */
270
    int         valid_ev;                       /* Valid Full Event entries: Can be winners */
1 root 271
    int         disqualified;                   /* Those disqualified */
272
    int         non_equestrian;                 /* Those on Non-E */
380 david 273
    int         vet_check;                      /* Those that failed the vet check */
1 root 274
} t_class_sum_entry;
275
 
276
typedef struct
277
{
380 david 278
    t_class_sum_entry   teamclass[MAX_CLASS];       /* Per class data */
279
    t_class_sum_entry   total;                      /* Totals */
1 root 280
} t_class_summary;
281
 
18 david 282
typedef struct
283
{
284
    char        name[MAX_PERSON_NAME + 1];
285
    ushort      leg;
286
    ushort      team;
380 david 287
    short       teamclass;
18 david 288
    char        multi;
289
} ty_s_namedata;
1 root 290
 
380 david 291
/*
292
**  A structure to hold statistical information
293
*/
294
typedef struct
295
{
296
    int         team[MAX_LEGS + 1][MAX_CLASS + 1];
297
    struct
298
    {
299
        int     team[MAX_LEGS + 1][MAX_CLASS + 1];
384 david 300
        maraTime_t  time[MAX_LEGS + 1][MAX_CLASS + 1];
380 david 301
    } fast;
384 david 302
    maraTime_t      average[MAX_LEGS + 1][MAX_CLASS + 1];
380 david 303
} ty_stats;
75 - 304
 
384 david 305
#pragma pack(pop)
75 - 306
 
1 root 307
/********************************* EOF ***********************************/
380 david 308
#endif