aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan3/sysdep.h
blob: 1889a3ea00fd726aad45591eb2c69516936366fd (plain)
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
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef GLK_ALAN3_SYSDEP
#define GLK_ALAN3_SYSDEP

/* System dependencies file for Alan Adventure Language system

  N.B. The test for symbols used here should really be of three types
  - processor name (like PC, x86, ...)
  - os name (DOS, WIN32, Solaris2, ...)
  - compiler name and version (DJGPP, CYGWIN, GCC271, THINK-C, ...)

  The set symbols should indicate if a feature is on or off like the GNU
  AUTOCONFIG package does.

  This is not completely done yet!
*/

#include "common/util.h"

namespace Glk {
namespace Alan3 {

#define GLK
#define HAVE_GLK

#undef isspace
#define isspace Common::isSpace
#undef isdigit
#define isdigit Common::isDigit
#undef isalpha
#define isalpha Common::isAlpha
#undef stricmp
#define stricmp scumm_stricmp
#undef strdup
#define strdup scumm_strdup
#undef strcasecmp
#define strcasecmp scumm_stricmp
#undef strncasecmp
#define strncasecmp scumm_strnicmp
#undef rand
#define rand() g_vm->getRandomNumber(0x7fffffff)


/*----------------------------------------------------------------------

  Below follows OS and compiler dependent settings. They should not be
  changed except for introducing new sections when porting to new
  environments.

 */

/***********************/
/* ISO character sets? */
/***********************/

/* Common case first */
#define ISO 1
#define NATIVECHARSET 0

#undef ISO
#define ISO 1
#undef NATIVECHARSET
#define NATIVECHARSET 0

/**************************/
/* Strings for file modes */
/**************************/
#define READ_MODE "rb"
#define WRITE_MODE "wb"


/****************/

/* don't need TERMIO */
#undef HAVE_TERMIO
/* don't need ANSI */
#undef HAVE_ANSI

#define USE_READLINE


/* Native character functions */
extern int isSpace(unsigned int c);      /* IN - Native character to test */
extern int isLower(unsigned int c);      /* IN - Native character to test */
extern int isUpper(unsigned int c);      /* IN - Native character to test */
extern int isLetter(unsigned int c);     /* IN - Native character to test */
extern int toLower(unsigned int c);      /* IN - Native character to convert */
extern int toUpper(unsigned int c);      /* IN - Native character to convert */
extern char *strlow(char str[]); /* INOUT - Native string to convert */
extern char *strupp(char str[]); /* INOUT - Native string to convert */

/* ISO character functions */
extern int isISOLetter(int c);  /* IN - ISO character to test */
extern char IsoToLowerCase(int c); /* IN - ISO character to convert */
extern char IsoToUpperCase(int c); /* IN - ISO character to convert */
extern char *stringLower(char str[]); /* INOUT - ISO string to convert */
extern char *stringUpper(char str[]); /* INOUT - ISO string to convert */
extern int compareStrings(char str1[], char str2[]); /* Case-insensitive compare */

/* ISO string conversion functions */
extern void toIso(char copy[],  /* OUT - Mapped string */
                  char original[], /* IN - string to convert */
                  int charset); /* IN - The current character set */

extern void fromIso(char copy[], /* OUT - Mapped string */
                    char original[]); /* IN - string to convert */

extern void toNative(char copy[], /* OUT - Mapped string */
                     char original[], /* IN - string to convert */
                     int charset); /* IN - current character set */

extern char *baseNameStart(char *fullPathName);

} // End of namespace Alan3
} // End of namespace Glk

#endif