|
Packit Service |
12e4cd |
/* FriBidi
|
|
Packit Service |
12e4cd |
* run.h - text run data type
|
|
Packit Service |
12e4cd |
*
|
|
Packit Service |
12e4cd |
* Authors:
|
|
Packit Service |
12e4cd |
* Behdad Esfahbod, 2001, 2002, 2004
|
|
Packit Service |
12e4cd |
* Dov Grobgeld, 1999, 2000
|
|
Packit Service |
12e4cd |
*
|
|
Packit Service |
12e4cd |
* Copyright (C) 2004 Sharif FarsiWeb, Inc
|
|
Packit Service |
12e4cd |
* Copyright (C) 2001,2002 Behdad Esfahbod
|
|
Packit Service |
12e4cd |
* Copyright (C) 1999,2000 Dov Grobgeld
|
|
Packit Service |
12e4cd |
*
|
|
Packit Service |
12e4cd |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
12e4cd |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
12e4cd |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
12e4cd |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
12e4cd |
*
|
|
Packit Service |
12e4cd |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
12e4cd |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
12e4cd |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
12e4cd |
* Lesser General Public License for more details.
|
|
Packit Service |
12e4cd |
*
|
|
Packit Service |
12e4cd |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
12e4cd |
* along with this library, in a file named COPYING; if not, write to the
|
|
Packit Service |
12e4cd |
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Packit Service |
12e4cd |
* Boston, MA 02110-1301, USA
|
|
Packit Service |
12e4cd |
*
|
|
Packit Service |
12e4cd |
* For licensing issues, contact <fribidi.license@gmail.com>.
|
|
Packit Service |
12e4cd |
*/
|
|
Packit Service |
12e4cd |
#ifndef _RUN_H
|
|
Packit Service |
12e4cd |
#define _RUN_H
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#include "common.h"
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#include <fribidi-common.h>
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#include <fribidi-types.h>
|
|
Packit Service |
12e4cd |
#include <fribidi-bidi-types.h>
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#include <fribidi-begindecls.h>
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
typedef struct _FriBidiRunStruct FriBidiRun;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
struct _FriBidiRunStruct
|
|
Packit Service |
12e4cd |
{
|
|
Packit Service |
12e4cd |
FriBidiRun *prev;
|
|
Packit Service |
12e4cd |
FriBidiRun *next;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
FriBidiStrIndex pos, len;
|
|
Packit Service |
12e4cd |
FriBidiCharType type;
|
|
Packit Service |
12e4cd |
FriBidiLevel level;
|
|
Packit Service |
12e4cd |
FriBidiLevel isolate_level;
|
|
Packit Service |
12e4cd |
FriBidiBracketType bracket_type;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
/* Additional links for connecting the isolate tree */
|
|
Packit Service |
12e4cd |
FriBidiRun *prev_isolate, *next_isolate;
|
|
Packit Service |
12e4cd |
};
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
FriBidiRun *
|
|
Packit Service |
12e4cd |
new_run (
|
|
Packit Service |
12e4cd |
void
|
|
Packit Service |
12e4cd |
)
|
|
Packit Service |
12e4cd |
FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
FriBidiRun *new_run_list (
|
|
Packit Service |
12e4cd |
void
|
|
Packit Service |
12e4cd |
)
|
|
Packit Service |
12e4cd |
FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
void free_run_list (
|
|
Packit Service |
12e4cd |
FriBidiRun *run_list
|
|
Packit Service |
12e4cd |
) FRIBIDI_GNUC_HIDDEN;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
FriBidiRun *run_list_encode_bidi_types (
|
|
Packit Service |
12e4cd |
const FriBidiCharType *bidi_types,
|
|
Packit Service |
12e4cd |
const FriBidiBracketType *bracket_types,
|
|
Packit Service |
12e4cd |
const FriBidiStrIndex len
|
|
Packit Service |
12e4cd |
)
|
|
Packit Service |
12e4cd |
FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
fribidi_boolean shadow_run_list (
|
|
Packit Service |
12e4cd |
FriBidiRun *base,
|
|
Packit Service |
12e4cd |
FriBidiRun *over,
|
|
Packit Service |
12e4cd |
fribidi_boolean preserve_length
|
|
Packit Service |
12e4cd |
)
|
|
Packit Service |
12e4cd |
FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_WARN_UNUSED;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define swap(a,b) \
|
|
Packit Service |
12e4cd |
FRIBIDI_BEGIN_STMT \
|
|
Packit Service |
12e4cd |
void *t; \
|
|
Packit Service |
12e4cd |
(t) = (a); \
|
|
Packit Service |
12e4cd |
(a) = (b); \
|
|
Packit Service |
12e4cd |
(b) = (t); \
|
|
Packit Service |
12e4cd |
FRIBIDI_END_STMT
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define merge_lists(a,b) \
|
|
Packit Service |
12e4cd |
FRIBIDI_BEGIN_STMT \
|
|
Packit Service |
12e4cd |
swap((a)->prev->next, (b)->prev->next); \
|
|
Packit Service |
12e4cd |
swap((a)->prev, (b)->prev); \
|
|
Packit Service |
12e4cd |
FRIBIDI_END_STMT
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define delete_node(x) \
|
|
Packit Service |
12e4cd |
FRIBIDI_BEGIN_STMT \
|
|
Packit Service |
12e4cd |
(x)->prev->next = (x)->next; \
|
|
Packit Service |
12e4cd |
(x)->next->prev = (x)->prev; \
|
|
Packit Service |
12e4cd |
FRIBIDI_END_STMT
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define insert_node_before(x, list) \
|
|
Packit Service |
12e4cd |
FRIBIDI_BEGIN_STMT \
|
|
Packit Service |
12e4cd |
(x)->prev = (list)->prev; \
|
|
Packit Service |
12e4cd |
(list)->prev->next = (x); \
|
|
Packit Service |
12e4cd |
(x)->next = (list); \
|
|
Packit Service |
12e4cd |
(list)->prev = (x); \
|
|
Packit Service |
12e4cd |
FRIBIDI_END_STMT
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define move_node_before(x, list) \
|
|
Packit Service |
12e4cd |
FRIBIDI_BEGIN_STMT \
|
|
Packit Service |
12e4cd |
if ((x)->prev) { \
|
|
Packit Service |
12e4cd |
delete_node(x); \
|
|
Packit Service |
12e4cd |
} \
|
|
Packit Service |
12e4cd |
insert_node_before((x), (list)); \
|
|
Packit Service |
12e4cd |
FRIBIDI_END_STMT
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define for_run_list(x, list) \
|
|
Packit Service |
12e4cd |
for ((x) = (list)->next; (x)->type != FRIBIDI_TYPE_SENTINEL; (x) = (x)->next)
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#ifdef DEBUG
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
void fribidi_validate_run_list (
|
|
Packit Service |
12e4cd |
FriBidiRun *run_list /* input run list */
|
|
Packit Service |
12e4cd |
) FRIBIDI_GNUC_HIDDEN;
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#else /* !DEBUG */
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#define fribidi_validate_run_list(run_list) fribidi_assert(run_list)
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#endif /* !DEBUG */
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#include <fribidi-enddecls.h>
|
|
Packit Service |
12e4cd |
|
|
Packit Service |
12e4cd |
#endif /* !_RUN_H */
|
|
Packit Service |
12e4cd |
/* Editor directions:
|
|
Packit Service |
12e4cd |
* vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
|
|
Packit Service |
12e4cd |
*/
|