[FriBidi-commit] fribidi/gen.tab Makefile.am, 1.11,
1.12 gen-bidi-type-tab.c, 1.11, 1.12 gen-joining-type-tab.c,
NONE, 1.1 gen-mirroring-tab.c, 1.8, 1.9 gen-unicode-version.c,
1.5, 1.6 packtab.c, 1.4, 1.5 packtab.h, 1.3, 1.4
Behdad Esfahbod
behdad at pdx.freedesktop.org
Sun Jun 13 13:11:44 PDT 2004
- Previous message: [FriBidi-commit] fribidi/doc Makefile.am,1.12,1.13
- Next message: [FriBidi-commit] fribidi/lib Headers.mk, 1.5, 1.6 Makefile.am, 1.9,
1.10 common.h, 1.12, 1.13 debug.h, 1.6, 1.7 env.h, 1.2,
1.3 fribidi-bidi-type.c, 1.11, 1.12 fribidi-bidi-types-list.h,
1.4, 1.5 fribidi-bidi-types.c, 1.5, 1.6 fribidi-bidi-types.h,
1.7, 1.8 fribidi-joining-type.c, NONE,
1.1 fribidi-joining-type.h, NONE,
1.1 fribidi-joining-types-list.h, NONE,
1.1 fribidi-joining-types.c, NONE, 1.1 fribidi-joining-types.h,
NONE, 1.1 fribidi-joining.c, NONE, 1.1 fribidi-joining.h, NONE,
1.1 fribidi-mirroring.c, 1.10, 1.11 fribidi.def, 1.4,
1.5 joining-types.h, NONE, 1.1 run.h, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/fribidi/fribidi/gen.tab
In directory pdx:/tmp/cvs-serv32450/gen.tab
Modified Files:
Makefile.am gen-bidi-type-tab.c gen-mirroring-tab.c
gen-unicode-version.c packtab.c packtab.h
Added Files:
gen-joining-type-tab.c
Log Message:
First joining stuff checked in. Generate joining table using my beloved
packtab, in gen-joining-type-tab.c. Defined FriBidiJoiningType type and wrote
accompanying functions and macros.
Index: Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.am 9 Jun 2004 20:01:00 -0000 1.11
+++ Makefile.am 13 Jun 2004 20:11:42 -0000 1.12
@@ -1,9 +1,11 @@
EXTRA_PROGRAMS = \
gen-bidi-type-tab \
+ gen-joining-type-tab \
gen-mirroring-tab \
gen-unicode-version
gen_bidi_type_tab_SOURCES = gen-bidi-type-tab.c packtab.c packtab.h
+gen_joining_type_tab_SOURCES = gen-joining-type-tab.c packtab.c packtab.h
gen_mirroring_tab_SOURCES = gen-mirroring-tab.c packtab.c packtab.h
gen_unicode_version_SOURCES = gen-unicode-version.c
@@ -25,91 +27,67 @@
$(srcdir)/unidata/extracted \
$(top_builddir)/lib
+COMPRESSION = 4
+
# generate bidi-type.tab.i
gen_bidi_type_tab = gen-bidi-type-tab$(EXEEXT)
-COMPRESSION = 4
-
-BIDI_TYPE_TAB_VARIANTS = \
- UnicodeData_bidi-type.tab.i \
- DerivedBidiClass_bidi-type.tab.i
-
-UnicodeData_bidi-type.tab.i: \
- UnicodeData.txt \
+derived_bidi-type.tab.i: \
+ DerivedBidiClass.txt \
fribidi-unicode-version.h \
$(gen_bidi_type_tab_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) $(gen_bidi_type_tab)
+ ./$(gen_bidi_type_tab) $(COMPRESSION) $^ > $@ \
+ || ($(RM) $@ && false)
-DerivedBidiClass_bidi-type.tab.i: \
- DerivedBidiClass.txt \
+bidi-type.tab.i: \
+ UnicodeData.txt \
fribidi-unicode-version.h \
$(gen_bidi_type_tab_SOURCES)
-
-$(BIDI_TYPE_TAB_VARIANTS):
$(MAKE) $(AM_MAKEFLAGS) $(gen_bidi_type_tab)
- (DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
- ./$(gen_bidi_type_tab) $(COMPRESSION) \
- $$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
+ ./$(gen_bidi_type_tab) $(COMPRESSION) $^ > $@ \
+ || ($(RM) $@ && false)
-bidi-type.tab.i:
- @for x in $(BIDI_TYPE_TAB_VARIANTS); do \
- if $(MAKE) $(AM_MAKEFLAGS) $$x && mv $$x bidi-type.tab.i; then \
- break; \
- fi; \
- done; \
- test -f bidi-type.tab.i || (echo Could not build $@; false)
+DISTCLEANFILES += derived_bidi-type.tab.i
-DISTCLEANFILES += $(BIDI_TYPE_TAB_VARIANTS)
+# generate joining-type.tab.i
+
+gen_joining_type_tab = gen-joining-type-tab$(EXEEXT)
+
+joining-type.tab.i: \
+ UnicodeData.txt \
+ ArabicShaping.txt \
+ fribidi-unicode-version.h \
+ $(gen_joining_type_tab_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) $(gen_joining_type_tab)
+ ./$(gen_joining_type_tab) $(COMPRESSION) $^ > $@ \
+ || ($(RM) $@ && false)
# generate mirroring.tab.i
gen_mirroring_tab = gen-mirroring-tab$(EXEEXT)
-MIRRORING_TAB_VARIANTS = \
- BidiMirroring_mirroring.tab.i
-
-BidiMirroring_mirroring.tab.i: \
+mirroring.tab.i: \
BidiMirroring.txt \
fribidi-unicode-version.h \
$(gen_mirroring_tab_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_mirroring_tab)
- (DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
- ./$(gen_mirroring_tab) $(COMPRESSION) \
- $$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
-
-mirroring.tab.i:
- @for x in $(MIRRORING_TAB_VARIANTS); do \
- if $(MAKE) $(AM_MAKEFLAGS) $$x && mv $$x mirroring.tab.i; then \
- break; \
- fi; \
- done; \
- test -f mirroring.tab.i || (echo Could not build $@; false)
-
-DISTCLEANFILES += $(MIRRORING_TAB_VARIANTS)
+ ./$(gen_mirroring_tab) $(COMPRESSION) $^ > $@ \
+ || ($(RM) $@ && false)
# generate fribidi-unicode-version.h
gen_unicode_version = gen-unicode-version$(EXEEXT)
-UNICODE_VERSION_VARIANTS = \
- ReadMe_fribidi-unicode-version.h
-
-ReadMe_fribidi-unicode-version.h: \
+fribidi-unicode-version.h: \
ReadMe.txt \
$(gen_unicode_version_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) $(gen_unicode_version)
- (DATA_FILE_TYPE=`echo $< | sed s,.*/,,`; \
- ./$(gen_unicode_version) \
- $$DATA_FILE_TYPE $< > $@ || ($(RM) $@ && false))
-
-fribidi-unicode-version.h:
- @for x in $(UNICODE_VERSION_VARIANTS); do \
- if $(MAKE) $(AM_MAKEFLAGS) $$x && mv $$x fribidi-unicode-version.h; then \
- break; \
- fi; \
- done; \
- test -f fribidi-unicode-version.h || (echo Could not build $@; false)
+ ./$(gen_unicode_version) $< > $@ \
+ || ($(RM) $@ && false)
-DISTCLEANFILES += $(UNICODE_VERSION_VARIANTS)
+# generate all generators:
+gen: $(EXTRA_PROGRAMS)
.DELETE_ON_ERROR:
Index: gen-bidi-type-tab.c
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/gen-bidi-type-tab.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- gen-bidi-type-tab.c 9 Jun 2004 20:01:00 -0000 1.11
+++ gen-bidi-type-tab.c 13 Jun 2004 20:11:42 -0000 1.12
@@ -61,7 +61,7 @@
static void
die (
- char *msg
+ const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
@@ -70,8 +70,8 @@
static void
die2 (
- char *fmt,
- char *p
+ const char *fmt,
+ const char *p
)
{
fprintf (stderr, appname ": ");
@@ -82,9 +82,9 @@
static void
die3 (
- char *fmt,
+ const char *fmt,
unsigned long l,
- char *p
+ const char *p
)
{
fprintf (stderr, appname ": ");
@@ -105,7 +105,7 @@
struct
{
- char *name;
+ const char *name;
int key;
}
type_names[] =
@@ -119,11 +119,11 @@
#define type_names_count (sizeof (type_names) / sizeof (type_names[0]))
-static char *names[type_names_count];
+static const char *names[type_names_count];
static char
get_type (
- char *s
+ const char *s
)
{
int i;
@@ -131,7 +131,7 @@
for (i = 0; i < type_names_count; i++)
if (!strcmp (s, type_names[i].name))
return type_names[i].key;
- die2 ("type name `%s' not found", s);
+ die2 ("bidi type name `%s' not found", s);
return 0;
}
@@ -139,7 +139,8 @@
#define macro_name "FRIBIDI_GET_BIDI_TYPE"
static signed int table[FRIBIDI_UNICODE_CHARS];
-static char s[4000];
+static char buf[4000];
+static char tp[sizeof (buf)];
static void
init (
@@ -159,7 +160,6 @@
{
register FriBidiChar c;
- /* default types for reserved and noncharacter code points */
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
table[c] = LTR;
}
@@ -219,18 +219,21 @@
FILE *f
)
{
- char tp[10];
unsigned long c, l;
init_tab_unicode_data_txt ();
l = 0;
- while (fgets (s, sizeof s, f))
+ while (fgets (buf, sizeof buf, f))
{
int i;
+ const char *s = buf;
l++;
+ while (*s == ' ')
+ s++;
+
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
continue;
@@ -247,27 +250,30 @@
FILE *f
)
{
- char tp[10];
unsigned long c, c2, l;
init_tab_derived_bidi_class_txt ();
l = 0;
- while (fgets (s, sizeof s, f))
+ while (fgets (buf, sizeof buf, f))
{
int i;
register char typ;
+ const char *s = buf;
l++;
+ while (*s == ' ')
+ s++;
+
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
continue;
- i = sscanf (s, "%lx ; %s", &c, tp);
+ i = sscanf (s, "%lx ; %[^; ]", &c, tp);
if (i == 2)
c2 = c;
else
- i = sscanf (s, "%lx..%lx ; %s", &c, &c2, tp) - 1;
+ i = sscanf (s, "%lx..%lx ; %[^; ]", &c, &c2, tp) - 1;
if (i != 2 || c > c2 || c2 >= FRIBIDI_UNICODE_CHARS)
die3 ("invalid input at line %ld: %s", l, s);
@@ -280,8 +286,8 @@
static void
read_data (
- char *data_file_type,
- char *data_file_name
+ const char *data_file_type,
+ const char *data_file_name
)
{
FILE *f;
@@ -303,7 +309,7 @@
static void
gen_bidi_type_tab (
int max_depth,
- char *data_file_type
+ const char *data_file_type
)
{
fprintf (stderr, "Generating output, it may take up to a few minutes\n");
@@ -329,17 +335,16 @@
int
main (
int argc,
- char **argv
+ const char **argv
)
{
- 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"
- " * UnicodeData.txt\n" " * DerivedBidiClass.txt");
+ const char *data_file_type = "UnicodeData.txt";
+ if (argc < 3)
+ die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
+ data_file_type);
{
int max_depth = atoi (argv[1]);
- char *data_file_type = argv[2];
- char *data_file_name = argv[3];
+ const char *data_file_name = argv[2];
if (max_depth < 2)
die ("invalid depth");
--- NEW FILE: gen-joining-type-tab.c ---
/* FriBidi
* gen-joining-type-tab.c - generate joining-type.tab.i for libfribidi
*
* $Id: gen-joining-type-tab.c,v 1.1 2004/06/13 20:11:42 behdad Exp $
* $Author: behdad $
* $Date: 2004/06/13 20:11:42 $
* $Revision: 1.1 $
* $Source: /cvs/fribidi/fribidi/gen.tab/gen-joining-type-tab.c,v $
*
* Author:
* Behdad Esfahbod, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2004 Behdad Esfahbod
*
* 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA
*
* For licensing issues, contact <license at farsiweb.info>.
*/
#include <common.h>
#include <fribidi-unicode.h>
#include <stdio.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"
#define appname "gen-joining-type-tab"
#define outputname "joining-type.tab.i"
static void
die (
const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
const char *fmt,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
static void
die3 (
const char *fmt,
const char *p,
const char *q
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p, q);
fprintf (stderr, "\n");
exit (1);
}
static void
die3l (
const char *fmt,
unsigned long l,
const char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, l, p);
fprintf (stderr, "\n");
exit (1);
}
enum FriBidiJoiningLinearEnumOffsetOne
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE,
# include <fribidi-joining-types-list.h>
# undef _FRIBIDI_ADD_TYPE
NUM_TYPES
};
struct
{
const char *name;
int key;
}
type_names[] =
{
# define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) {STRINGIZE(TYPE), TYPE},
# include <fribidi-joining-types-list.h>
# undef _FRIBIDI_ADD_TYPE
};
#define type_names_count (sizeof (type_names) / sizeof (type_names[0]))
static const char *names[type_names_count];
static char
get_type (
const char *s
)
{
int i;
for (i = 0; i < type_names_count; i++)
if (!strcmp (s, type_names[i].name))
return type_names[i].key;
die2 ("joining type name `%s' not found", s);
return -1;
}
static const char *ignored_bidi_types[] = {
"BN",
"LRE",
"RLE",
"LRO",
"RLO",
"PDF",
NULL
};
static const char *transparent_general_categories[] = {
"Mn",
"Cf",
NULL
};
static const char *
type_is (
const char *s,
const char *type_list[]
)
{
for (; type_list[0]; type_list++)
if (!strcmp (s, type_list[0]))
return type_list[0];
return NULL;
}
#define table_name "Joi"
#define macro_name "FRIBIDI_GET_JOINING_TYPE"
static signed int table[FRIBIDI_UNICODE_CHARS];
static char buf[4000];
static char tp[sizeof (buf)], tp_gen[sizeof (buf)], tp_bidi[sizeof (buf)];
static void
clear_tab (
)
{
register FriBidiChar c;
for (c = 0; c < FRIBIDI_UNICODE_CHARS; c++)
table[c] = U;
}
static void
init (
)
{
register int i;
for (i = 0; i < type_names_count; i++)
names[i] = 0;
for (i = type_names_count - 1; i >= 0; i--)
names[type_names[i].key] = type_names[i].name;
clear_tab ();
}
static void
read_unicode_data_txt (
FILE *f
)
{
unsigned long c, l;
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (*s == '#' || *s == '\0' || *s == '\n')
continue;
i = sscanf (s, "%lx;%*[^;];%[^; ];%*[^;];%[^; ]", &c, tp_gen, tp_bidi);
if (i != 3 || c >= FRIBIDI_UNICODE_CHARS)
die3l ("UnicodeData.txt: invalid input at line %ld: %s", l, s);
if (type_is (tp_bidi, ignored_bidi_types))
table[c] = G;
if (type_is (tp_gen, transparent_general_categories))
table[c] = T;
}
}
static void
read_arabic_shaping_txt (
FILE *f
)
{
unsigned long c, c2, l;
l = 0;
while (fgets (buf, sizeof buf, f))
{
int i;
register char typ;
const char *s = buf;
l++;
while (*s == ' ')
s++;
if (*s == '#' || *s == '\0' || *s == '\n')
continue;
i = sscanf (s, "%lx ; %*[^;]; %[^; ]", &c, tp);
if (i == 2)
c2 = c;
else
i = sscanf (s, "%lx..%lx ; %*[^;]; %[^; ]", &c, &c2, tp) - 1;
if (i != 2 || c > c2 || c2 >= FRIBIDI_UNICODE_CHARS)
die3l ("ArabicShaping.txt: invalid input at line %ld: %s", l, s);
typ = get_type (tp);
for (; c <= c2; c++)
table[c] = typ;
}
}
static void
read_data (
const char *data_file_type[],
const char *data_file_name[]
)
{
FILE *f;
for (; data_file_name[0] && data_file_type[0];
data_file_name++, data_file_type++)
{
fprintf (stderr, "Reading `%s'\n", data_file_name[0]);
if (!(f = fopen (data_file_name[0], "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name[0]);
if (!strcmp (data_file_type[0], "UnicodeData.txt"))
read_unicode_data_txt (f);
else if (!strcmp (data_file_type[0], "ArabicShaping.txt"))
read_arabic_shaping_txt (f);
else
die2 ("error: unknown data-file type %s", data_file_type[0]);
fclose (f);
}
}
static void
gen_joining_type_tab (
int max_depth,
const char *data_file_type[]
)
{
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 files %s, %s of Unicode version "
FRIBIDI_UNICODE_VERSION ". */\n\n", data_file_type[0],
data_file_type[1]);
printf ("#define PACKTAB_UINT8 fribidi_uint8\n"
"#define PACKTAB_UINT16 fribidi_uint16\n"
"#define PACKTAB_UINT32 fribidi_uint32\n\n");
if (!pack_table
(table, FRIBIDI_UNICODE_CHARS, 1, U, max_depth, 1, 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");
}
int
main (
int argc,
const char **argv
)
{
const char *data_file_type[] =
{ "UnicodeData.txt", "ArabicShaping.txt", NULL };
if (argc < 4)
die3 ("usage:\n " appname " max-depth /path/to/%s /path/to/%s [junk...]",
data_file_type[0], data_file_type[1]);
{
int max_depth = atoi (argv[1]);
const char *data_file_name[] = { NULL, NULL, NULL };
data_file_name[0] = argv[2];
data_file_name[1] = argv[3];
if (max_depth < 2)
die ("invalid depth");
init ();
read_data (data_file_type, data_file_name);
gen_joining_type_tab (max_depth, data_file_type);
}
return 0;
}
Index: gen-mirroring-tab.c
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/gen-mirroring-tab.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- gen-mirroring-tab.c 9 Jun 2004 20:01:00 -0000 1.8
+++ gen-mirroring-tab.c 13 Jun 2004 20:11:42 -0000 1.9
@@ -61,7 +61,7 @@
static void
die (
- char *msg
+ const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
@@ -70,8 +70,8 @@
static void
die2 (
- char *fmt,
- char *p
+ const char *fmt,
+ const char *p
)
{
fprintf (stderr, appname ": ");
@@ -82,7 +82,7 @@
static void
die4 (
- char *fmt,
+ const char *fmt,
unsigned long l,
unsigned long p,
unsigned long q
@@ -95,10 +95,10 @@
}
#define table_name "Mir"
-#define macro_name "FRIBIDI_GET_MIRRORING_DELTA"
+#define macro_name "FRIBIDI_GET_MIRRORING"
static signed int table[FRIBIDI_UNICODE_CHARS];
-static char s[4000];
+static char buf[4000];
static signed long max_dist;
static void
@@ -119,7 +119,7 @@
}
static void
-init_tab_bidi_mirroring_txt (
+init_tab_mirroring_txt (
)
{
clear_tab ();
@@ -132,15 +132,21 @@
{
unsigned long l;
+ init_tab_mirroring_txt ();
+
l = 0;
- while (fgets (s, sizeof s, f))
+ while (fgets (buf, sizeof buf, f))
{
unsigned long i, j;
signed long dist;
int k;
+ const char *s = buf;
l++;
+ while (*s == ' ')
+ s++;
+
if (s[0] == '#' || s[0] == '\0' || s[0] == '\n')
continue;
@@ -159,8 +165,8 @@
static void
read_data (
- char *data_file_type,
- char *data_file_name
+ const char *data_file_type,
+ const char *data_file_name
)
{
FILE *f;
@@ -180,11 +186,11 @@
static void
gen_mirroring_tab (
int max_depth,
- char *data_file_type
+ const char *data_file_type
)
{
int key_bytes;
- char *key_type;
+ const char *key_type;
fprintf (stderr, "Generating output, it may take up to a few minutes\n");
printf ("/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME " "
@@ -201,28 +207,30 @@
if (!pack_table
(table, FRIBIDI_UNICODE_CHARS, key_bytes, 0, max_depth, 1, NULL,
- key_type, table_name, macro_name, stdout))
+ key_type, table_name, macro_name "_DELTA", stdout))
die ("error: insufficient memory, decrease max_depth");
printf ("#undef PACKTAB_UINT8\n"
"#undef PACKTAB_UINT16\n" "#undef PACKTAB_UINT32\n\n");
+ printf ("#define " macro_name "(x) ((x) + " macro_name "_DELTA(x))\n\n");
+
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
- char **argv
+ const char **argv
)
{
- 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");
+ const char *data_file_type = "BidiMirroring.txt";
+ if (argc < 3)
+ die2 ("usage:\n " appname " max-depth /path/to/%s [junk...]",
+ data_file_type);
{
int max_depth = atoi (argv[1]);
- char *data_file_type = argv[2];
- char *data_file_name = argv[3];
+ const char *data_file_name = argv[2];
if (max_depth < 2)
die ("invalid depth");
Index: gen-unicode-version.c
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/gen-unicode-version.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gen-unicode-version.c 31 May 2004 18:43:26 -0000 1.5
+++ gen-unicode-version.c 13 Jun 2004 20:11:42 -0000 1.6
@@ -11,7 +11,7 @@
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
- * Copyright (C) 2001,2002,2004 Behdad Esfahbod
+ * Copyright (C) 2004 Behdad Esfahbod
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -59,7 +59,7 @@
static void
die (
- char *msg
+ const char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
@@ -68,8 +68,8 @@
static void
die2 (
- char *fmt,
- char *p
+ const char *fmt,
+ const char *p
)
{
fprintf (stderr, appname ": ");
@@ -80,6 +80,7 @@
int version_major, version_minor, version_micro;
char unicode_version[100];
+char buf[4000];
static void
init (
@@ -94,13 +95,12 @@
FILE *f
)
{
- char s[200];
- char *p;
+ const char *s;
- while (fgets (s, sizeof s, f))
- if ((p = strstr (s, "Version")))
+ while (fgets (buf, sizeof buf, f))
+ if ((s = strstr (buf, "Version")))
{
- sscanf (p, "Version %d.%d.%d", &version_major, &version_minor,
+ sscanf (s, "Version %d.%d.%d", &version_major, &version_minor,
&version_micro);
sprintf (unicode_version, "%d.%d.%d", version_major, version_minor,
version_micro);
@@ -111,8 +111,8 @@
static void
read_data (
- char *data_file_type,
- char *data_file_name
+ const char *data_file_type,
+ const char *data_file_name
)
{
FILE *f;
@@ -131,7 +131,7 @@
static void
gen_unicode_version (
- char *data_file_type
+ const char *data_file_type
)
{
fprintf (stderr, "Generating output\n");
@@ -158,15 +158,15 @@
int
main (
int argc,
- char **argv
+ const char **argv
)
{
- if (argc != 3)
- die ("usage:\n " appname " data-file-type data-file-name\n"
- "where data-file-type is one of these:\n" " * ReadMe.txt");
+ const char *data_file_type = "ReadMe.txt";
+
+ if (argc < 2)
+ die2 ("usage:\n " appname " /path/to/%s [junk...]", data_file_type);
{
- char *data_file_type = argv[1];
- char *data_file_name = argv[2];
+ const char *data_file_name = argv[1];
init ();
read_data (data_file_type, data_file_name);
Index: packtab.c
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/packtab.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- packtab.c 9 Jun 2004 20:01:00 -0000 1.4
+++ packtab.c 13 Jun 2004 20:11:42 -0000 1.5
@@ -136,8 +136,7 @@
return 0;
}
-static int lev, p[22], nn;
-static int best_lev, best_p[22];
+static int lev, best_lev, p[22], best_p[22], nn;
static long c[22], best_c[22], s, best_s;
static long t[22], best_t[22], clusters[22], best_cluster[22];
@@ -366,16 +365,17 @@
else
fprintf (f, "%d", def_key);
fprintf (f, " : ");
- j = 1;
+ j = 0;
for (i = best_lev - 1; i >= 0; i--)
{
- fprintf (f, " \\\n\t%sLev%d[(x)", table_name, i);
- if (j != 1)
- fprintf (f, "/%d", j);
+ fprintf (f, " \\\n\t%sLev%d[((x)", table_name, i);
+ if (j != 0)
+ fprintf (f, " >> %d", j);
if (i)
- fprintf (f, "%%%ld +", pow[best_p[best_lev - 1 - i]]);
- j *= best_cluster[best_lev - 1 - i];
+ fprintf (f, " & 0x%02lx) +", pow[best_p[best_lev - 1 - i]] - 1);
+ j += best_p[best_lev - 1 - i];
}
+ fprintf (f, ")");
for (i = 0; i < best_lev; i++)
fprintf (f, "]");
fprintf (f, ")\n\n");
Index: packtab.h
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/packtab.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- packtab.h 9 Jun 2004 20:01:00 -0000 1.3
+++ packtab.h 13 Jun 2004 20:11:42 -0000 1.4
@@ -27,7 +27,7 @@
{
#endif
-#define packtab_version 2
+#define packtab_version 3
int pack_table (
const signed int *base,
- Previous message: [FriBidi-commit] fribidi/doc Makefile.am,1.12,1.13
- Next message: [FriBidi-commit] fribidi/lib Headers.mk, 1.5, 1.6 Makefile.am, 1.9,
1.10 common.h, 1.12, 1.13 debug.h, 1.6, 1.7 env.h, 1.2,
1.3 fribidi-bidi-type.c, 1.11, 1.12 fribidi-bidi-types-list.h,
1.4, 1.5 fribidi-bidi-types.c, 1.5, 1.6 fribidi-bidi-types.h,
1.7, 1.8 fribidi-joining-type.c, NONE,
1.1 fribidi-joining-type.h, NONE,
1.1 fribidi-joining-types-list.h, NONE,
1.1 fribidi-joining-types.c, NONE, 1.1 fribidi-joining-types.h,
NONE, 1.1 fribidi-joining.c, NONE, 1.1 fribidi-joining.h, NONE,
1.1 fribidi-mirroring.c, 1.10, 1.11 fribidi.def, 1.4,
1.5 joining-types.h, NONE, 1.1 run.h, 1.4, 1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the FriBidi-Commit
mailing list