57#define ASSERT(x) do { if (!(x)) FIXME("assert failed: %s\n", #x); } while(0)
60#define odd(x) ((x) & 1)
187#define push_stack(l,o,i) \
189 stack[stack_top].level = l; \
190 stack[stack_top].override = o; \
191 stack[stack_top].isolate = i;} while(0)
193#define pop_stack() do { stack_top++; } while(0)
195#define valid_level(x) (x <= MAX_DEPTH && overflow_isolate_count == 0 && overflow_embedding_count == 0)
200 int overflow_isolate_count = 0;
201 int overflow_embedding_count = 0;
202 int valid_isolate_count = 0;
215 UINT8 least_odd, least_even;
217 switch (
c->bidi_class)
226 else if (overflow_isolate_count == 0)
227 overflow_embedding_count++;
236 else if (overflow_isolate_count == 0)
237 overflow_embedding_count++;
246 else if (overflow_isolate_count == 0)
247 overflow_embedding_count++;
256 else if (overflow_isolate_count == 0)
257 overflow_embedding_count++;
266 valid_isolate_count++;
270 overflow_isolate_count++;
279 valid_isolate_count++;
283 overflow_isolate_count++;
298 if (
p->bidi_class ==
LRI ||
p->bidi_class ==
RLI ||
p->bidi_class ==
FSI)
303 else if (
p->bidi_class ==
PDI)
312 if (skipping)
continue;
314 if (
p->bidi_class ==
L)
319 else if (
p->bidi_class ==
R ||
p->bidi_class ==
AL)
330 valid_isolate_count++;
334 overflow_isolate_count++;
341 valid_isolate_count++;
345 overflow_isolate_count++;
370 if (overflow_isolate_count) overflow_isolate_count--;
371 else if (!valid_isolate_count) {}
374 overflow_embedding_count = 0;
377 valid_isolate_count--;
385 if (overflow_isolate_count) {}
386 else if (overflow_embedding_count) overflow_embedding_count--;
393 c->resolved = baselevel;
397 c->explicit =
c->resolved;
469 if (
index <= 0)
return -1;
571 for (
j =
i-1 ;
j > -1;
j--) {
613 if (iso_run->
sos ==
L &&
j == -1)
643 if (!open_stack || !stack_index || !
out) {
656 if ((ubv >> 8) == 0) {
664 else if ((ubv >> 8) == 1) {
670 if (
c == 0x232A)
c = 0x3009;
671 if (
c == open_stack[
j]) {
672 out[pair_count].start = stack_index[
j];
673 out[pair_count].end =
i;
675 out[pair_count].start = -1;
688 else if (pair_count > 1)
698 return (
class ==
AN ||
class ==
EN) ?
R :
class;
745 while (
p->start >= 0) {
751 TRACE(
"Bracket Pair [%i - %i]\n",
p->start,
p->end);
754 for (
j =
p->start+1; j < p->
end;
j++) {
764 if (
j ==
p->end && flag_o) {
765 for (
j =
p->start;
j >= 0;
j--) {
863 if (
c->bidi_class ==
BN)
869 if (
odd(
c->resolved) && (
c->bidi_class ==
L ||
c->bidi_class ==
EN ||
c->bidi_class ==
AN))
871 else if (!
odd(
c->resolved) &&
c->bidi_class ==
R)
873 else if (!
odd(
c->resolved) && (
c->bidi_class ==
EN ||
c->bidi_class ==
AN))
900 int i, sos = 0, eos =
count - 1;
903 for (
i = sos;
i <= eos;
i++)
934 int run_start, run_end,
i;
946 while (run_start <
count)
952 runs[run_count].
start = run_start;
953 runs[run_count].
end = run_end;
954 runs[run_count].
e = chars[run_start].
resolved;
961 while (
i < run_count)
967 int type_fence, real_end;
976 run_start = runs[
k].
start;
977 current_isolated->
e = runs[
k].
e;
980 for (
j = 0;
j < current_isolated->
length; ++
j)
986 run_end = runs[
k].
end;
988 TRACE(
"{ [%i -- %i]",run_start, run_end);
998 if (
j < run_count && runs[
i].
e != runs[
j].
e) {
1005 int l = current_isolated->
length;
1009 for (
m = 0;
l < current_isolated->
length;
l++,
m++) {
1016 run_end = runs[
j].
end;
1030 if (type_fence == -1)
1031 current_isolated->
sos =
max(baselevel, chars[run_start].
resolved);
1037 if (run_end ==
count)
1038 current_isolated->
eos = current_isolated->
sos;
1045 if (real_end < run_start)
1046 real_end = run_start;
1052 if (type_fence ==
count)
1053 current_isolated->
eos =
max(baselevel, chars[real_end].
resolved);
1073 struct list IsolatingRuns;
1085 WARN(
"Failed to compute isolating runs set, hr %#lx.\n",
hr);
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
struct tagBracketPair BracketPair
static void bidi_resolve_implicit(struct bidi_char *chars, unsigned int count)
static void bidi_resolve_explicit(struct bidi_char *chars, unsigned int count, UINT8 baselevel)
const unsigned short bidi_direction_table[]
static void iso_dump_types(const char *header, IsolatedRun *run)
static BOOL is_rule_L1_reset_class(UINT8 class)
static int get_prev_valid_char_from_run(IsolatedRun *run, int index)
struct tagIsolatedRun IsolatedRun
static int get_next_valid_char_from_run(IsolatedRun *run, int index)
static void bidi_dump_types(const char *header, const struct bidi_char *chars, UINT32 start, UINT32 end)
static UINT8 get_rule_N0_class(UINT8 class)
static void bidi_resolve_weak(IsolatedRun *iso_run)
static const char debug_type[][4]
struct tagRunChar RunChar
static int get_next_valid_char_index(const struct bidi_char *chars, int index, int front_fence)
HRESULT bidi_computelevels(struct bidi_char *chars, unsigned int count, UINT8 baselevel)
static UINT8 get_embedding_direction(UINT8 level)
#define push_stack(l, o, i)
struct tagStackItem StackItem
static void bidi_resolve_resolved(struct bidi_char *chars, unsigned int count, UINT8 baselevel)
const unsigned short bidi_bracket_table[]
static UINT8 get_greater_even_level(UINT8 level)
static int __cdecl bracketpair_compr(const void *a, const void *b)
static BracketPair * bidi_compute_bracket_pairs(IsolatedRun *iso_run)
static BOOL bidi_is_isolate(UINT8 class)
static UINT8 get_greater_odd_level(UINT8 level)
static void bidi_resolve_neutrals(IsolatedRun *run)
static HRESULT bidi_compute_isolating_runs_set(struct bidi_char *chars, unsigned int count, UINT8 baselevel, struct list *set)
static int get_prev_valid_char_index(const struct bidi_char *chars, int index, int back_fence)
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
_ACRTIMP size_t __cdecl strlen(const char *)
static unsigned short get_table_entry_16(const unsigned short *table, WCHAR ch)
static jsval_t stack_top(script_ctx_t *ctx)
GLuint GLuint GLsizei count
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLuint GLsizei GLsizei * length
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
static short search(int val, const short *table, int size)
static unsigned __int64 next
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out