~ubuntu-branches/ubuntu/wily/gargoyle-free/wily-proposed

« back to all changes in this revision

Viewing changes to terps/agility/config.h

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Beucler
  • Date: 2009-09-11 20:09:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090911200943-idgzoyupq6650zpn
Tags: upstream-2009-08-25
ImportĀ upstreamĀ versionĀ 2009-08-25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* config.h-- Configuration information for AGiliTy. */
 
2
/* Copyright (C) 1996-1999,2001  Robert Masenten          */
 
3
/* This program may be redistributed under the terms of the
 
4
   GNU General Public License, version 2; see agility.h for details. */
 
5
/*
 
6
   This file contains most of the configuration information
 
7
      including the platform-dependent #define statements 
 
8
   It's in three major sections:
 
9
     --Platform specific defines for various platforms, each 
 
10
       surrounded by "#ifdef <platform>" and "#endif" 
 
11
     --Various defaults
 
12
     --Filename extensions     
 
13
 
 
14
   Ideally, a port to a new platform should only need to modify this
 
15
    file, the makefile, os_<whatever>.c, and possibly filename.c.  (In
 
16
    practice, you may also need to tweak the the high-level I/O code
 
17
    in interface.c or the memory-allocation code in util.c.  If you
 
18
    find yourself needing to do more than that, get in touch with me.)  */
 
19
 
 
20
#undef _WIN32 /* GARGLK */
 
21
 
 
22
 
 
23
/* Default to PLAIN platform */
 
24
/* At the moment, you can replace this with LINUX, HPUX, AMIGA,     */
 
25
/*   MSDOS, SUN, or NEXT; some of these may require the correct os_... */
 
26
/*   file to work                                                   */
 
27
/*   (In particular, AMIGA requires David Kinder's os_amiga.c file) */
 
28
/* The actual platform specific defines don't start until a few     */
 
29
/*   lines down, past the #includes and the definition of global    */
 
30
#ifndef PLAIN 
 
31
#define PLAIN
 
32
#endif
 
33
 
 
34
 
 
35
#if defined(__MSDOS__) || defined(_DOS)   
 
36
    /* These work under Borland C and Visual C++ 1.52, respectively */
 
37
#ifndef MSDOS
 
38
#define MSDOS
 
39
#endif
 
40
#ifndef MSDOS32
 
41
#define MSDOS16
 
42
#endif
 
43
#endif
 
44
 
 
45
/* ------------------------------------------------------------------- */
 
46
/* PLATFORM SPECIFIC DEFINITIONS, ETC. */
 
47
/*  See agility.doc or porting.txt for more information. */
 
48
/* Things you can currently define: */
 
49
/*    fix_ascii: 1=translate IBM character set, 0=don't */
 
50
/*    NEED_STR_CMP: define if strcasecmp() not defined on your system */
 
51
/*    NEED_STRN_CMP: define if strncasecmp() not defined on your system */
 
52
/*    HAVE_STRDUP: define if strdup() exists on your system */
 
53
/*    REPLACE_GETFILE: define if you replace the default get_user_file(). */
 
54
/*    REPLACE_MENU if you replace agt_menu().                 */
 
55
/*    REPLACE_MAIN: define if you replace the default main(). */
 
56
/*  (replacements should be defined in the relevant os_<platform>.c file) */
 
57
/*    DA1,DA2,...DA6,DSS,pTTL: file name extensions for the various AGT 
 
58
            files */
 
59
/*   HAVE_SLEEP if your platform has the sleep() function */
 
60
/*   BUFF_SIZE is the maximum size of the buffer to use when reading
 
61
       in files. Regardless, it will be made no bigger than the file 
 
62
       being read in and no smaller than the record size; thus setting
 
63
       it to 0 will cause the smallest buffer to always be used and
 
64
       setting this to 1MB will in practice always use a buffer the
 
65
       sizs of the file. It defaults to 32K */
 
66
/*   CBUF_SIZE is the maximum size of the buffer used for reading in 
 
67
       the Master's Edition DA6 files; the size of the buffer in bytes
 
68
       is twice this value (since an individual token is two bytes long). */
 
69
/*   DESCR_BUFFSIZE is the maximum size of the description text block before
 
70
       the interpreter will read it from disk rather than storing it in 
 
71
       memory during play. At the moment this only affects AGX games;
 
72
       original AGT games always use the disk. */
 
73
/*   DOHASH to use a hash table for dictionary searches; the only 
 
74
       reason not to have this would be memory */
 
