2 * run.h - text run data type
5 * Behdad Esfahbod, 2001, 2002, 2004
6 * Dov Grobgeld, 1999, 2000
8 * Copyright (C) 2004 Sharif FarsiWeb, Inc
9 * Copyright (C) 2001,2002 Behdad Esfahbod
10 * Copyright (C) 1999,2000 Dov Grobgeld
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library, in a file named COPYING; if not, write to the
24 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA
27 * For licensing issues, contact <fribidi.license@gmail.com>.
32 #include "fribidi-common.h"
34 #include <fribidi-common.h>
36 #include <fribidi-types.h>
37 #include <fribidi-bidi-types.h>
39 #include <fribidi-begindecls.h>
41 typedef struct _FriBidiRunStruct FriBidiRun;
43 struct _FriBidiRunStruct
48 FriBidiStrIndex pos, len;
51 FriBidiLevel isolate_level;
52 FriBidiBracketType bracket_type;
54 /* Additional links for connecting the isolate tree */
55 FriBidiRun *prev_isolate, *next_isolate;
63 FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
65 FriBidiRun *new_run_list (
68 FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
72 ) FRIBIDI_GNUC_HIDDEN;
74 FriBidiRun *run_list_encode_bidi_types (
75 const FriBidiCharType *bidi_types,
76 const FriBidiBracketType *bracket_types,
77 const FriBidiStrIndex len
79 FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;
81 fribidi_boolean shadow_run_list (
84 fribidi_boolean preserve_length
86 FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;
97 #define merge_lists(a,b) \
99 swap((a)->prev->next, (b)->prev->next); \
100 swap((a)->prev, (b)->prev); \
103 #define delete_node(x) \
105 (x)->prev->next = (x)->next; \
106 (x)->next->prev = (x)->prev; \
109 #define insert_node_before(x, list) \
111 (x)->prev = (list)->prev; \
112 (list)->prev->next = (x); \
113 (x)->next = (list); \
114 (list)->prev = (x); \
117 #define move_node_before(x, list) \
122 insert_node_before((x), (list)); \
125 #define for_run_list(x, list) \
126 for ((x) = (list)->next; (x)->type != FRIBIDI_TYPE_SENTINEL; (x) = (x)->next)
131 void fribidi_validate_run_list (
132 FriBidiRun *run_list /* input run list */
133 ) FRIBIDI_GNUC_HIDDEN;
137 #define fribidi_validate_run_list(run_list) fribidi_assert(run_list)
141 #include <fribidi-enddecls.h>
144 /* Editor directions:
145 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent