File: constants.h

package info (click to toggle)
grcompiler 4.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,076 kB
  • ctags: 5,163
  • sloc: cpp: 45,565; sh: 4,451; ansic: 4,377; makefile: 185; xml: 175; perl: 127
file content (330 lines) | stat: -rw-r--r-- 9,234 bytes parent folder | download | duplicates (4)
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/*--------------------------------------------------------------------*//*:Ignore this sentence.
Copyright (C) 1999, 2001 SIL International. All rights reserved.

Distributable under the terms of either the Common Public License or the
GNU Lesser General Public License, as specified in the LICENSING.txt file.

File: Main.h
Responsibility: Sharon Correll
Last reviewed: Not yet.

Description:
    Constant definitions.
-------------------------------------------------------------------------------*//*:End Ignore*/


enum {
	// Maximum Silf table version that can be generated by this version of the compiler:
	kfxdCompilerVersion = 0x00040002,
	kfxdMaxSilfVersion  = 0x00040000
};

enum {
	kMaxGlyphsPerFont = 65530,
	// Reserve 6 glyphs for defined constants.
	kBadGlyph = 65531
};

//	Kludge to ensure that certain error messages come last:
enum {
	kMaxFileLineNumber = 0x1FFFFFFF
};

// Expected type of result of expression
typedef enum ExpressionType {	// hungarian: expt
	kexptUnknown,
	kexptNumber,
	kexptBoolean,
	kexptMeas,
	kexptZero,	// to handle the fact that 0 == 0m == false
	kexptOne,	// to handle the fact that 1 == true
	kexptSlotRef,
	kexptString,
	kexptPoint,
	kexptGlyphID
} ExpressionType;


bool EquivalentTypes(ExpressionType expt1, ExpressionType expt2);


//	Glyph types:
typedef enum GlyphType {	// hungarian: glft
	kglftUnknown = 0,
	kglftUnicode,
	kglftGlyphID,
	kglftCodepoint,
	kglftPostscript,
	kglftPseudo
} GlyphType;


//	Symbol types
typedef enum SymbolType {	// hungarian: symt
	ksymtNone,
	ksymtClass,					// user-defined
	ksymtPseudo,				// user-defined
	ksymtDirective,				// pre-defined
	ksymtFeature,				// user-defined
		ksymtFeatStyle,			// user-defined
	ksymtFeatSetting,			// user-defined
	ksymtLanguage,				// user defined
	ksymtGlobal,				// pre-defined
	ksymtGlyphData,
		ksymtGlyphAttr,			// pre-defined and user-defined
			ksymtGlyphAttrComp,	// user-defined: component.???.top/bottom/right/left
		ksymtGlyphMetric,		// pre-defined
	ksymtInvalid,
		ksymtInvalidGlyphAttr,	// a non-leaf field within a glyph attribute
	ksymtNameID,				// user-defined
	ksymtOperator,				// pre-defined: ==, &&, +, -, min, max, etc.
		ksymtOpAssign,
	ksymtProcState,				// pre-defined: JustifyMode, JustifyLevel
	ksymtSlotAttr,				// pre-defined
		ksymtSlotAttrPt,		// pre-defined: attach.at/with, shift, kern--attributes with
								//		point values that need to be expanded into integers
		ksymtSlotAttrCompRef,	// user-defined: component.???.reference
	ksymtSpecial,				// pre-defined: _, @, #, ^, etc.
		ksymtSpecialAt,
		ksymtSpecialCaret,
		ksymtSpecialLb,
		ksymtSpecialUnderscore,
	ksymtTable,					// pre-defined: feature, glyph, name
		ksymtTableRule,			// pre-defined: linebreak, substitution, position
	ksymtUnit					// pre-defined: 'm'
} SymbolType;


//	Scaling units:
enum {
	kmunitUnscaled	= -2,	// already converted from scaled to unscaled
	kmunitNone		= -1,	// no scaling
	kmunitDefault	=  0	// use default
};


