* @date 2005
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
-
-#include "firm_config.h"
#ifdef DEBUG_libfirm
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-
-#define strncasecmp strnicmp
#endif
-#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#endif
-
#include <stdio.h>
#include <signal.h>
-
-#ifdef HAVE_STRING_H
#include <string.h>
-#endif
+
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include "irdump.h"
#include "iredges_t.h"
#include "debug.h"
+#include "error.h"
#ifdef _WIN32
/* Break into the debugger. The Win32 way. */
case BP_ON_REMIRG: return "removing IRG";
case BP_ON_NEW_ENT: return "entity creation";
case BP_ON_NEW_TYPE: return "type creation";
- default: assert(0);
+ case BP_MAX_REASON: break;
}
- return "unknown";
+ panic("unsupported reason");
} /* reason_str */
/**
/**
* Type-walker: Find an entity with given number.
*/
-static void check_ent_nr(type_or_ent *tore, void *ctx) {
- ir_entity *ent = (ir_entity *)tore;
+static void check_ent_nr(type_or_ent tore, void *ctx) {
find_env_t *env = ctx;
- if (is_entity(ent))
- if (get_entity_nr(ent) == env->u.nr) {
- env->res = ent;
+ if (is_entity(tore.ent)) {
+ if (get_entity_nr(tore.ent) == env->u.nr) {
+ env->res = tore.ent;
}
+ }
} /* check_ent_nr */
/**
* Type-walker: Find an entity with given name.
*/
-static void check_ent_name(type_or_ent *tore, void *ctx) {
- ir_entity *ent = (ir_entity *)tore;
+static void check_ent_name(type_or_ent tore, void *ctx) {
find_env_t *env = ctx;
- if (is_entity(ent))
- if (strcmp(get_entity_name(ent), env->u.name) == 0) {
- env->res = ent;
+ if (is_entity(tore.ent))
+ if (strcmp(get_entity_name(tore.ent), env->u.name) == 0) {
+ env->res = tore.ent;
}
} /* check_ent_name */
/**
* Search methods for a name.
*/
-static void show_by_name(type_or_ent *tore, void *env) {
+static void show_by_name(type_or_ent tore, void *env) {
ident *id = (ident *)env;
- if (is_entity(tore)) {
- ir_entity *ent = (ir_entity *)tore;
+ if (is_entity(tore.ent)) {
+ ir_entity *ent = tore.ent;
if (is_method_entity(ent)) {
if (get_entity_ident(ent) == id) {
/**
* Search methods for a ldname.
*/
-static void show_by_ldname(type_or_ent *tore, void *env) {
+static void show_by_ldname(type_or_ent tore, void *env) {
ident *id = (ident *)env;
- if (is_entity(tore)) {
- ir_entity *ent = (ir_entity *)tore;
+ if (is_entity(tore.ent)) {
+ ir_entity *ent = tore.ent;
if (is_method_entity(ent)) {
if (get_entity_ld_ident(ent) == id) {
lexer.tok_start = lexer.curr_pos - 1;
if (c == '.' || isalpha(c)) {
/* command begins here */
- int len = 0;
+ int len = 0;
+ const char* tok_start;
- if (c == '.') {
- /* skip the dot */
- ++lexer.tok_start;
- c = next_char();
- }
do {
c = next_char();
++len;
- } while (isalpha(c));
+ } while (isgraph(c));
unput();
+ tok_start = lexer.tok_start;
+ if (*tok_start == '.') {
+ ++tok_start;
+ --len;
+ }
for (i = sizeof(reserved)/sizeof(reserved[0]) - 1; i >= 0; --i) {
- if (strncasecmp(lexer.tok_start, reserved[i], len) == 0 && reserved[i][len] == '\0')
- break;
+ if (strncasecmp(tok_start, reserved[i], len) == 0 && reserved[i][len] == '\0')
+ return 256 + i;
}
- if (i >= 0)
- return 256 + i;
- return tok_error;
- } else if (isalpha(c)) {
- /* identifier */
- lexer.s = lexer.curr_pos - 1;
- do {
- c = next_char();
- } while (isgraph(c));
- unput();
+ /* identifier */
+ lexer.s = lexer.tok_start;
lexer.len = lexer.curr_pos - lexer.s;
return tok_identifier;
} else if (isdigit(c) || c == '-') {