1 /* File: h-system.h */
2 
3 #ifndef INCLUDED_H_SYSTEM_H
4 #define INCLUDED_H_SYSTEM_H
5 
6 /*
7  * Include the basic "system" files.
8  *
9  * Make sure all "system" constants/macros are defined.
10  * Make sure all "system" functions have "extern" declarations.
11  *
12  * This file is a big hack to make other files less of a hack.
13  * This file has been rebuilt -- it may need a little more work.
14  *
15  * It is (very) unlikely that VMS will work without help, primarily
16  * because VMS does not use the "ASCII" character set.
17  */
18 
19 
20 #include <stdio.h>
21 #include <ctype.h>
22 #include <errno.h>
23 
24 
25 #if defined(NeXT)
26 # include <libc.h>
27 #else
28 # include <stdlib.h>
29 #endif /* NeXT */
30 
31 
32 #ifdef SET_UID
33 
34 # include <sys/types.h>
35 
36 # if defined(Pyramid) || defined(NeXT) || defined(SUNOS) || \
37      defined(NCR3K) || defined(SUNOS) || defined(ibm032) || \
38      defined(__osf__) || defined(ISC) || defined(SGI) || \
39      defined(linux)
40 #  include <sys/time.h>
41 # endif
42 
43 # if !defined(SGI) && !defined(ULTRIX)
44 #  include <sys/timeb.h>
45 # endif
46 
47 #endif /* SET_UID */
48 
49 
50 #include <time.h>
51 
52 
53 #ifdef MACINTOSH
54 # include <unix.h>
55 #endif /* MACINTOSH */
56 
57 
58 #if defined(WINDOWS) || defined(MSDOS) || defined(USE_EMX)
59 # include <io.h>
60 #endif
61 
62 #if !defined(MACINTOSH) && !defined(AMIGA) && \
63     !defined(ACORN) && !defined(VM) && !defined(__MWERKS__)
64 # if defined(__TURBOC__) || defined(__WATCOMC__)
65 #  include <mem.h>
66 # else
67 #  include <memory.h>
68 # endif
69 #endif
70 
71 
72 #if !defined(NeXT) && !defined(__MWERKS__) && !defined(ACORN)
73 # include <fcntl.h>
74 #endif
75 
76 
77 #ifdef SET_UID
78 
79 # ifndef USG
80 #  include <sys/param.h>
81 #  include <sys/file.h>
82 # endif	/* !USG */
83 
84 # ifdef linux
85 #  include <sys/file.h>
86 # endif
87 
88 # include <pwd.h>
89 
90 # include <unistd.h>
91 
92 # include <sys/stat.h>
93 
94 # ifdef SOLARIS
95 #  include <netdb.h>
96 # endif
97 
98 #endif /* SET_UID */
99 
100 #ifdef __DJGPP__
101 #include <unistd.h>
102 #endif /* __DJGPP__ */
103 
104 #include <string.h>
105 
106 #include <stdarg.h>
107 
108 
109 /* Include maid-x11.c */
110 #if defined(USE_X11) || defined(USE_XAW) || defined(USE_XPJ)
111 #define USE_XMAID
112 #endif
113 
114 
115 
116 /* Hack - this should be in h-types.h, but we need errr and cptr here */
117 
118 /* Error codes for function return values */
119 /* Success = 0, Failure = -N, Problem = +N */
120 typedef int errr;
121 
122 /* String pointer */
123 typedef const char *cptr;
124 
125 
126 
127 /* The init functions for each port called from main.c */
128 
129 #ifdef USE_XAW
130 extern errr init_xaw(int argc, char **argv);
131 extern cptr help_xaw[];
132 #endif
133 
134 #ifdef USE_X11
135 extern errr init_x11(int argc, char **argv);
136 extern cptr help_x11[];
137 #endif
138 
139 #ifdef USE_XPJ
140 extern errr init_xpj(int argc, char **argv);
141 extern cptr help_xpj[];
142 #endif
143 
144 #ifdef USE_GCU
145 extern errr init_gcu(void);
146 extern cptr help_gcu[];
147 #endif
148 
149 #ifdef USE_CAP
150 extern errr init_cap(void);
151 extern cptr help_cap[];
152 #endif
153 
154 #ifdef USE_DOS
155 extern errr init_dos(void);
156 extern cptr help_dos[];
157 #endif
158 
159 #ifdef USE_IBM
160 extern errr init_ibm(void);
161 extern cptr help_ibm[];
162 #endif
163 
164 #ifdef USE_EMX
165 extern errr init_emx(void);
166 extern cptr help_emx[];
167 #endif
168 
169 #ifdef USE_SLA
170 extern errr init_sla(void);
171 extern cptr help_sla[];
172 #endif
173 
174 #ifdef USE_AMI
175 extern errr init_ami(void);
176 extern cptr help_ami[];
177 #endif
178 
179 #ifdef USE_VME
180 extern errr init_vme(void);
181 extern cptr help_vme[];
182 #endif
183 
184 #ifdef USE_LSL
185 extern errr init_lsl(void);
186 extern cptr help_lsl[];
187 #endif
188 
189 #ifdef USE_GTK
190 extern errr init_gtk(int argc, char **argv, unsigned char *new_game);
191 extern cptr help_gtk[];
192 #endif
193 
194 #ifdef USE_VCS
195 extern errr init_vcs(int argc, char **argv);
196 extern cptr help_vcs[];
197 #endif
198 
199 #ifdef USE_TNB
200 extern errr init_tnb(int argc, cptr *argv);
201 extern cptr help_tnb[];
202 #endif
203 
204 /*
205  * Type used to access a module
206  */
207 typedef struct module_type module_type;
208 
209 struct module_type
210 {
211 	cptr name;
212 	cptr *help;
213 	errr (*init) (int argc, char **argv, unsigned char *new_game);
214 };
215 
216 
217 /*
218  * Macro to make an entry for a port in main.c's list.
219  *
220  * This expands 'INIT_MODULE(port)' to be:
221  *
222  * { "port", help_port, init_port }   (Without the type-cast. )
223  *
224  * When adding new ports make sure you use the correct parameter
225  * types to init_"port_name"().  If you need to add a new one,
226  * add it on the end of the list.  (You don't have to use all the
227  * parameters due to the way C passes them on the stack.)
228  */
229 #define INIT_MODULE(P) \
230 		{ #P, help_##P, (errr (*)(int, char **, unsigned char *)) init_##P }
231 
232 #endif /* INCLUDED_H_SYSTEM_H */
233