]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/ubidiimp.h
ICU-66108.tar.gz
[apple/icu.git] / icuSources / common / ubidiimp.h
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
73c04bcf 3/*
b75a7d8f
A
4******************************************************************************
5*
2ca993e8 6* Copyright (C) 1999-2016, International Business Machines
b75a7d8f
A
7* Corporation and others. All Rights Reserved.
8*
9******************************************************************************
10* file name: ubidiimp.h
f3c0d7a5 11* encoding: UTF-8
b75a7d8f
A
12* tab size: 8 (not used)
13* indentation:4
14*
15* created on: 1999aug06
46f4442e 16* created by: Markus W. Scherer, updated by Matitiahu Allouche
b75a7d8f
A
17*/
18
19#ifndef UBIDIIMP_H
20#define UBIDIIMP_H
21
b75a7d8f 22#include "unicode/utypes.h"
2ca993e8 23#include "unicode/ubidi.h"
b75a7d8f 24#include "unicode/uchar.h"
73c04bcf 25#include "ubidi_props.h"
b75a7d8f
A
26
27/* miscellaneous definitions ---------------------------------------------- */
28
29typedef uint8_t DirProp;
30typedef uint32_t Flags;
31
32/* Comparing the description of the BiDi algorithm with this implementation
33 is easier with the same names for the BiDi types in the code as there.
34 See UCharDirection in uchar.h .
35*/
73c04bcf 36enum {
57a6839d
A
37 L= U_LEFT_TO_RIGHT, /* 0 */
38 R= U_RIGHT_TO_LEFT, /* 1 */
39 EN= U_EUROPEAN_NUMBER, /* 2 */
40 ES= U_EUROPEAN_NUMBER_SEPARATOR, /* 3 */
41 ET= U_EUROPEAN_NUMBER_TERMINATOR, /* 4 */
42 AN= U_ARABIC_NUMBER, /* 5 */
43 CS= U_COMMON_NUMBER_SEPARATOR, /* 6 */
44 B= U_BLOCK_SEPARATOR, /* 7 */
45 S= U_SEGMENT_SEPARATOR, /* 8 */
46 WS= U_WHITE_SPACE_NEUTRAL, /* 9 */
47 ON= U_OTHER_NEUTRAL, /* 10 */
48 LRE=U_LEFT_TO_RIGHT_EMBEDDING, /* 11 */
49 LRO=U_LEFT_TO_RIGHT_OVERRIDE, /* 12 */
50 AL= U_RIGHT_TO_LEFT_ARABIC, /* 13 */
51 RLE=U_RIGHT_TO_LEFT_EMBEDDING, /* 14 */
52 RLO=U_RIGHT_TO_LEFT_OVERRIDE, /* 15 */
53 PDF=U_POP_DIRECTIONAL_FORMAT, /* 16 */
54 NSM=U_DIR_NON_SPACING_MARK, /* 17 */
55 BN= U_BOUNDARY_NEUTRAL, /* 18 */
56 FSI=U_FIRST_STRONG_ISOLATE, /* 19 */
57 LRI=U_LEFT_TO_RIGHT_ISOLATE, /* 20 */
58 RLI=U_RIGHT_TO_LEFT_ISOLATE, /* 21 */
59 PDI=U_POP_DIRECTIONAL_ISOLATE, /* 22 */
60 ENL, /* EN after W7 */ /* 23 */
61 ENR, /* EN not subject to W7 */ /* 24 */
b75a7d8f
A
62 dirPropCount
63};
64
57a6839d
A
65/* Sometimes, bit values are more appropriate
66 to deal with directionality properties.
67 Abbreviations in these macro names refer to names
68 used in the BiDi algorithm.
69*/
b75a7d8f 70#define DIRPROP_FLAG(dir) (1UL<<(dir))
57a6839d 71#define PURE_DIRPROP(prop) ((prop)&~0xE0) ?????????????????????????
b75a7d8f
A
72
73/* special flag for multiple runs from explicit embedding codes */
74#define DIRPROP_FLAG_MULTI_RUNS (1UL<<31)
75
76/* are there any characters that are LTR or RTL? */
57a6839d
A
77#define MASK_LTR (DIRPROP_FLAG(L)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(ENL)|DIRPROP_FLAG(ENR)|DIRPROP_FLAG(AN)|DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO)|DIRPROP_FLAG(LRI))
78#define MASK_RTL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO)|DIRPROP_FLAG(RLI))
46f4442e 79#define MASK_R_AL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL))
57a6839d 80#define MASK_STRONG_EN_AN (DIRPROP_FLAG(L)|DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(AN))
b75a7d8f
A
81
82/* explicit embedding codes */
57a6839d
A
83#define MASK_EXPLICIT (DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO)|DIRPROP_FLAG(PDF))
84
85/* explicit isolate codes */
86#define MASK_ISO (DIRPROP_FLAG(LRI)|DIRPROP_FLAG(RLI)|DIRPROP_FLAG(FSI)|DIRPROP_FLAG(PDI))
b75a7d8f 87
b75a7d8f
A
88#define MASK_BN_EXPLICIT (DIRPROP_FLAG(BN)|MASK_EXPLICIT)
89
90/* paragraph and segment separators */
91#define MASK_B_S (DIRPROP_FLAG(B)|DIRPROP_FLAG(S))
92
93/* all types that are counted as White Space or Neutral in some steps */
57a6839d 94#define MASK_WS (MASK_B_S|DIRPROP_FLAG(WS)|MASK_BN_EXPLICIT|MASK_ISO)
b75a7d8f
A
95
96/* types that are neutrals or could becomes neutrals in (Wn) */
57a6839d 97#define MASK_POSSIBLE_N (DIRPROP_FLAG(ON)|DIRPROP_FLAG(CS)|DIRPROP_FLAG(ES)|DIRPROP_FLAG(ET)|MASK_WS)
b75a7d8f
A
98
99/*
57a6839d
A
100 * These types may be changed to "e",
101 * the embedding type (L or R) of the run,
102 * in the BiDi algorithm (N2)
b75a7d8f
A
103 */
104#define MASK_EMBEDDING (DIRPROP_FLAG(NSM)|MASK_POSSIBLE_N)
105
106/* the dirProp's L and R are defined to 0 and 1 values in UCharDirection */
107#define GET_LR_FROM_LEVEL(level) ((DirProp)((level)&1))
108
73c04bcf
A
109#define IS_DEFAULT_LEVEL(level) ((level)>=0xfe)
110
111/*
57a6839d
A
112 * The following bit is used for the directional isolate status.
113 * Stack entries corresponding to isolate sequences are greater than ISOLATE.
73c04bcf 114 */
57a6839d
A
115#define ISOLATE 0x0100
116
117U_CFUNC UBiDiLevel
118ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t index);
73c04bcf
A
119
120#define GET_PARALEVEL(ubidi, index) \
57a6839d
A
121 ((UBiDiLevel)(!(ubidi)->defaultParaLevel || (index)<(ubidi)->paras[0].limit ? \
122 (ubidi)->paraLevel : ubidi_getParaLevelAtIndex((ubidi), (index))))
73c04bcf 123
57a6839d 124/* number of paras entries allocated initially without malloc */
b331163b 125#define SIMPLE_PARAS_COUNT 10
57a6839d 126/* number of isolate entries allocated initially without malloc */
b331163b 127#define SIMPLE_ISOLATES_COUNT 5
57a6839d 128/* number of isolate run entries for paired brackets allocated initially without malloc */
b331163b 129#define SIMPLE_OPENINGS_COUNT 20
73c04bcf
A
130
131#define CR 0x000D
132#define LF 0x000A
b75a7d8f
A
133
134/* Run structure for reordering --------------------------------------------- */
73c04bcf
A
135enum {
136 LRM_BEFORE=1,
137 LRM_AFTER=2,
138 RLM_BEFORE=4,
139 RLM_AFTER=8
140};
b75a7d8f 141
57a6839d
A
142typedef struct Para {
143 int32_t limit;
144 int32_t level;
145} Para;
146
147enum { /* flags for Opening.flags */
148 FOUND_L=DIRPROP_FLAG(L),
149 FOUND_R=DIRPROP_FLAG(R)
150};
151
152typedef struct Opening {
153 int32_t position; /* position of opening bracket */
154 int32_t match; /* matching char or -position of closing bracket */
155 int32_t contextPos; /* position of last strong char found before opening */
156 uint16_t flags; /* bits for L or R/AL found within the pair */
157 UBiDiDirection contextDir; /* L or R according to last strong char before opening */
158 uint8_t filler; /* to complete a nice multiple of 4 chars */
159} Opening;
160
161typedef struct IsoRun {
162 int32_t contextPos; /* position of char determining context */
163 uint16_t start; /* index of first opening entry for this run */
164 uint16_t limit; /* index after last opening entry for this run */
165 UBiDiLevel level; /* level of this run */
166 DirProp lastStrong; /* bidi class of last strong char found in this run */
167 DirProp lastBase; /* bidi class of last base char found in this run */
168 UBiDiDirection contextDir; /* L or R to use as context for following openings */
169} IsoRun;
170
171typedef struct BracketData {
172 UBiDi *pBiDi;
173 /* array of opening entries which should be enough in most cases; no malloc() */
b331163b 174 Opening simpleOpenings[SIMPLE_OPENINGS_COUNT];
57a6839d 175 Opening *openings; /* pointer to current array of entries */
b331163b 176 int32_t openingsCount; /* number of allocated entries */
57a6839d
A
177 int32_t isoRunLast; /* index of last used entry */
178 /* array of nested isolated sequence entries; can never excess UBIDI_MAX_EXPLICIT_LEVEL
179 + 1 for index 0, + 1 for before the first isolated sequence */
180 IsoRun isoRuns[UBIDI_MAX_EXPLICIT_LEVEL+2];
181 UBool isNumbersSpecial; /* reordering mode for NUMBERS_SPECIAL */
182} BracketData;
183
184typedef struct Isolate {
185 int32_t startON;
186 int32_t start1;
b331163b 187 int32_t state;
57a6839d 188 int16_t stateImp;
57a6839d
A
189} Isolate;
190
b75a7d8f
A
191typedef struct Run {
192 int32_t logicalStart, /* first character of the run; b31 indicates even/odd level */
73c04bcf
A
193 visualLimit, /* last visual position of the run +1 */
194 insertRemove; /* if >0, flags for inserting LRM/RLM before/after run,
195 if <0, count of bidi controls within run */
b75a7d8f
A
196} Run;
197
198/* in a Run, logicalStart will get this bit set if the run level is odd */
199#define INDEX_ODD_BIT (1UL<<31)
200
340931cb
A
201#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)((level)&1)<<31))
202#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)((level)&1)<<31))
b75a7d8f
A
203#define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT)
204
73c04bcf
A
205#define GET_INDEX(x) ((x)&~INDEX_ODD_BIT)
206#define GET_ODD_BIT(x) ((uint32_t)(x)>>31)
46f4442e
A
207#define IS_ODD_RUN(x) ((UBool)(((x)&INDEX_ODD_BIT)!=0))
208#define IS_EVEN_RUN(x) ((UBool)(((x)&INDEX_ODD_BIT)==0))
b75a7d8f
A
209
210U_CFUNC UBool
46f4442e 211ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
b75a7d8f 212
73c04bcf
A
213/** BiDi control code points */
214enum {
215 ZWNJ_CHAR=0x200c,
216 ZWJ_CHAR,
217 LRM_CHAR,
218 RLM_CHAR,
219 LRE_CHAR=0x202a,
220 RLE_CHAR,
221 PDF_CHAR,
222 LRO_CHAR,
57a6839d
A
223 RLO_CHAR,
224 LRI_CHAR=0x2066,
225 RLI_CHAR,
226 FSI_CHAR,
227 PDI_CHAR
73c04bcf
A
228};
229
57a6839d 230#define IS_BIDI_CONTROL_CHAR(c) (((uint32_t)(c)&0xfffffffc)==ZWNJ_CHAR || (uint32_t)((c)-LRE_CHAR)<5 || (uint32_t)((c)-LRI_CHAR)<4)
73c04bcf
A
231
232/* InsertPoints structure for noting where to put BiDi marks ---------------- */
233
234typedef struct Point {
235 int32_t pos; /* position in text */
236 int32_t flag; /* flag for LRM/RLM, before/after */
237} Point;
238
239typedef struct InsertPoints {
240 int32_t capacity; /* number of points allocated */
241 int32_t size; /* number of points used */
242 int32_t confirmed; /* number of points confirmed */
243 UErrorCode errorCode; /* for eventual memory shortage */
244 Point *points; /* pointer to array of points */
245} InsertPoints;
246
247
b75a7d8f
A
248/* UBiDi structure ----------------------------------------------------------- */
249
250struct UBiDi {
73c04bcf
A
251 /* pointer to parent paragraph object (pointer to self if this object is
252 * a paragraph object); set to NULL in a newly opened object; set to a
253 * real value after a successful execution of ubidi_setPara or ubidi_setLine
254 */
255 const UBiDi * pParaBiDi;
256
b75a7d8f
A
257 /* alias pointer to the current text */
258 const UChar *text;
259
260 /* length of the current text */
73c04bcf
A
261 int32_t originalLength;
262
263 /* if the UBIDI_OPTION_STREAMING option is set, this is the length
264 * of text actually processed by ubidi_setPara, which may be shorter than
265 * the original length.
266 * Otherwise, it is identical to the original length.
267 */
b75a7d8f
A
268 int32_t length;
269
73c04bcf
A
270 /* if the UBIDI_OPTION_REMOVE_CONTROLS option is set, and/or
271 * marks are allowed to be inserted in one of the reordering mode, the
272 * length of the result string may be different from the processed length.
273 */
274 int32_t resultLength;
275
b75a7d8f 276 /* memory sizes in bytes */
2ca993e8 277 int32_t dirInsertSize, dirPropsSize, levelsSize, openingsSize, parasSize, runsSize, isolatesSize;
b75a7d8f
A
278
279 /* allocated memory */
2ca993e8 280 uint16_t *dirInsertMemory;
b75a7d8f
A
281 DirProp *dirPropsMemory;
282 UBiDiLevel *levelsMemory;
57a6839d 283 Opening *openingsMemory;
73c04bcf 284 Para *parasMemory;
b75a7d8f 285 Run *runsMemory;
57a6839d 286 Isolate *isolatesMemory;
b75a7d8f
A
287
288 /* indicators for whether memory may be allocated after ubidi_open() */
289 UBool mayAllocateText, mayAllocateRuns;
290
291 /* arrays with one value per text-character */
2ca993e8 292 uint16_t *dirInsert;
57a6839d 293 DirProp *dirProps;
b75a7d8f
A
294 UBiDiLevel *levels;
295
296 /* are we performing an approximation of the "inverse BiDi" algorithm? */
297 UBool isInverse;
298
73c04bcf
A
299 /* are we using the basic algorithm or its variation? */
300 UBiDiReorderingMode reorderingMode;
301
302 /* UBIDI_REORDER_xxx values must be ordered so that all the regular
303 * logical to visual modes come first, and all inverse BiDi modes
304 * come last.
305 */
306 #define UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL UBIDI_REORDER_NUMBERS_SPECIAL
307
308 /* bitmask for reordering options */
309 uint32_t reorderingOptions;
310
311 /* must block separators receive level 0? */
312 UBool orderParagraphsLTR;
313
b75a7d8f
A
314 /* the paragraph level */
315 UBiDiLevel paraLevel;
73c04bcf
A
316 /* original paraLevel when contextual */
317 /* must be one of UBIDI_DEFAULT_xxx or 0 if not contextual */
318 UBiDiLevel defaultParaLevel;
319
4388f060
A
320 /* context data */
321 const UChar *prologue;
322 int32_t proLength;
323 const UChar *epilogue;
324 int32_t epiLength;
325
73c04bcf
A
326 /* the following is set in ubidi_setPara, used in processPropertySeq */
327 const struct ImpTabPair * pImpTabPair; /* pointer to levels state table pair */
b75a7d8f
A
328
329 /* the overall paragraph or line directionality - see UBiDiDirection */
330 UBiDiDirection direction;
331
332 /* flags is a bit set for which directional properties are in the text */
333 Flags flags;
334
73c04bcf
A
335 /* lastArabicPos is index to the last AL in the text, -1 if none */
336 int32_t lastArabicPos;
337
b75a7d8f
A
338 /* characters after trailingWSStart are WS and are */
339 /* implicitly at the paraLevel (rule (L1)) - levels may not reflect that */
340 int32_t trailingWSStart;
341
73c04bcf
A
342 /* fields for paragraph handling */
343 int32_t paraCount; /* set in getDirProps() */
57a6839d
A
344 /* filled in getDirProps() */
345 Para *paras;
73c04bcf 346
57a6839d 347 /* for relatively short text, we only need a tiny array of paras (no malloc()) */
b331163b 348 Para simpleParas[SIMPLE_PARAS_COUNT];
73c04bcf 349
b75a7d8f
A
350 /* fields for line reordering */
351 int32_t runCount; /* ==-1: runs not set up yet */
352 Run *runs;
353
354 /* for non-mixed text, we only need a tiny array of runs (no malloc()) */
355 Run simpleRuns[1];
73c04bcf 356
57a6839d
A
357 /* maximum or current nesting depth of isolate sequences */
358 /* Within resolveExplicitLevels() and checkExplicitLevels(), this is the maximal
359 nesting encountered.
360 Within resolveImplicitLevels(), this is the index of the current isolates
361 stack entry. */
362 int32_t isolateCount;
363 Isolate *isolates;
364
365 /* for simple text, have a small stack (no malloc()) */
b331163b 366 Isolate simpleIsolates[SIMPLE_ISOLATES_COUNT];
57a6839d 367
73c04bcf
A
368 /* for inverse Bidi with insertion of directional marks */
369 InsertPoints insertPoints;
370
371 /* for option UBIDI_OPTION_REMOVE_CONTROLS */
372 int32_t controlCount;
373
374 /* for Bidi class callback */
375 UBiDiClassCallback *fnClassCallback; /* action pointer */
376 const void *coClassCallback; /* context pointer */
b75a7d8f
A
377};
378
73c04bcf 379#define IS_VALID_PARA(x) ((x) && ((x)->pParaBiDi==(x)))
73c04bcf
A
380#define IS_VALID_PARA_OR_LINE(x) ((x) && ((x)->pParaBiDi==(x) || (((x)->pParaBiDi) && (x)->pParaBiDi->pParaBiDi==(x)->pParaBiDi)))
381
46f4442e 382typedef union {
2ca993e8 383 uint16_t *dirInsertMemory;
46f4442e
A
384 DirProp *dirPropsMemory;
385 UBiDiLevel *levelsMemory;
57a6839d 386 Opening *openingsMemory;
46f4442e
A
387 Para *parasMemory;
388 Run *runsMemory;
57a6839d 389 Isolate *isolatesMemory;
46f4442e
A
390} BidiMemoryForAllocation;
391
392/* Macros for initial checks at function entry */
340931cb
A
393#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
394 if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue; \
395} UPRV_BLOCK_MACRO_END
396#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
397 if(!IS_VALID_PARA(bidi)) { \
398 errcode=U_INVALID_STATE_ERROR; \
399 return retvalue; \
400 } \
401} UPRV_BLOCK_MACRO_END
402#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
403 if(!IS_VALID_PARA_OR_LINE(bidi)) { \
404 errcode=U_INVALID_STATE_ERROR; \
405 return retvalue; \
406 } \
407} UPRV_BLOCK_MACRO_END
408#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
409 if((arg)<(start) || (arg)>=(limit)) { \
410 (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
411 return retvalue; \
412 } \
413} UPRV_BLOCK_MACRO_END
414
415#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) UPRV_BLOCK_MACRO_BEGIN { \
416 if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return; \
417} UPRV_BLOCK_MACRO_END
418#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
419 if(!IS_VALID_PARA(bidi)) { \
420 errcode=U_INVALID_STATE_ERROR; \
421 return; \
422 } \
423} UPRV_BLOCK_MACRO_END
424#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
425 if(!IS_VALID_PARA_OR_LINE(bidi)) { \
426 errcode=U_INVALID_STATE_ERROR; \
427 return; \
428 } \
429} UPRV_BLOCK_MACRO_END
430#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) UPRV_BLOCK_MACRO_BEGIN { \
431 if((arg)<(start) || (arg)>=(limit)) { \
432 (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
433 return; \
434 } \
435} UPRV_BLOCK_MACRO_END
46f4442e 436
b75a7d8f
A
437/* helper function to (re)allocate memory if allowed */
438U_CFUNC UBool
46f4442e 439ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded);
b75a7d8f
A
440
441/* helper macros for each allocated array in UBiDi */
2ca993e8
A
442#define getDirInsertMemory(pBiDi, length) \
443 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirInsertMemory, &(pBiDi)->dirInsertSize, \
444 (pBiDi)->mayAllocateText, (length)*sizeof(uint16_t))
445
b75a7d8f 446#define getDirPropsMemory(pBiDi, length) \
46f4442e 447 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
b75a7d8f
A
448 (pBiDi)->mayAllocateText, (length))
449
450#define getLevelsMemory(pBiDi, length) \
46f4442e 451 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
b75a7d8f
A
452 (pBiDi)->mayAllocateText, (length))
453
454#define getRunsMemory(pBiDi, length) \
46f4442e 455 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
b75a7d8f
A
456 (pBiDi)->mayAllocateRuns, (length)*sizeof(Run))
457
458/* additional macros used by ubidi_open() - always allow allocation */
2ca993e8
A
459#define getInitialDirInsertMemory(pBiDi, length) \
460 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirInsertMemory, &(pBiDi)->dirInsertSize, \
461 TRUE, (length))
462
b75a7d8f 463#define getInitialDirPropsMemory(pBiDi, length) \
46f4442e 464 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
b75a7d8f
A
465 TRUE, (length))
466
467#define getInitialLevelsMemory(pBiDi, length) \
46f4442e 468 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
b75a7d8f
A
469 TRUE, (length))
470
57a6839d
A
471#define getInitialOpeningsMemory(pBiDi, length) \
472 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->openingsMemory, &(pBiDi)->openingsSize, \
473 TRUE, (length)*sizeof(Opening))
474
73c04bcf 475#define getInitialParasMemory(pBiDi, length) \
46f4442e 476 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->parasMemory, &(pBiDi)->parasSize, \
73c04bcf
A
477 TRUE, (length)*sizeof(Para))
478
b75a7d8f 479#define getInitialRunsMemory(pBiDi, length) \
46f4442e 480 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
b75a7d8f
A
481 TRUE, (length)*sizeof(Run))
482
57a6839d
A
483#define getInitialIsolatesMemory(pBiDi, length) \
484 ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->isolatesMemory, &(pBiDi)->isolatesSize, \
485 TRUE, (length)*sizeof(Isolate))
486
b75a7d8f 487#endif