From 9722316f91efafc46a4c08c29e03e089a751d3e2 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Tue, 28 Nov 2006 06:22:35 +0000 Subject: [PATCH] ICU-5445 Fix some compiler warnings for both Linux and Windows. Also clean up some code. X-SVN-Rev: 20688 --- icu4c/source/common/ubidi.c | 365 ++++++++++++++++++------------------ 1 file changed, 182 insertions(+), 183 deletions(-) diff --git a/icu4c/source/common/ubidi.c b/icu4c/source/common/ubidi.c index f19a19e8fcc..2c75c8adfc7 100644 --- a/icu4c/source/common/ubidi.c +++ b/icu4c/source/common/ubidi.c @@ -14,11 +14,6 @@ * created by: Markus W. Scherer */ -/* set import/export definitions */ -#ifndef U_COMMON_IMPLEMENTATION -# define U_COMMON_IMPLEMENTATION -#endif - #include "cmemory.h" #include "unicode/utypes.h" #include "unicode/ustring.h" @@ -775,27 +770,28 @@ checkExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) { return directionFromFlags(pBiDi); } -/*********************************************************************/ -/* The Properties state machine table */ -/*********************************************************************/ -/* */ -/* All table cells are 8 bits: */ -/* bits 0..4: next state */ -/* bits 5..7: action to perform (if > 0) */ -/* */ -/* Cells may be of format "n" where n represents the next state */ -/* (except for the rightmost column). */ -/* Cells may also be of format "_(x,y)" where x represents an action */ -/* to perform and y represents the next state. */ -/* */ -/*********************************************************************/ -/* Definitions and type for properties state table */ -/*********************************************************************/ +/****************************************************************** + The Properties state machine table +******************************************************************* + + All table cells are 8 bits: + bits 0..4: next state + bits 5..7: action to perform (if > 0) + + Cells may be of format "n" where n represents the next state + (except for the rightmost column). + Cells may also be of format "s(x,y)" where x represents an action + to perform and y represents the next state. + +******************************************************************* + Definitions and type for properties state table +******************************************************************* +*/ #define IMPTABPROPS_COLUMNS 14 #define IMPTABPROPS_RES (IMPTABPROPS_COLUMNS - 1) #define GET_STATEPROPS(cell) ((cell)&0x1f) #define GET_ACTIONPROPS(cell) ((cell)>>5) -#define _(action, newState) ((uint8_t)(newState+(action<<5))) +#define s(action, newState) ((uint8_t)(newState+(action<<5))) static const uint8_t groupProp[] = /* dirProp regrouped */ { @@ -804,91 +800,93 @@ static const uint8_t groupProp[] = /* dirProp regrouped */ }; enum { _L=0, _R=1, _EN=2, _AN=3, _ON=4, _S=5, _B=6 }; /* reduced dirProp */ -/*********************************************************************/ -/* */ -/* PROPERTIES STATE TABLE */ -/* */ -/* In table impTabProps, */ -/* - the ON column regroups ON and WS */ -/* - the BN column regroups BN, LRE, RLE, LRO, RLO, PDF */ -/* - the Res column is the reduced property assigned to a run */ -/* */ -/* Action 1: process current run1, init new run1 */ -/* 2: init new run2 */ -/* 3: process run1, process run2, init new run1 */ -/* 4: process run1, set run1=run2, init new run2 */ -/* */ -/* Notes: */ -/* 1) This table is used in resolveImplicitLevels(). */ -/* 2) This table triggers actions when there is a change in the Bidi*/ -/* property of incoming characters (action 1). */ -/* 3) Most such property sequences are processed immediately (in */ -/* fact, passed to processPropertySeq(). */ -/* 4) However, numbers are assembled as one sequence. This means */ -/* that undefined situations (like CS following digits, until */ -/* it is known if the next char will be a digit) are held until */ -/* following chars define them. */ -/* Example: digits followed by CS, then comes another CS or ON; */ -/* the digits will be processed, then the CS assigned */ -/* as the start of an ON sequence (action 3). */ -/* 5) There are cases where more than one sequence must be */ -/* processed, for instance digits followed by CS followed by L: */ -/* the digits must be processed as one sequence, and the CS */ -/* must be processed as an ON sequence, all this before starting */ -/* assembling chars for the opening L sequence. */ -/* */ -/* */ +/****************************************************************** + + PROPERTIES STATE TABLE + + In table impTabProps, + - the ON column regroups ON and WS + - the BN column regroups BN, LRE, RLE, LRO, RLO, PDF + - the Res column is the reduced property assigned to a run + + Action 1: process current run1, init new run1 + 2: init new run2 + 3: process run1, process run2, init new run1 + 4: process run1, set run1=run2, init new run2 + + Notes: + 1) This table is used in resolveImplicitLevels(). + 2) This table triggers actions when there is a change in the Bidi + property of incoming characters (action 1). + 3) Most such property sequences are processed immediately (in + fact, passed to processPropertySeq(). + 4) However, numbers are assembled as one sequence. This means + that undefined situations (like CS following digits, until + it is known if the next char will be a digit) are held until + following chars define them. + Example: digits followed by CS, then comes another CS or ON; + the digits will be processed, then the CS assigned + as the start of an ON sequence (action 3). + 5) There are cases where more than one sequence must be + processed, for instance digits followed by CS followed by L: + the digits must be processed as one sequence, and the CS + must be processed as an ON sequence, all this before starting + assembling chars for the opening L sequence. + + +*/ static const uint8_t impTabProps[][IMPTABPROPS_COLUMNS] = { /* L , R , EN , AN , ON , S , B , ES , ET , CS , BN , NSM , AL , Res */ /* 0 Init */ { 1 , 2 , 4 , 5 , 7 , 15 , 17 , 7 , 9 , 7 , 0 , 7 , 3 , _ON }, -/* 1 L */ { 1 , _(1,2), _(1,4), _(1,5), _(1,7),_(1,15),_(1,17), _(1,7), _(1,9), _(1,7), 1 , 1 , _(1,3), _L }, -/* 2 R */ { _(1,1), 2 , _(1,4), _(1,5), _(1,7),_(1,15),_(1,17), _(1,7), _(1,9), _(1,7), 2 , 2 , _(1,3), _R }, -/* 3 AL */ { _(1,1), _(1,2), _(1,6), _(1,6), _(1,8),_(1,16),_(1,17), _(1,8), _(1,8), _(1,8), 3 , 3 , 3 , _R }, -/* 4 EN */ { _(1,1), _(1,2), 4 , _(1,5), _(1,7),_(1,15),_(1,17),_(2,10), 11 ,_(2,10), 4 , 4 , _(1,3), _EN }, -/* 5 AN */ { _(1,1), _(1,2), _(1,4), 5 , _(1,7),_(1,15),_(1,17), _(1,7), _(1,9),_(2,12), 5 , 5 , _(1,3), _AN }, -/* 6 AL:EN/AN */ { _(1,1), _(1,2), 6 , 6 , _(1,8),_(1,16),_(1,17), _(1,8), _(1,8),_(2,13), 6 , 6 , _(1,3), _AN }, -/* 7 ON */ { _(1,1), _(1,2), _(1,4), _(1,5), 7 ,_(1,15),_(1,17), 7 ,_(2,14), 7 , 7 , 7 , _(1,3), _ON }, -/* 8 AL:ON */ { _(1,1), _(1,2), _(1,6), _(1,6), 8 ,_(1,16),_(1,17), 8 , 8 , 8 , 8 , 8 , _(1,3), _ON }, -/* 9 ET */ { _(1,1), _(1,2), 4 , _(1,5), 7 ,_(1,15),_(1,17), 7 , 9 , 7 , 9 , 9 , _(1,3), _ON }, -/*10 EN+ES/CS */ { _(3,1), _(3,2), 4 , _(3,5), _(4,7),_(3,15),_(3,17), _(4,7),_(4,14), _(4,7), 10 , _(4,7), _(3,3), _EN }, -/*11 EN+ET */ { _(1,1), _(1,2), 4 , _(1,5), _(1,7),_(1,15),_(1,17), _(1,7), 11 , _(1,7), 11 , 11 , _(1,3), _EN }, -/*12 AN+CS */ { _(3,1), _(3,2), _(3,4), 5 , _(4,7),_(3,15),_(3,17), _(4,7),_(4,14), _(4,7), 12 , _(4,7), _(3,3), _AN }, -/*13 AL:EN/AN+CS */ { _(3,1), _(3,2), 6 , 6 , _(4,8),_(3,16),_(3,17), _(4,8), _(4,8), _(4,8), 13 , _(4,8), _(3,3), _AN }, -/*14 ON+ET */ { _(1,1), _(1,2), _(4,4), _(1,5), 7 ,_(1,15),_(1,17), 7 , 14 , 7 , 14 , 14 , _(1,3), _ON }, -/*15 S */ { _(1,1), _(1,2), _(1,4), _(1,5), _(1,7), 15 ,_(1,17), _(1,7), _(1,9), _(1,7), 15 , _(1,7), _(1,3), _S }, -/*16 AL:S */ { _(1,1), _(1,2), _(1,6), _(1,6), _(1,8), 16 ,_(1,17), _(1,8), _(1,8), _(1,8), 16 , _(1,8), _(1,3), _S }, -/*17 B */ { _(1,1), _(1,2), _(1,4), _(1,5), _(1,7),_(1,15), 17 , _(1,7), _(1,9), _(1,7), 17 , _(1,7), _(1,3), _B } +/* 1 L */ { 1 , s(1,2), s(1,4), s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), s(1,9), s(1,7), 1 , 1 , s(1,3), _L }, +/* 2 R */ { s(1,1), 2 , s(1,4), s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), s(1,9), s(1,7), 2 , 2 , s(1,3), _R }, +/* 3 AL */ { s(1,1), s(1,2), s(1,6), s(1,6), s(1,8),s(1,16),s(1,17), s(1,8), s(1,8), s(1,8), 3 , 3 , 3 , _R }, +/* 4 EN */ { s(1,1), s(1,2), 4 , s(1,5), s(1,7),s(1,15),s(1,17),s(2,10), 11 ,s(2,10), 4 , 4 , s(1,3), _EN }, +/* 5 AN */ { s(1,1), s(1,2), s(1,4), 5 , s(1,7),s(1,15),s(1,17), s(1,7), s(1,9),s(2,12), 5 , 5 , s(1,3), _AN }, +/* 6 AL:EN/AN */ { s(1,1), s(1,2), 6 , 6 , s(1,8),s(1,16),s(1,17), s(1,8), s(1,8),s(2,13), 6 , 6 , s(1,3), _AN }, +/* 7 ON */ { s(1,1), s(1,2), s(1,4), s(1,5), 7 ,s(1,15),s(1,17), 7 ,s(2,14), 7 , 7 , 7 , s(1,3), _ON }, +/* 8 AL:ON */ { s(1,1), s(1,2), s(1,6), s(1,6), 8 ,s(1,16),s(1,17), 8 , 8 , 8 , 8 , 8 , s(1,3), _ON }, +/* 9 ET */ { s(1,1), s(1,2), 4 , s(1,5), 7 ,s(1,15),s(1,17), 7 , 9 , 7 , 9 , 9 , s(1,3), _ON }, +/*10 EN+ES/CS */ { s(3,1), s(3,2), 4 , s(3,5), s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 10 , s(4,7), s(3,3), _EN }, +/*11 EN+ET */ { s(1,1), s(1,2), 4 , s(1,5), s(1,7),s(1,15),s(1,17), s(1,7), 11 , s(1,7), 11 , 11 , s(1,3), _EN }, +/*12 AN+CS */ { s(3,1), s(3,2), s(3,4), 5 , s(4,7),s(3,15),s(3,17), s(4,7),s(4,14), s(4,7), 12 , s(4,7), s(3,3), _AN }, +/*13 AL:EN/AN+CS */ { s(3,1), s(3,2), 6 , 6 , s(4,8),s(3,16),s(3,17), s(4,8), s(4,8), s(4,8), 13 , s(4,8), s(3,3), _AN }, +/*14 ON+ET */ { s(1,1), s(1,2), s(4,4), s(1,5), 7 ,s(1,15),s(1,17), 7 , 14 , 7 , 14 , 14 , s(1,3), _ON }, +/*15 S */ { s(1,1), s(1,2), s(1,4), s(1,5), s(1,7), 15 ,s(1,17), s(1,7), s(1,9), s(1,7), 15 , s(1,7), s(1,3), _S }, +/*16 AL:S */ { s(1,1), s(1,2), s(1,6), s(1,6), s(1,8), 16 ,s(1,17), s(1,8), s(1,8), s(1,8), 16 , s(1,8), s(1,3), _S }, +/*17 B */ { s(1,1), s(1,2), s(1,4), s(1,5), s(1,7),s(1,15), 17 , s(1,7), s(1,9), s(1,7), 17 , s(1,7), s(1,3), _B } }; /* we must undef macro _ because the levels table have a different * structure (4 bits for action and 4 bits for next state. */ -#undef _ +#undef s -/*********************************************************************/ -/* The levels state machine tables */ -/*********************************************************************/ -/* */ -/* All table cells are 8 bits: */ -/* bits 0..3: next state */ -/* bits 4..7: action to perform (if > 0) */ -/* */ -/* Cells may be of format "n" where n represents the next state */ -/* (except for the rightmost column). */ -/* Cells may also be of format "_(x,y)" where x represents an action */ -/* to perform and y represents the next state. */ -/* */ -/* This format limits each table to 16 states each and to 15 actions.*/ -/* */ -/*********************************************************************/ -/* Definitions and type for levels state tables */ -/*********************************************************************/ +/****************************************************************** + The levels state machine tables +******************************************************************* + + All table cells are 8 bits: + bits 0..3: next state + bits 4..7: action to perform (if > 0) + + Cells may be of format "n" where n represents the next state + (except for the rightmost column). + Cells may also be of format "s(x,y)" where x represents an action + to perform and y represents the next state. + + This format limits each table to 16 states each and to 15 actions. + +******************************************************************* + Definitions and type for levels state tables +******************************************************************* +*/ #define IMPTABLEVELS_COLUMNS (_B + 2) #define IMPTABLEVELS_RES (IMPTABLEVELS_COLUMNS - 1) #define GET_STATE(cell) ((cell)&0x0f) #define GET_ACTION(cell) ((cell)>>4) -#define _(action, newState) ((uint8_t)(newState+(action<<4))) +#define s(action, newState) ((uint8_t)(newState+(action<<4))) typedef uint8_t ImpTab[][IMPTABLEVELS_COLUMNS]; typedef uint8_t ImpAct[]; @@ -897,45 +895,46 @@ typedef uint8_t ImpAct[]; * instead of having a pair of ImpTab and a pair of ImpAct. */ typedef struct ImpTabPair { - const ImpTab * pImpTab[2]; - const ImpAct * pImpAct[2]; + const void * pImpTab[2]; + const void * pImpAct[2]; } ImpTabPair; -/*********************************************************************/ -/* */ -/* LEVELS STATE TABLES */ -/* */ -/* In all levels state tables, */ -/* - state 0 is the initial state */ -/* - the Res column is the increment to add to the text level */ -/* for this property sequence. */ -/* */ -/* The impAct arrays for each table of a pair map the local action */ -/* numbers of the table to the total list of actions. For instance, */ -/* action 2 in a given table corresponds to the action number which */ -/* appears in entry [2] of the impAct array for that table. */ -/* The first entry of all impAct arrays must be 0. */ -/* */ -/* Action 1: init conditional sequence */ -/* 2: prepend conditional sequence to current sequence */ -/* 3: set ON sequence to new level - 1 */ -/* 4: init EN/AN/ON sequence */ -/* 5: fix EN/AN/ON sequence followed by R */ -/* 6: set previous level sequence to level 2 */ -/* */ -/* Notes: */ -/* 1) These tables are used in processPropertySeq(). The input */ -/* is property sequences as determined by resolveImplicitLevels. */ -/* 2) Most such property sequences are processed immediately */ -/* (levels are assigned). */ -/* 3) However, some sequences cannot be assigned a final level till */ -/* one or more following sequences are received. For instance, */ -/* ON following an R sequence within an even-level paragraph. */ -/* If the following sequence is R, the ON sequence will be */ -/* assigned basic run level+1, and so will the R sequence. */ -/* 4) S is generally handled like ON, since its level will be fixed */ -/* to paragraph level in adjustWSLevels(). */ -/* */ +/****************************************************************** + + LEVELS STATE TABLES + + In all levels state tables, + - state 0 is the initial state + - the Res column is the increment to add to the text level + for this property sequence. + + The impAct arrays for each table of a pair map the local action + numbers of the table to the total list of actions. For instance, + action 2 in a given table corresponds to the action number which + appears in entry [2] of the impAct array for that table. + The first entry of all impAct arrays must be 0. + + Action 1: init conditional sequence + 2: prepend conditional sequence to current sequence + 3: set ON sequence to new level - 1 + 4: init EN/AN/ON sequence + 5: fix EN/AN/ON sequence followed by R + 6: set previous level sequence to level 2 + + Notes: + 1) These tables are used in processPropertySeq(). The input + is property sequences as determined by resolveImplicitLevels. + 2) Most such property sequences are processed immediately + (levels are assigned). + 3) However, some sequences cannot be assigned a final level till + one or more following sequences are received. For instance, + ON following an R sequence within an even-level paragraph. + If the following sequence is R, the ON sequence will be + assigned basic run level+1, and so will the R sequence. + 4) S is generally handled like ON, since its level will be fixed + to paragraph level in adjustWSLevels(). + +*/ static const ImpTab impTabL_DEFAULT = /* Even paragraph level */ /* In this table, conditional sequences receive the higher possible level @@ -944,11 +943,11 @@ static const ImpTab impTabL_DEFAULT = /* Even paragraph level */ { /* L , R , EN , AN , ON , S , B , Res */ /* 0 : init */ { 0 , 1 , 0 , 2 , 0 , 0 , 0 , 0 }, -/* 1 : R */ { 0 , 1 , 3 , 3 , _(1,4), _(1,4), 0 , 1 }, -/* 2 : AN */ { 0 , 1 , 0 , 2 , _(1,5), _(1,5), 0 , 2 }, -/* 3 : R+EN/AN */ { 0 , 1 , 3 , 3 , _(1,4), _(1,4), 0 , 2 }, -/* 4 : R+ON */ { _(2,0), 1 , 3 , 3 , 4 , 4 , _(2,0), 1 }, -/* 5 : AN+ON */ { _(2,0), 1 , _(2,0), 2 , 5 , 5 , _(2,0), 1 } +/* 1 : R */ { 0 , 1 , 3 , 3 , s(1,4), s(1,4), 0 , 1 }, +/* 2 : AN */ { 0 , 1 , 0 , 2 , s(1,5), s(1,5), 0 , 2 }, +/* 3 : R+EN/AN */ { 0 , 1 , 3 , 3 , s(1,4), s(1,4), 0 , 2 }, +/* 4 : R+ON */ { s(2,0), 1 , 3 , 3 , 4 , 4 , s(2,0), 1 }, +/* 5 : AN+ON */ { s(2,0), 1 , s(2,0), 2 , 5 , 5 , s(2,0), 1 } }; static const ImpTab impTabR_DEFAULT = /* Odd paragraph level */ /* In this table, conditional sequences receive the lower possible level @@ -957,10 +956,10 @@ static const ImpTab impTabR_DEFAULT = /* Odd paragraph level */ { /* L , R , EN , AN , ON , S , B , Res */ /* 0 : init */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 0 }, -/* 1 : L */ { 1 , 0 , 1 , 3 , _(1,4), _(1,4), 0 , 1 }, +/* 1 : L */ { 1 , 0 , 1 , 3 , s(1,4), s(1,4), 0 , 1 }, /* 2 : EN/AN */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 1 }, /* 3 : L+AN */ { 1 , 0 , 1 , 3 , 5 , 5 , 0 , 1 }, -/* 4 : L+ON */ { _(2,1), 0 , _(2,1), 3 , 4 , 4 , 0 , 0 }, +/* 4 : L+ON */ { s(2,1), 0 , s(2,1), 3 , 4 , 4 , 0 , 0 }, /* 5 : L+AN+ON */ { 1 , 0 , 1 , 3 , 5 , 5 , 0 , 0 } }; static const ImpAct impAct0 = {0,1,2,3,4,5,6}; @@ -976,9 +975,9 @@ static const ImpTab impTabL_NUMBERS_SPECIAL = /* Even paragraph level */ /* L , R , EN , AN , ON , S , B , Res */ /* 0 : init */ { 0 , 2 , 1 , 1 , 0 , 0 , 0 , 0 }, /* 1 : L+EN/AN */ { 0 , 2 , 1 , 1 , 0 , 0 , 0 , 2 }, -/* 2 : R */ { 0 , 2 , 4 , 4 , _(1,3), 0 , 0 , 1 }, -/* 3 : R+ON */ { _(2,0), 2 , 4 , 4 , 3 , 3 , _(2,0), 1 }, -/* 4 : R+EN/AN */ { 0 , 2 , 4 , 4 , _(1,3), _(1,3), 0 , 2 } +/* 2 : R */ { 0 , 2 , 4 , 4 , s(1,3), 0 , 0 , 1 }, +/* 3 : R+ON */ { s(2,0), 2 , 4 , 4 , 3 , 3 , s(2,0), 1 }, +/* 4 : R+EN/AN */ { 0 , 2 , 4 , 4 , s(1,3), s(1,3), 0 , 2 } }; static const ImpTabPair impTab_NUMBERS_SPECIAL = {{&impTabL_NUMBERS_SPECIAL, &impTabR_DEFAULT}, @@ -990,12 +989,12 @@ static const ImpTab impTabL_GROUP_NUMBERS_WITH_R = */ { /* L , R , EN , AN , ON , S , B , Res */ -/* 0 init */ { 0 , 3 , _(1,1), _(1,1), 0 , 0 , 0 , 0 }, -/* 1 EN/AN */ { _(2,0), 3 , 1 , 1 , 2 , _(2,0), _(2,0), 2 }, -/* 2 EN/AN+ON */ { _(2,0), 3 , 1 , 1 , 2 , _(2,0), _(2,0), 1 }, -/* 3 R */ { 0 , 3 , 5 , 5 , _(1,4), 0 , 0 , 1 }, -/* 4 R+ON */ { _(2,0), 3 , 5 , 5 , 4 , _(2,0), _(2,0), 1 }, -/* 5 R+EN/AN */ { 0 , 3 , 5 , 5 , _(1,4), 0 , 0 , 2 } +/* 0 init */ { 0 , 3 , s(1,1), s(1,1), 0 , 0 , 0 , 0 }, +/* 1 EN/AN */ { s(2,0), 3 , 1 , 1 , 2 , s(2,0), s(2,0), 2 }, +/* 2 EN/AN+ON */ { s(2,0), 3 , 1 , 1 , 2 , s(2,0), s(2,0), 1 }, +/* 3 R */ { 0 , 3 , 5 , 5 , s(1,4), 0 , 0 , 1 }, +/* 4 R+ON */ { s(2,0), 3 , 5 , 5 , 4 , s(2,0), s(2,0), 1 }, +/* 5 R+EN/AN */ { 0 , 3 , 5 , 5 , s(1,4), 0 , 0 , 2 } }; static const ImpTab impTabR_GROUP_NUMBERS_WITH_R = /* In this table, EN/AN+ON sequences receive levels as if associated with R @@ -1005,9 +1004,9 @@ static const ImpTab impTabR_GROUP_NUMBERS_WITH_R = /* L , R , EN , AN , ON , S , B , Res */ /* 0 init */ { 2 , 0 , 1 , 1 , 0 , 0 , 0 , 0 }, /* 1 EN/AN */ { 2 , 0 , 1 , 1 , 0 , 0 , 0 , 1 }, -/* 2 L */ { 2 , 0 , _(1,4), _(1,4), _(1,3), 0 , 0 , 1 }, -/* 3 L+ON */ { _(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 0 }, -/* 4 L+EN/AN */ { _(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 1 } +/* 2 L */ { 2 , 0 , s(1,4), s(1,4), s(1,3), 0 , 0 , 1 }, +/* 3 L+ON */ { s(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 0 }, +/* 4 L+EN/AN */ { s(2,2), 0 , 4 , 4 , 3 , 0 , 0 , 1 } }; static const ImpTabPair impTab_GROUP_NUMBERS_WITH_R = { {&impTabL_GROUP_NUMBERS_WITH_R, @@ -1022,11 +1021,11 @@ static const ImpTab impTabL_INVERSE_NUMBERS_AS_L = { /* L , R , EN , AN , ON , S , B , Res */ /* 0 : init */ { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 }, -/* 1 : R */ { 0 , 1 , 0 , 0 , _(1,4), _(1,4), 0 , 1 }, -/* 2 : AN */ { 0 , 1 , 0 , 0 , _(1,5), _(1,5), 0 , 2 }, -/* 3 : R+EN/AN */ { 0 , 1 , 0 , 0 , _(1,4), _(1,4), 0 , 2 }, -/* 4 : R+ON */ { _(2,0), 1 , _(2,0), _(2,0), 4 , 4 , _(2,0), 1 }, -/* 5 : AN+ON */ { _(2,0), 1 , _(2,0), _(2,0), 5 , 5 , _(2,0), 1 } +/* 1 : R */ { 0 , 1 , 0 , 0 , s(1,4), s(1,4), 0 , 1 }, +/* 2 : AN */ { 0 , 1 , 0 , 0 , s(1,5), s(1,5), 0 , 2 }, +/* 3 : R+EN/AN */ { 0 , 1 , 0 , 0 , s(1,4), s(1,4), 0 , 2 }, +/* 4 : R+ON */ { s(2,0), 1 , s(2,0), s(2,0), 4 , 4 , s(2,0), 1 }, +/* 5 : AN+ON */ { s(2,0), 1 , s(2,0), s(2,0), 5 , 5 , s(2,0), 1 } }; static const ImpTab impTabR_INVERSE_NUMBERS_AS_L = /* This table is identical to the Default RTL table except that EN and AN are @@ -1035,10 +1034,10 @@ static const ImpTab impTabR_INVERSE_NUMBERS_AS_L = { /* L , R , EN , AN , ON , S , B , Res */ /* 0 : init */ { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 }, -/* 1 : L */ { 1 , 0 , 1 , 1 , _(1,4), _(1,4), 0 , 1 }, +/* 1 : L */ { 1 , 0 , 1 , 1 , s(1,4), s(1,4), 0 , 1 }, /* 2 : EN/AN */ { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 1 }, /* 3 : L+AN */ { 1 , 0 , 1 , 1 , 5 , 5 , 0 , 1 }, -/* 4 : L+ON */ { _(2,1), 0 , _(2,1), _(2,1), 4 , 4 , 0 , 0 }, +/* 4 : L+ON */ { s(2,1), 0 , s(2,1), s(2,1), 4 , 4 , 0 , 0 }, /* 5 : L+AN+ON */ { 1 , 0 , 1 , 1 , 5 , 5 , 0 , 0 } }; static const ImpTabPair impTab_INVERSE_NUMBERS_AS_L = { @@ -1053,12 +1052,12 @@ static const ImpTab impTabR_INVERSE_LIKE_DIRECT = /* Odd paragraph level */ { /* L , R , EN , AN , ON , S , B , Res */ /* 0 : init */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 0 }, -/* 1 : L */ { 1 , 0 , 1 , 2 , _(1,3), _(1,3), 0 , 1 }, +/* 1 : L */ { 1 , 0 , 1 , 2 , s(1,3), s(1,3), 0 , 1 }, /* 2 : EN/AN */ { 1 , 0 , 2 , 2 , 0 , 0 , 0 , 1 }, -/* 3 : L+ON */ { _(2,1), _(3,0), 6 , 4 , 3 , 3 , _(3,0), 0 }, -/* 4 : L+ON+AN */ { _(2,1), _(3,0), 6 , 4 , 5 , 5 , _(3,0), 3 }, -/* 5 : L+AN+ON */ { _(2,1), _(3,0), 6 , 4 , 5 , 5 , _(3,0), 2 }, -/* 6 : L+ON+EN */ { _(2,1), _(3,0), 6 , 4 , 3 , 3 , _(3,0), 1 } +/* 3 : L+ON */ { s(2,1), s(3,0), 6 , 4 , 3 , 3 , s(3,0), 0 }, +/* 4 : L+ON+AN */ { s(2,1), s(3,0), 6 , 4 , 5 , 5 , s(3,0), 3 }, +/* 5 : L+AN+ON */ { s(2,1), s(3,0), 6 , 4 , 5 , 5 , s(3,0), 2 }, +/* 6 : L+ON+EN */ { s(2,1), s(3,0), 6 , 4 , 3 , 3 , s(3,0), 1 } }; static const ImpAct impAct1 = {0,1,11,12}; /* FOOD FOR THOUGHT: in LTR table below, check case "JKL 123abc" @@ -1073,13 +1072,13 @@ static const ImpTab impTabL_INVERSE_LIKE_DIRECT_WITH_MARKS = */ { /* L , R , EN , AN , ON , S , B , Res */ -/* 0 : init */ { 0 , _(6,3), 0 , 1 , 0 , 0 , 0 , 0 }, -/* 1 : L+AN */ { 0 , _(6,3), 0 , 1 , _(1,2), _(3,0), 0 , 4 }, -/* 2 : L+AN+ON */ { _(2,0), _(6,3), _(2,0), 1 , 2 , _(3,0), _(2,0), 3 }, -/* 3 : R */ { 0 , _(6,3), _(5,5), _(5,6), _(1,4), _(3,0), 0 , 3 }, -/* 4 : R+ON */ { _(3,0), _(4,3), _(5,5), _(5,6), 4 , _(3,0), _(3,0), 3 }, -/* 5 : R+EN */ { _(3,0), _(4,3), 5 , _(5,6), _(1,4), _(3,0), _(3,0), 4 }, -/* 6 : R+AN */ { _(3,0), _(4,3), _(5,5), 6 , _(1,4), _(3,0), _(3,0), 4 } +/* 0 : init */ { 0 , s(6,3), 0 , 1 , 0 , 0 , 0 , 0 }, +/* 1 : L+AN */ { 0 , s(6,3), 0 , 1 , s(1,2), s(3,0), 0 , 4 }, +/* 2 : L+AN+ON */ { s(2,0), s(6,3), s(2,0), 1 , 2 , s(3,0), s(2,0), 3 }, +/* 3 : R */ { 0 , s(6,3), s(5,5), s(5,6), s(1,4), s(3,0), 0 , 3 }, +/* 4 : R+ON */ { s(3,0), s(4,3), s(5,5), s(5,6), 4 , s(3,0), s(3,0), 3 }, +/* 5 : R+EN */ { s(3,0), s(4,3), 5 , s(5,6), s(1,4), s(3,0), s(3,0), 4 }, +/* 6 : R+AN */ { s(3,0), s(4,3), s(5,5), 6 , s(1,4), s(3,0), s(3,0), 4 } }; static const ImpTab impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS = /* The cases handled in this table are (visually): R EN L @@ -1087,13 +1086,13 @@ static const ImpTab impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS = */ { /* L , R , EN , AN , ON , S , B , Res */ -/* 0 : init */ { _(1,3), 0 , 1 , 1 , 0 , 0 , 0 , 0 }, -/* 1 : R+EN/AN */ { _(2,3), 0 , 1 , 1 , 2 , _(4,0), 0 , 1 }, -/* 2 : R+EN/AN+ON */ { _(2,3), 0 , 1 , 1 , 2 , _(4,0), 0 , 0 }, -/* 3 : L */ { 3 , 0 , 3 , _(3,6), _(1,4), _(4,0), 0 , 1 }, -/* 4 : L+ON */ { _(5,3), _(4,0), 5 , _(3,6), 4 , _(4,0), _(4,0), 0 }, -/* 5 : L+ON+EN */ { _(5,3), _(4,0), 5 , _(3,6), 4 , _(4,0), _(4,0), 1 }, -/* 6 : L+AN */ { _(5,3), _(4,0), 6 , 6 , 4 , _(4,0), _(4,0), 3 } +/* 0 : init */ { s(1,3), 0 , 1 , 1 , 0 , 0 , 0 , 0 }, +/* 1 : R+EN/AN */ { s(2,3), 0 , 1 , 1 , 2 , s(4,0), 0 , 1 }, +/* 2 : R+EN/AN+ON */ { s(2,3), 0 , 1 , 1 , 2 , s(4,0), 0 , 0 }, +/* 3 : L */ { 3 , 0 , 3 , s(3,6), s(1,4), s(4,0), 0 , 1 }, +/* 4 : L+ON */ { s(5,3), s(4,0), 5 , s(3,6), 4 , s(4,0), s(4,0), 0 }, +/* 5 : L+ON+EN */ { s(5,3), s(4,0), 5 , s(3,6), 4 , s(4,0), s(4,0), 1 }, +/* 6 : L+AN */ { s(5,3), s(4,0), 6 , 6 , 4 , s(4,0), s(4,0), 3 } }; static const ImpAct impAct2 = {0,1,7,8,9,10}; static const ImpTabPair impTab_INVERSE_LIKE_DIRECT_WITH_MARKS = { @@ -1111,18 +1110,18 @@ static const ImpTab impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS = */ { /* L , R , EN , AN , ON , S , B , Res */ -/* 0 : init */ { 0 , _(6,2), 1 , 1 , 0 , 0 , 0 , 0 }, -/* 1 : L+EN/AN */ { 0 , _(6,2), 1 , 1 , 0 , _(3,0), 0 , 4 }, -/* 2 : R */ { 0 , _(6,2), _(5,4), _(5,4), _(1,3), _(3,0), 0 , 3 }, -/* 3 : R+ON */ { _(3,0), _(4,2), _(5,4), _(5,4), 3 , _(3,0), _(3,0), 3 }, -/* 4 : R+EN/AN */ { _(3,0), _(4,2), 4 , 4 , _(1,3), _(3,0), _(3,0), 4 } +/* 0 : init */ { 0 , s(6,2), 1 , 1 , 0 , 0 , 0 , 0 }, +/* 1 : L+EN/AN */ { 0 , s(6,2), 1 , 1 , 0 , s(3,0), 0 , 4 }, +/* 2 : R */ { 0 , s(6,2), s(5,4), s(5,4), s(1,3), s(3,0), 0 , 3 }, +/* 3 : R+ON */ { s(3,0), s(4,2), s(5,4), s(5,4), 3 , s(3,0), s(3,0), 3 }, +/* 4 : R+EN/AN */ { s(3,0), s(4,2), 4 , 4 , s(1,3), s(3,0), s(3,0), 4 } }; static const ImpTabPair impTab_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS = { {&impTabL_INVERSE_FOR_NUMBERS_SPECIAL_WITH_MARKS, &impTabR_INVERSE_LIKE_DIRECT_WITH_MARKS}, {&impAct0, &impAct2}}; -#undef _ +#undef s typedef struct { const ImpTab * pImpTab; /* level table pointer */ @@ -1414,8 +1413,8 @@ resolveImplicitLevels(UBiDi *pBiDi, levState.lastStrongRTL=-1; /* used for INVERSE_LIKE_DIRECT_WITH_MARKS */ levState.state=0; levState.runLevel=pBiDi->levels[start]; - levState.pImpTab=((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1]; - levState.pImpAct=((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1]; + levState.pImpTab=(const ImpTab*)((pBiDi->pImpTabPair)->pImpTab)[levState.runLevel&1]; + levState.pImpAct=(const ImpAct*)((pBiDi->pImpTabPair)->pImpAct)[levState.runLevel&1]; processPropertySeq(pBiDi, &levState, sor, start, start); /* initialize for property state table */ if(dirProps[start]==NSM) {