No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / openldap / dist / libraries / liblunicode / ucdata / ucpgba.h
blob806bb2d9af4bf58ef6ea0a29a8ecbce547833c79
1 /* $OpenLDAP: pkg/ldap/libraries/liblunicode/ucdata/ucpgba.h,v 1.8.2.3 2008/02/11 23:26:42 kurt Exp $ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1998-2008 The OpenLDAP Foundation.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
9 * Public License.
11 * A copy of this license is available in file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
15 /* Copyright 1999 Computing Research Labs, New Mexico State University
17 * Permission is hereby granted, free of charge, to any person obtaining a
18 * copy of this software and associated documentation files (the "Software"),
19 * to deal in the Software without restriction, including without limitation
20 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
21 * and/or sell copies of the Software, and to permit persons to whom the
22 * Software is furnished to do so, subject to the following conditions:
24 * The above copyright notice and this permission notice shall be included in
25 * all copies or substantial portions of the Software.
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
30 * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
31 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
32 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
33 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 /* $Id: ucpgba.h,v 1.1.1.1 2008/02/11 23:26:42 lukem Exp $ */
37 #ifndef _h_ucpgba
38 #define _h_ucpgba
40 #include "portable.h"
42 LDAP_BEGIN_DECL
44 /***************************************************************************
46 * Macros and types.
48 ***************************************************************************/
51 * These are the direction values that can appear in render runs and render
52 * strings.
54 #define UCPGBA_LTR 0
55 #define UCPGBA_RTL 1
58 * These are the flags for cursor motion.
60 #define UCPGBA_CURSOR_VISUAL 0
61 #define UCPGBA_CURSOR_LOGICAL 1
64 * This structure is used to contain runs of text in a particular direction.
66 typedef struct _ucrun_t {
67 struct _ucrun_t *visual_prev; /* Pointer to the previous visual run. */
68 struct _ucrun_t *visual_next; /* Pointer to the next visual run. */
70 struct _ucrun_t *logical_prev; /* Pointer to the previous logical run. */
71 struct _ucrun_t *logical_next; /* Pointer to the next logical run. */
73 int direction; /* Direction of the run. */
75 long cursor; /* Position of "cursor" in the string. */
77 unsigned long *chars; /* List of characters for the run. */
78 unsigned long *positions; /* List of original positions in source. */
80 unsigned long *source; /* The source string. */
81 unsigned long start; /* Beginning offset in the source string. */
82 unsigned long end; /* Ending offset in the source string. */
83 } ucrun_t;
86 * This represents a string of runs rendered up to a point that is not
87 * platform specific.
89 typedef struct _ucstring_t {
90 int direction; /* Overall direction of the string. */
92 int cursor_motion; /* Logical or visual cursor motion flag. */
94 ucrun_t *cursor; /* The run containing the "cursor." */
96 ucrun_t *logical_first; /* First run in the logical order. */
97 ucrun_t *logical_last; /* Last run in the logical order. */
99 ucrun_t *visual_first; /* First run in the visual order. */
100 ucrun_t *visual_last; /* Last run in the visual order. */
102 unsigned long *source; /* The source string. */
103 unsigned long start; /* The beginning offset in the source. */
104 unsigned long end; /* The ending offset in the source. */
105 } ucstring_t;
107 /***************************************************************************
109 * API
111 ***************************************************************************/
114 * This creates and reorders the specified substring using the
115 * "Pretty Good Bidi Algorithm." A default direction is provided for cases
116 * of a string containing no strong direction characters and the default
117 * cursor motion should be provided.
119 LDAP_LUNICODE_F (ucstring_t *)
120 ucstring_create LDAP_P((unsigned long *source,
121 unsigned long start,
122 unsigned long end,
123 int default_direction,
124 int cursor_motion));
126 * This releases the string.
128 LDAP_LUNICODE_F (void) ucstring_free LDAP_P((ucstring_t *string));
131 * This changes the cursor motion flag for the string.
133 LDAP_LUNICODE_F (int)
134 ucstring_set_cursor_motion LDAP_P((ucstring_t *string,
135 int cursor_motion));
138 * This function will move the cursor to the right depending on the
139 * type of cursor motion that was specified for the string.
141 * A 0 is returned if no cursor motion is performed, otherwise a
142 * 1 is returned.
144 LDAP_LUNICODE_F (int)
145 ucstring_cursor_right LDAP_P((ucstring_t *string, int count));
148 * This function will move the cursor to the left depending on the
149 * type of cursor motion that was specified for the string.
151 * A 0 is returned if no cursor motion is performed, otherwise a
152 * 1 is returned.
154 LDAP_LUNICODE_F (int)
155 ucstring_cursor_left LDAP_P((ucstring_t *string, int count));
158 * This routine retrieves the direction of the run containing the cursor
159 * and the actual position in the original text string.
161 LDAP_LUNICODE_F (void)
162 ucstring_cursor_info LDAP_P((ucstring_t *string, int *direction,
163 unsigned long *position));
165 LDAP_END_DECL
167 #endif /* _h_ucpgba */