[FriBidi-commit] fribidi/bin Makefile.am, 1.5,
1.6 fribidi-caprtl2utf8.c, NONE, 1.1
Behdad Esfahbod
behdad at freedesktop.org
Tue Jun 7 01:39:16 PDT 2005
Update of /cvs/fribidi/fribidi/bin
In directory gabe:/tmp/cvs-serv7964/bin
Modified Files:
Makefile.am
Added Files:
fribidi-caprtl2utf8.c
Log Message:
An integrated CapRTL to UTF-8 converter added.
Index: Makefile.am
===================================================================
RCS file: /cvs/fribidi/fribidi/bin/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile.am 7 Jun 2005 08:20:05 -0000 1.5
+++ Makefile.am 7 Jun 2005 08:39:14 -0000 1.6
@@ -1,6 +1,6 @@
bin_PROGRAMS = fribidi
-noinst_PROGRAMS = fribidi-benchmark fribidi-bidi-types
+noinst_PROGRAMS = fribidi-benchmark fribidi-bidi-types fribidi-caprtl2utf8
getopt_SOURCES = getopt.c getopt1.c getopt_int.h getopt.h gettext.h
--- NEW FILE: fribidi-caprtl2utf8.c ---
#include <stdio.h>
#include <string.h>
#include <fribidi.h>
char buf[BUFSIZ];
FriBidiChar ubuf[BUFSIZ];
int main()
{
FriBidiCharSet caprtl = fribidi_parse_charset("CapRTL");
FriBidiCharSet utf8 = fribidi_parse_charset("UTF-8");
while (fgets(buf, sizeof buf, stdin))
{
char eol[5];
FriBidiStrIndex len = strlen(buf);
while (len && (buf[len-1] == '\n' || buf[len-1] == '\r'))
len--;
strncpy (eol, buf + len, sizeof eol);
buf[len] = 0;
len = fribidi_charset_to_unicode (caprtl, buf, len, ubuf);
fprintf(stderr, "%d\n", len);
len = fribidi_unicode_to_charset (utf8, ubuf, len, buf);
buf[len] = 0;
printf ("%s%s", buf, eol);
}
return 0;
}
More information about the fribidi-commit
mailing list