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. */
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"
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.) */
20
#undef _WIN32 /* GARGLK */
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_... */
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 */
35
#if defined(__MSDOS__) || defined(_DOS)
36
/* These work under Borland C and Visual C++ 1.52, respectively */
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
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
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
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
/* ------------------------------------------------------------------- */
105
/* force16 is used purely for debugging purposes, to make sure that
106
everything works okay even with 16-bit ints */
107
/* #define force16 */
111
/* This is intended for DJGPP */
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
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)
129
#define REPLACE_BNW /* Enable picture and font support */
135
/* This works with Borland C; I don't know about other DOS C compilers */
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)
150
#define DOSFARDATA far
158
/* This is common configuration information shared by both
161
#define fnamecmp strcasecmp /* Case insensitive file name comparison */
162
#define fix_ascii 0 /* DON'T translate IBM character set */
166
#define PATH_SEP ":\\"
167
#define pathtest(s) (s[0]=='\\' || strchr(s,':')!=NULL);
177
/* #define HAVE_TPARAM */
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
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"
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. */
202
#define BUFF_SIZE (1024L*1024L)
203
#define MAXSTRUCT (1024L*1024L)
204
#define DESCR_BUFFSIZE (1024L*1024L)
205
#define CBUF_SIZE (20000L)
207
#define PORTSTR "HP-UX Version"
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"
225
/* This can presumably be tweaked to support various flavors of BSD */
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
237
#include <sys/types.h>
242
/* From David Kinder's Amiga port; you'll also need his os_amiga.c file */
245
#define NEED_STRN_CMP
247
#define REPLACE_GETFILE
249
#define BUFF_SIZE (256L*1024L)
250
#define CBUF_SIZE (20000L)
252
#define PORTSTR "Amiga Version by David Kinder"
253
#define READFLAG O_RDONLY
254
#define WRITEFLAG (O_WRONLY|O_CREAT|O_TRUNC)
257
/* Fix for DICE compiler problem */
262
#define INT_MIN -2147483647
269
/* For David Kinder's Windows port; you will also need his source files */
272
#define NEED_STRN_CMP
274
#define REPLACE_GETFILE
276
#define BUFF_SIZE (256L*1024L)
277
#define CBUF_SIZE (20000L)
279
#define PORTSTR "Windows Version by David Kinder"
280
#define READFLAG O_RDONLY
281
#define WRITEFLAG (O_WRONLY|O_CREAT|O_TRUNC)
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.
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. */
312
/* PLAIN should always come last, giving everyone else a chance
314
#ifdef PLAIN /* This should work if nothing else does */
316
#define NEED_STRN_CMP
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
322
#define PORTSTR "Pure ANSI C version"
329
/* ------------------------------------------------------------------- */
330
/* DEFAULTS FOR "PLATFORM SPECIFIC" DEFINES */
331
/* ------------------------------------------------------------------- */
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)
346
#define pathtest(s) (s[0]=='/');
350
#ifdef __STRICT_ANSI__
352
#define NEED_STRN_CMP
357
#define fix_ascii 1 /* Translate IBM character set by default */
362
#define BUFF_SIZE 0 /* i.e. unbuffered */
364
#define BUFF_SIZE (32L*1024L) /* 32K */
366
#endif /* BUFF_SIZE */
369
#define MAXSTRUC (1024L*1024L)
372
#ifndef DESCR_BUFFSIZE
373
#define DESCR_BUFFSIZE 0 /* Always load descriptions from disk */
378
#define HASHBITS 12 /* 4K entries */
380
#define HASHBITS 13 /* 8K entries in hash table */
382
#endif /* HASHBITS */
384
#ifndef fnamecmp /* Used to compare filenames */
385
#define fnamecmp strcmp
388
#ifndef fnamencmp /* Also used to compare filenames */
389
#define fnamencmp strncmp
392
/* If DOSFARDATA hasn't been defined, define it as the empty string. */
397
/* ---------------------------------------------------------------------- */
398
/* FILENAME EXTENSIONS */
399
/* These are the various filename extensions for the different data files.*/
400
/* ---------------------------------------------------------------------- */
402
/* The following are only used by the interpreter, agtout, and agt2agx */
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 */
415
/* The following are only used by the Magx compiler */
422
#define AGTpSTD "agt.std" /* Default error message file */
425
/* The following are used by both the interpreter and the compiler */
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 */
437
#define pSAV ".sav" /* Extension for save files */
441
#define pSCR ".scr" /* Script file */
445
#define pLOG ".log" /* LOG/REPLAY file */
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 */
456
typedef FILE* genfile;
457
typedef char* file_id_type; /* i.e. the filename */
459
#define NO_FILE_ID NULL
460
#define BAD_TEXTFILE NULL
461
#define BAD_BINFILE NULL
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)
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);