1 /*
2  * $Id: chkic.c,v 1.2 2001/06/14 18:16:10 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  * chkic.c v 1.0   Tue Mar  5 19:20:16 JST 1991
40  */
41 
42 /*
43  *      Author: Takashi Inoue    OMRON Corporation
44  *                               takashi@ari.ncl.omron.co.jp
45  *
46  *              Shoji kamada     OMRON Corporation
47  *                               kamada@ari.ncl.omron.co.jp
48  *
49  */
50 
51 #include <stdio.h>
52 
53 #include "exvalue.h"
54 #include "func.h"
55 
56 /* *INDENT-OFF* */
57 XIC
createic(im,mode,lfdir,flag)58 createic (im, mode, lfdir, flag)        /* check of XCreateIC */
59      XIM im;
60      FLAG mode;
61      char *lfdir;
62      FLAG *flag;
63 /* *INDENT-ON* */
64 {
65   XIC ic;
66   int cnt;
67   XIC onmust (), onmay (), overmust (), overmay (), rootmust (), rootmay ();
68 
69   static CRICMF ftbl[MODENUM] = {
70     {ONSP, onmust, onmay},
71     {OVERSP, overmust, overmay},
72     {OFFSP, offmust, offmay},
73     {ROOTW, rootmust, rootmay},
74     {NULL, NULL, NULL}
75   };
76 
77   for (cnt = 0; ftbl[cnt].mode != NULL; cnt++)
78     {
79       if (mode == ftbl[cnt].mode)
80         {
81           ic = (*ftbl[cnt].fmust) (im, lfdir, flag);
82           if (ic == NULL)
83             {
84               return (ic);
85             }
86           ic = (*ftbl[cnt].fmay) (im, flag);
87           return (ic);
88         }
89     }
90   return (NULL);
91 }
92 
93 /* *INDENT-OFF* */
94 XIC
onmust(im,lfdir,flag)95 onmust (im, lfdir, flag)        /* for ON-the-spot mode (MUST) */
96      XIM im;
97      char *lfdir;
98      FLAG *flag;
99 /* *INDENT-ON* */
100 
101 {
102   XIC ic;
103   static int cntlog = 1;
104   char logfile[MAX_BUF];
105   int cnt;
106   int sum;
107   XIMStyle gistyle;
108   CALLBACK gpec;
109   CALLBACK gstc;
110   XVaNestedList cpe_nelist, cst_nelist;
111   XVaNestedList gpe_nelist, gst_nelist;
112   VALUABLE *von[ONMUST];
113 
114   prmode ("X11R5 Input Method Test Program : <<on-the-spot mode>>");
115   prstatus ("Creating log file for ic...");     /* open log file for IC test */
116   sprintf (logfile, "%s/ticon.log%d", lfdir, cntlog);
117   icfp = fopen (logfile, "w");
118   cntlog++;
119   prstatus ("done.");
120   prstatus ("Creating NestedList for set...");
121   /* create NestedList for create IC (must) */
122   uistyle = (XIMPreeditCallbacks | XIMStatusCallbacks); /* initialize valuables */
123   upec.start.client_data = NULL;
124   upec.start.callback = (XIMProc) pe_start;
125   upec.done.client_data = NULL;
126   upec.done.callback = (XIMProc) pe_done;
127   upec.draw.client_data = NULL;
128   upec.draw.callback = (XIMProc) pe_draw;
129   upec.caret.client_data = NULL;
130   upec.caret.callback = (XIMProc) pe_caret;
131   ustc.start.client_data = NULL;
132   ustc.start.callback = (XIMProc) st_start;
133   ustc.done.client_data = NULL;
134   ustc.done.callback = (XIMProc) st_done;
135   ustc.draw.client_data = NULL;
136   ustc.draw.callback = (XIMProc) st_draw;
137   cpe_nelist = XVaCreateNestedList (DUMMY, XNPreeditStartCallback, &upec.start, XNPreeditDoneCallback, &upec.done, XNPreeditDrawCallback, &upec.draw, XNPreeditCaretCallback, &upec.caret, NULL);
138   cst_nelist = XVaCreateNestedList (DUMMY, XNStatusStartCallback, &ustc.start, XNStatusDoneCallback, &ustc.done, XNStatusDrawCallback, &ustc.draw, NULL);
139   prstatus ("done.");
140 
141   prstatus ("Creating ic...");  /* test of XCreateIC() (must) */
142   ic = XCreateIC (im, XNInputStyle, uistyle, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
143   prstatus ("done.");
144   if (ic == NULL)
145     {                           /* transaction of error */
146       cls (prdisp);
147       prprint ("Test of XCreateIC() <must> is failed.\n");
148       prprint ("Cannot create IC. NULL returned.\n");
149       prprint ("This program will shutdown soon.\n\n");
150       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
151       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
152       *flag = CRICERR;
153       return (NULL);
154     }
155   prstatus ("Creating NestedList for get...");
156   /* Create NestedList for GetICValues() (must) */
157   gpe_nelist = XVaCreateNestedList (DUMMY, XNPreeditStartCallback, &gpec.start, XNPreeditDoneCallback, &gpec.done, XNPreeditDrawCallback, &gpec.draw, XNPreeditCaretCallback, &gpec.caret, NULL);
158   gst_nelist = XVaCreateNestedList (DUMMY, XNStatusStartCallback, &gstc.start, XNStatusDoneCallback, &gstc.done, XNStatusDrawCallback, &gstc.draw, NULL);
159   prstatus ("done.");
160 
161   prstatus ("Test of GetICValues()...");        /* test of GetICValues() (must) */
162   XGetICValues (ic, XNInputStyle, &gistyle, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
163   prstatus ("done.");
164 
165 
166   sum = 0;                      /* verify valuables */
167   von[0] = mkstruct (IS, HEX, uistyle, gistyle);
168   von[1] = mkstruct (PSL, HEX, upec.start.client_data, gpec.start.client_data);
169   von[2] = mkstruct (PSA, HEX, upec.start.callback, gpec.start.callback);
170   von[3] = mkstruct (POL, HEX, upec.done.client_data, gpec.done.client_data);
171   von[4] = mkstruct (POA, HEX, upec.done.callback, gpec.done.callback);
172   von[5] = mkstruct (PRL, HEX, upec.draw.client_data, gpec.draw.client_data);
173   von[6] = mkstruct (PRA, HEX, upec.draw.callback, gpec.draw.callback);
174   von[7] = mkstruct (PCL, HEX, upec.caret.client_data, gpec.caret.client_data);
175   von[8] = mkstruct (PCA, HEX, upec.caret.callback, gpec.caret.callback);
176   von[9] = mkstruct (SSL, HEX, ustc.start.client_data, gstc.start.client_data);
177   von[10] = mkstruct (SSA, HEX, ustc.start.callback, gstc.start.callback);
178   von[11] = mkstruct (SOL, HEX, ustc.done.client_data, gstc.done.client_data);
179   von[12] = mkstruct (SOA, HEX, ustc.done.callback, gstc.done.callback);
180   von[13] = mkstruct (SRL, HEX, ustc.draw.client_data, gstc.draw.client_data);
181   von[14] = mkstruct (SRA, HEX, ustc.draw.callback, gstc.draw.callback);
182   for (cnt = 0; cnt < ONMUST; cnt++)
183     {
184       sum += verval (von[cnt]);
185     }
186 
187   cls (prdisp);
188   prveres (sum);
189   if (sum != NOERR)
190     {
191       prprint ("Test of XCreateIC() <must> is failed.\n");
192       prprint ("This program will shutdown soon.\n\n");
193       prverlog (sum);
194       fprintf (icfp, "...Test of XCreateIC <must> is failed.\n\n");
195       *flag = GICERR;
196       return (NULL);
197     }
198   else
199     {
200       prprint ("Test of XCreateIC() <must> is succeeded.\n");
201       prprint ("move next test.\n\n");
202       prverlog (sum);
203       fprintf (icfp, "...Test of XCreateIC <must> is succeeded.\n\n");
204     }
205   XFree ((char *) cpe_nelist);
206   XFree ((char *) cst_nelist);
207   XFree ((char *) gpe_nelist);
208   XFree ((char *) gst_nelist);
209   return (ic);
210 }
211 
212 /* *INDENT-OFF* */
213 XIC
onmay(im,flag)214 onmay (im, flag)                /* for ON-the-spot mode (MAY) */
215      XIM im;
216      FLAG *flag;
217 /* *INDENT-ON* */
218 
219 {
220   XIC ic;
221   int cnt;
222   int sum;
223   XIMStyle gistyle;
224   Window gclient;
225   Window gfocus;
226   CALLBACK gpec;
227   CALLBACK gstc;
228   XVaNestedList cpe_nelist, cst_nelist;
229   XVaNestedList gpe_nelist, gst_nelist;
230   VALUABLE *von[ONMUST];
231 
232   prmode ("X11R5 Input Method Test Program : <<on-the-spot mode>>");
233   prstatus ("Creating NestedList for set...");
234   /* create NestedList for create IC (must) */
235   uistyle = (XIMPreeditCallbacks | XIMStatusCallbacks); /* initialize valuables */
236   uclient = window1.win;
237   ufocus = window3.win;
238   ufname = window3.name;
239   upec.start.client_data = NULL;
240   upec.start.callback = (XIMProc) pe_start;
241   upec.done.client_data = NULL;
242   upec.done.callback = (XIMProc) pe_done;
243   upec.draw.client_data = NULL;
244   upec.draw.callback = (XIMProc) pe_draw;
245   upec.caret.client_data = NULL;
246   upec.caret.callback = (XIMProc) pe_caret;
247   ustc.start.client_data = NULL;
248   ustc.start.callback = (XIMProc) st_start;
249   ustc.done.client_data = NULL;
250   ustc.done.callback = (XIMProc) st_done;
251   ustc.draw.client_data = NULL;
252   ustc.draw.callback = (XIMProc) st_draw;
253   cpe_nelist = XVaCreateNestedList (DUMMY, XNPreeditStartCallback, &upec.start, XNPreeditDoneCallback, &upec.done, XNPreeditDrawCallback, &upec.draw, XNPreeditCaretCallback, &upec.caret, NULL);
254   cst_nelist = XVaCreateNestedList (DUMMY, XNStatusStartCallback, &ustc.start, XNStatusDoneCallback, &ustc.done, XNStatusDrawCallback, &ustc.draw, NULL);
255   prstatus ("done.");
256 
257   prstatus ("Creating ic...");  /* test of XCreateIC() (must) */
258   ic = XCreateIC (im, XNInputStyle, uistyle, XNClientWindow, uclient, XNFocusWindow, ufocus, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
259   prstatus ("done.");
260   if (ic == NULL)
261     {                           /* transaction of error */
262       cls (prdisp);
263       prprint ("Test of XCreateIC() <must> is failed.\n");
264       prprint ("Cannot create IC. NULL returned.\n");
265       prprint ("This program will shutdown soon.\n\n");
266       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
267       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
268       *flag = CRICERR;
269       return (NULL);
270     }
271   prstatus ("Creating NestedList for get...");
272   /* Create NestedList for GetICValues() (must) */
273   gpe_nelist = XVaCreateNestedList (DUMMY, XNPreeditStartCallback, &gpec.start, XNPreeditDoneCallback, &gpec.done, XNPreeditDrawCallback, &gpec.draw, XNPreeditCaretCallback, &gpec.caret, NULL);
274   gst_nelist = XVaCreateNestedList (DUMMY, XNStatusStartCallback, &gstc.start, XNStatusDoneCallback, &gstc.done, XNStatusDrawCallback, &gstc.draw, NULL);
275   prstatus ("done.");
276 
277   prstatus ("Test of GetICValues()...");        /* test of GetICValues() (must) */
278   XGetICValues (ic, XNInputStyle, &gistyle, XNClientWindow, &gclient, XNFocusWindow, &gfocus, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
279   prstatus ("done.");
280 
281 
282   sum = 0;                      /* verify valuables */
283   von[0] = mkstruct (IS, HEX, uistyle, gistyle);
284   von[1] = mkstruct (CW, HEX, uclient, gclient);
285   von[2] = mkstruct (FW, HEX, ufocus, gfocus);
286   von[3] = mkstruct (PSL, HEX, upec.start.client_data, gpec.start.client_data);
287   von[4] = mkstruct (PSA, HEX, upec.start.callback, gpec.start.callback);
288   von[5] = mkstruct (POL, HEX, upec.done.client_data, gpec.done.client_data);
289   von[6] = mkstruct (POA, HEX, upec.done.callback, gpec.done.callback);
290   von[7] = mkstruct (PRL, HEX, upec.draw.client_data, gpec.draw.client_data);
291   von[8] = mkstruct (PRA, HEX, upec.draw.callback, gpec.draw.callback);
292   von[9] = mkstruct (PCL, HEX, upec.caret.client_data, gpec.caret.client_data);
293   von[10] = mkstruct (PCA, HEX, upec.caret.callback, gpec.caret.callback);
294   von[11] = mkstruct (SSL, HEX, ustc.start.client_data, gstc.start.client_data);
295   von[12] = mkstruct (SSA, HEX, ustc.start.callback, gstc.start.callback);
296   von[13] = mkstruct (SOL, HEX, ustc.done.client_data, gstc.done.client_data);
297   von[14] = mkstruct (SOA, HEX, ustc.done.callback, gstc.done.callback);
298   von[15] = mkstruct (SRL, HEX, ustc.draw.client_data, ustc.draw.client_data);
299   von[16] = mkstruct (SRA, HEX, ustc.draw.callback, gstc.draw.callback);
300   for (cnt = 0; cnt < ONMAY; cnt++)
301     {
302       sum += verval (von[cnt]);
303     }
304 
305   cls (prdisp);
306   prveres (sum);
307   if (sum != NOERR)
308     {
309       prprint ("Test of XCreateIC() <must> is failed.\n");
310       prprint ("This program will shutdown soon.\n\n");
311       prverlog (sum);
312       fprintf (icfp, "...Test of XCreateIC <must> is failed.\n\n");
313       *flag = GICERR;
314       return (NULL);
315     }
316   else
317     {
318       prprint ("Test of XCreateIC() <must> is succeeded.\n");
319       prprint ("move next test.\n\n");
320       prverlog (sum);
321       fprintf (icfp, "...Test of XCreateIC <must> is succeeded.\n\n");
322     }
323   XFree ((char *) cpe_nelist);
324   XFree ((char *) cst_nelist);
325   XFree ((char *) gpe_nelist);
326   XFree ((char *) gst_nelist);
327   return (ic);
328 }
329 
330 /* *INDENT-OFF* */
331 XIC
overmust(im,lfdir,flag)332 overmust (im, lfdir, flag)      /* for OVER-the-spot mode (MUST) */
333      XIM im;
334      char *lfdir;
335      FLAG *flag;
336 /* *INDENT-ON* */
337 
338 {
339   XIC ic;
340   static int cntlog = 1;
341   char logfile[MAX_BUF];
342   int cnt;
343   int sum;
344   XIMStyle gistyle;
345   XPoint *gspot;
346   XFontSet gpfset, gsfset;
347   XVaNestedList cpe_nelist, cst_nelist;
348   XVaNestedList gpe_nelist, gst_nelist;
349   VALUABLE *vover[OVERMUST];
350 
351   prmode ("X11R5 Input Method Test Program : <<over-the-spot mode>>");
352   prstatus ("Creating log file for ic...");     /* open log file for IC test */
353   sprintf (logfile, "%s/ticover.log%d", lfdir, cntlog);
354   icfp = fopen (logfile, "w");
355   cntlog++;
356   prstatus ("done.");
357   prstatus ("Creating NestedList for set...");
358   /* create NestedList for create IC (must) */
359   uistyle = (XIMPreeditPosition | XIMStatusArea);       /* initialize valuables */
360   upea.spot.x = XPSL1;
361   upea.spot.y = YPSL;
362   upea.fset = fontset[0];
363   usta.fset = fontset[1];
364   cpe_nelist = XVaCreateNestedList (DUMMY, XNSpotLocation, &upea.spot, XNFontSet, upea.fset, NULL);
365   cst_nelist = XVaCreateNestedList (DUMMY, XNFontSet, usta.fset, NULL);
366   prstatus ("done.");
367 
368   prstatus ("Creating ic...");  /* test of XCreateIC() (must) */
369   ic = XCreateIC (im, XNInputStyle, uistyle, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
370   prstatus ("done.");
371   if (ic == NULL)
372     {                           /* transaction of error */
373       cls (prdisp);
374       prprint ("Test of XCreateIC() <must> is failed.\n");
375       prprint ("Cannot create IC. NULL returned.\n");
376       prprint ("This program will shutdown soon.\n\n");
377       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
378       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
379       *flag = CRICERR;
380       return (NULL);
381     }
382   prstatus ("Creating NestedList for get...");
383   /* Create NestedList for GetICValues() (must) */
384   gpe_nelist = XVaCreateNestedList (DUMMY, XNSpotLocation, &gspot, XNFontSet, &gpfset, NULL);
385   gst_nelist = XVaCreateNestedList (DUMMY, XNFontSet, &gsfset, NULL);
386   prstatus ("done.");
387 
388   prstatus ("Test of GetICValues()...");        /* test of GetICValues() (must) */
389   XGetICValues (ic, XNInputStyle, &gistyle, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
390   prstatus ("done.");
391 
392   sum = 0;                      /* verify valuables */
393   vover[0] = mkstruct (IS, HEX, uistyle, gistyle);
394   vover[1] = mkstruct (PSLX, DEC, upea.spot.x, gspot->x);
395   vover[2] = mkstruct (PSLY, DEC, upea.spot.y, gspot->y);
396   vover[3] = mkstruct (PFS, HEX, upea.fset, gpfset);
397   vover[4] = mkstruct (SFS, HEX, usta.fset, gsfset);
398   for (cnt = 0; cnt < OVERMUST; cnt++)
399     {
400       sum += verval (vover[cnt]);
401     }
402 
403   cls (prdisp);
404   prveres (sum);
405   if (sum != NOERR)
406     {
407       prprint ("Test of XCreateIC() <must> is failed.\n");
408       prprint ("This program will shutdown soon.\n\n");
409       prverlog (sum);
410       fprintf (icfp, "...Test of XCreateIC <must> is failed.\n\n");
411       *flag = GICERR;
412       return (NULL);
413     }
414   else
415     {
416       prprint ("Test of XCreateIC() <must> is succeeded.\n");
417       prprint ("move next test.\n\n");
418       prverlog (sum);
419       fprintf (icfp, "...Test of XCreateIC <must> is succeeded.\n\n");
420     }
421   XFree ((char *) cpe_nelist);
422   XFree ((char *) cst_nelist);
423   XFree ((char *) gpe_nelist);
424   XFree ((char *) gst_nelist);
425   XFree ((XPoint *) gspot);
426   return (ic);
427 }
428 
429 
430 /* *INDENT-OFF* */
431 XIC
overmay(im,flag)432 overmay (im, flag)              /* for OVER-the-spot mode (MAY) */
433      XIM im;
434      FLAG *flag;
435 /* *INDENT-ON* */
436 
437 {
438   XIC ic;
439   int cnt;
440   int sum;
441   XIMStyle gistyle;
442   Window gclient;
443   Window gfocus;
444   RESOURCE gres;
445   XRectangle *gparea, *gsarea;
446   XPoint *gspot;
447   Colormap gpcmap, gscmap;
448   u_long gpfg, gpbg, gsfg, gsbg;
449   Pixmap gppix, gspix;
450   XFontSet gpfset, gsfset;
451   int glspc;
452   Cursor gpcursor, gscursor;
453   XVaNestedList cpe_nelist, cst_nelist;
454   XVaNestedList gpe_nelist, gst_nelist;
455   VALUABLE *vover[OVERMAY];
456 
457   prmode ("X11R5 Input Method Test Program : <<over-the-spot mode>>");
458   prstatus ("Creating NestedList for set...");
459   /* create NestedList for create IC (may) */
460   uistyle = (XIMPreeditPosition | XIMStatusArea);       /* initialize valuables */
461   uclient = window1.win;
462   ufocus = window3.win;
463   ufname = window3.name;
464   ures.name = "xim";
465   ures.class = "Xim";
466   usta.area.x = WIN_ITV;
467   usta.area.y = CALCY ((CALCY (W1_HEIGHT, NW_HEIGHT)), PS_HEIGHT);
468   usta.area.width = ST_WIDTH;
469   usta.area.height = PS_HEIGHT;
470   usta.cmap = cmap[0];
471   usta.fg = pixel[cmflag][0];
472   usta.bg = pixel[cmflag][3];
473   usta.bgpm = pix[1];
474   usta.fset = fontset[1];
475   usta.cursor = cursor[1];
476   upea.area.x = XPOVER;
477   upea.area.y = YPOVER;
478   upea.area.width = WPOVER1;
479   upea.area.height = HPOVER;
480   upea.spot.x = XPSL1;
481   upea.spot.y = YPSL;
482   upea.cmap = cmap[0];
483   upea.fg = pixel[cmflag][3];
484   upea.bg = pixel[cmflag][0];
485   upea.bgpm = pix[0];
486   upea.fset = fontset[0];
487   upea.lspc = LSPC1;
488   upea.cursor = cursor[0];
489   cpe_nelist = XVaCreateNestedList (DUMMY, XNArea, &upea.area,
490                                     XNSpotLocation, &upea.spot,
491                                     XNColormap, upea.cmap,
492                                     XNForeground, upea.fg, XNBackground, upea.bg, XNBackgroundPixmap, upea.bgpm, XNFontSet, upea.fset, XNLineSpace, upea.lspc, XNCursor, upea.cursor, NULL);
493   cst_nelist = XVaCreateNestedList (DUMMY, XNArea, &usta.area,
494                                     XNColormap, usta.cmap, XNForeground, usta.fg, XNBackground, usta.bg, XNBackgroundPixmap, usta.bgpm, XNFontSet, usta.fset, XNCursor, usta.cursor, NULL);
495   prstatus ("done.");
496 
497   prstatus ("Creating ic...");  /* test of XCreateIC() (may) */
498   ic = XCreateIC (im, XNInputStyle, uistyle,
499                   XNClientWindow, uclient, XNFocusWindow, ufocus, XNResourceName, ures.name, XNResourceClass, ures.class, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
500   prstatus ("done.");
501   if (ic == NULL)
502     {                           /* transaction of error */
503       cls (prdisp);
504       prprint ("Test of XCreateIC() <must> is failed.\n");
505       prprint ("Cannot create IC. NULL returned.\n");
506       prprint ("This program will shutdown soon.\n\n");
507       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
508       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
509       *flag = CRICERR;
510       return (NULL);
511     }
512 
513   prstatus ("Creating NestedList for get...");
514   /* Create NestedList for GetICValues() (may) */
515   gpe_nelist = XVaCreateNestedList (DUMMY, XNArea, &gparea,
516                                     XNSpotLocation, &gspot,
517                                     XNColormap, &gpcmap, XNForeground, &gpfg, XNBackground, &gpbg, XNBackgroundPixmap, &gppix, XNFontSet, &gpfset, XNLineSpace, &glspc, XNCursor, &gpcursor, NULL);
518   gst_nelist = XVaCreateNestedList (DUMMY, XNArea, &gsarea, XNColormap, &gscmap, XNForeground, &gsfg, XNBackground, &gsbg, XNBackgroundPixmap, &gspix, XNFontSet, &gsfset, XNCursor, &gscursor, NULL);
519   prstatus ("done.");
520   prstatus ("Test of XGetICValues()...");       /* test of GetICValues() (may) */
521   XGetICValues (ic, XNInputStyle, &gistyle,
522                 XNClientWindow, &gclient, XNFocusWindow, &gfocus, XNResourceName, &gres.name, XNResourceClass, &gres.class, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
523   prstatus ("done.");
524 
525   sum = 0;                      /* verify valuables */
526   vover[0] = mkstruct (IS, HEX, uistyle, gistyle);
527   vover[1] = mkstruct (CW, HEX, uclient, gclient);
528   vover[2] = mkstruct (FW, HEX, ufocus, gfocus);
529   vover[3] = mkstruct (RN, STR, ures.name, gres.name);
530   vover[4] = mkstruct (RC, STR, ures.class, gres.class);
531   vover[5] = mkstruct (PAX, DEC, upea.area.x, gparea->x);
532   vover[6] = mkstruct (PAY, DEC, upea.area.y, gparea->y);
533   vover[7] = mkstruct (PAW, DEC, upea.area.width, gparea->width);
534   vover[8] = mkstruct (PAH, DEC, upea.area.height, gparea->height);
535   vover[9] = mkstruct (PSLX, DEC, upea.spot.x, gspot->x);
536   vover[10] = mkstruct (PSLY, DEC, upea.spot.y, gspot->y);
537   vover[11] = mkstruct (PCM, HEX, upea.cmap, gpcmap);
538   vover[12] = mkstruct (PFG, HEX, upea.fg, gpfg);
539   vover[13] = mkstruct (PBG, HEX, upea.bg, gpbg);
540   vover[14] = mkstruct (PBP, HEX, upea.bgpm, gppix);
541   vover[15] = mkstruct (PFS, HEX, upea.fset, gpfset);
542   vover[16] = mkstruct (PLS, DEC, upea.lspc, glspc);
543   vover[17] = mkstruct (PCU, HEX, upea.cursor, gpcursor);
544   vover[18] = mkstruct (SAX, DEC, usta.area.x, gsarea->x);
545   vover[19] = mkstruct (SAY, DEC, usta.area.y, gsarea->y);
546   vover[20] = mkstruct (SAW, DEC, usta.area.width, gsarea->width);
547   vover[21] = mkstruct (SAH, DEC, usta.area.height, gsarea->height);
548   vover[22] = mkstruct (SCM, HEX, usta.cmap, gscmap);
549   vover[23] = mkstruct (SFG, HEX, usta.fg, gsfg);
550   vover[24] = mkstruct (SBG, HEX, usta.bg, gsbg);
551   vover[25] = mkstruct (SBP, HEX, usta.bgpm, gspix);
552   vover[26] = mkstruct (SFS, HEX, usta.fset, gsfset);
553   vover[27] = mkstruct (SCU, HEX, usta.cursor, gscursor);
554   for (cnt = 0; cnt < OVERMAY; cnt++)
555     {
556       sum += verval (vover[cnt]);
557     }
558 
559   cls (prdisp);
560   prveres (sum);
561   if (sum != NOERR)
562     {
563       prprint ("Test of XCreateIC() <may> is failed.\n");
564       prprint ("This program will shutdown soon.\n\n");
565       prverlog (sum);
566       fprintf (icfp, "...Test of XCreateIC <may> is failed.\n\n");
567       *flag = GICERR;
568       return (NULL);
569     }
570   else
571     {
572       prprint ("Test of XCreateIC() <may> is succeeded.\n");
573       prprint ("move next test.\n\n");
574       prverlog (sum);
575       fprintf (icfp, "...Test of XCreateIC <may> is succeeded.\n\n");
576     }
577   XFree ((char *) cpe_nelist);
578   XFree ((char *) cst_nelist);
579   XFree ((char *) gpe_nelist);
580   XFree ((char *) gst_nelist);
581   XFree ((XRectangle *) gparea);
582   XFree ((XRectangle *) gsarea);
583   XFree ((XPoint *) gspot);
584   return (ic);
585 }
586 
587 /* *INDENT-OFF* */
588 XIC
offmust(im,lfdir,flag)589 offmust (im, lfdir, flag)       /* for OFF-the-spot mode (MUST) */
590      XIM im;
591      char *lfdir;
592      FLAG *flag;
593 /* *INDENT-ON* */
594 
595 {
596   XIC ic;
597   static int cntlog = 1;
598   char logfile[MAX_BUF];
599   int cnt;
600   int sum;
601   XIMStyle gistyle;
602   XFontSet gpfset, gsfset;
603   XVaNestedList cpe_nelist, cst_nelist;
604   XVaNestedList gpe_nelist, gst_nelist;
605   VALUABLE *voff[OFFMUST];
606 
607   prmode ("X11R5 Input Method Test Program : <<off-the-spot mode>>");
608   prstatus ("Creating log file for ic...");     /* open log file for IC test */
609   sprintf (logfile, "%s/ticoff.log%d", lfdir, cntlog);
610   icfp = fopen (logfile, "w");
611   prstatus ("done.");
612   cntlog++;
613   prstatus ("Creating NestedList for set...");
614   /* create NestedList for create IC (must) */
615   uistyle = (XIMPreeditArea | XIMStatusArea);   /* initialize valuables */
616   upea.fset = fontset[0];
617   usta.fset = fontset[1];
618   cpe_nelist = XVaCreateNestedList (DUMMY, XNFontSet, upea.fset, NULL);
619   cst_nelist = XVaCreateNestedList (DUMMY, XNFontSet, usta.fset, NULL);
620   prstatus ("done.");
621 
622   prstatus ("Creating ic...");  /* test of XCreateIC() (must) */
623   ic = XCreateIC (im, XNInputStyle, uistyle, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
624   prstatus ("done.");
625   if (ic == NULL)
626     {                           /* transaction of error */
627       cls (prdisp);
628       prprint ("Test of XCreateIC() <must> is failed.\n");
629       prprint ("Cannot create IC. NULL returned.\n");
630       prprint ("This program will shutdown soon.\n\n");
631       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
632       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
633       *flag = CRICERR;
634       return (NULL);
635     }
636   prstatus ("Creating NestedList for get...");
637   /* Create NestedList for GetICValues() (must) */
638   gpe_nelist = XVaCreateNestedList (DUMMY, XNFontSet, &gpfset, NULL);
639   gst_nelist = XVaCreateNestedList (DUMMY, XNFontSet, &gsfset, NULL);
640   prstatus ("done.");
641 
642   prstatus ("Test of GetICValues()...");        /* test of GetICValues() (must) */
643   XGetICValues (ic, XNInputStyle, &gistyle, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
644   prstatus ("done.");
645 
646   sum = 0;                      /* verify valuables */
647   voff[0] = mkstruct (IS, HEX, uistyle, gistyle);
648   voff[1] = mkstruct (PFS, HEX, upea.fset, gpfset);
649   voff[2] = mkstruct (SFS, HEX, usta.fset, gsfset);
650   for (cnt = 0; cnt < OFFMUST; cnt++)
651     {
652       sum += verval (voff[cnt]);
653     }
654 
655   cls (prdisp);
656   prveres (sum);
657   if (sum != NOERR)
658     {
659       prprint ("Test of XCreateIC() <must> is failed.\n");
660       prprint ("This program will shutdown soon.\n\n");
661       prverlog (sum);
662       fprintf (icfp, "...Test of XCreateIC <must> is failed.\n\n");
663       *flag = GICERR;
664       return (NULL);
665     }
666   else
667     {
668       prprint ("Test of XCreateIC() <must> is succeeded.\n");
669       prprint ("move next test.\n\n");
670       prverlog (sum);
671       fprintf (icfp, "...Test of XCreateIC <must> is succeeded.\n\n");
672     }
673   XFree ((char *) cpe_nelist);
674   XFree ((char *) cst_nelist);
675   XFree ((char *) gpe_nelist);
676   XFree ((char *) gst_nelist);
677   return (ic);
678 }
679 
680 
681 /* *INDENT-OFF* */
682 XIC
offmay(im,flag)683 offmay (im, flag)               /* for OFF-the-spot mode (MAY) */
684      XIM im;
685      FLAG *flag;
686 /* *INDENT-ON* */
687 
688 {
689   XIC ic;
690   int cnt;
691   int sum;
692   XIMStyle gistyle;
693   Window gclient;
694   Window gfocus;
695   RESOURCE gres;
696   XRectangle *gparea, *gsarea;
697   Colormap gpcmap, gscmap;
698   u_long gpfg, gpbg, gsfg, gsbg;
699   Pixmap gppix, gspix;
700   XFontSet gpfset, gsfset;
701   Cursor gpcursor, gscursor;
702   XVaNestedList cpe_nelist, cst_nelist;
703   XVaNestedList gpe_nelist, gst_nelist;
704   VALUABLE *voff[OFFMAY];
705 
706   prmode ("X11R5 Input Method Test Program : <<off-the-spot mode>>");
707   prstatus ("Creating NestedList for set...");
708   /* create NestedList for create IC (may) */
709   uistyle = (XIMPreeditArea | XIMStatusArea);   /* initialize valuables */
710   uclient = window1.win;
711   ufocus = window3.win;
712   ufname = window3.name;
713   ures.name = "xim";
714   ures.class = "Xim";
715   usta.area.x = WIN_ITV;
716   usta.area.y = CALCY ((CALCY (W1_HEIGHT, NW_HEIGHT)), PS_HEIGHT);
717   usta.area.width = ST_WIDTH;
718   usta.area.height = PS_HEIGHT;
719   usta.cmap = cmap[0];
720   usta.fg = pixel[cmflag][0];
721   usta.bg = pixel[cmflag][3];
722   usta.fset = fontset[1];
723   usta.bgpm = pix[1];
724   usta.cursor = cursor[1];
725   upea.area.x = ST_WIDTH + 2 * WIN_ITV;
726   upea.area.y = usta.area.y;
727   upea.area.width = WPOFF1;
728   upea.area.height = PS_HEIGHT;
729   upea.cmap = cmap[0];
730   upea.fg = pixel[cmflag][3];
731   upea.bg = pixel[cmflag][0];
732   upea.bgpm = pix[0];
733   upea.fset = fontset[0];
734   upea.cursor = cursor[0];
735   cpe_nelist = XVaCreateNestedList (DUMMY, XNArea, &upea.area,
736                                     XNColormap, upea.cmap, XNForeground, upea.fg, XNBackground, upea.bg, XNBackgroundPixmap, upea.bgpm, XNFontSet, upea.fset, XNCursor, upea.cursor, NULL);
737   cst_nelist = XVaCreateNestedList (DUMMY, XNArea, &usta.area,
738                                     XNColormap, usta.cmap, XNForeground, usta.fg, XNBackground, usta.bg, XNBackgroundPixmap, usta.bgpm, XNFontSet, usta.fset, XNCursor, usta.cursor, NULL);
739   prstatus ("done.");
740 
741   prstatus ("Creating ic...");  /* test of XCreateIC() (may) */
742   ic = XCreateIC (im, XNInputStyle, uistyle,
743                   XNClientWindow, uclient, XNFocusWindow, ufocus, XNResourceName, ures.name, XNResourceClass, ures.class, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
744   prstatus ("done.");
745   if (ic == NULL)
746     {                           /* transaction of error */
747       cls (prdisp);
748       prprint ("Test of XCreateIC() <must> is failed.\n");
749       prprint ("Cannot create IC. NULL returned.\n");
750       prprint ("This program will shutdown soon.\n\n");
751       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
752       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
753       *flag = CRICERR;
754       return (NULL);
755     }
756   prstatus ("Creating NestedList for get...");
757   /* Create NestedList for GetICValues() (may) */
758   gpe_nelist = XVaCreateNestedList (DUMMY, XNArea, &gparea, XNColormap, &gpcmap, XNForeground, &gpfg, XNBackground, &gpbg, XNBackgroundPixmap, &gppix, XNFontSet, &gpfset, XNCursor, &gpcursor, NULL);
759   gst_nelist = XVaCreateNestedList (DUMMY, XNArea, &gsarea, XNColormap, &gscmap, XNForeground, &gsfg, XNBackground, &gsbg, XNBackgroundPixmap, &gspix, XNFontSet, &gsfset, XNCursor, &gscursor, NULL);
760   prstatus ("done.");
761   prstatus ("Test of XGetICValues()...");       /* test of GetICValues() (may) */
762   XGetICValues (ic, XNInputStyle, &gistyle,
763                 XNClientWindow, &gclient, XNFocusWindow, &gfocus, XNResourceName, &gres.name, XNResourceClass, &gres.class, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
764   prstatus ("done.");
765 
766   sum = 0;                      /* verify valuables */
767   voff[0] = mkstruct (IS, HEX, uistyle, gistyle);
768   voff[1] = mkstruct (CW, HEX, uclient, gclient);
769   voff[2] = mkstruct (FW, HEX, ufocus, gfocus);
770   voff[3] = mkstruct (RN, STR, ures.name, gres.name);
771   voff[4] = mkstruct (RC, STR, ures.name, gres.name);
772   voff[5] = mkstruct (PAX, DEC, upea.area.x, gparea->x);
773   voff[6] = mkstruct (PAY, DEC, upea.area.y, gparea->y);
774   voff[7] = mkstruct (PAW, DEC, upea.area.width, gparea->width);
775   voff[8] = mkstruct (PAH, DEC, upea.area.height, gparea->height);
776   voff[9] = mkstruct (PCM, HEX, upea.cmap, gpcmap);
777   voff[10] = mkstruct (PFG, HEX, upea.fg, gpfg);
778   voff[11] = mkstruct (PBG, HEX, upea.bg, gpbg);
779   voff[12] = mkstruct (PBP, HEX, upea.bgpm, gppix);
780   voff[13] = mkstruct (PFS, HEX, upea.fset, gpfset);
781   voff[14] = mkstruct (PCU, HEX, upea.cursor, gpcursor);
782   voff[15] = mkstruct (SAX, DEC, usta.area.x, gsarea->x);
783   voff[16] = mkstruct (SAY, DEC, usta.area.y, gsarea->y);
784   voff[17] = mkstruct (SAW, DEC, usta.area.width, gsarea->width);
785   voff[18] = mkstruct (SAH, DEC, usta.area.height, gsarea->height);
786   voff[19] = mkstruct (SCM, HEX, usta.cmap, gscmap);
787   voff[20] = mkstruct (SFG, HEX, usta.fg, gsfg);
788   voff[21] = mkstruct (SBG, HEX, usta.bg, gsbg);
789   voff[22] = mkstruct (SBP, HEX, usta.bgpm, gspix);
790   voff[23] = mkstruct (SFS, HEX, usta.fset, gsfset);
791   voff[24] = mkstruct (SCU, HEX, usta.cursor, gscursor);
792   for (cnt = 0; cnt < OFFMAY; cnt++)
793     {
794       sum += verval (voff[cnt]);
795     }
796   cls (prdisp);
797   prveres (sum);
798   if (sum != NOERR)
799     {
800       prprint ("Test of XCreateIC() <may> is failed.\n");
801       prprint ("This program will shutdown soon.\n\n");
802       prverlog (sum);
803       fprintf (icfp, "...Test of XCreateIC <may> is failed.\n\n");
804       *flag = GICERR;
805       return (NULL);
806     }
807   else
808     {
809       prprint ("Test of XCreateIC() <may> is succeeded.\n");
810       prprint ("move next test.\n\n");
811       prverlog (sum);
812       fprintf (icfp, "...Test of XCreateIC <may> is succeeded.\n\n");
813     }
814   XFree ((char *) cpe_nelist);
815   XFree ((char *) cst_nelist);
816   XFree ((char *) gpe_nelist);
817   XFree ((char *) gst_nelist);
818   XFree ((XRectangle *) gsarea);
819   XFree ((XRectangle *) gsarea);
820   return (ic);
821 }
822 
823 /* *INDENT-OFF* */
824 XIC
rootmust(im,lfdir,flag)825 rootmust (im, lfdir, flag)      /* for ROOT-window mode (MUST) */
826      XIM im;
827      char *lfdir;
828      FLAG *flag;
829 /* *INDENT-ON* */
830 
831 {
832   XIC ic;
833   static int cntlog = 1;
834   char logfile[MAX_BUF];
835   int sum;
836   XIMStyle gistyle;
837   VALUABLE *vroot;
838 
839   prmode ("X11R5 Input Method Test Program : <<root-window mode>>");
840   prstatus ("Creating log file for ic...");     /* open log file for IC test */
841   sprintf (logfile, "%s/ticroot.log%d", lfdir, cntlog);
842   icfp = fopen (logfile, "w");
843   cntlog++;
844   prstatus ("done.");
845   uistyle = (XIMPreeditNothing | XIMStatusNothing);     /* initialize valuables */
846 
847   prstatus ("Creating ic...");  /* test of XCreateIC() (must) */
848   ic = XCreateIC (im, XNInputStyle, uistyle, NULL);
849   prstatus ("done.");
850   if (ic == NULL)
851     {                           /* transaction of error */
852       cls (prdisp);
853       prprint ("Test of XCreateIC() <must> is failed.\n");
854       prprint ("Cannot create IC. NULL returned.\n");
855       prprint ("This program will shutdown soon.\n\n");
856       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
857       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
858       *flag = CRICERR;
859       return (NULL);
860     }
861   prstatus ("Test of GetICValues()...");        /* test of GetICValues() (must) */
862   XGetICValues (ic, XNInputStyle, &gistyle, NULL);
863   prstatus ("done.");
864 
865   sum = 0;                      /* verify valuables */
866   vroot = mkstruct (IS, HEX, uistyle, gistyle);
867   sum += verval (vroot);
868   cls (prdisp);
869   prveres (sum);
870   if (sum != NOERR)
871     {
872       prprint ("Test of XCreateIC() <must> is failed.\n");
873       prprint ("This program will shutdown soon.\n\n");
874       prverlog (sum);
875       fprintf (icfp, "...Test of XCreateIC <must> is failed.\n\n");
876       *flag = GICERR;
877       return (NULL);
878     }
879   else
880     {
881       prprint ("Test of XCreateIC() <must> is succeeded.\n");
882       prprint ("move next test.\n\n");
883       prverlog (sum);
884       fprintf (icfp, "...Test of XCreateIC <must> is succeeded.\n\n");
885     }
886   return (ic);
887 }
888 
889 
890 /* *INDENT-OFF* */
891 XIC
rootmay(im,flag)892 rootmay (im, flag)              /* for ROOT-window mode (MAY) */
893      XIM im;
894      FLAG *flag;
895 /* *INDENT-ON* */
896 
897 {
898   XIC ic;
899   int cnt;
900   int sum;
901   XIMStyle gistyle;
902   Window gclient;
903   Window gfocus;
904   RESOURCE gres;
905   Colormap gpcmap, gscmap;
906   u_long gpfg, gpbg, gsfg, gsbg;
907   Pixmap gppix, gspix;
908   XFontSet gpfset, gsfset;
909   Cursor gpcursor, gscursor;
910   XVaNestedList cpe_nelist, cst_nelist;
911   XVaNestedList gpe_nelist, gst_nelist;
912   VALUABLE *vroot[ROOTMAY];
913 
914   prmode ("X11R5 Input Method Test Program : <<root-window mode>>");
915   prstatus ("Creating NestedList for set...");
916   /* create NestedList for create IC (may) */
917   uistyle = (XIMPreeditNothing | XIMStatusNothing);     /* initialize valuables */
918   uclient = window1.win;
919   ufocus = window3.win;
920   ufname = window3.name;
921   ures.name = "xim";
922   ures.class = "Xim";
923   usta.cmap = cmap[0];
924   usta.fg = pixel[cmflag][0];
925   usta.bg = pixel[cmflag][3];
926   usta.bgpm = pix[1];
927   usta.fset = fontset[1];
928   usta.cursor = cursor[1];
929   upea.cmap = cmap[0];
930   upea.fg = pixel[cmflag][3];
931   upea.bg = pixel[cmflag][0];
932   upea.bgpm = pix[0];
933   upea.fset = fontset[0];
934   upea.cursor = cursor[0];
935   cpe_nelist = XVaCreateNestedList (DUMMY, XNColormap, upea.cmap, XNForeground, upea.fg, XNBackground, upea.bg, XNBackgroundPixmap, upea.bgpm, XNFontSet, upea.fset, XNCursor, upea.cursor, NULL);
936   cst_nelist = XVaCreateNestedList (DUMMY, XNColormap, usta.cmap, XNForeground, usta.fg, XNBackground, usta.bg, XNBackgroundPixmap, usta.bgpm, XNFontSet, usta.fset, XNCursor, usta.cursor, NULL);
937   prstatus ("done.");
938 
939   prstatus ("Creating ic...");  /* test of XCreateIC() (may) */
940   ic = XCreateIC (im, XNInputStyle, uistyle,
941                   XNClientWindow, uclient, XNFocusWindow, ufocus, XNResourceName, ures.name, XNResourceClass, ures.class, XNPreeditAttributes, cpe_nelist, XNStatusAttributes, cst_nelist, NULL);
942   prstatus ("done.");
943   if (ic == NULL)
944     {                           /* transaction of error */
945       cls (prdisp);
946       prprint ("Test of XCreateIC() <must> is failed.\n");
947       prprint ("Cannot create IC. NULL returned.\n");
948       prprint ("This program will shutdown soon.\n\n");
949       fprintf (icfp, "Test of XCreateIC <must> is failed.\n");
950       fprintf (icfp, "Cannot create IC. NULL returned.\n\n");
951       *flag = CRICERR;
952       return (NULL);
953     }
954 
955   prstatus ("Creating NestedList for get...");
956   /* Create NestedList for GetICValues() (may) */
957   gpe_nelist = XVaCreateNestedList (DUMMY, XNColormap, &gpcmap, XNForeground, &gpfg, XNBackground, &gpbg, XNBackgroundPixmap, &gppix, XNFontSet, &gpfset, XNCursor, &gpcursor, NULL);
958   gst_nelist = XVaCreateNestedList (DUMMY, XNColormap, &gscmap, XNForeground, &gsfg, XNBackground, &gsbg, XNBackgroundPixmap, &gspix, XNFontSet, &gsfset, XNCursor, &gscursor, NULL);
959   prstatus ("done.");
960   prstatus ("Test of XGetICValues()...");       /* test of GetICValues() (may) */
961   XGetICValues (ic, XNInputStyle, &gistyle,
962                 XNClientWindow, &gclient, XNFocusWindow, &gfocus, XNResourceName, &gres.name, XNResourceClass, &gres.class, XNPreeditAttributes, gpe_nelist, XNStatusAttributes, gst_nelist, NULL);
963   prstatus ("done.");
964 
965 
966   sum = 0;                      /* verify valuables */
967   vroot[0] = mkstruct (IS, HEX, uistyle, gistyle);
968   vroot[1] = mkstruct (CW, HEX, uclient, gclient);
969   vroot[2] = mkstruct (FW, HEX, ufocus, gfocus);
970   vroot[3] = mkstruct (RN, STR, ures.name, gres.name);
971   vroot[4] = mkstruct (RC, STR, ures.class, gres.class);
972   vroot[5] = mkstruct (PCM, HEX, upea.cmap, gpcmap);
973   vroot[6] = mkstruct (PFG, HEX, upea.fg, gpfg);
974   vroot[7] = mkstruct (PBG, HEX, upea.bg, gpbg);
975   vroot[8] = mkstruct (PBP, HEX, upea.bgpm, gppix);
976   vroot[9] = mkstruct (PFS, HEX, upea.fset, gpfset);
977   vroot[10] = mkstruct (PCU, HEX, upea.cursor, gpcursor);
978   vroot[11] = mkstruct (SCM, HEX, usta.cmap, gscmap);
979   vroot[12] = mkstruct (SFG, HEX, usta.fg, gsfg);
980   vroot[13] = mkstruct (SBG, HEX, usta.bg, gsbg);
981   vroot[14] = mkstruct (SBP, HEX, usta.bgpm, gspix);
982   vroot[15] = mkstruct (SFS, HEX, usta.fset, gsfset);
983   vroot[16] = mkstruct (SCU, HEX, usta.cursor, gscursor);
984   for (cnt = 0; cnt < ROOTMAY; cnt++)
985     {
986       sum += verval (vroot[cnt]);
987     }
988   cls (prdisp);
989   prveres (sum);
990   if (sum != NOERR)
991     {
992       prprint ("Test of XCreateIC() <may> is failed.\n");
993       prprint ("This program will shutdown soon.\n\n");
994       prverlog (sum);
995       fprintf (icfp, "...Test of XCreateIC <may> is failed.\n\n");
996       *flag = GICERR;
997       return (NULL);
998     }
999   else
1000     {
1001       prprint ("Test of XCreateIC() <may> is succeeded.\n");
1002       prprint ("move next test.\n\n");
1003       prverlog (sum);
1004       fprintf (icfp, "...Test of XCreateIC <may> is succeeded.\n\n");
1005     }
1006   XFree ((char *) cpe_nelist);
1007   XFree ((char *) cst_nelist);
1008   XFree ((char *) gpe_nelist);
1009   XFree ((char *) gst_nelist);
1010   return (ic);
1011 }
1012 
1013 void
destic(ic)1014 destic (ic)                     /* DESTroy IC */
1015      XIC ic;
1016 {
1017   if (focuson == OK)
1018     {
1019       XUnsetICFocus (ic);
1020       focuson = NG;
1021       cwcolor (ufname, pixel[cmflag][1]);
1022     }
1023   XDestroyIC (ic);
1024 }
1025 
1026 void
fclic()1027 fclic ()                        /* log File Close for IC */
1028 {
1029   fclose (icfp);
1030 }
1031