1 /*
2  * $Id: chkxls.c,v 1.2 2001/06/14 18:16:11 ura Exp $
3  */
4 
5 /*
6  * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
7  * This file is part of FreeWnn.
8  *
9  * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
10  *
11  * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with GNU Emacs; see the file COPYING.  If not, write to the
25  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26  *
27  * Commentary:
28  *
29  * Change log:
30  *
31  * Last modified date: 8,Feb.1999
32  *
33  * Code:
34  *
35  */
36 
37 /*
38  * X11R5 Input Method Test Program
39  * chkxls.c v 1.0   Mon Mar 11 14:27:45 JST 1991
40  */
41 
42 /*
43  *      Author: Takashi Inoue    OMRON Corporation
44  *                               takashi@ari.ncl.omron.co.jp
45  */
46 
47 #include <stdio.h>
48 #include "exvalue.h"
49 #include "func.h"
50 
51 void
xlstr(ic,event)52 xlstr (ic, event)
53      XIC ic;
54      XEvent *event;
55 {
56   int res;
57   int cnt;
58   char mbbuf[MAX_BUF];
59   wchar_t wcbuf[MAX_BUF];
60   KeySym ksret;
61   Status stret;
62 
63   if (strflag == MB)
64     {
65       res = XmbLookupString (ic, event, mbbuf, sizeof (mbbuf), &ksret, &stret);
66     }
67   else if (strflag == WC)
68     {
69       res = XwcLookupString (ic, event, wcbuf, sizeof (wcbuf), &ksret, &stret);
70     }
71   cls (prdisp);
72   switch (stret)
73     {
74     case XLookupBoth:
75     case XLookupKeySym:
76       prprint ("Key Symbol returned.\n");
77       fprintf (icfp, "returned Key Symbol : 0x%X\n", ksret);
78       if (stret == XLookupKeySym)
79         prprint ("\nCheck your own eyes on the test window.\n\n");
80       break;
81     case XLookupChars:
82       prprint ("Character returned.\n");
83       prprint ("\nCheck your own eyes on the test window.\n\n");
84       for (cnt = 0; cnt < res; cnt++)
85         if (strflag == MB)
86           {
87             fprintf (icfp, "returned character code : 0x%X\n", mbbuf[cnt]);
88           }
89         else if (strflag == WC)
90           {
91             fprintf (icfp, "returned character code : 0x%X\n", wcbuf[cnt]);
92           }
93       fprintf (icfp, "\n");
94       break;
95     case XLookupNone:
96       prprint ("returned status : XLookupNone\n\n");
97       fprintf (icfp, "returned status : XLookupNone\n\n");
98       break;
99     case XBufferOverflow:
100       prprint ("returned status : XBufferOverflow\n\n");
101       fprintf (icfp, "returned status : XBufferOverflow\n\n");
102       break;
103     default:
104       prprint ("returned status : Unknown Value\n\n");
105       fprintf (icfp, "returned status : Unknown Value\n\n");
106       break;
107     }
108 }
109