]> andersk Git - splint.git/blob - src/ekind.c
noexpand always false.
[splint.git] / src / ekind.c
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.
19 **
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
23 */
24 /*
25 ** ekind.c
26 */
27
28 # include "splintMacros.nf"
29 # include "basic.h"
30
31 ekind
32 ekind_fromInt (int i)
33 {
34   if /*@+enumint@*/ (i < KINVALID || i > KELAST) /*@=enumint@*/
35     {
36       llcontbug (message ("ekind_fromInt: invalid: %d", i));
37       return KINVALID; 
38     }
39
40   return (ekind)i;
41 }
42
43 cstring ekind_unparse (ekind k)
44 {
45   switch (k)
46     {
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]");
59     }
60
61   BADEXIT;
62 }
63
64 cstring ekind_unparseLong (ekind k)
65 {
66   switch (k)
67     {
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]");
80     }
81
82   BADEXIT;
83 }
84
85 cstring
86 ekind_capName (ekind k)
87 {
88   switch (k)
89     {
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]");
102     }
103
104   BADEXIT;
105 }
106
This page took 0.960255 seconds and 5 git commands to generate.