1 #ifndef __OTL_PARSER_H__ 2 #define __OTL_PARSER_H__ 3 4 #include "otlayout.h" 5 #include "otlgdef.h" 6 #include "otlgsub.h" 7 #include "otlgpos.h" 8 9 OTL_BEGIN_HEADER 10 11 typedef struct OTL_ParserRec_* OTL_Parser; 12 13 typedef struct OTL_StringRec_* OTL_String; 14 15 typedef struct OTL_StringGlyphRec_ 16 { 17 OTL_UInt gindex; 18 OTL_UInt properties; 19 OTL_UInt lig_component; 20 OTL_UInt lig_id; 21 22 } OTL_StringGlyphRec, *OTL_StringGlyph; 23 24 typedef struct OTL_StringRec_ 25 { 26 OTL_StringGlyph glyphs; 27 OTL_UInt cursor; 28 OTL_UInt length; 29 OTL_UInt capacity; 30 31 } OTL_StringRec; 32 33 typedef struct OTL_ParserRec_ 34 { 35 OTL_Bytes tab_gdef; 36 OTL_Bytes tab_gsub; 37 OTL_Bytes tab_gpos; 38 OTL_Bytes tab_base; 39 OTL_Bytes tab_jstf; 40 41 OTL_Alternate alternate; /* external alternate handler */ 42 43 OTL_UInt context_len; 44 OTL_UInt markup_flags; 45 46 OTL_jmp_buf jump_buffer; 47 OTL_Memory memory; 48 OTL_Error error; 49 50 OTL_StringRec strings[2]; 51 OTL_String str_in; 52 OTL_String str_out; 53 54 } OTL_ParserRec; 55 56 typedef enum 57 { 58 OTL_Err_Parser_Ok = 0, 59 OTL_Err_Parser_InvalidData, 60 OTL_Err_Parser_UncoveredGlyph 61 62 } OTL_ParseError; 63 64 OTL_LOCAL( OTL_UInt ) 65 otl_parser_get_gindex( OTL_Parser parser ); 66 67 68 OTL_LOCAL( void ) 69 otl_parser_error( OTL_Parser parser, OTL_ParserError error ); 70 71 #define OTL_PARSER_UNCOVERED(x) \ 72 otl_parser_error( x, OTL_Err_Parser_UncoveredGlyph ) 73 74 OTL_LOCAL( void ) 75 otl_parser_check_property( OTL_Parser parser, 76 OTL_UInt gindex, 77 OTL_UInt flags, 78 OTL_UInt *aproperty ); 79 80 /* copy current input glyph to output */ 81 OTL_LOCAL( void ) 82 otl_parser_copy_1( OTL_Parser parser ); 83 84 /* copy current input glyph to output, replacing its index */ 85 OTL_LOCAL( void ) 86 otl_parser_replace_1( OTL_Parser parser, 87 OTL_UInt gindex ); 88 89 /* copy current input glyph to output, replacing it by several indices */ 90 /* read directly from the table */ 91 OTL_LOCAL( void ) 92 otl_parser_replace_n( OTL_Parser parser, 93 OTL_UInt count, 94 OTL_Bytes indices ); 95 96 OTL_END_HEADER 97 98 #endif /* __OTL_PARSER_H__ */ 99 100