First part of transition from not-function header.
[splint-patched.git] / src / ekind.c
blob9b335387cada993229ac761ca12f45a1e129178f
1 /*
2 ** Splint - annotation-assisted static program checker
3 ** Copyright (C) 1994-2003 University of Virginia,
4 ** Massachusetts Institute of Technology
5 **
6 ** This program is free software; you can redistribute it and/or modify it
7 ** under the terms of the GNU General Public License as published by the
8 ** Free Software Foundation; either version 2 of the License, or (at your
9 ** option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful, but
12 ** WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ** General Public License for more details.
15 **
16 ** The GNU General Public License is available from http://www.gnu.org/ or
17 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 ** MA 02111-1307, USA.
20 ** For information on splint: info@splint.org
21 ** To report a bug: splint-bug@splint.org
22 ** For more information: http://www.splint.org
25 ** ekind.c
28 # include "splintMacros.nf"
29 # include "basic.h"
31 ekind
32 ekind_fromInt (int i)
34 if /*@+enumint@*/ (i < KINVALID || i > KELAST) /*@=enumint@*/
36 llcontbug (message ("ekind_fromInt: invalid: %d", i));
37 return KINVALID;
40 return (ekind)i;
43 cstring ekind_unparse (ekind k)
45 switch (k)
47 case KENUMCONST: return cstring_makeLiteralTemp ("ect");
48 case KCONST: return cstring_makeLiteralTemp ("cst");
49 case KVAR: return cstring_makeLiteralTemp ("var");
50 case KITER: return cstring_makeLiteralTemp ("itr");
51 case KENDITER: return cstring_makeLiteralTemp ("etr");
52 case KDATATYPE: return cstring_makeLiteralTemp ("dtp");
53 case KFCN: return cstring_makeLiteralTemp ("fcn");
54 case KSTRUCTTAG: return cstring_makeLiteralTemp ("stg");
55 case KUNIONTAG: return cstring_makeLiteralTemp ("utg");
56 case KENUMTAG: return cstring_makeLiteralTemp ("etg");
57 case KELIPSMARKER: return cstring_makeLiteralTemp ("eps");
58 case KINVALID: return cstring_makeLiteralTemp ("[invalid]");
61 BADEXIT;
64 cstring ekind_unparseLong (ekind k)
66 switch (k)
68 case KCONST: return cstring_makeLiteralTemp ("constant");
69 case KENUMCONST: return cstring_makeLiteralTemp ("enum member");
70 case KVAR: return cstring_makeLiteralTemp ("variable");
71 case KITER: return cstring_makeLiteralTemp ("iterator");
72 case KENDITER: return cstring_makeLiteralTemp ("iterator finalizer");
73 case KDATATYPE: return cstring_makeLiteralTemp ("datatype");
74 case KFCN: return cstring_makeLiteralTemp ("function");
75 case KSTRUCTTAG: return cstring_makeLiteralTemp ("struct tag");
76 case KUNIONTAG: return cstring_makeLiteralTemp ("union tag");
77 case KENUMTAG: return cstring_makeLiteralTemp ("enum tag");
78 case KELIPSMARKER: return cstring_makeLiteralTemp ("...");
79 case KINVALID: return cstring_makeLiteralTemp ("[invalid]");
82 BADEXIT;
85 cstring
86 ekind_capName (ekind k)
88 switch (k)
90 case KCONST: return cstring_makeLiteralTemp ("Constant");
91 case KENUMCONST: return cstring_makeLiteralTemp ("Enum member");
92 case KVAR: return cstring_makeLiteralTemp ("Variable");
93 case KITER: return cstring_makeLiteralTemp ("Iterator");
94 case KENDITER: return cstring_makeLiteralTemp ("Iterator finalizer");
95 case KDATATYPE: return cstring_makeLiteralTemp ("Datatype");
96 case KFCN: return cstring_makeLiteralTemp ("Function");
97 case KSTRUCTTAG: return cstring_makeLiteralTemp ("Struct tag");
98 case KUNIONTAG: return cstring_makeLiteralTemp ("Union tag");
99 case KENUMTAG: return cstring_makeLiteralTemp ("Enum tag");
100 case KELIPSMARKER: return cstring_makeLiteralTemp ("...");
101 case KINVALID: return cstring_makeLiteralTemp ("[invalid]");
104 BADEXIT;