Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

ekind.c

Go to the documentation of this file.
00001 /*
00002 ** LCLint - annotation-assisted static program checker
00003 ** Copyright (C) 1994-2000 University of Virginia,
00004 **         Massachusetts Institute of Technology
00005 **
00006 ** This program is free software; you can redistribute it and/or modify it
00007 ** under the terms of the GNU General Public License as published by the
00008 ** Free Software Foundation; either version 2 of the License, or (at your
00009 ** option) any later version.
00010 ** 
00011 ** This program is distributed in the hope that it will be useful, but
00012 ** WITHOUT ANY WARRANTY; without even the implied warranty of
00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 ** General Public License for more details.
00015 ** 
00016 ** The GNU General Public License is available from http://www.gnu.org/ or
00017 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00018 ** MA 02111-1307, USA.
00019 **
00020 ** For information on lclint: lclint-request@cs.virginia.edu
00021 ** To report a bug: lclint-bug@cs.virginia.edu
00022 ** For more information: http://lclint.cs.virginia.edu
00023 */
00024 /*
00025 ** ekind.c
00026 */
00027 
00028 # include "lclintMacros.nf"
00029 # include "basic.h"
00030 
00031 ekind
00032 ekind_fromInt (int i)
00033 {
00034   if /*@+enumint@*/ (i < KINVALID || i > KELAST) /*@=enumint@*/
00035     {
00036       llcontbug (message ("ekind_fromInt: invalid: %d", i));
00037       return KINVALID; 
00038     }
00039 
00040   return (ekind)i;
00041 }
00042 
00043 cstring ekind_unparse (ekind k)
00044 {
00045   switch (k)
00046     {
00047     case KENUMCONST:   return cstring_makeLiteralTemp ("ect");
00048     case KCONST:       return cstring_makeLiteralTemp ("cst");
00049     case KVAR:         return cstring_makeLiteralTemp ("var");
00050     case KITER:        return cstring_makeLiteralTemp ("itr");
00051     case KENDITER:     return cstring_makeLiteralTemp ("etr");
00052     case KDATATYPE:    return cstring_makeLiteralTemp ("dtp");
00053     case KFCN:         return cstring_makeLiteralTemp ("fcn");
00054     case KSTRUCTTAG:   return cstring_makeLiteralTemp ("stg");
00055     case KUNIONTAG:    return cstring_makeLiteralTemp ("utg");
00056     case KENUMTAG:     return cstring_makeLiteralTemp ("etg");
00057     case KELIPSMARKER: return cstring_makeLiteralTemp ("eps");
00058     case KINVALID:     return cstring_makeLiteralTemp ("[invalid]");
00059     }
00060 
00061   BADEXIT;
00062 }
00063 
00064 cstring ekind_unparseLong (ekind k)
00065 {
00066   switch (k)
00067     {
00068     case KCONST:       return cstring_makeLiteralTemp ("constant");
00069     case KENUMCONST:   return cstring_makeLiteralTemp ("enum member");
00070     case KVAR:         return cstring_makeLiteralTemp ("variable");
00071     case KITER:        return cstring_makeLiteralTemp ("iterator");
00072     case KENDITER:     return cstring_makeLiteralTemp ("iterator finalizer");
00073     case KDATATYPE:    return cstring_makeLiteralTemp ("datatype");
00074     case KFCN:         return cstring_makeLiteralTemp ("function");
00075     case KSTRUCTTAG:   return cstring_makeLiteralTemp ("struct tag");
00076     case KUNIONTAG:    return cstring_makeLiteralTemp ("union tag");
00077     case KENUMTAG:     return cstring_makeLiteralTemp ("enum tag");
00078     case KELIPSMARKER: return cstring_makeLiteralTemp ("...");
00079     case KINVALID:     return cstring_makeLiteralTemp ("[invalid]");
00080     }
00081 
00082   BADEXIT;
00083 }
00084 
00085 cstring
00086 ekind_capName (ekind k)
00087 {
00088   switch (k)
00089     {
00090     case KCONST:       return cstring_makeLiteralTemp ("Constant");
00091     case KENUMCONST:   return cstring_makeLiteralTemp ("Enum member");
00092     case KVAR:         return cstring_makeLiteralTemp ("Variable");
00093     case KITER:        return cstring_makeLiteralTemp ("Iterator");
00094     case KENDITER:     return cstring_makeLiteralTemp ("Iterator finalizer");
00095     case KDATATYPE:    return cstring_makeLiteralTemp ("Datatype");
00096     case KFCN:         return cstring_makeLiteralTemp ("Function");
00097     case KSTRUCTTAG:   return cstring_makeLiteralTemp ("Struct tag");
00098     case KUNIONTAG:    return cstring_makeLiteralTemp ("Union tag");
00099     case KENUMTAG:     return cstring_makeLiteralTemp ("Enum tag");
00100     case KELIPSMARKER: return cstring_makeLiteralTemp ("...");
00101     case KINVALID:     return cstring_makeLiteralTemp ("[invalid]");
00102     }
00103 
00104   BADEXIT;
00105 }
00106 

Generated at Fri Nov 3 18:57:40 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000