1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
/***************************************************************************
begin : Thu Jul 02 2009
copyright : (C) 2009 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* Please see toplevel file COPYING for license details *
***************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "tm_util.h"
#include "tm_type.h"
#include <gwenhywfar/stringlist.h>
#include <gwenhywfar/debug.h>
uint32_t Typemaker2_FlagsFromString(const char *t) {
GWEN_STRINGLIST *sl;
uint32_t flags=0;
assert(t && *t);
sl=GWEN_StringList_fromString(t, " ,:/", 1);
if (sl) {
GWEN_STRINGLISTENTRY *se;
se=GWEN_StringList_FirstEntry(sl);
while(se) {
const char *s;
s=GWEN_StringListEntry_Data(se);
assert(s);
if (strcasecmp(s, "own")==0)
flags|=TYPEMAKER2_FLAGS_OWN;
else if (strcasecmp(s, "volatile")==0)
flags|=TYPEMAKER2_FLAGS_VOLATILE;
else if (strcasecmp(s, "const")==0)
flags|=TYPEMAKER2_FLAGS_CONST;
else if (strcasecmp(s, "static")==0)
flags|=TYPEMAKER2_FLAGS_STATIC;
else if (strcasecmp(s, "dup")==0)
flags|=TYPEMAKER2_FLAGS_DUP;
else if (strcasecmp(s, "nodup")==0)
flags|=TYPEMAKER2_FLAGS_NODUP;
else if (strcasecmp(s, "copy")==0)
flags|=TYPEMAKER2_FLAGS_COPY;
else if (strcasecmp(s, "nocopy")==0)
flags|=TYPEMAKER2_FLAGS_NOCOPY;
else if (strcasecmp(s, "attribute")==0)
flags|=TYPEMAKER2_FLAGS_ATTRIBUTE;
else if (strcasecmp(s, "enum")==0)
flags|=TYPEMAKER2_FLAGS_ENUM;
else if (strcasecmp(s, "define")==0)
flags|=TYPEMAKER2_FLAGS_DEFINE;
else if (strcasecmp(s, "with_db")==0)
flags|=TYPEMAKER2_FLAGS_WITH_DB;
else if (strcasecmp(s, "with_xml")==0)
flags|=TYPEMAKER2_FLAGS_WITH_XML;
else if (strcasecmp(s, "with_object")==0)
flags|=TYPEMAKER2_FLAGS_WITH_OBJECT;
else if (strcasecmp(s, "with_list1")==0)
flags|=TYPEMAKER2_FLAGS_WITH_LIST1;
else if (strcasecmp(s, "with_list2")==0)
flags|=TYPEMAKER2_FLAGS_WITH_LIST2;
else if (strcasecmp(s, "with_inherit")==0)
flags|=TYPEMAKER2_FLAGS_WITH_INHERIT;
else if (strcasecmp(s, "with_idmap")==0)
flags|=TYPEMAKER2_FLAGS_WITH_IDMAP;
else if (strcasecmp(s, "with_getbymember")==0)
flags|=TYPEMAKER2_FLAGS_WITH_GETBYMEMBER;
else if (strcasecmp(s, "with_tree")==0)
flags|=TYPEMAKER2_FLAGS_WITH_TREE;
else if (strcasecmp(s, "with_hash")==0)
flags|=TYPEMAKER2_FLAGS_WITH_HASH;
else if (strcasecmp(s, "with_hashnum")==0)
flags|=TYPEMAKER2_FLAGS_WITH_HASHNUM;
else if (strcasecmp(s, "with_refcount")==0)
flags|=TYPEMAKER2_FLAGS_WITH_REFCOUNT;
else if (strcasecmp(s, "with_flags")==0)
flags|=TYPEMAKER2_FLAGS_WITH_FLAGS;
else if (strcasecmp(s, "assign")==0)
flags|=TYPEMAKER2_FLAGS_ASSIGN;
else if (strcasecmp(s, "omit")==0)
flags|=TYPEMAKER2_FLAGS_OMIT;
else if (strcasecmp(s, "with_signals")==0)
flags|=TYPEMAKER2_FLAGS_WITH_SIGNALS;
else if (strcasecmp(s, "with_slots")==0)
flags|=TYPEMAKER2_FLAGS_WITH_SLOTS;
else if (strcasecmp(s, "with_cachefns")==0)
flags|=TYPEMAKER2_FLAGS_WITH_CACHEFNS;
else if (strcasecmp(s, "sortByMember")==0)
flags|=TYPEMAKER2_FLAGS_SORTBYMEMBER;
else if (strcasecmp(s, "noConstObject")==0)
flags|=TYPEMAKER2_FLAGS_NOCONSTOBJECT;
else if (strcasecmp(s, "none")==0)
flags|=TYPEMAKER2_FLAGS_NONE;
se=GWEN_StringListEntry_Next(se);
}
GWEN_StringList_free(sl);
}
return flags;
}
int Typemaker2_AccessFromString(const char *s) {
assert(s);
if (strcasecmp(s, "pub")==0 ||
strcasecmp(s, "public")==0)
return TypeMaker2_Access_Public;
else if (strcasecmp(s, "library")==0 ||
strcasecmp(s, "lib")==0)
return TypeMaker2_Access_Library;
else if (strcasecmp(s, "protected")==0 ||
strcasecmp(s, "prot")==0)
return TypeMaker2_Access_Protected;
else if (strcasecmp(s, "private")==0 ||
strcasecmp(s, "priv")==0)
return TypeMaker2_Access_Private;
return TypeMaker2_Access_Unknown;
}
|