// © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ****************************************************************************** * * Copyright (C) 1999-2016, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** * file name: ubidiimp.h * encoding: UTF-8 * tab size: 8 (not used) * indentation:4 * * created on: 1999aug06 * created by: Markus W. Scherer, updated by Matitiahu Allouche */ #ifndef UBIDIIMP_H #define UBIDIIMP_H #include "unicode/utypes.h" #include "unicode/ubidi.h" #include "unicode/uchar.h" #include "ubidi_props.h" /* miscellaneous definitions ---------------------------------------------- */ // ICU-20853=ICU-20935 Solaris #defines CS and ES in sys/regset.h #ifdef CS # undef CS #endif #ifdef ES # undef ES #endif DirProp; Flags; /* Comparing the description of the BiDi algorithm with this implementation is easier with the same names for the BiDi types in the code as there. See UCharDirection in uchar.h . */ enum { … }; /* Sometimes, bit values are more appropriate to deal with directionality properties. Abbreviations in these macro names refer to names used in the BiDi algorithm. */ #define DIRPROP_FLAG(dir) … #define PURE_DIRPROP(prop) … /* special flag for multiple runs from explicit embedding codes */ #define DIRPROP_FLAG_MULTI_RUNS … /* are there any characters that are LTR or RTL? */ #define MASK_LTR … #define MASK_RTL … #define MASK_R_AL … #define MASK_STRONG_EN_AN … /* explicit embedding codes */ #define MASK_EXPLICIT … /* explicit isolate codes */ #define MASK_ISO … #define MASK_BN_EXPLICIT … /* paragraph and segment separators */ #define MASK_B_S … /* all types that are counted as White Space or Neutral in some steps */ #define MASK_WS … /* types that are neutrals or could becomes neutrals in (Wn) */ #define MASK_POSSIBLE_N … /* * These types may be changed to "e", * the embedding type (L or R) of the run, * in the BiDi algorithm (N2) */ #define MASK_EMBEDDING … /* the dirProp's L and R are defined to 0 and 1 values in UCharDirection */ #define GET_LR_FROM_LEVEL(level) … #define IS_DEFAULT_LEVEL(level) … /* * The following bit is used for the directional isolate status. * Stack entries corresponding to isolate sequences are greater than ISOLATE. */ #define ISOLATE … U_CFUNC UBiDiLevel ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t index); #define GET_PARALEVEL(ubidi, index) … /* number of paras entries allocated initially without malloc */ #define SIMPLE_PARAS_COUNT … /* number of isolate entries allocated initially without malloc */ #define SIMPLE_ISOLATES_COUNT … /* number of isolate run entries for paired brackets allocated initially without malloc */ #define SIMPLE_OPENINGS_COUNT … #define CR … #define LF … /* Run structure for reordering --------------------------------------------- */ enum { … }; Para; enum { … }; Opening; IsoRun; BracketData; Isolate; Run; /* in a Run, logicalStart will get this bit set if the run level is odd */ #define INDEX_ODD_BIT … #define MAKE_INDEX_ODD_PAIR(index, level) … #define ADD_ODD_BIT_FROM_LEVEL(x, level) … #define REMOVE_ODD_BIT(x) … #define GET_INDEX(x) … #define GET_ODD_BIT(x) … #define IS_ODD_RUN(x) … #define IS_EVEN_RUN(x) … U_CFUNC UBool ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode); /** BiDi control code points */ enum { … }; #define IS_BIDI_CONTROL_CHAR(c) … /* InsertPoints structure for noting where to put BiDi marks ---------------- */ Point; InsertPoints; /* UBiDi structure ----------------------------------------------------------- */ struct UBiDi { … }; #define IS_VALID_PARA(x) … #define IS_VALID_PARA_OR_LINE(x) … BidiMemoryForAllocation; /* Macros for initial checks at function entry */ #define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) … #define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) … #define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) … #define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) … #define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) … #define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) … #define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) … #define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) … /* helper function to (re)allocate memory if allowed */ U_CFUNC UBool ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded); /* helper macros for each allocated array in UBiDi */ #define getDirPropsMemory(pBiDi, length) … #define getLevelsMemory(pBiDi, length) … #define getRunsMemory(pBiDi, length) … /* additional macros used by ubidi_open() - always allow allocation */ #define getInitialDirPropsMemory(pBiDi, length) … #define getInitialLevelsMemory(pBiDi, length) … #define getInitialOpeningsMemory(pBiDi, length) … #define getInitialParasMemory(pBiDi, length) … #define getInitialRunsMemory(pBiDi, length) … #define getInitialIsolatesMemory(pBiDi, length) … #endif