75
/*   HASHBITS determines the size of the hash table: (2^HASHBITS)*sizeof(word);
 
76
       the hash table must be at least as large as the dictionary.
 
77
       In practice this means HASHBITS should be at least 12;
 
78
       this is the current default. */
 
79
/*   MAXSTRUC The maximum size (in chars) which a single data structure can
 
80
       be on this platform. This defaults to 1MB (i.e. no limit for 
 
81
       practical purposes). In practice I know of no game files that
 
82
       require any structures bigger than about 30K.  */
 
83
/*   LOWMEM Define this if you are low on memory. At the moment this
 
84
       only saves a few K.*/
 
85
/*   PORTSTR Is the string describing this particular port.
 
86
        e.g. #define PORTSTR "OrfDOS Port by R.J. Wright" */ 
 
87
/*   UNIX_IO  if you have Unix-like low level file I/O functions.
 
88
       (MS-DOS, for example, does). This speeds up the reading
 
89
       of the large game data files on some platforms. If this is 
 
90
       defined, READFLAG, WRITEFLAG, and FILE_PERM also need to
 
91
       be defined. (Giving the flags needed for opening a file for
 
92
       reading or writing, and the file permissions to be given to newly
 
93
       created files. */  
 
94
/*   OPEN_AS_TEXT  Define to cause text files to be opened as text files. */
 
95
/*   PREFIX_EXT  Add filename extensions at the beginning of the name, 
 
96
       rather than at the end. */
 
97
/*   PATH_SEP, if defined, is a string containing all characters which
 
98
       can be used to separate the path from the filename. */
 
99
/*   pathtest(s) is a macro that should check whether the given string
 
100
        is an absolute path.  If this is left undefined, then _all_
 
101
        paths will be treated as absolute. You don't need to define
 
102
        this if you are replacing filename.c.  */
 
103
/* ------------------------------------------------------------------- */
 
104
 
 
105
/* force16 is used purely for debugging purposes, to make sure that
 
106
   everything works okay even with 16-bit ints */
 
107
/* #define force16  */
 
108
 
 
109
#define DOHASH
 
110
 
 
111
/* This is intended for DJGPP */
 
112
#ifdef MSDOS32
 
113
#define HAVE_STRDUP
 
114
#define BUFF_SIZE (1024L*1024L) 
 
115
#define INBUFF_SIZE (8*1024)     /* Used by Magx */
 
116
#define MAXSTRUC (4*1024L*1024L) /* If we're asking for over 4 MB, something
 
117
                                  is wrong. */
 
118
#define DESCR_BUFFSIZE (4*1025L*1024L)
 
119
#define CBUF_SIZE (20000L)
 
120
#define PORTSTR "DOS 386 Version"
 
121
#define READFLAG O_RDONLY
 
122
#define WRITEFLAG (O_WRONLY|O_CREAT|O_TRUNC)
 
123
#define FILE_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
 
124
#include <unistd.h>
 
125
#ifndef MSDOS
 
126
#define MSDOS
 
127
#endif
 
128
#ifdef __DJGPP__
 
129
#define REPLACE_BNW /* Enable picture and font support */
 
130
#endif
 
131
#endif
 
132
 
 
133
 
 
134
 
 
135
/* This works with Borland C; I don't know about other DOS C compilers  */
 
136
#ifdef MSDOS16
 
137
#define strcasecmp(s1,s2) stricmp(s1,s2)
 
138
#define NEED_STRN_CMP
 
139
#define BUFF_SIZE (16*1024L)
 
140
#define INBUFF_SIZE (2*1024)     /* Used by Magx */
 
141
#define CBUF_SIZE (10000L)     /* DOS file routines used signed ints, and
 
142
                                  so can only handle 32K sized blocks */
 
143
#define MAXSTRUC (64L*1024L)  /* DOS 64K Limit */
 
144
#define PORTSTR "DOS Version"
 
145
#define READFLAG (O_RDONLY | O_BINARY)
 
146
#define WRITEFLAG (O_WRONLY | O_BINARY | O_CREAT | O_TRUNC)
 
147
#define FILE_PERM (S_IWRITE | S_IREAD)
 
148
#define REPLACE_BNW
 
149
/* #define LOWMEM*/
 
150
#define DOSFARDATA far
 
151
#define HASHBITS 13
 
152
#ifndef MSDOS
 
153
#define MSDOS
 
154
#endif
 
155
#endif
 
156
 
 
157
 
 
158
/* This is common configuration information shared by both 
 
159
   DOS16 and DOS32 */
 
160
#ifdef MSDOS
 
161
#define fnamecmp strcasecmp   /* Case insensitive file name comparison */
 
162
#define fix_ascii 0  /* DON'T translate IBM character set */
 
