[FriBidi-commit] fribidi/gen.tab gen-unicode-version.c, NONE,
1.1 .cvsignore, 1.1, 1.2 Makefile.am, 1.2,
1.3 gen-bidi-type-tab.c, 1.3, 1.4 gen-mirroring-tab.c, 1.2, 1.3
Behdad Esfahbod
behdad at pdx.freedesktop.org
Wed May 12 16:13:58 PDT 2004
- Previous message: [FriBidi-commit] fribidi/lib .cvsignore, 1.2, 1.3 Makefile.am, 1.5,
1.6 common.h, 1.7, 1.8 fribidi-bidi-type.c, 1.5,
1.6 fribidi-common.h, 1.4, 1.5 fribidi-unicode.h, 1.2, 1.3
- Next message: [FriBidi-commit] fribidi configure.ac, 1.6, 1.7 fribidi.pc.in,
1.1.1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/fribidi/fribidi/gen.tab
In directory pdx:/tmp/cvs-serv19332/gen.tab
Modified Files:
.cvsignore Makefile.am gen-bidi-type-tab.c gen-mirroring-tab.c
Added Files:
gen-unicode-version.c
Log Message:
gen-unicode-version is operational now.
--- NEW FILE: gen-unicode-version.c ---
/* FriBidi
* gen-unicode-version.c - generate fribidi-unicode-version.h for libfribidi
*
* $Id: gen-unicode-version.c,v 1.1 2004/05/12 23:13:55 behdad Exp $
* $Author: behdad $
* $Date: 2004/05/12 23:13:55 $
* $Revision: 1.1 $
* $Source: /cvs/fribidi/fribidi/gen.tab/gen-unicode-version.c,v $
*
* Author:
* Behdad Esfahbod, 2001, 2002, 2004
*
* Copyright (C) 2004 Sharif FarsiWeb, Inc
* Copyright (C) 2001,2002,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 <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-unicode-version"
#define outputname "fribidi-unicode-version.h"
static void
die (
char *msg
)
{
fprintf (stderr, appname ": %s\n", msg);
exit (1);
}
static void
die2 (
char *fmt,
char *p
)
{
fprintf (stderr, appname ": ");
fprintf (stderr, fmt, p);
fprintf (stderr, "\n");
exit (1);
}
int version_major, version_minor, version_micro;
char *unicode_version;
static void
init_tab (
)
{
version_major = version_minor = version_micro = 0;
unicode_version = "unknown";
}
static void
read_read_me_txt (
FILE *f
)
{
char s[200];
char *p;
while (fgets (s, sizeof s, f))
if ((p = strstr (s, "Version")))
{
sscanf (p, "Version %d.%d.%d", &version_major, &version_minor, &version_micro);
unicode_version = fribidi_malloc (100);
sprintf (unicode_version, "%d.%d.%d", version_major, version_minor,
version_micro);
return;
}
die ("error: version not found");
}
static void read_data (
char *data_file_type,
char *data_file_name
)
{
FILE *f;
fprintf (stderr, "Reading `%s'\n", data_file_name);
if (!(f = fopen (data_file_name, "rt")))
die2 ("error: cannot open `%s' for reading", data_file_name);
if (!strcmp(data_file_type, "ReadMe.txt"))
read_read_me_txt(f);
else
die2 ("error: unknown data-file type %s", data_file_type);
fclose(f);
}
static void
gen_unicode_version (
char *data_file_type
)
{
fprintf (stderr, "Generating output\n");
printf (
"/* " outputname "\n * generated by " appname " (" FRIBIDI_NAME FRIBIDI_VERSION ")\n"
" * from the file %s */\n\n", data_file_type);
printf ("#define FRIBIDI_UNICODE_VERSION \"%s\"\n"
"#define FRIBIDI_UNICODE_MAJOR_VERSION %d\n"
"#define FRIBIDI_UNICODE_MINOR_VERSION %d\n"
"#define FRIBIDI_UNICODE_MICRO_VERSION %d\n\n",
unicode_version, version_major, version_minor, version_micro);
printf ("/* End of generated " outputname " */\n");
}
int
main (
int argc,
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");
{
char *data_file_type = argv[1];
char *data_file_name = argv[2];
init_tab ();
read_data (data_file_type, data_file_name);
gen_unicode_version (data_file_type);
}
return 0;
}
Index: .cvsignore
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- a/.cvsignore 25 Apr 2004 19:13:35 -0000 1.1
+++ b/.cvsignore 12 May 2004 23:13:55 -0000 1.2
@@ -1,2 +1,3 @@
-fribidi-gen-bidi-type-table
-fribidi-gen-mirroring-table
+gen-bidi-type-table
+gen-mirroring-table
+gen-unicode-version
Index: Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/Makefile.am 12 May 2004 07:06:21 -0000 1.2
+++ b/Makefile.am 12 May 2004 23:13:55 -0000 1.3
@@ -1,7 +1,11 @@
-noinst_PROGRAMS = gen-bidi-type-tab gen-mirroring-tab
+noinst_PROGRAMS = \
+ gen-bidi-type-tab \
+ gen-mirroring-tab \
+ 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_unicode_version_SOURCES = gen-unicode-version.c
AM_CPPFLAGS = \
-I$(top_builddir)/lib \
Index: gen-bidi-type-tab.c
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/gen-bidi-type-tab.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- a/gen-bidi-type-tab.c 12 May 2004 08:17:19 -0000 1.3
+++ b/gen-bidi-type-tab.c 12 May 2004 23:13:55 -0000 1.4
@@ -179,7 +179,7 @@
while (fgets (s, sizeof s, f))
{
- sscanf (s, "%x;%*[^;];%*[^;];%*[^;];%[^;]", &i, tp);
+ sscanf (s, "%x;%*[^;];%*[^;];%*[^;];%9[^;]", &i, tp);
table[i] = get_type (tp);
}
}
@@ -213,7 +213,7 @@
{
fprintf (stderr, "Generating output, it may take up to a few minutes\n");
printf (
- "/* " outputname " generated by " appname " (" FRIBIDI_NAME FRIBIDI_VERSION ")\n"
+ "/* " 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 ("#define PACKTAB_UINT8 fribidi_uint8\n"
Index: gen-mirroring-tab.c
===================================================================
RCS file: /cvs/fribidi/fribidi/gen.tab/gen-mirroring-tab.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/gen-mirroring-tab.c 12 May 2004 07:06:21 -0000 1.2
+++ b/gen-mirroring-tab.c 12 May 2004 23:13:55 -0000 1.3
@@ -143,7 +143,7 @@
FriBidiChar i;
fprintf (stderr, "Generating output, it may take up to a few seconds\n");
- printf ("/* " outputname " generated by " appname " (" FRIBIDI_NAME FRIBIDI_VERSION ")\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");
- Previous message: [FriBidi-commit] fribidi/lib .cvsignore, 1.2, 1.3 Makefile.am, 1.5,
1.6 common.h, 1.7, 1.8 fribidi-bidi-type.c, 1.5,
1.6 fribidi-common.h, 1.4, 1.5 fribidi-unicode.h, 1.2, 1.3
- Next message: [FriBidi-commit] fribidi configure.ac, 1.6, 1.7 fribidi.pc.in,
1.1.1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the FriBidi-Commit
mailing list