-/*
- * genmdesc: Generates the machine description
+/**
+ * \file
+ * Generates the machine description
*
* Authors:
* Paolo Molaro (lupus@ximian.com)
#include <string.h>
#include <mono/metadata/opcodes.h>
-#if defined(__native_client__) || defined(__native_client_codegen__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
#define MINI_OP(a,b,dest,src1,src2) b,
#define MINI_OP3(a,b,dest,src1,src2,src3) b,
/* keep in sync with the enum in mini.h */
#define eat_whitespace(s) while (*(s) && isspace (*(s))) s++;
+// Per spec isalnum() expects input in the range 0-255
+// and can misbehave if you pass in a signed char.
+static int
+isalnum_char(char c)
+{
+ return isalnum ((unsigned char)c);
+}
+
static int
load_file (const char *name) {
FILE *f;
OpDesc *tdesc;
p += 9;
tname = p;
- while (*p && isalnum (*p)) ++p;
+ while (*p && isalnum_char (*p)) ++p;
*p++ = 0;
tdesc = (OpDesc *)g_hash_table_lookup (template_table, tname);
if (!tdesc)
g_error ("Duplicated name tag in template %s at '%s' at line %d in %s\n", desc->name, p, line, name);
p += 5;
tname = p;
- while (*p && isalnum (*p)) ++p;
+ while (*p && isalnum_char (*p)) ++p;
*p++ = 0;
if (g_hash_table_lookup (template_table, tname))
g_error ("Duplicated template %s at line %d in %s\n", tname, line, name);
if (is_template && !desc->name)
g_error ("Template without name at line %d in %s\n", line, name);
}
+ g_string_free (comment,TRUE);
fclose (f);
return 0;
}
static void
output_char (FILE *f, char c) {
- if (isalnum (c))
+ if (isalnum_char (c))
fprintf (f, "%c", c);
else
fprintf (f, "\\x%x\" \"", (guint8)c);