/* FriBidi
* fribidi-main.c - command line program for libfribidi
*
- * $Id: fribidi-main.c,v 1.9 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi-main.c,v 1.10 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.9 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.10 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bin/fribidi-main.c,v $
*
* Authors:
exit (0);
}
-char *my_fribidi_strdup (char *s)
+char *
+my_fribidi_strdup (
+ char *s
+)
{
char *m;
if (!m)
return NULL;
- strcpy(m, s);
+ strcpy (m, s);
return m;
}
/* FriBidi
* fribidi-char-sets.c - character set conversion routines
*
- * $Id: fribidi-char-sets.c,v 1.5 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi-char-sets.c,v 1.6 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.5 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.6 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/charset/fribidi-char-sets.c,v $
*
* Authors:
return toupper (*s1) - toupper (*s2);
}
#else /* FRIBIDI_USE_GLIB */
+# include <glib/gstrfuncs.h>
# define fribidi_strcasecmp g_ascii_strcasecmp
#endif /* FRIBIDI_USE_GLIB */
## Use autoupdate to update this file for newer versions of autoconf.
## Use autoscan to check if you need to add something to this file.
##############################################################################
-## $Id: configure.ac,v 1.13 2004-06-09 14:59:21 behdad Exp $
+## $Id: configure.ac,v 1.14 2004-06-09 20:01:00 behdad Exp $
## $Auther: behdad $
-## $Date: 2004-06-09 14:59:21 $
-## $Revision: 1.13 $
+## $Date: 2004-06-09 20:01:00 $
+## $Revision: 1.14 $
## $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/configure.ac,v $
##############################################################################
fribidi_major_version.fribidi_minor_version.fribidi_micro_version))dnl
AC_INIT([GNU FriBidi],fribidi_version(),[http://freedesktop.org/cgi-bin/bugzilla/enter_bug.cgi?product=FriBidi])
-AC_REVISION([$Id: configure.ac,v 1.13 2004-06-09 14:59:21 behdad Exp $])
+AC_REVISION([$Id: configure.ac,v 1.14 2004-06-09 20:01:00 behdad Exp $])
AC_CONFIG_SRCDIR(lib/fribidi.h)
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([gnits])
# Checks for typedefs and structures.
AC_C_CONST
-AC_C_INLINE
AC_C_STRINGIZE
AC_CHECK_SIZEOF(int)
SIZEOF_INT=$ac_cv_sizeof_int
gen-unicode-version
gen_bidi_type_tab_SOURCES = gen-bidi-type-tab.c packtab.c packtab.h
-gen_mirroring_tab_SOURCES = gen-mirroring-tab.c
+gen_mirroring_tab_SOURCES = gen-mirroring-tab.c packtab.c packtab.h
gen_unicode_version_SOURCES = gen-unicode-version.c
CLEANFILES = $(EXTRA_PROGRAMS)
$(gen_mirroring_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_mirroring_tab)
(DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
- ./$(gen_mirroring_tab) \
+ ./$(gen_mirroring_tab) $(COMPRESSION) \
$$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
mirroring.tab.i:
/* FriBidi
* gen-bidi-type-tab.c - generate bidi-type.tab.i for libfribidi
*
- * $Id: gen-bidi-type-tab.c,v 1.10 2004-06-04 09:41:11 behdad Exp $
+ * $Id: gen-bidi-type-tab.c,v 1.11 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-04 09:41:11 $
- * $Revision: 1.10 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.11 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-bidi-type-tab.c,v $
*
* Author:
return 0;
}
-#define table_name "FriBidiCharTypeData"
+#define table_name "Bid"
#define macro_name "FRIBIDI_GET_BIDI_TYPE"
-static int table[FRIBIDI_UNICODE_CHARS];
+static signed int table[FRIBIDI_UNICODE_CHARS];
static char s[4000];
static void
"#define PACKTAB_UINT32 fribidi_uint32\n\n");
if (!pack_table
- (table, FRIBIDI_UNICODE_CHARS, 1, max_depth, 3, names,
+ (table, FRIBIDI_UNICODE_CHARS, 1, LTR, max_depth, 3, names,
"unsigned char", table_name, macro_name, stdout))
die ("error: insufficient memory, decrease max_depth");
+ printf ("#undef PACKTAB_UINT8\n"
+ "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
+
printf ("/* End of generated " outputname " */\n");
}
/* FriBidi
- * gen-mirroring-tab.c - generate mirroring.tab.i for libfribidi
+ * gen-mirroring-tab.c - generate bidi-mirroring.i for libfribidi
*
- * $Id: gen-mirroring-tab.c,v 1.7 2004-05-31 18:43:26 behdad Exp $
+ * $Id: gen-mirroring-tab.c,v 1.8 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-05-31 18:43:26 $
- * $Revision: 1.7 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.8 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/gen.tab/gen-mirroring-tab.c,v $
*
* Author:
# include <strings.h>
#endif
+#include "packtab.h"
+
#define appname "gen-mirroring-tab"
#define outputname "mirroring.tab.i"
exit (1);
}
-static FriBidiChar table[FRIBIDI_UNICODE_CHARS];
-static char s[4000];
+#define table_name "Mir"
+#define macro_name "FRIBIDI_GET_MIRRORING_DELTA"
-static int mirroring_count;
+static signed int table[FRIBIDI_UNICODE_CHARS];
+static char s[4000];
+static signed long max_dist;
static void
init (
)
{
- register FriBidiChar i;
+ max_dist = 0;
+}
- for (i = 0; i < FRIBIDI_UNICODE_CHARS; i++)
- table[i] = 0;
- mirroring_count = 0;
+static void
+clear_tab (
+)
+{
+ register FriBidiChar c;
+
+ for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
+ table[c] = 0;
+}
+
+static void
+init_tab_bidi_mirroring_txt (
+)
+{
+ clear_tab ();
}
static void
while (fgets (s, sizeof s, f))
{
unsigned long i, j;
+ signed long dist;
int k;
l++;
continue;
k = sscanf (s, "%lx; %lx", &i, &j);
- if (k != 2 || i >= FRIBIDI_UNICODE_CHARS || j >= FRIBIDI_UNICODE_CHARS)
+ if (k != 2 || i < 0 || i >= FRIBIDI_UNICODE_CHARS || j < 0
+ || j >= FRIBIDI_UNICODE_CHARS)
die4 ("invalid pair in input at line %ld: %04lX, %04lX", l, i, j);
- table[i] = j;
- mirroring_count++;
+ dist = ((signed long) j - (signed long) i);
+ table[i] = dist;
+ if (dist > max_dist)
+ max_dist = dist;
+ else if (-dist > max_dist)
+ max_dist = -dist;
}
}
static void
gen_mirroring_tab (
+ int max_depth,
char *data_file_type
)
{
- FriBidiChar i;
+ int key_bytes;
+ char *key_type;
- fprintf (stderr, "Generating output, it may take up to a few seconds\n");
+ fprintf (stderr, "Generating output, it may take up to a few minutes\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
FRIBIDI_VERSION ")\n" " * from the file %s of Unicode version "
FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type);
- printf ("/* *IND" "ENT-OFF" "* */\n\n");
- printf
- ("static const struct _FriBidiMirroredPair FriBidiMirroredChars[] =\n{\n");
- for (i = 0; i < FRIBIDI_UNICODE_CHARS; i++)
- if (table[i])
- printf (" {0x%04lX, 0x%04lX},\n", (unsigned long) i,
- (unsigned long) table[i]);
- printf ("} ;\n\n");
- printf ("/* *IND" "ENT-ON* */\n\n");
- printf ("static const int nFriBidiMirroredChars = %d;\n\n",
- mirroring_count);
+ printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
+ "#define PACKTAB_UINT16 fribidi_uint16\n"
+ "#define PACKTAB_UINT32 fribidi_uint32\n\n");
+
+ key_bytes = max_dist <= 0x7f ? 1 : max_dist < 0x7fff ? 2 : 4;
+ key_type = key_bytes == 1 ? "fribidi_int8" : key_bytes == 2 ?
+ "fribidi_int16" : "fribidi_int32";
+
+ if (!pack_table
+ (table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
+ key_type, table_name, macro_name, stdout))
+ die ("error: insufficient memory, decrease max_depth");
+
+ printf ("#undef PACKTAB_UINT8\n"
+ "#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
printf ("/* End of generated " outputname " */\n");
}
char **argv
)
{
- if (argc != 3)
- die ("usage:\n " appname " data-file-type data-file-name\n"
- "where data-file-type is:\n" " * BidiMirroring.txt");
+ if (argc != 4)
+ die ("usage:\n " appname " max-depth data-file-type data-file-name\n"
+ "where data-file-type is one of these:\n" " * BidiMirroring.txt");
{
- char *data_file_type = argv[1];
- char *data_file_name = argv[2];
+ int max_depth = atoi (argv[1]);
+ char *data_file_type = argv[2];
+ char *data_file_name = argv[3];
+
+ if (max_depth < 2)
+ die ("invalid depth");
init ();
read_data (data_file_type, data_file_name);
- gen_mirroring_tab (data_file_type);
+ gen_mirroring_tab (max_depth, data_file_type);
}
return 0;
int key
1 <= max_depth <= 21
*/
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
#include "packtab.h"
-typedef int uni_table[1024 * 1024 * 2];
-static int n, a, max_depth, N, digits, tab_width, per_row;
+typedef signed int uni_table[1024 * 1024 * 2];
+static int n, a, max_depth, digits, tab_width, per_row;
+static long N;
+signed int def_key;
static uni_table temp, x, perm, *tab;
-static int pow[22], cluster, cmpcluster;
-static char **name, *key_type_name, *table_name, *macro_name;
+static long pow[22], cluster, cmpcluster;
+static const char *const *name, *key_type_name, *table_name, *macro_name;
static FILE *f;
-static inline void
+static long
+most_binary (
+ long min,
+ long max
+)
+{
+ /* min should be less than max */
+ register int i, ii;
+
+ if (min == max)
+ return max;
+
+ for (i = 21; max < pow[i]; i--)
+ ;
+ ii = i;
+ while (i && !((min ^ max) & pow[i]))
+ i--;
+
+ if (ii == i)
+ {
+ /* min is less than half of max */
+ for (i = 21 - 1; min < pow[i]; i--)
+ ;
+ i++;
+ return pow[i];
+ }
+
+ return max & (pow[i] - 1);
+}
+
+static void
init (
+ const signed int *table
)
{
- int i;
+ register int i;
+
+ /* initialize powers of two */
pow[0] = 1;
for (i = 1; i <= 21; i++)
- pow[i] = pow[i - 1] * 2;
- for (n = 21; pow[n] > N || N % pow[n]; n--)
+ pow[i] = pow[i - 1] << 1;
+
+ /* reduce number of elements to get a more binary number */
+ {
+ long essen;
+
+ /* find number of essential items */
+ essen = N - 1;
+ while (essen && table[essen] == def_key)
+ essen--;
+ essen++;
+
+ N = most_binary (essen, N);
+ }
+
+ for (n = 21; N % pow[n]; n--)
;
digits = (n + 3) / 4;
for (i = 6; i; i--)
return 0;
}
-static int lev, p[22], t[22], c[22], clusters[22], s, nn;
-static int best_lev, best_p[22], best_t[22], best_c[22], best_cluster[22],
- best_s;
+static int lev, p[22], nn;
+static int best_lev, best_p[22];
+static long c[22], best_c[22], s, best_s;
+static long t[22], best_t[22], clusters[22], best_cluster[22];
static void
found (
int node_size
)
{
- int i, j, k, y, sbak, key_bytes;
+ long i, j, k, y, sbak;
+ long key_bytes;
if (t[lev] == 1)
{
static void
write_array (
- int max_key
+ long max_key
)
{
int i, j, k, y, ii, ofs;
- char *key_type;
+ const char *key_type;
if (best_t[lev] == 1)
return;
key_type = !lev ? key_type_name :
max_key <= 0xff ? "PACKTAB_UINT8" :
max_key <= 0xffff ? "PACKTAB_UINT16" : "PACKTAB_UINT32";
- fprintf (f, "static const %s %sLevel%d[%d*%d] = {", key_type, table_name,
+ fprintf (f, "static const %s %sLev%d[%ld*%d] = {", key_type, table_name,
best_lev - lev - 1, cluster, k);
ofs = 0;
for (ii = 0; ii < k; ii++)
{
int kk, jj;
- fprintf (f, "\n\n#define %sLevel%d_%0*X 0x%0X\n", table_name,
+ fprintf (f, "\n#define %sLev%d_%0*lX 0x%0X", table_name,
best_lev - lev - 1, digits, x[i] * pow[n - nn], ofs);
kk = x[i] * cluster;
if (!lev)
}
else
for (j = 0; j < cluster; j++, kk++)
- fprintf (f, "\n %sLevel%d_%0*X, /* %0*X..%0*X */", table_name,
+ fprintf (f, "\n %sLev%d_%0*lX, /* %0*lX..%0*lX */", table_name,
best_lev - lev, digits,
tab[lev][kk] * pow[n - nn - best_p[lev]], digits,
x[i] * pow[n - nn] + j * pow[n - nn - best_p[lev]], digits,
write_array (0);
fprintf (f, "/* *IND" "ENT-ON* */\n\n");
- fprintf (f, "#define %s(x)", macro_name);
+ fprintf (f, "#define %s(x) \\\n", macro_name);
+ fprintf (f, "\t((x) >= 0x%lx ? ", N);
+ if (name)
+ fprintf (f, "%s", name[def_key]);
+ else
+ fprintf (f, "%d", def_key);
+ fprintf (f, " : ");
j = 1;
for (i = best_lev - 1; i >= 0; i--)
{
- fprintf (f, "\t\\\n\t%sLevel%d[(x)", table_name, i);
+ fprintf (f, " \\\n\t%sLev%d[(x)", table_name, i);
if (j != 1)
fprintf (f, "/%d", j);
if (i)
- fprintf (f, "%%%d +", pow[best_p[best_lev - 1 - i]]);
+ fprintf (f, "%%%ld +", pow[best_p[best_lev - 1 - i]]);
j *= best_cluster[best_lev - 1 - i];
}
for (i = 0; i < best_lev; i++)
fprintf (f, "]");
- fprintf (f, "\n\n");
+ fprintf (f, ")\n\n");
}
static void
" generated by packtab.c version %d\n\n"
" use %s(key) to access your table\n\n"
" assumed sizeof(%s): %d\n"
- " required memory: %d\n"
+ " required memory: %ld\n"
" lookups: %d\n"
" partition shape: %s",
packtab_version, macro_name, key_type_name, a, best_s, best_lev,
table_name);
for (i = best_lev - 1; i >= 0; i--)
- fprintf (f, "[%d]", best_cluster[i]);
+ fprintf (f, "[%ld]", best_cluster[i]);
fprintf (f, "\n" " different table entries:");
for (i = best_lev - 1; i >= 0; i--)
- fprintf (f, " %d", best_c[i]);
+ fprintf (f, " %ld", best_c[i]);
fprintf (f, "\n*/\n");
write_source ();
}
int
pack_table (
- int *base,
- int key_num,
+ const signed int *base,
+ long key_num,
int key_size,
+ signed int default_key,
int p_max_depth,
int p_tab_width,
- char **p_name,
- char *p_key_type_name,
- char *p_table_name,
- char *p_macro_name,
+ const char *const *p_name,
+ const char *p_key_type_name,
+ const char *p_table_name,
+ const char *p_macro_name,
FILE *out
)
{
N = key_num;
a = key_size;
+ def_key = default_key;
max_depth = p_max_depth;
tab_width = p_tab_width;
name = p_name;
table_name = p_table_name;
macro_name = p_macro_name;
f = out;
- init ();
+ init (base);
if (!(tab = malloc ((n + 1) * sizeof (tab[0]))))
return 0;
- memmove (tab[0], base, key_num * sizeof (int));
+ memmove (tab[0], base, N * sizeof (base[0]));
solve ();
write_out ();
free (tab);
#define packtab_version 2
int pack_table (
- int *base,
- int key_num,
+ const signed int *base,
+ long key_num,
int key_size,
+ signed int default_key,
int max_depth,
int tab_width,
- char **name,
- char *key_type_name,
- char *table_name,
- char *macro_name,
+ const char *const *name,
+ const char *key_type_name,
+ const char *table_name,
+ const char *macro_name,
FILE *out
);
/* FriBidi
* fribidi-bidi-type.c - get character bidi type
*
- * $Id: fribidi-bidi-type.c,v 1.10 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi-bidi-type.c,v 1.11 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.10 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.11 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/Attic/fribidi-bidi-type.c,v $
*
* Authors:
FRIBIDI_ENTRY FriBidiCharType
fribidi_get_bidi_type (
/* input */
- FriBidiChar uch
+ FriBidiChar ch
)
{
- if (uch < FRIBIDI_UNICODE_CHARS)
- return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (uch)];
- else
- return FRIBIDI_TYPE_LTR;
- /* Non-Unicode chars */
+ return linear_enum_to_char_type[FRIBIDI_GET_BIDI_TYPE (ch)];
}
/* FriBidi
* fribidi-bidi-types.h - character bidi types
*
- * $Id: fribidi-bidi-types.h,v 1.6 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi-bidi-types.h,v 1.7 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.6 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.7 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-bidi-types.h,v $
*
* Author:
FRIBIDI_TYPE_##TYPE = FRIBIDI_TYPE_##TYPE##_VAL,
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
- _FRIBIDI_TYPE_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
+ _FRIBIDI_TYPE_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
} FriBidiCharType;
typedef enum
# include "fribidi-bidi-types-list.h"
# undef _FRIBIDI_ADD_TYPE
# undef _FRIBIDI_PAR_TYPES
- _FRIBIDI_PAR_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
+ _FRIBIDI_PAR_SENTINEL = FRIBIDI_TYPE_SENTINEL /* Don't use this */
} FriBidiParType;
#else
* For licensing issues, contact <license@farsiweb.info> or write to
* Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
*/
-/* $Id: fribidi-mirroring.c,v 1.9 2004-06-09 14:59:21 behdad Exp $
+/* $Id: fribidi-mirroring.c,v 1.10 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.9 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.10 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.c,v $
*
* Authors:
#include <fribidi-mirroring.h>
-struct _FriBidiMirroredPair
-{
- FriBidiChar ch, mirrored_ch;
-};
-
#include "mirroring.tab.i"
FRIBIDI_ENTRY fribidi_boolean
FriBidiChar *mirrored_ch
)
{
- register int pos;
- int step;
- fribidi_boolean found;
-
- pos = step = (nFriBidiMirroredChars / 2) + 1;
-
- while LIKELY
- (step > 1)
- {
- FriBidiChar cmp_ch = FriBidiMirroredChars[pos].ch;
- step = (step + 1) / 2;
-
- if (cmp_ch < ch)
- {
- pos += step;
- if UNLIKELY
- (pos >= nFriBidiMirroredChars) pos = nFriBidiMirroredChars - 1;
- }
- else if LIKELY
- (cmp_ch > ch)
- {
- pos -= step;
- if UNLIKELY
- (pos < 0) pos = 0;
- }
- else
- break;
- }
- found = FriBidiMirroredChars[pos].ch == ch;
-
+ register FriBidiChar result;
+ result = FRIBIDI_GET_MIRRORING_DELTA (ch);
if (mirrored_ch)
- *mirrored_ch = found ? FriBidiMirroredChars[pos].mirrored_ch : ch;
-
- return found;
+ *mirrored_ch = ch + result;
+ return result ? true : false;
}
/* Editor directions:
/* FriBidi
* fribidi-types.h - define data types for the rest of the library
*
- * $Id: fribidi-types.h,v 1.5 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi-types.h,v 1.6 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.5 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.6 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-types.h,v $
*
* Author:
#if !FRIBIDI_USE_GLIB
-# if HAVE_INTTYPES_H
+# if defined(HAVE_INTTYPES_H) || defined(HAVE_STDINT_H)
# ifndef __FRIBIDI_DOC
-# include <inttypes.h>
+# if HAVE_INTTYPES_H
+# include <inttypes.h>
+# elif HAVE_STDINT_H
+# include <stdint.h>
+# endif /* !HAVE_STDINT_H */
# endif /* !__FRIBIDI_DOC */
+# define FRIBIDI_INT8_LOCAL int8_t
+# define FRIBIDI_INT16_LOCAL int16_t
+# define FRIBIDI_INT32_LOCAL int32_t
# define FRIBIDI_UINT8_LOCAL uint8_t
# define FRIBIDI_UINT16_LOCAL uint16_t
# define FRIBIDI_UINT32_LOCAL uint32_t
-# else /* !HAVE_INTTYPES_H */
-# if HAVE_STDINT_H
-# ifndef __FRIBIDI_DOC
-# include <stdint.h>
-# endif /* !__FRIBIDI_DOC */
-# define FRIBIDI_UINT8_LOCAL uint8_t
-# define FRIBIDI_UINT16_LOCAL uint16_t
-# define FRIBIDI_UINT32_LOCAL uint32_t
-# else /* !HAVE_STDINT_H */
-# define FRIBIDI_UINT8_LOCAL unsigned char
-# if !defined(SIZEOF_SHORT) || SIZEOF_SHORT >= 2
-# define FRIBIDI_UINT16_LOCAL unsigned short
-# else /* SIZEOF_SHORT < 2 */
-# define FRIBIDI_UINT16_LOCAL unsigned int
-# endif /* SIZEOF_SHORT < 2 */
-# if !defined(SIZEOF_INT) || SIZEOF_INT >= 4
-# define FRIBIDI_UINT32_LOCAL unsigned int
-# else /* SIZEOF_INT < 4 */
-# define FRIBIDI_UINT32_LOCAL unsigned long
-# endif /* SIZEOF_INT < 4 */
-# endif /* !HAVE_STDINT_H */
-# endif /* !HAVE_INTTYPES_H */
+# else /* no int types */
+# define FRIBIDI_INT8_LOCAL signed char
+# define FRIBIDI_UINT8_LOCAL unsigned char
+# if !defined(FRIBIDI_SIZEOF_INT) || FRIBIDI_SIZEOF_INT >= 4
+# define FRIBIDI_INT16_LOCAL signed short
+# define FRIBIDI_UINT16_LOCAL unsigned short
+# define FRIBIDI_INT32_LOCAL signed int
+# define FRIBIDI_UINT32_LOCAL unsigned int
+# else /* SIZEOF_INT < 4 */
+# define FRIBIDI_INT16_LOCAL signed int
+# define FRIBIDI_UINT16_LOCAL unsigned int
+# define FRIBIDI_INT32_LOCAL signed long
+# define FRIBIDI_UINT32_LOCAL unsigned long
+# endif /* SIZEOF_INT < 4 */
+# endif /* no int types */
# if HAVE_STDBOOL_H
# ifndef __FRIBIDI_DOC
# include <stdbool.h>
# define FRIBIDI_UNICHAR_LOCAL fribidi_uint32
# endif /* SIZEOF_WCHAR_T < 4 */
#else /* FRIBIDI_USE_GLIB */
-# ifndef __FRIBIDI_DOC
-# include <glib/gtypes.h>
-# include <glib/gunicode.h>
-# endif /* !__FRIBIDI_DOC */
+# ifndef __FRIBIDI_DOC
+# include <glib/gtypes.h>
+# include <glib/gunicode.h>
+# endif /* !__FRIBIDI_DOC */
+# define FRIBIDI_INT8_LOCAL gint8
+# define FRIBIDI_INT16_LOCAL gint16
+# define FRIBIDI_INT32_LOCAL gint32
# define FRIBIDI_UINT8_LOCAL guint8
# define FRIBIDI_UINT16_LOCAL guint16
# define FRIBIDI_UINT32_LOCAL guint32
# define FRIBIDI_UNICHAR_LOCAL gunichar
#endif /* FRIBIDI_USE_GLIB */
-#ifndef FRIBIDI_UINT8
+#if !FRIBIDI_INT_TYPES
+# define FRIBIDI_INT8 FRIBIDI_INT8_LOCAL
+# define FRIBIDI_INT16 FRIBIDI_INT16_LOCAL
+# define FRIBIDI_INT32 FRIBIDI_INT32_LOCAL
# define FRIBIDI_UINT8 FRIBIDI_UINT8_LOCAL
-#endif /* !FRIBIDI_UINT8 */
-#ifndef FRIBIDI_UINT16
# define FRIBIDI_UINT16 FRIBIDI_UINT16_LOCAL
-#endif /* !FRIBIDI_UINT16 */
-#ifndef FRIBIDI_UINT32
# define FRIBIDI_UINT32 FRIBIDI_UINT32_LOCAL
-#endif /* !FRIBIDI_UINT32 */
+#endif /* !FRIBIDI_INT_TYPES */
#ifndef FRIBIDI_BOOLEAN
# define FRIBIDI_BOOLEAN FRIBIDI_BOOLEAN_LOCAL
#endif /* !FRIBIDI_BOOLEAN */
#endif /* FRIBIDI_STR_INDEX */
+typedef FRIBIDI_UINT8 fribidi_int8;
+typedef FRIBIDI_INT16 fribidi_int16;
+typedef FRIBIDI_INT32 fribidi_int32;
typedef FRIBIDI_UINT8 fribidi_uint8;
typedef FRIBIDI_UINT16 fribidi_uint16;
typedef FRIBIDI_UINT32 fribidi_uint32;
/* FriBidi
* fribidi.h - Unicode bidirectional and Arabic joining/shaping algorithms
*
- * $Id: fribidi.h,v 1.4 2004-06-09 14:59:21 behdad Exp $
+ * $Id: fribidi.h,v 1.5 2004-06-09 20:01:00 behdad Exp $
* $Author: behdad $
- * $Date: 2004-06-09 14:59:21 $
- * $Revision: 1.4 $
+ * $Date: 2004-06-09 20:01:00 $
+ * $Revision: 1.5 $
* $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi.h,v $
*
* Author:
#define fribidi_version_info FRIBIDI_NAMESPACE(version_info)
/* An string containing the version information of the library. */
-extern const char *fribidi_version_info;
+ extern const char *fribidi_version_info;
#include "fribidi-enddecls.h"