//	Table options for rule-checking:
typedef enum RuleCheckOption {
	kfrcoNone = 0,
	kfrcoLb			= 0x0001,	// can LB items be in the rule?
	kfrcoSubst		= 0x0002,	// can substitutions be done?
	kfrcoSetBreak	= 0x0004,	// set breakweight attribute?
	kfrcoSetCompRef = 0x0008,	// set component.ref attr?
	kfrcoSetDir		= 0x0010,	// set directionality attr?
	kfrcoSetInsert	= 0x0020,	// set insertion attr?
	kfrcoSetPos		= 0x0040,	// set attach, shift, kern attrs?
	kfrcoPreBidi	= 0x0080,	// justifiy.stretch/shrink vs. justify.width
	kfrcoNeedJust	= 0x0100	// need tests for justification
} RuleCheckOption;


typedef enum TableType {	// hungarian: tblt
	ktbltNone,
	ktbltName,
	ktbltFeature,
	ktbltGlyph,
	ktbltRule,
	ktbltLanguage
} TableType;


//	Maxima permitted by the binary format of the TrueType tables.
enum {
	kMaxSubTables			= 256,
	kMaxGlyphAttrs			= 65536,	// Gloc table
	kMinGlyphAttrValue	   = -32768,
	kMaxGlyphAttrValue		= 32768,
	kMaxPasses				= 128,		// Sil_sub table would allow 256
	kMaxPseudos				= 65536,
	kMaxScriptTags			= 256,
	kMaxReplcmtClasses		= 65535,	// Class map
	kMaxReplcmtClassesV1_2	= 256,
	kMaxGlyphAttrsGlat1		= 256,
	kMaxComponents			= 16383
};


//	Maxima permitted by the engine implementation. These codes MUST match those used by
//	the engine.
enum {
	kMaxFontNameLength		=    32,	// font cache name buffer size
	kMaxFeatures			=    64,
	kFieldsPerComponent		=     4,	// four corners of the box
	kMaxSlotsPerRule		=    64,
	kMaxGlyphsPerInputClass	= 65535,
	kMaxTotalGlyphs			= 65535
};

//	Pragmatic maxima:
enum {
	//	Maxima imposed by the binary tables = 256
	kMaxUserDefinableSlotAttrs	= 64,
	kMaxComponentsPerGlyph		= 32
};


//	Engine code operators. These codes MUST match those used by the engine.
enum ActionCommand {
	kopNop = 0,

	kopPushByte,		kopPushByteU,		kopPushShort,	kopPushShortU,	kopPushLong,

	kopAdd,				kopSub,				kopMul,			kopDiv,
	kopMin,				kopMax,
	kopNeg,
	kopTrunc8,			kopTrunc16,

	kopCond,
	
	kopAnd,				kopOr,				kopNot,
	kopEqual,			kopNotEq,
	kopLess,			kopGtr,				kopLessEq,		kopGtrEq,

	kopNext,			kopNextN,			kopCopyNext,
	kopPutGlyphV1_2,	kopPutSubsV1_2,		kopPutCopy,
	kopInsert,			kopDelete,
	kopAssoc,
	kopCntxtItem,

	kopAttrSet,			kopAttrAdd,			kopAttrSub,
	kopAttrSetSlot,
	kopIAttrSetSlot,
	kopPushSlotAttr,		kopPushGlyphAttrV1_2,	kopPushGlyphMetric,		kopPushFeat,
	kopPushAttToGAttrV1_2,	kopPushAttToGlyphMetric,
	kopPushISlotAttr,

	kopPushIGlyphAttr,	// not yet implemented

	kopPopRet,			kopRetZero,			kopRetTrue,
	kopIAttrSet,		kopIAttrAdd,		kopIAttrSub,
	kopPushProcState,	kopPushVersion,
	kopPutSubs,			kopPutSubs2,		kopPutSubs3,
	kopPutGlyph,		kopPushGlyphAttr,	kopPushAttToGlyphAttr

};


//	Slot attribute internal IDs. These codes MUST match those used by the engine.
enum SlotAttrName {
	kslatAdvX = 0,		kslatAdvY,
	kslatAttTo,
	kslatAttAtX,		kslatAttAtY,		kslatAttAtGpt,
	kslatAttAtXoff,		kslatAttAtYoff,
	kslatAttWithX,		kslatAttWithY,		kslatAttWithGpt,
	kslatAttWithXoff,	kslatAttWithYoff,
	kslatAttLevel,
	kslatBreak,
	kslatCompRef,
	kslatDir,
	kslatInsert,
	kslatPosX,			kslatPosY,
	kslatShiftX,		kslatShiftY,
	kslatUserDefnV1, // version 1.0
	kslatMeasureSol,	kslatMeasureEol,
	kslatJStretch,		kslatJShrink,		kslatJStep,		kslatJWeight,	kslatJWidth,
	kslatSegSplit = kslatJStretch + 29,
	// this must be last:
	kslatUserDefn = kslatJStretch + 30
};


