3 * (C) Copyright IBM Corp. and others 1998-2016 - All Rights Reserved
7 #ifndef __STATETABLES_H
8 #define __STATETABLES_H
16 #include "LayoutTables.h"
17 #include "LETableReference.h"
25 * State table loop detection.
26 * Detects if too many ( LE_STATE_PATIENCE_COUNT ) state changes occur without moving the glyph index 'g'.
31 * LE_STATE_PATIENCE_INIT();
33 * int g=0; // the glyph index - expect it to be moving
36 * if(LE_STATE_PATIENCE_DECR()) { // decrements the patience counter
37 * // ran out of patience, get out.
41 * LE_STATE_PATIENCE_CURR(int, g); // store the 'current'
42 * state = newState(state,g);
43 * g+= <something, could be zero>;
44 * LE_STATE_PATIENCE_INCR(g); // if g has moved, increment the patience counter. Otherwise leave it.
49 #define LE_STATE_PATIENCE_COUNT 4096 /**< give up if a state table doesn't move the glyph after this many iterations */
50 #define LE_STATE_PATIENCE_INIT() le_uint32 le_patience_count = LE_STATE_PATIENCE_COUNT
51 #define LE_STATE_PATIENCE_DECR() --le_patience_count==0
52 #define LE_STATE_PATIENCE_CURR(type,x) type le_patience_curr=(x)
53 #define LE_STATE_PATIENCE_INCR(x) if((x)!=le_patience_curr) ++le_patience_count;
56 struct StateTableHeader
59 ByteOffset classTableOffset
;
60 ByteOffset stateArrayOffset
;
61 ByteOffset entryTableOffset
;
64 struct StateTableHeader2
67 le_uint32 classTableOffset
;
68 le_uint32 stateArrayOffset
;
69 le_uint32 entryTableOffset
;
78 classCodeFirstFree
= 4,
82 typedef le_uint8 ClassCode
;
88 ClassCode classArray
[ANY_NUMBER
];
90 LE_VAR_ARRAY(ClassTable
, classArray
)
100 typedef le_uint8 EntryTableIndex
;
104 ByteOffset newStateOffset
;
108 typedef le_uint16 EntryTableIndex2
;
110 struct StateEntry2
// same struct different interpretation
112 le_uint16 newStateIndex
;