163
#define HAVE_SLEEP
 
164
#define FAST_FIXSIGN
 
165
#define UNIX_IO
 
166
#define PATH_SEP ":\\"
 
167
#define pathtest(s) (s[0]=='\\' || strchr(s,':')!=NULL);
 
168
#undef PLAIN
 
169
#endif 
 
170
 
 
171
 
 
172
 
 
173
 
 
174
#ifdef LINUX
 
175
#define LINUX_COLOR
 
176
#define fix_ascii 1  
 
177
/* #define HAVE_TPARAM */
 
178
#define UNIX
 
179
#define HAVE_STRDUP
 
180
#define BUFF_SIZE (1024L*1024L) 
 
181
#define INBUFF_SIZE (8*1024)     /* Used by Magx */
 
182
#define MAXSTRUC (4*1024L*1024L) /* If we're asking for over 4 MB, something
 
183
                                  is wrong. */
 
184
#define DESCR_BUFFSIZE (4*1025L*1024L)
 
185
#define CBUF_SIZE (20000L)
 
186
/* If you're compiling for a 32-bit platform, you can uncomment the following
 
187
   for a modest performance increase. */
 
188
/* #define FAST_FIXSIGN */
 
189
#define PORTSTR "Linux Version"
 
190
#define REPLACE_BNW
 
191
#undef PLAIN
 
192
#endif
 
193
 
 
194
 
 
195
/* The following configuration was contributed by Alexander Lehmann */
 
196
/* It was originally written for 0.3, but it should work for later */
 
197
/* versions as well. */ 
 
198
#ifdef HPUX
 
199
#define HAVE_TPARAM
 
200
#define UNIX
 
201
#define HAVE_STRDUP
 
202
#define BUFF_SIZE (1024L*1024L)
 
203
#define MAXSTRUCT (1024L*1024L)
 
204
#define DESCR_BUFFSIZE (1024L*1024L)
 
205
#define CBUF_SIZE (20000L)
 
206
#define FAST_FIXSIGN
 
207
#define PORTSTR "HP-UX Version"
 
208
#undef PLAIN
 
209
#endif
 
210
 
 
211
 
 
212
 
 
213
#ifdef SUN
 
214
#define NO_TERMCAP_H
 
215
#define UNIX
 
216
#define BUFF_SIZE (1024L*1024L)
 
217
#define MAXSTRUC (1024L*1024L) 
 
218
#define DESCR_BUFFSIZE (1024L*1024L) 
 
219
#define CBUF_SIZE (20000L)  
 
220
#define PORTSTR "UNIX Version"
 
221
#undef PLAIN
 
222
#endif
 
223
 
 
224
 
 
225
/* This can presumably be tweaked to support various flavors of BSD */
 
226
#ifdef NEXT
 
227
#define NO_TERMCAP_H
 
228
#define UNIX
 
229
#define BSD_TERM
 
230
#define BUFF_SIZE (1024L*1024L)
 
231
#define MAXSTRUC (1024L*1024L) 
 
232
#define DESCR_BUFFSIZE (1024L*1024L)
 
233
#define CBUF_SIZE (20000L)  
 
234
#define PORTSTR "NEXT/BSD Version"
 
235
#define _POSIX_SOURCE
 
236
#include <time.h>
 
237
#include <sys/types.h>
 
238
#undef PLAIN
 
239
#endif
 
240
 
 
241
 
 
242
/* From David Kinder's Amiga port; you'll also need his os_amiga.c file  */
 
243
#ifdef AMIGA  
 
244
#define NEED_STR_CMP
 
245
#define NEED_STRN_CMP
 
246
#undef HAVE_STRDUP
 
247
#define REPLACE_GETFILE
 
248
#define FAST_FIXSIGN
 
249
#define BUFF_SIZE (256L*1024L)
 
250
#define CBUF_SIZE (20000L)
 
251
#define UNIX_IO
 
252
#define PORTSTR "Amiga Version by David Kinder"
 
253
#define READFLAG O_RDONLY
 
254
#define WRITEFLAG (O_WRONLY|O_CREAT|O_TRUNC)  
 
255
#define FILE_PERM 0
 
256
#undef PLAIN
 
257
/* Fix for DICE compiler problem */
 
258
#ifdef _DCC
 
259
#ifdef INT_MIN
 
260
#undef INT_MIN
 
261
#endif
 
262
#define INT_MIN -2147483647
 
263
#endif
 
264
#endif
 
265
 
 
266
 
 
267
 
 
268
 
 
269
/* For David Kinder's Windows port; you will also need his source files */
 
270
#ifdef _WIN32
 
