3 * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
7 #ifndef __STATETABLES_H
8 #define __STATETABLES_H
16 #include "LayoutTables.h"
24 * State table loop detection.
25 * Detects if too many ( LE_STATE_PATIENCE_COUNT ) state changes occur without moving the glyph index 'g'.
30 * LE_STATE_PATIENCE_INIT();
32 * int g=0; // the glyph index - expect it to be moving
35 * if(LE_STATE_PATIENCE_DECR()) { // decrements the patience counter
36 * // ran out of patience, get out.
40 * LE_STATE_PATIENCE_CURR(int, g); // store the 'current'
41 * state = newState(state,g);
42 * g+= <something, could be zero>;
43 * LE_STATE_PATIENCE_INCR(g); // if g has moved, increment the patience counter. Otherwise leave it.
48 #define LE_STATE_PATIENCE_COUNT 4096 /**< give up if a state table doesn't move the glyph after this many iterations */
49 #define LE_STATE_PATIENCE_INIT() le_uint32 le_patience_count = LE_STATE_PATIENCE_COUNT
50 #define LE_STATE_PATIENCE_DECR() --le_patience_count==0
51 #define LE_STATE_PATIENCE_CURR(type,x) type le_patience_curr=(x)
52 #define LE_STATE_PATIENCE_INCR(x) if((x)!=le_patience_curr) ++le_patience_count;
55 struct StateTableHeader
58 ByteOffset classTableOffset
;
59 ByteOffset stateArrayOffset
;
60 ByteOffset entryTableOffset
;
63 struct StateTableHeader2
66 le_uint32 classTableOffset
;
67 le_uint32 stateArrayOffset
;
68 le_uint32 entryTableOffset
;
77 classCodeFirstFree
= 4,
81 typedef le_uint8 ClassCode
;
87 ClassCode classArray
[ANY_NUMBER
];
89 LE_VAR_ARRAY(ClassTable
, classArray
)
99 typedef le_uint8 EntryTableIndex
;
103 ByteOffset newStateOffset
;
107 typedef le_uint16 EntryTableIndex2
;
109 struct StateEntry2
// same struct different interpretation
111 le_uint16 newStateIndex
;