Disabling auto-refresh of game list by default, as it is causing bugs sometimes
[open-ps2-loader.git] / thirdparty / freetype-2.3.12 / src / otvalid / otvcommn.h
blob898887fc954babd587bd4fa7212f2ce21afa22b7
1 /***************************************************************************/
2 /* */
3 /* otvcommn.h */
4 /* */
5 /* OpenType common tables validation (specification). */
6 /* */
7 /* Copyright 2004, 2005, 2007, 2009 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
19 #ifndef __OTVCOMMN_H__
20 #define __OTVCOMMN_H__
23 #include <ft2build.h>
24 #include "otvalid.h"
25 #include FT_INTERNAL_DEBUG_H
28 FT_BEGIN_HEADER
31 /*************************************************************************/
32 /*************************************************************************/
33 /***** *****/
34 /***** VALIDATION *****/
35 /***** *****/
36 /*************************************************************************/
37 /*************************************************************************/
39 typedef struct OTV_ValidatorRec_* OTV_Validator;
41 typedef void (*OTV_Validate_Func)( FT_Bytes table,
42 OTV_Validator valid );
44 typedef struct OTV_ValidatorRec_
46 FT_Validator root;
47 FT_UInt type_count;
48 OTV_Validate_Func* type_funcs;
50 FT_UInt lookup_count;
51 FT_UInt glyph_count;
53 FT_UInt nesting_level;
55 OTV_Validate_Func func[3];
57 FT_UInt extra1; /* for passing parameters */
58 FT_UInt extra2;
59 FT_Bytes extra3;
61 #ifdef FT_DEBUG_LEVEL_TRACE
62 FT_UInt debug_indent;
63 const FT_String* debug_function_name[3];
64 #endif
66 } OTV_ValidatorRec;
69 #undef FT_INVALID_
70 #define FT_INVALID_( _prefix, _error ) \
71 ft_validator_error( valid->root, _prefix ## _error )
73 #define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \
74 FT_Bytes _table ## _p
76 #define OTV_OPTIONAL_OFFSET( _offset ) \
77 FT_BEGIN_STMNT \
78 _offset ## _p = p; \
79 _offset = FT_NEXT_USHORT( p ); \
80 FT_END_STMNT
82 #define OTV_LIMIT_CHECK( _count ) \
83 FT_BEGIN_STMNT \
84 if ( p + (_count) > valid->root->limit ) \
85 FT_INVALID_TOO_SHORT; \
86 FT_END_STMNT
88 #define OTV_SIZE_CHECK( _size ) \
89 FT_BEGIN_STMNT \
90 if ( _size > 0 && _size < table_size ) \
91 { \
92 if ( valid->root->level == FT_VALIDATE_PARANOID ) \
93 FT_INVALID_OFFSET; \
94 else \
95 { \
96 /* strip off `const' */ \
97 FT_Byte* pp = (FT_Byte*)_size ## _p; \
100 FT_TRACE3(( "\n" \
101 "Invalid offset to optional table `%s'" \
102 " set to zero.\n" \
103 "\n", #_size )); \
105 /* always assume 16bit entities */ \
106 _size = pp[0] = pp[1] = 0; \
109 FT_END_STMNT
112 #define OTV_NAME_(x) #x
113 #define OTV_NAME(x) OTV_NAME_(x)
115 #define OTV_FUNC_(x) x##Func
116 #define OTV_FUNC(x) OTV_FUNC_(x)
118 #ifdef FT_DEBUG_LEVEL_TRACE
120 #define OTV_NEST1( x ) \
121 FT_BEGIN_STMNT \
122 valid->nesting_level = 0; \
123 valid->func[0] = OTV_FUNC( x ); \
124 valid->debug_function_name[0] = OTV_NAME( x ); \
125 FT_END_STMNT
127 #define OTV_NEST2( x, y ) \
128 FT_BEGIN_STMNT \
129 valid->nesting_level = 0; \
130 valid->func[0] = OTV_FUNC( x ); \
131 valid->func[1] = OTV_FUNC( y ); \
132 valid->debug_function_name[0] = OTV_NAME( x ); \
133 valid->debug_function_name[1] = OTV_NAME( y ); \
134 FT_END_STMNT
136 #define OTV_NEST3( x, y, z ) \
137 FT_BEGIN_STMNT \
138 valid->nesting_level = 0; \
139 valid->func[0] = OTV_FUNC( x ); \
140 valid->func[1] = OTV_FUNC( y ); \
141 valid->func[2] = OTV_FUNC( z ); \
142 valid->debug_function_name[0] = OTV_NAME( x ); \
143 valid->debug_function_name[1] = OTV_NAME( y ); \
144 valid->debug_function_name[2] = OTV_NAME( z ); \
145 FT_END_STMNT
147 #define OTV_INIT valid->debug_indent = 0
149 #define OTV_ENTER \
150 FT_BEGIN_STMNT \
151 valid->debug_indent += 2; \
152 FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \
153 FT_TRACE4(( "%s table\n", \
154 valid->debug_function_name[valid->nesting_level] )); \
155 FT_END_STMNT
157 #define OTV_NAME_ENTER( name ) \
158 FT_BEGIN_STMNT \
159 valid->debug_indent += 2; \
160 FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \
161 FT_TRACE4(( "%s table\n", name )); \
162 FT_END_STMNT
164 #define OTV_EXIT valid->debug_indent -= 2
166 #define OTV_TRACE( s ) \
167 FT_BEGIN_STMNT \
168 FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \
169 FT_TRACE4( s ); \
170 FT_END_STMNT
172 #else /* !FT_DEBUG_LEVEL_TRACE */
174 #define OTV_NEST1( x ) \
175 FT_BEGIN_STMNT \
176 valid->nesting_level = 0; \
177 valid->func[0] = OTV_FUNC( x ); \
178 FT_END_STMNT
180 #define OTV_NEST2( x, y ) \
181 FT_BEGIN_STMNT \
182 valid->nesting_level = 0; \
183 valid->func[0] = OTV_FUNC( x ); \
184 valid->func[1] = OTV_FUNC( y ); \
185 FT_END_STMNT
187 #define OTV_NEST3( x, y, z ) \
188 FT_BEGIN_STMNT \
189 valid->nesting_level = 0; \
190 valid->func[0] = OTV_FUNC( x ); \
191 valid->func[1] = OTV_FUNC( y ); \
192 valid->func[2] = OTV_FUNC( z ); \
193 FT_END_STMNT
195 #define OTV_INIT do { } while ( 0 )
196 #define OTV_ENTER do { } while ( 0 )
197 #define OTV_NAME_ENTER( name ) do { } while ( 0 )
198 #define OTV_EXIT do { } while ( 0 )
200 #define OTV_TRACE( s ) do { } while ( 0 )
202 #endif /* !FT_DEBUG_LEVEL_TRACE */
205 #define OTV_RUN valid->func[0]
208 /*************************************************************************/
209 /*************************************************************************/
210 /***** *****/
211 /***** COVERAGE TABLE *****/
212 /***** *****/
213 /*************************************************************************/
214 /*************************************************************************/
216 FT_LOCAL( void )
217 otv_Coverage_validate( FT_Bytes table,
218 OTV_Validator valid,
219 FT_Int expected_count );
221 /* return first covered glyph */
222 FT_LOCAL( FT_UInt )
223 otv_Coverage_get_first( FT_Bytes table );
225 /* return last covered glyph */
226 FT_LOCAL( FT_UInt )
227 otv_Coverage_get_last( FT_Bytes table );
229 /* return number of covered glyphs */
230 FT_LOCAL( FT_UInt )
231 otv_Coverage_get_count( FT_Bytes table );
234 /*************************************************************************/
235 /*************************************************************************/
236 /***** *****/
237 /***** CLASS DEFINITION TABLE *****/
238 /***** *****/
239 /*************************************************************************/
240 /*************************************************************************/
242 FT_LOCAL( void )
243 otv_ClassDef_validate( FT_Bytes table,
244 OTV_Validator valid );
247 /*************************************************************************/
248 /*************************************************************************/
249 /***** *****/
250 /***** DEVICE TABLE *****/
251 /***** *****/
252 /*************************************************************************/
253 /*************************************************************************/
255 FT_LOCAL( void )
256 otv_Device_validate( FT_Bytes table,
257 OTV_Validator valid );
260 /*************************************************************************/
261 /*************************************************************************/
262 /***** *****/
263 /***** LOOKUPS *****/
264 /***** *****/
265 /*************************************************************************/
266 /*************************************************************************/
268 FT_LOCAL( void )
269 otv_Lookup_validate( FT_Bytes table,
270 OTV_Validator valid );
272 FT_LOCAL( void )
273 otv_LookupList_validate( FT_Bytes table,
274 OTV_Validator valid );
277 /*************************************************************************/
278 /*************************************************************************/
279 /***** *****/
280 /***** FEATURES *****/
281 /***** *****/
282 /*************************************************************************/
283 /*************************************************************************/
285 FT_LOCAL( void )
286 otv_Feature_validate( FT_Bytes table,
287 OTV_Validator valid );
289 /* lookups must already be validated */
290 FT_LOCAL( void )
291 otv_FeatureList_validate( FT_Bytes table,
292 FT_Bytes lookups,
293 OTV_Validator valid );
296 /*************************************************************************/
297 /*************************************************************************/
298 /***** *****/
299 /***** LANGUAGE SYSTEM *****/
300 /***** *****/
301 /*************************************************************************/
302 /*************************************************************************/
304 FT_LOCAL( void )
305 otv_LangSys_validate( FT_Bytes table,
306 OTV_Validator valid );
309 /*************************************************************************/
310 /*************************************************************************/
311 /***** *****/
312 /***** SCRIPTS *****/
313 /***** *****/
314 /*************************************************************************/
315 /*************************************************************************/
317 FT_LOCAL( void )
318 otv_Script_validate( FT_Bytes table,
319 OTV_Validator valid );
321 /* features must already be validated */
322 FT_LOCAL( void )
323 otv_ScriptList_validate( FT_Bytes table,
324 FT_Bytes features,
325 OTV_Validator valid );
328 /*************************************************************************/
329 /*************************************************************************/
330 /***** *****/
331 /***** UTILITY FUNCTIONS *****/
332 /***** *****/
333 /*************************************************************************/
334 /*************************************************************************/
336 #define ChainPosClassSetFunc otv_x_Ox
337 #define ChainPosRuleSetFunc otv_x_Ox
338 #define ChainSubClassSetFunc otv_x_Ox
339 #define ChainSubRuleSetFunc otv_x_Ox
340 #define JstfLangSysFunc otv_x_Ox
341 #define JstfMaxFunc otv_x_Ox
342 #define LigGlyphFunc otv_x_Ox
343 #define LigatureArrayFunc otv_x_Ox
344 #define LigatureSetFunc otv_x_Ox
345 #define PosClassSetFunc otv_x_Ox
346 #define PosRuleSetFunc otv_x_Ox
347 #define SubClassSetFunc otv_x_Ox
348 #define SubRuleSetFunc otv_x_Ox
350 FT_LOCAL( void )
351 otv_x_Ox ( FT_Bytes table,
352 OTV_Validator valid );
354 #define AlternateSubstFormat1Func otv_u_C_x_Ox
355 #define ChainContextPosFormat1Func otv_u_C_x_Ox
356 #define ChainContextSubstFormat1Func otv_u_C_x_Ox
357 #define ContextPosFormat1Func otv_u_C_x_Ox
358 #define ContextSubstFormat1Func otv_u_C_x_Ox
359 #define LigatureSubstFormat1Func otv_u_C_x_Ox
360 #define MultipleSubstFormat1Func otv_u_C_x_Ox
362 FT_LOCAL( void )
363 otv_u_C_x_Ox( FT_Bytes table,
364 OTV_Validator valid );
366 #define AlternateSetFunc otv_x_ux
367 #define AttachPointFunc otv_x_ux
368 #define ExtenderGlyphFunc otv_x_ux
369 #define JstfGPOSModListFunc otv_x_ux
370 #define JstfGSUBModListFunc otv_x_ux
371 #define SequenceFunc otv_x_ux
373 FT_LOCAL( void )
374 otv_x_ux( FT_Bytes table,
375 OTV_Validator valid );
377 #define PosClassRuleFunc otv_x_y_ux_sy
378 #define PosRuleFunc otv_x_y_ux_sy
379 #define SubClassRuleFunc otv_x_y_ux_sy
380 #define SubRuleFunc otv_x_y_ux_sy
382 FT_LOCAL( void )
383 otv_x_y_ux_sy( FT_Bytes table,
384 OTV_Validator valid );
386 #define ChainPosClassRuleFunc otv_x_ux_y_uy_z_uz_p_sp
387 #define ChainPosRuleFunc otv_x_ux_y_uy_z_uz_p_sp
388 #define ChainSubClassRuleFunc otv_x_ux_y_uy_z_uz_p_sp
389 #define ChainSubRuleFunc otv_x_ux_y_uy_z_uz_p_sp
391 FT_LOCAL( void )
392 otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes table,
393 OTV_Validator valid );
395 #define ContextPosFormat2Func otv_u_O_O_x_Onx
396 #define ContextSubstFormat2Func otv_u_O_O_x_Onx
398 FT_LOCAL( void )
399 otv_u_O_O_x_Onx( FT_Bytes table,
400 OTV_Validator valid );
402 #define ContextPosFormat3Func otv_u_x_y_Ox_sy
403 #define ContextSubstFormat3Func otv_u_x_y_Ox_sy
405 FT_LOCAL( void )
406 otv_u_x_y_Ox_sy( FT_Bytes table,
407 OTV_Validator valid );
409 #define ChainContextPosFormat2Func otv_u_O_O_O_O_x_Onx
410 #define ChainContextSubstFormat2Func otv_u_O_O_O_O_x_Onx
412 FT_LOCAL( void )
413 otv_u_O_O_O_O_x_Onx( FT_Bytes table,
414 OTV_Validator valid );
416 #define ChainContextPosFormat3Func otv_u_x_Ox_y_Oy_z_Oz_p_sp
417 #define ChainContextSubstFormat3Func otv_u_x_Ox_y_Oy_z_Oz_p_sp
419 FT_LOCAL( void )
420 otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes table,
421 OTV_Validator valid );
424 FT_LOCAL( FT_UInt )
425 otv_GSUBGPOS_get_Lookup_count( FT_Bytes table );
427 FT_LOCAL( FT_UInt )
428 otv_GSUBGPOS_have_MarkAttachmentType_flag( FT_Bytes table );
430 /* */
432 FT_END_HEADER
434 #endif /* __OTVCOMMN_H__ */
437 /* END */