From e6f6442ff4ec5b6b26b45560e9d436686f2bc62b Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 21 Jan 2009 12:49:23 +0000 Subject: [PATCH] *** empty log message *** --- Makefile.am | 19 ++++++++++++++++++- imtest3.c | 27 +++++++++++++++++++++++++-- mim-xml.c | 42 ++++++++++++++++++++++++++++++++++++++---- 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1cb4918..271d7e9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,8 @@ noinst_PROGRAMS = \ linebreak replace mimdemo mimdaemon fifotest1 fifotest2 \ imtest findfont gdkdraw finddb imsim langname viewfile pangotest \ - flt-gui flt-otf flt-hb flt-pango find-flt test + flt-gui flt-otf flt-hb flt-pango find-flt test key-aliases conv-by-im \ + mim-xml reader2 mimdemo_LDADD = -lgd mimdaemon_LDADD = -lgd @@ -20,6 +21,14 @@ test_SOURCES = test.c test_CFLAGS = @M17N_CFLAGS@ @M17NFLT_CFLAGS@ test_LDFLAGS= @M17N_LIBS@ @M17NFLT_LIBS@ +key_aliases_SOURCES = key-aliases.c +key_aliases_CFLAGS = @M17N_CFLAGS@ @M17NFLT_CFLAGS@ +key_aliases_LDFLAGS= @M17N_LIBS@ @M17NFLT_LIBS@ + +conv_by_im_SOURCES = conv-by-im.c +conv_by_im_CFLAGS = @M17N_CFLAGS@ @M17NFLT_CFLAGS@ +conv_by_im_LDFLAGS= @M17N_LIBS@ @M17NFLT_LIBS@ + flt_gui_SOURCES = flt.c flt_gui_CFLAGS = ${baseCFLAGS} @M17NGUI_CFLAGS@ -DFLT_GUI flt_gui_LDFLAGS = ${baseLIBS} @M17NGUI_LIBS@ @@ -40,6 +49,14 @@ find_flt_SOURCES = find-flt.c find_flt_CFLAGS = ${baseCFLAGS} @M17NFLT_CFLAGS@ find_flt_LDFLAGS = ${baseLIBS} @M17NFLT_LIBS@ +mim_xml_SOURCES = mim-xml.c +mim_xml_CFLAGS = `xml2-config --cflags` +mim_xml_LDFLAGS = `xml2-config --libs` + +reader2_SOURCES = reader2.c +reader2_CFLAGS = `xml2-config --cflags` +reader2_LDFLAGS = `xml2-config --libs` + verify: linebreak @echo "checking line breaking..." @for arg in "" --sp-cm --korean-sp --ai-as-id; do \ diff --git a/imtest3.c b/imtest3.c index 04a865c..f3dade6 100644 --- a/imtest3.c +++ b/imtest3.c @@ -7,6 +7,9 @@ main (int argc, char **argv) { MInputMethod *im; MInputContext *ic; + unsigned char byte[2]; + int i; + MSymbol prop, alias, sym; M17N_INIT (); im = minput_open_im (Mt, msymbol ("test"), NULL); @@ -15,11 +18,31 @@ main (int argc, char **argv) ic = minput_create_ic (im, NULL); if (ic) { - minput_filter (ic, msymbol ("\x80"), NULL); - minput_filter (ic, msymbol ("\x81"), NULL); + byte[0] = 0xd1; + byte[1] = 0; + minput_filter (ic, msymbol (byte), NULL); minput_destroy_ic (ic); } minput_close_im (im); } + prop = msymbol (" key-alias"); + byte[1] = 0; + for (i = 0; i < 256; i++) + { + byte[0] = i; + sym = msymbol ((char *) byte); + alias = msymbol_get (sym, prop); + if (alias) + { + printf ("%02X:", i); + while (alias && alias != sym) + { + printf (" %s", msymbol_name (alias)); + alias = msymbol_get (alias, prop); + } + printf ("\n"); + } + } + exit (0); } diff --git a/mim-xml.c b/mim-xml.c index 6c26109..ecd621c 100644 --- a/mim-xml.c +++ b/mim-xml.c @@ -7,9 +7,10 @@ #include void -error_exit (char *fmt, char *arg) +error_exit (char *fmt, const char *arg) { fprintf (stderr, fmt, arg); + fprintf (stderr, "\n"); exit (1); } @@ -20,16 +21,49 @@ main (int argc, char **argv) XPathContextPtr context; xmlXPathObjectPtr result; xmlChar *xpath = (xmlChar *) "//input-method"; - xmlChar *key; xmlNodeSetPtr nodeset; #endif - int i; + const xmlChar *name, *value; xmlTextReaderPtr reader; + int depth; - reader = xmlReaderForFile (argv[1], "utf-8", 0); + reader = xmlReaderForFile (argv[1], "utf-8", + XML_PARSE_NOBLANKS + /*XML_PARSE_XINCLUDE|XML_PARSE_NOENT*/); + /*xmlTextReaderRelaxNGValidate (reader, argv[2]);*/ + if (xmlTextReaderRead (reader) != 1) + error_exit ("Read error: %s", argv[1]); + if (! (name = xmlTextReaderConstLocalName (reader))) + error_exit ("No %s node", "input-method"); + printf ("%s", (char *) name); + xmlTextReaderRead (reader); + if (! (name = xmlTextReaderConstLocalName (reader))) + error_exit ("No inner node: %s", "tags"); + printf (" %s", (char *) name); + xmlTextReaderRead (reader); + printf (" %s", (char *) xmlTextReaderConstLocalName (reader)); + xmlTextReaderRead (reader); + printf (" %s", (char *) xmlTextReaderConstLocalName (reader)); + depth = xmlTextReaderDepth(reader); + value = xmlTextReaderConstValue (reader); + printf (" \"%s\"", (char *) value); + xmlTextReaderRead (reader); + xmlTextReaderRead (reader); + xmlTextReaderRead (reader); + value = xmlTextReaderConstValue (reader); + printf (" \"%s\"", (char *) value); + do { xmlTextReaderRead (reader); } + while (xmlTextReaderNodeType (reader) != XML_READER_TYPE_TEXT); + value = xmlTextReaderConstValue (reader); + if (depth == xmlTextReaderDepth(reader)) + printf (" \"%s\"", (char *) value); + printf ("\n"); + +#if 0 xmlTextReaderRelaxNGValidate (reader, argv[2]); while ((i = xmlTextReaderRead (reader)) == 1); printf ("%d\n\n", i); +#endif #if 0 doc = xmlParseFile (argv[1]); -- 1.7.10.4