271
#define NEED_STR_CMP
 
272
#define NEED_STRN_CMP
 
273
#undef HAVE_STRDUP
 
274
#define REPLACE_GETFILE
 
275
#define FAST_FIXSIGN
 
276
#define BUFF_SIZE (256L*1024L)
 
277
#define CBUF_SIZE (20000L)
 
278
#define UNIX_IO
 
279
#define PORTSTR "Windows Version by David Kinder"
 
280
#define READFLAG O_RDONLY
 
281
#define WRITEFLAG (O_WRONLY|O_CREAT|O_TRUNC)
 
282
#define FILE_PERM 0
 
283
#undef PLAIN
 
284
#endif
 
285
 
 
286
 
 
287
/*
 
288
 * The Glk port is very similar to plain ASCII, to give it the best
 
289
 * chance at success on multiple Glk platforms.  The only basic change
 
290
 * is to turn off IBM character translations; Glk works in ISO 8859
 
291
 * Latin-1, which can offer slightly closer translation of the IBM
 
292
 * code page 437 characters that the simpler mappings in the core
 
293
 * AGiliTy code.  The os_glk.c module handles the translations.
 
294
 */
 
295
#ifdef GLK  
 
296
#define NEED_STR_CMP                    /* Inherited from PLAIN. */
 
297
#define NEED_STRN_CMP                   /* Inherited from PLAIN. */
 
298
#define BUFF_SIZE       0               /* Inherited from PLAIN. */
 
299
#define CBUF_SIZE       (5000L)         /* Inherited from PLAIN. */
 
300
#define INBUFF_SIZE     (1024)          /* Inherited from PLAIN. */
 
301
#define fix_ascii       0               /* os_glk.c does translations. */
 
302
#define MAXSTRUC        (1024L*1024L)   /* 32Kb from PLAIN is too small for
 
303
                                           several games (including Soggy). */
 
304
#define PORTSTR         "Glk version"   /* Identify ourselves discreetly. */
 
305
#define REPLACE_GETFILE                 /* Override get_user_file. */
 
306
#define REPLACE_MAIN                    /* Override main. */
 
307
#define fnamecmp        strcasecmp      /* Case insensitive filename compare. */
 
308
#undef PLAIN
 
309
#endif
 
310
 
 
311
 
 
312
/* PLAIN should always come last, giving everyone else a chance
 
313
 to #undef it. */
 
314
#ifdef PLAIN  /* This should work if nothing else does */
 
315
#define NEED_STR_CMP
 
316
#define NEED_STRN_CMP
 
317
#define BUFF_SIZE 0    
 
318
#define CBUF_SIZE (5000L)
 
319
#define INBUFF_SIZE (1024)     /* Used by Magx */
 
320
#define MAXSTRUC (32L*1024L) /* IIRC, 32K is the minimum required by
 
321
                                the ANSI standard */
 
322
#define PORTSTR "Pure ANSI C version"
 
323
#endif
 
324
 
 
325
 
 
326
/* __GNUC__ */
 
327
 
 
328
 
 
329
/* ------------------------------------------------------------------- */
 
330
/* DEFAULTS FOR "PLATFORM SPECIFIC" DEFINES */
 
331
/* ------------------------------------------------------------------- */
 
332
 
 
333
#ifdef __POSIX__
 
334
#ifndef UNIX
 
335
#define UNIX
 
336
#endif
 
337
#endif
 
338
 
 
339
#ifdef UNIX
 
340
#define HAVE_SLEEP
 
341
#define UNIX_IO
 
342
#define READFLAG O_RDONLY
 
343
#define WRITEFLAG (O_WRONLY|O_CREAT|O_TRUNC)
 
344
#define FILE_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
 
345
#define PATH_SEP "/"
 
346
#define pathtest(s) (s[0]=='/');
 
347
#include <unistd.h>
 
348
#endif
 
349
 
 
350
#ifdef __STRICT_ANSI__
 
351
#define NEED_STR_CMP
 
352
#define NEED_STRN_CMP
 
353
#undef HAVE_STRDUP
 
354
#endif
 
355
 
 
356
#ifndef fix_ascii
 
357
#define fix_ascii 1  /* Translate IBM character set by default */
 
358
#endif
 
359
 
 
360
#ifndef BUFF_SIZE
 
361
#ifdef LOWMEM
 
362
#define BUFF_SIZE 0   /* i.e. unbuffered */
 
363
#else
 
364
#define BUFF_SIZE (32L*1024L)  /* 32K */
 
365
#endif
 
366
#endif /* BUFF_SIZE */
 
367
 
 
368
#ifndef MAXSTRUC
 
