1 /*
2  * $Id: funcv.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  * funcv.c v 1.0   Fri Mar  8 14:51:03 JST 1991
40  */
41 
42 /*
43  *      Author: Takashi Inoue    OMRON Corporation
44  *                               takashi@ari.ncl.omron.co.jp
45  */
46 
47 #include "exvalue.h"
48 
49 VALUABLE *
mkstruct(valname,mode,setval,getval)50 mkstruct (valname, mode, setval, getval)        /* MaKe STRUCT valuable */
51      char *valname;
52      FLAG mode;
53 #ifdef SYSV
54      caddr_t *setval;
55      caddr_t *getval;
56 #else
57      void *setval;
58      void *getval;
59 #endif
60 {
61   VALUABLE *p;
62 
63   p = (VALUABLE *) malloc (sizeof (VALUABLE));
64   p->vname = valname;
65   p->mode = mode;
66   p->sval = setval;
67   p->gval = getval;
68   return (p);
69 }
70 
71 /* *INDENT-OFF* */
72 FLAG
verval(va_st)73 verval (va_st)                  /* VERify VALuable */
74      VALUABLE *va_st;
75 /* *INDENT-ON* */
76 
77 {
78   switch (va_st->mode)
79     {
80     case STR:
81       fprintf (icfp, "value %-35s: set -> %-10s, get -> %-10s", va_st->vname, va_st->sval, va_st->gval);
82       if (!strcmp (va_st->sval, va_st->gval))
83         {
84           fprintf (icfp, "\n");
85           return (OK);
86         }
87       fprintf (icfp, "\t...Failed.\n");
88       return (NG);
89       break;
90     case HEX:
91       fprintf (icfp, "value %-35s: set -> 0x%-8X, get -> 0x%-8X", va_st->vname, va_st->sval, va_st->gval);
92       break;
93     case DEC:
94       fprintf (icfp, "value %-35s: set -> %-10d, get -> %-10d", va_st->vname, va_st->sval, va_st->gval);
95       break;
96     }
97   if ((strcmp (va_st->vname, PNW)) && (strcmp (va_st->vname, PNH)) && (strcmp (va_st->vname, SNW)) && (strcmp (va_st->vname, SNH)))
98     {
99       if (va_st->sval != va_st->gval)
100         {
101           fprintf (icfp, "\t...Failed.\n");
102           return (NG);
103         }
104     }
105   fprintf (icfp, "\n");
106   return (OK);
107 }
108