//	Glyph metric internal IDs. These codes MUST match those used by the engine.
typedef enum GlyphMetric {
	kgmetLsb = 0,		kgmetRsb,
	kgmetBbTop,			kgmetBbBottom,		kgmetBbLeft,		kgmetBbRight,
	kgmetBbHeight,		kgmetBbWidth,
	kgmetAdvWidth,		kgmetAdvHeight,
	kgmetAscent,		kgmetDescent
} GlyphMetric;


//	Directionality codes. These codes MUST match those used by the engine.
typedef enum DirCode {  // Hungarian: dirc

	kdircUnknown	= -1,	// not yet determined by the bidi algorithm
	kdircNeutral	=  0,	// other neutrals (default) - ON
	kdircL			=  1,	// left-to-right, strong - L
	kdircR			=  2,	// right-to-left, strong - R
	kdircRArab		=  3,	// Arabic letter, right-to-left, strong, AR
	kdircEuroNum	=  4,	// European number, left-to-right, weak - EN
	kdircEuroSep	=  5,	// European separator, left-to-right, weak - ES
	kdircEuroTerm	=  6,	// European number terminator, left-to-right, weak - ET
	kdircArabNum	=  7,	// Arabic number, left-to-right, weak - AN
	kdircComSep		=  8,	// Common number separator, left-to-right, weak - CS
	kdircWhiteSpace	=  9,	// white space, neutral - WS
	kdircBndNeutral = 10,	// boundary netural - BN

	kdircLRO		= 11,	// LTR override
	kdircRLO		= 12,	// RTL override
	kdircLRE		= 13,	// LTR embedding
	kdircRLE		= 14,	// RTL embedding
	kdircPDF		= 15,	// pop directionality flag

	//	I think we need this too:
	kdircNSM		= 16,	// non-space mark

	//	Special values for internal use:
	kdircLlb		= 32,	// left-to-right line-break
	kdircRlb		= 33,	// right-to-left line-break
	kdircPDFl		= 34,	// PDF marker matching an LRO or LRE
	kdircPDFr		= 35	// PDF marker matching an RLO or RLE

} DirCode;


//	Unicode characters with special treatments
enum DefinedChars {

	kchwSpace	= 0x0020,		// space
	kchwHyphen	= 0x002D,		// hyphen

	kchwLRM		= 0x200E,		// left-to-right mark
	kchwRLM		= 0x200F,		// right-to-left mark
	kchwLRE		= 0x202A,		// left-to-right embedding
	kchwRLE		= 0x202B,		// right-to-left embedding
	kchwPDF		= 0x202C,		// pop directional format
	kchwLRO		= 0x202D,		// left-to-right override
	kchwRLO		= 0x202E			// right-to-left override

};

// version 1.0 breakweights
enum BreakWeightsV1
{
	klbv1WordBreak		= 1,
	klbv1HyphenBreak	= 2,
	klbv1LetterBreak	= 3,
	klbv1ClipBreak		= 4
};

enum BreakWeightsV2
{
	klbv2WsBreak		= 10,
	klbv2WordBreak		= 15,
	klbv2HyphenBreak	= 20,
	klbv2LetterBreak	= 30,
	klbv2ClipBreak		= 40
};

//	Gpoint = zero value. This code MUST match that used by the engine.
//	Most unset attributes have a default value of zero, but gpoint attributes need something
//	to distinguish between an actual value of zero and nothing. (This is a somewhat arbitrary
//	value, except we want to avoid -1 because that often used by the engine to indicate
//	"never been set").
enum {
	kGpointZero = -2
};

enum ProcessStates
{
	kpstatJustifyMode	= 1,
	kpstatJustifyLevel	= 2
};

enum JustifyModes
{
	kjmodNormal		= 0,
	kjmodMeasure	= 1,
	kjmodJustify	= 2
};