1 /*
2 -- CXB30060.C
3 --
4 --                             Grant of Unlimited Rights
5 --
6 --     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
7 --     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
8 --     unlimited rights in the software and documentation contained herein.
9 --     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
10 --     this public release, the Government intends to confer upon all
11 --     recipients unlimited rights  equal to those held by the Government.
12 --     These rights include rights to use, duplicate, release or disclose the
13 --     released technical data and computer software in whole or in part, in
14 --     any manner and for any purpose whatsoever, and to have or permit others
15 --     to do so.
16 --
17 --                                    DISCLAIMER
18 --
19 --     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
20 --     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
21 --     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
22 --     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
23 --     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
24 --     PARTICULAR PURPOSE OF SAID MATERIAL.
25 --*
26 --
27 -- FUNCTION NAME: CXB30060   ("wchar_gen")
28 --
29 -- FUNCTION DESCRIPTION:
30 --      This C function returns the value of type wchar_t corresponding to the
31 --      value of its parameter, where
32 --          Val  0 ..  9 ==> '0' .. '9'
33 --          Val 10 .. 19 ==> 'A' .. 'J'
34 --          Val 20 .. 29 ==> 'k' .. 't'
35 --          Val 30       ==> ' '
36 --          Val 31       ==> '.'
37 --          Val 32       ==> ','
38 --
39 -- INPUT:
40 --      This function requires that one int parameter be passed to it.
41 --
42 -- OUTPUT:
43 --      The function will return the appropriate value of type wchar_t.
44 --
45 -- CHANGE HISTORY:
46 --      13 Sep 99   RLB     Created function to replace incorrect
47 --                          Unchecked_Conversion.
48 --
49 --!
50 */
51 
52 #include <stddef.h>
53 
CXB30060(int val)54 wchar_t CXB30060 (int val)
55 
56 /* NOTE: The above function definition should be accepted by an ANSI-C   */
57 /*       compiler.  Older C compilers may reject it; they may, however   */
58 /*       accept the following two lines.  An implementation may comment  */
59 /*       out the above function definition and uncomment the following   */
60 /*       one.  Otherwise, an implementation must provide the necessary   */
61 /*       modifications to this C code to satisfy the function            */
62 /*       requirements (see Function Description).                        */
63 /*                                                                       */
64 /*  wchar_t CXB30060 (val)                                               */
65 /*     int     val;                                                      */
66 /*                                                                       */
67 
68 {  wchar_t return_value = ';';
69 
70    switch (val)
71    {
72       case 0:
73          return_value = '0';
74          break;
75       case 1:
76          return_value = '1';
77          break;
78       case 2:
79          return_value = '2';
80          break;
81       case 3:
82          return_value = '3';
83          break;
84       case 4:
85          return_value = '4';
86          break;
87       case 5:
88          return_value = '5';
89          break;
90       case 6:
91          return_value = '6';
92          break;
93       case 7:
94          return_value = '7';
95          break;
96       case 8:
97          return_value = '8';
98          break;
99       case 9:
100          return_value = '9';
101          break;
102       case 10:
103          return_value = 'A';
104          break;
105       case 11:
106          return_value = 'B';
107          break;
108       case 12:
109          return_value = 'C';
110          break;
111       case 13:
112          return_value = 'D';
113          break;
114       case 14:
115          return_value = 'E';
116          break;
117       case 15:
118          return_value = 'F';
119          break;
120       case 16:
121          return_value = 'G';
122          break;
123       case 17:
124          return_value = 'H';
125          break;
126       case 18:
127          return_value = 'I';
128          break;
129       case 19:
130          return_value = 'J';
131          break;
132       case 20:
133          return_value = 'k';
134          break;
135       case 21:
136          return_value = 'l';
137          break;
138       case 22:
139          return_value = 'm';
140          break;
141       case 23:
142          return_value = 'n';
143          break;
144       case 24:
145          return_value = 'o';
146          break;
147       case 25:
148          return_value = 'p';
149          break;
150       case 26:
151          return_value = 'q';
152          break;
153       case 27:
154          return_value = 'r';
155          break;
156       case 28:
157          return_value = 's';
158          break;
159       case 29:
160          return_value = 't';
161          break;
162       case 30:
163          return_value = ' ';
164          break;
165       case 31:
166          return_value = '.';
167          break;
168       case 32:
169          return_value = ',';
170          break;
171    }
172 
173    return (return_value); /* Return character value */
174 }
175