-
Notifications
You must be signed in to change notification settings - Fork 0
/
GOLF.H
217 lines (184 loc) · 6.76 KB
/
GOLF.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
**************************************************************************
golf.h Brett A. Morrison
This file contains all preprocessor statements, type definitions, and
function prototypes.
**************************************************************************
*/
#include <windows.h>
#include <commdlg.h>
#include <stdlib.h>
#include <math.h>
#include <dos.h>
#include "boxes.h"
#define swap(A,B) ((A)=^(B)=^(A)=^(B))
#define convert_to_digit(A) ((A) - '0')
#define range(A, min, max) (((A) >= (min) ) && ((A) <=(max)))
#define focus(A) (((A) >= IDD_PFIRST) && ((A) <= IDD_SC_18))
#define LESS -1
#define EQUAL 0
#define GREATER 1
#define MAX_CAPTION 60
#define FILE_NAME_SIZE 256
#define FILE_EXTENSION_SIZE 5
#define FULL_NAME_SIZE 256
#define FULL_PATH_SIZE 256
#define COLUMN_WIDTH 80
#define MAX_FILE_SIZE 32000
#define BYTE_SIZE 32767
#define NORMAL_FILE_ATTRIBUTES 0x4010
#define TAB_PIXEL_SETTING 144
#define COURSE_NAME_LENGTH 19
#define FIRST_NAME_LENGTH 20
#define LAST_NAME_LENGTH 20
#define STREET_LENGTH 30
#define CITY_LENGTH 20
#define STATE_LENGTH 2
#define ZIP_LENGTH 10
#define PHONE_LENGTH 14
#define RATING_LENGTH 6
#define DATE_LENGTH 8
#define SCORE_LENGTH 2
#define LONG_MESSAGE_LENGTH 50
#define SEARCH_LENGTH 50
#define NUM_HOLES 18
#define MAX_COURSES 30
#define MAX_PLAYERS 10
#define MAX_ROUNDS 30
#define COURSE_MARKER 'C'
#define PLAYER_MARKER 'P'
#define END_RECORDS_MARKER '~'
typedef short score_array[NUM_HOLES+1]; /* Stores score at each hole */
typedef struct { /* Course record definition */
char c_name [COURSE_NAME_LENGTH+1];
char c_street [STREET_LENGTH+1];
char c_city [CITY_LENGTH+1];
char c_state [STATE_LENGTH+1];
char c_zip [ZIP_LENGTH+1];
char c_phone [PHONE_LENGTH+1];
char c_rating [RATING_LENGTH+1];
score_array hole_par;
score_array hole_handicap;
} course_record;
typedef course_record course_data[MAX_COURSES];
typedef struct {
course_data course;
int course_numb;
} course_array;
typedef struct { /* Player history record */
long date;
char course_name [COURSE_NAME_LENGTH+1];
score_array score;
} score_record;
typedef score_record history_data[MAX_ROUNDS];
typedef struct {
history_data history;
int round_numb;
} history_array;
typedef struct { /* Player record definition */
char p_first [FIRST_NAME_LENGTH+1];
char p_last [LAST_NAME_LENGTH+1];
char p_street [STREET_LENGTH+1];
char p_city [CITY_LENGTH+1];
char p_state [STATE_LENGTH+1];
char p_zip [ZIP_LENGTH+1];
char p_phone [PHONE_LENGTH+1];
history_array p_scores;
} player_record;
typedef player_record player_data[MAX_PLAYERS];
typedef struct {
player_data player;
int player_numb;
} player_array;
/* golf.c */
int PASCAL WinMain(HANDLE, HANDLE, LPSTR, int);
int FAR PASCAL MainWndProc(HWND, WORD, WORD, LONG);
int FAR PASCAL DefaultDlg(HWND, unsigned, WORD, LONG);
int NEAR PASCAL CommandHandler(WORD, LONG);
/* dlgproc.c */
BOOL FAR PASCAL AboutDlgProc(HWND, WORD, WORD, LONG);
BOOL FAR PASCAL DeleteCourseDlgProc(HWND, WORD, WORD, LONG);
BOOL FAR PASCAL NameDateDlgProc(HWND, WORD, WORD, LONG);
BOOL FAR PASCAL SearchDlgProc(HWND, WORD, WORD, LONG);
short AskAboutSave(HWND, char *, char);
void DoCaption(HWND, char *, char *);
/* files.c */
long FileLength(HANDLE);
BOOL ReadFile(HWND, char *, char *, char *, BOOL,
player_array *, course_array *, char);
BOOL WriteFile(HWND, char *, player_array *, course_array *, char,
int, int, int);
/* print.c */
BOOL PrintFile(HANDLE, HWND, char *);
BOOL FAR PASCAL AbortProc(HDC, short);
BOOL FAR PASCAL PrintDlgProc(HWND, WORD, WORD, LONG);
/* sort.c */
int compare_course(const void *, const void *);
int compare_player(const void *, const void *);
int compare_round(const void *, const void *);
/* utils.c */
LPSTR lstrchr(LPSTR, char);
LPSTR lstrrchr(LPSTR, char);
void OkMessageBox(HWND, char *, char *);
void GraphData(history_array *, course_array *);
void DoMenu(WORD, player_array *, course_array *, int, HWND);
/* dates.c */
void convert_date(long *, char []);
void get_date_elements(char [], char [], char [], char []);
void GetSystemDate(char [], char [], char []);
long string_to_date(char [], char [], char []);
void add0(char []);
long JulianDate(int, int, int);
void CalendarDate(long, int *, int *, int *);
BOOL GoodDate(int, int, int);
/* load.c */
void LoadCourses(LPSTR, course_array *);
void LoadPlayers(LPSTR, player_array *);
void load_string(long *, LPSTR , char[]);
void load_holes(long *, LPSTR, score_array);
void load_history(long *, LPSTR, history_array *);
/* unload.c */
void UnloadCourses(HANDLE, course_array *);
void UnloadPlayers(HANDLE, player_array *);
void unload_string(HANDLE, char[]);
void unload_holes(HANDLE, score_array);
void unload_history(HANDLE, history_array *);
/* display.c */
void show_player(HWND, HWND, player_array *, int *, int *, int *);
void clear_player(HWND, HWND);
void show_course(HWND, course_array *, int *);
void clear_score(HWND);
void clear_course(HWND);
void show_rounds(HWND, HWND, history_array *, int *, int *, BOOL);
void move_course(HWND, WORD, course_array *, int *);
void move_player(HWND, HWND, WORD, player_array *, int *, int *, int *);
void show_round(HWND, score_array);
void PrintIndex(HWND, int, int, int);
void ClearItems(HWND, int, int);
/* delete.c */
void delete_round(HWND, HWND, player_array *, int *, int *, int *);
void delete_player(HWND, HWND, player_array *, int *, int *, int *);
void delete_course(course_array *, int *);
BOOL delete_rounds(player_array *, char []);
/* search.c */
void SearchFor(HWND, BOOL, int, char [], BOOL);
/* validate.c */
BOOL get_par(HWND, course_array *, int);
BOOL get_handicap(HWND, course_array *, int);
BOOL get_rating(HWND, course_array *, int);
BOOL get_player(HWND, player_array *, int, int);
BOOL get_course(HWND, course_array *, int);
BOOL get_round(HWND, player_array *, int, int);
/* edit.c */
BOOL CheckEditShort(HWND, int, char [], short *, short, short);
/* add.c */
BOOL AddPlayer(HWND, player_array *, int *, int *);
BOOL AddRound(HWND, player_array *, int *, int *, int *);
BOOL AddCourse(HWND, course_array *, int *);
/* memory.c */
BOOL AllocateCourse(course_array *);
BOOL AllocateRound(history_array *);
BOOL AllocatePlayer(player_array *);
/* handicap.c */
BOOL FAR PASCAL HandicapDlgProc(HWND, WORD, WORD, LONG);
int gen_handicap(history_array *, course_array *);