369
#define MAXSTRUC (1024L*1024L)
 
370
#endif
 
371
 
 
372
#ifndef DESCR_BUFFSIZE
 
373
#define DESCR_BUFFSIZE 0  /* Always load descriptions from disk */
 
374
#endif
 
375
 
 
376
#ifndef HASHBITS
 
377
#ifdef LOWMEM
 
378
#define HASHBITS 12   /* 4K entries */
 
379
#else
 
380
#define HASHBITS 13   /* 8K entries in hash table */
 
381
#endif  
 
382
#endif /* HASHBITS */
 
383
 
 
384
#ifndef fnamecmp   /* Used to compare filenames */
 
385
#define fnamecmp strcmp
 
386
#endif
 
387
 
 
388
#ifndef fnamencmp  /* Also used to compare filenames */
 
389
#define fnamencmp strncmp
 
390
#endif
 
391
 
 
392
/* If DOSFARDATA hasn't been defined, define it as the empty string. */
 
393
#ifndef DOSFARDATA
 
394
#define DOSFARDATA
 
395
#endif 
 
396
 
 
397
/* ---------------------------------------------------------------------- */
 
398
/* FILENAME EXTENSIONS                                                    */
 
399
/* These are the various filename extensions for the different data files.*/
 
400
/* ---------------------------------------------------------------------- */
 
401
 
 
402
/* The following are only used by the interpreter, agtout, and agt2agx */
 
403
#ifndef DA1
 
404
#define DA1 ".da1"   /* General info (text file) */
 
405
#define DA2 ".da2"   /* Rooms */
 
406
#define DA3 ".da3"   /* Items */
 
407
#define DA4 ".da4"   /* Creatures */
 
408
#define DA5 ".da5"   /* Commands, headers */
 
409
#define DA6 ".da6"   /* Commands, code (Master's Ed only) */
 
410
#define DSS ".d$$"   /* Description strings */
 
411
#define pHNT ".hnt"  /* Popup hint file; not used yet. */
 
412
#define pOPT ".opt"  /* Interface specification file */
 
413
#endif
 
414
 
 
415
/* The following are only used by the Magx compiler */
 
416
#ifndef pAGT
 
417
#define pAGT ".agt"
 
418
#define pDAT ".dat"
 
419
#define pMSG ".msg"
 
420
#define pCMD ".cmd"
 
421
#define pSTD ".std"
 
422
#define AGTpSTD "agt.std"  /* Default error message file */
 
423
#endif
 
424
 
 
425
/* The following are used by both the interpreter and the compiler */
 
426
#ifndef pAGX
 
427
#define pAGX ".agx"  /* Extension for new Adventure Game eXecutable format */
 
428
#define pTTL ".ttl"  /* Title file */
 
429
#define pINS ".ins"  /* Instruction file */
 
430
#define pVOC ".voc"  /* Menu vocabulary file */
 
431
#define pCFG ".cfg"  /* Game configuration file */
 
432
#define pEXT "."  /* Separator between extension and base of filename */
 
433
#endif
 
434
 
 
435
 
 
436
#ifndef pSAV
 
437
#define pSAV ".sav"  /* Extension for save files */
 
438
#endif
 
439
 
 
440
#ifndef pSCR
 
441
#define pSCR ".scr"  /* Script file */
 
442
#endif
 
443
 
 
444
#ifndef pLOG
 
445
#define pLOG ".log"  /* LOG/REPLAY file */
 
446
#endif
 
447
 
 
448
 
 
449
 
 
450
 
 
451
 
 
452
/* Finally, two potentially platform dependent type defintions, 
 
453
   for binary and text files respectively.  Don't change these
 
454
   unless you are also changing filename.c */
 
455
 
 
456
typedef FILE* genfile;
 
457
typedef char* file_id_type;  /* i.e. the filename */
 
458
 
 
459
#define NO_FILE_ID NULL
 
460
#define BAD_TEXTFILE NULL
 
461
#define BAD_BINFILE  NULL
 
462
 
 
463
#define textgetc(f) fgetc(f)
 
464
#define textungetc(f,c) ungetc(c,f)
 
465
#define textgets(f,s,n) fgets(s,n,f)
 
466
#define texteof(f) feof(f)
 
467
#define textputs(f,s) fputs(s,f)
 
468
 
 
469
 
 
470
#if 0
 
471
int textgetc(genfile f);
 
472
void textungetc(genfile f, char c);
 
473
int texteof(genfile f);
 
474
void textgets(genfile f, char *buff, long leng);
 
475
void textputs(genfile f, const char *s);
 
476
#endif
 
477