1 /*
2 -- CXB30040.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: CXB30040   ("char_gen")
28 --
29 -- FUNCTION DESCRIPTION:
30 --      This C function returns the value of type char 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 char.
44 --
45 -- CHANGE HISTORY:
46 --      13 Sep 99   RLB     Created function to replace incorrect
47 --                          Unchecked_Conversion.
48 --
49 --!
50 */
51 
CXB30040(int val)52 char CXB30040 (int val)
53 
54 /* NOTE: The above function definition should be accepted by an ANSI-C   */
55 /*       compiler.  Older C compilers may reject it; they may, however   */
56 /*       accept the following two lines.  An implementation may comment  */
57 /*       out the above function definition and uncomment the following   */
58 /*       one.  Otherwise, an implementation must provide the necessary   */
59 /*       modifications to this C code to satisfy the function            */
60 /*       requirements (see Function Description).                        */
61 /*                                                                       */
62 /*  char CXB30040 (val)                                                  */
63 /*     int     val;                                                      */
64 /*                                                                       */
65 
66 {  char return_value = ';';
67 
68    switch (val)
69    {
70       case 0:
71          return_value = '0';
72          break;
73       case 1:
74          return_value = '1';
75          break;
76       case 2:
77          return_value = '2';
78          break;
79       case 3:
80          return_value = '3';
81          break;
82       case 4:
83          return_value = '4';
84          break;
85       case 5:
86          return_value = '5';
87          break;
88       case 6:
89          return_value = '6';
90          break;
91       case 7:
92          return_value = '7';
93          break;
94       case 8:
95          return_value = '8';
96          break;
97       case 9:
98          return_value = '9';
99          break;
100       case 10:
101          return_value = 'A';
102          break;
103       case 11:
104          return_value = 'B';
105          break;
106       case 12:
107          return_value = 'C';
108          break;
109       case 13:
110          return_value = 'D';
111          break;
112       case 14:
113          return_value = 'E';
114          break;
115       case 15:
116          return_value = 'F';
117          break;
118       case 16:
119          return_value = 'G';
120          break;
121       case 17:
122          return_value = 'H';
123          break;
124       case 18:
125          return_value = 'I';
126          break;
127       case 19:
128          return_value = 'J';
129          break;
130       case 20:
131          return_value = 'k';
132          break;
133       case 21:
134          return_value = 'l';
135          break;
136       case 22:
137          return_value = 'm';
138          break;
139       case 23:
140          return_value = 'n';
141          break;
142       case 24:
143          return_value = 'o';
144          break;
145       case 25:
146          return_value = 'p';
147          break;
148       case 26:
149          return_value = 'q';
150          break;
151       case 27:
152          return_value = 'r';
153          break;
154       case 28:
155          return_value = 's';
156          break;
157       case 29:
158          return_value = 't';
159          break;
160       case 30:
161          return_value = ' ';
162          break;
163       case 31:
164          return_value = '.';
165          break;
166       case 32:
167          return_value = ',';
168          break;
169    }
170 
171    return (return_value); /* Return character value */
172 }
173