File: run.h

package info (click to toggle)
fribidi 1.0.5-3.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 19,752 kB
  • sloc: ansic: 8,701; sh: 4,573; makefile: 350; python: 27
file content (146 lines) | stat: -rw-r--r-- 3,521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* FriBidi
 * run.h - text run data type
 *
 * Authors:
 *   Behdad Esfahbod, 2001, 2002, 2004
 *   Dov Grobgeld, 1999, 2000
 *
 * Copyright (C) 2004 Sharif FarsiWeb, Inc
 * Copyright (C) 2001,2002 Behdad Esfahbod
 * Copyright (C) 1999,2000 Dov Grobgeld
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library, in a file named COPYING; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA
 * 
 * For licensing issues, contact <fribidi.license@gmail.com>.
 */
#ifndef _RUN_H
#define _RUN_H

#include "fribidi-common.h"

#include <fribidi-common.h>

#include <fribidi-types.h>
#include <fribidi-bidi-types.h>

#include <fribidi-begindecls.h>

typedef struct _FriBidiRunStruct FriBidiRun;

struct _FriBidiRunStruct
{
  FriBidiRun *prev;
  FriBidiRun *next;

  FriBidiStrIndex pos, len;
  FriBidiCharType type;
  FriBidiLevel level;
  FriBidiLevel isolate_level;
  FriBidiBracketType bracket_type;

  /* Additional links for connecting the isolate tree */
  FriBidiRun *prev_isolate, *next_isolate;  
};


FriBidiRun *
new_run (
  void
)
     FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;

     FriBidiRun *new_run_list (
  void
)
     FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;

     void free_run_list (
  FriBidiRun *run_list
) FRIBIDI_GNUC_HIDDEN;

     FriBidiRun *run_list_encode_bidi_types (
  const FriBidiCharType *bidi_types,
  const FriBidiBracketType *bracket_types,
  const FriBidiStrIndex len
)
     FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;

     fribidi_boolean shadow_run_list (
  FriBidiRun *base,
  FriBidiRun *over,
  fribidi_boolean preserve_length
)
     FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;


#define swap(a,b) \
	FRIBIDI_BEGIN_STMT \
	void *t; \
	(t) = (a); \
	(a) = (b); \
	(b) = (t); \
	FRIBIDI_END_STMT

#define merge_lists(a,b) \
	FRIBIDI_BEGIN_STMT \
	swap((a)->prev->next, (b)->prev->next); \
	swap((a)->prev, (b)->prev); \
	FRIBIDI_END_STMT

#define delete_node(x) \
	FRIBIDI_BEGIN_STMT \
	(x)->prev->next = (x)->next; \
	(x)->next->prev = (x)->prev; \
	FRIBIDI_END_STMT

#define insert_node_before(x, list) \
	FRIBIDI_BEGIN_STMT \
	(x)->prev = (list)->prev; \
	(list)->prev->next = (x); \
	(x)->next = (list); \
	(list)->prev = (x); \
	FRIBIDI_END_STMT

#define move_node_before(x, list) \
	FRIBIDI_BEGIN_STMT \
	if ((x)->prev) { \
	  delete_node(x); \
	} \
	insert_node_before((x), (list)); \
	FRIBIDI_END_STMT

#define for_run_list(x, list) \
	for ((x) = (list)->next; (x)->type != FRIBIDI_TYPE_SENTINEL; (x) = (x)->next)


#ifdef DEBUG

     void fribidi_validate_run_list (
  FriBidiRun *run_list		/* input run list */
) FRIBIDI_GNUC_HIDDEN;

#else /* !DEBUG */

#define fribidi_validate_run_list(run_list) fribidi_assert(run_list)

#endif /* !DEBUG */

#include <fribidi-enddecls.h>

#endif /* !_RUN_H */
/* Editor directions:
 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
 */