aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/glk_types.h
blob: 84d3e151a1c36753926460642867839ae3068616 (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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/* 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_GLK_TYPES_H
#define GLK_GLK_TYPES_H

#include "common/scummsys.h"
#include "common/stream.h"

namespace Glk {

class Window;

/**
 * List of the different sub-engines the engine will likely eventually support
 */
enum InterpreterType {
	INTERPRETER_ADVSYS = 0,
	INTERPRETER_AGILITY = 1,
	INTERPRETER_ALAN2 = 2,
	INTERPRETER_ALAN3 = 3,
	INTERPRETER_BOCFEL = 4,
	INTERPRETER_FROTZ = 5,
	INTERPRETER_GEAS = 6,
	INTERPRETER_GLULXE = 7,
	INTERPRETER_HUGO = 8,
	INTERPRETER_JACL = 9,
	INTERPRETER_LEVEL9 = 10,
	INTERPRETER_MAGNETIC = 11,
	INTERPRETER_NITFOL = 12,
	INTERPRETER_SCARE = 13,
	INTERPRETER_SCOTT = 14,
	INTERPRETER_TADS2 = 15,
	INTERPRETER_TADS3 = 16
};

/**
 * These are the compile-time conditionals that reveal various Glk optional modules.
 */
#define GLK_MODULE_LINE_ECHO
#define GLK_MODULE_LINE_TERMINATORS
#define GLK_MODULE_UNICODE
#define GLK_MODULE_UNICODE_NORM
#define GLK_MODULE_IMAGE
#define GLK_MODULE_SOUND
#define GLK_MODULE_SOUND2
#define GLK_MODULE_HYPERLINKS
#define GLK_MODULE_DATETIME
#define GLK_MODULE_GARGLKTEXT

/**
 * Usurp C1 space for ligatures and smart typography glyphs
 */
enum Enc {
	ENC_LIG_FI = 128,
	ENC_LIG_FL = 129,
	ENC_LSQUO = 130,
	ENC_RSQUO = 131,
	ENC_LDQUO = 132,
	ENC_RDQUO = 133,
	ENC_NDASH = 134,
	ENC_MDASH = 135,
	ENC_FLOWBREAK = 136
};

/**
 * These are the Unicode versions
 */
enum UniChars {
	UNI_LIG_FI = 0xFB01,
	UNI_LIG_FL = 0xFB02,
	UNI_LSQUO = 0x2018,
	UNI_RSQUO = 0x2019,
	UNI_LDQUO = 0x201c,
	UNI_RDQUO = 0x201d,
	UNI_NDASH = 0x2013,
	UNI_MDASH = 0x2014
};

enum Gestalt {
	gestalt_Version                = 0,
	gestalt_CharInput              = 1,
	gestalt_LineInput              = 2,
	gestalt_CharOutput             = 3,
	gestalt_CharOutput_CannotPrint = 0,
	gestalt_CharOutput_ApproxPrint = 1,
	gestalt_CharOutput_ExactPrint  = 2,
	gestalt_MouseInput             = 4,
	gestalt_Timer                  = 5,
	gestalt_Graphics               = 6,
	gestalt_DrawImage              = 7,
	gestalt_Sound                  = 8,
	gestalt_SoundVolume            = 9,
	gestalt_SoundNotify            = 10,
	gestalt_Hyperlinks             = 11,
	gestalt_HyperlinkInput         = 12,
	gestalt_SoundMusic             = 13,
	gestalt_GraphicsTransparency   = 14,
	gestalt_Unicode                = 15,
	gestalt_UnicodeNorm            = 16,
	gestalt_LineInputEcho          = 17,
	gestalt_LineTerminators        = 18,
	gestalt_LineTerminatorKey      = 19,
	gestalt_DateTime               = 20,
	gestalt_Sound2                 = 21,
	gestalt_GarglkText             = 0x1100
};

enum Style {
	style_Normal       = 0,
	style_Emphasized   = 1,
	style_Preformatted = 2,
	style_Header       = 3,
	style_Subheader    = 4,
	style_Alert        = 5,
	style_Note         = 6,
	style_BlockQuote   = 7,
	style_Input        = 8,
	style_User1        = 9,
	style_User2        = 10,
	style_NUMSTYLES    = 11
};

enum WinType {
	wintype_AllTypes   = 0,
	wintype_Pair       = 1,
	wintype_Blank      = 2,
	wintype_TextBuffer = 3,
	wintype_TextGrid   = 4,
	wintype_Graphics   = 5
};

enum WinMethod {
	winmethod_Left         = 0x00,
	winmethod_Right        = 0x01,
	winmethod_Above        = 0x02,
	winmethod_Below        = 0x03,
	winmethod_Arbitrary    = 0x04,		///< Newly introduced for ScummGlk
	winmethod_DirMask      = 0x0f,

	winmethod_Fixed        = 0x10,
	winmethod_Proportional = 0x20,
	winmethod_DivisionMask = 0xf0,

	winmethod_Border     = 0x000,
	winmethod_NoBorder   = 0x100,
	winmethod_BorderMask = 0x100
};

enum StyleHint {
	stylehint_Indentation     = 0,
	stylehint_ParaIndentation = 1,
	stylehint_Justification  = 2,
	stylehint_Size            = 3,
	stylehint_Weight          = 4,
	stylehint_Oblique         = 5,
	stylehint_Proportional    = 6,
	stylehint_TextColor       = 7,
	stylehint_BackColor       = 8,
	stylehint_ReverseColor    = 9,
	stylehint_NUMHINTS        = 10,

	stylehint_just_LeftFlush  = 0,
	stylehint_just_LeftRight  = 1,
	stylehint_just_Centered   = 2,
	stylehint_just_RightFlush = 3
};

/**
 * These constants define the classes of opaque objects. It's a bit ugly to put
 * them in this header file, since more classes may be added in the future.
 * But if you find yourself stuck with an obsolete version of this file,
 * adding new class definitions will be easy enough -- they will be numbered
 * sequentially, and the numeric constants can be found in the Glk specification.
 */
enum giDisp {
	gidisp_Class_Window   = 0,
	gidisp_Class_Stream   = 1,
	gidisp_Class_Fileref  = 2,
	gidisp_Class_Schannel = 3
};

enum zcolor {
	zcolor_Transparent = 0x7FFFFFFCU,
	zcolor_Cursor      = 0x7FFFFFFDU,
	zcolor_Current     = 0x7FFFFFFEU,
	zcolor_Default     = 0x7FFFFFFFU
};

#ifdef GLK_MODULE_IMAGE

enum ImageAlign {
	imagealign_InlineUp     = 1,
	imagealign_InlineDown   = 2,
	imagealign_InlineCenter = 3,
	imagealign_MarginLeft   = 4,
	imagealign_MarginRight  = 5
};

#endif /* GLK_MODULE_IMAGE */

union gidispatch_rock_t {
	uint num;
	void *ptr;
};

union gluniversal_union {
	uint _uint;          ///< Iu
	int32 _sint;         ///< Is
	void *_opaqueref;    ///< Qa, Qb, Qc...
	byte _uch;           ///< Cu
	int8 _sch;           ///< Cs
	char _ch;            ///< Cn
	char *_charstr;		 ///< S
	uint32 *_unicharstr; ///< U
	void *_array;        ///< all # arguments
	uint32 _ptrflag;     ///< [ ... ] or *?
};
typedef gluniversal_union gluniversal_t;

struct gidispatch_intconst_struct {
	const char *name;
	uint32 val;
};
typedef gidispatch_intconst_struct gidispatch_intconst_t;

} // End of namespace Glk

#endif