equal
deleted
inserted
replaced
50 #include <typeinfo> |
50 #include <typeinfo> |
51 #include <list> |
51 #include <list> |
52 #include <strings.h> |
52 #include <strings.h> |
53 #include <string.h> /* required for strlen() */ |
53 #include <string.h> /* required for strlen() */ |
54 #include <stdlib.h> /* required for atoi() */ |
54 #include <stdlib.h> /* required for atoi() */ |
|
55 #include <errno.h> /* required for errno */ |
55 |
56 |
56 #include "../util/symtable.hh" |
57 #include "../util/symtable.hh" |
57 #include "../util/dsymtable.hh" |
58 #include "../util/dsymtable.hh" |
58 #include "../absyntax/visitor.hh" |
59 #include "../absyntax/visitor.hh" |
59 |
60 |
111 for(unsigned int i = 0; i < strlen(integer->value); i++) |
112 for(unsigned int i = 0; i < strlen(integer->value); i++) |
112 if (integer->value[i] != '_') str += integer->value[i]; |
113 if (integer->value[i] != '_') str += integer->value[i]; |
113 |
114 |
114 /* return atoi(str.c_str()); */ |
115 /* return atoi(str.c_str()); */ |
115 return atoll(str.c_str()); |
116 return atoll(str.c_str()); |
|
117 } |
|
118 |
|
119 uint64_t extract_hex_value(symbol_c *sym) { |
|
120 std::string str = ""; |
|
121 char *endptr; |
|
122 hex_integer_c * hex_integer; |
|
123 uint64_t ret; |
|
124 |
|
125 if ((hex_integer = dynamic_cast<hex_integer_c *>(sym)) == NULL) ERROR; |
|
126 for(unsigned int i = 3; i < strlen(hex_integer->value); i++) |
|
127 if (hex_integer->value[i] != '_') str += hex_integer->value[i]; |
|
128 errno = 0; /* To distinguish success/failure after call */ |
|
129 ret = strtol(str.c_str(), &endptr, 16); |
|
130 if (errno != 0) ERROR; |
|
131 |
|
132 return ret; |
116 } |
133 } |
117 |
134 |
118 |
135 |
119 |
136 |
120 /***********************************************************************/ |
137 /***********************************************************************/ |