aboutsummaryrefslogtreecommitdiff
path: root/sim/igen/misc.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-11-22 04:20:49 +0000
committerAndrew Cagney <cagney@redhat.com>2002-11-22 04:20:49 +0000
commit4e0bf4c4d00096ac436378edaf7718dafec9ff82 (patch)
tree9a80850d7051a761dee6c6dd1aed8df337a1f92c /sim/igen/misc.c
parentfeaee4bdbb06466822e886f5d1d30b9f1e04d985 (diff)
downloadgdb-4e0bf4c4d00096ac436378edaf7718dafec9ff82.zip
gdb-4e0bf4c4d00096ac436378edaf7718dafec9ff82.tar.gz
gdb-4e0bf4c4d00096ac436378edaf7718dafec9ff82.tar.bz2
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent. * filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto. * gen-icache.c, gen-icache.h, gen-idecode.c: Ditto. * gen-idecode.h, gen-itable.c, gen-itable.h: Ditto. * gen-model.c, gen-model.h, gen-semantics.c: Ditto. * gen-semantics.h, gen-support.c, gen-support.h: Ditto. * gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto. * ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto. * lf.h, misc.c, misc.h, table.c, table.h: Ditto.
Diffstat (limited to 'sim/igen/misc.c')
-rw-r--r--sim/igen/misc.c70
1 files changed, 29 insertions, 41 deletions
diff --git a/sim/igen/misc.c b/sim/igen/misc.c
index 6283482..c538926 100644
--- a/sim/igen/misc.c
+++ b/sim/igen/misc.c
@@ -46,9 +46,7 @@
trailing '\n' */
void
-error (const line_ref *line,
- char *msg,
- ...)
+error (const line_ref *line, char *msg, ...)
{
va_list ap;
if (line != NULL)
@@ -60,9 +58,7 @@ error (const line_ref *line,
}
void
-warning (const line_ref *line,
- char *msg,
- ...)
+warning (const line_ref *line, char *msg, ...)
{
va_list ap;
if (line != NULL)
@@ -73,25 +69,23 @@ warning (const line_ref *line,
}
void
-notify (const line_ref *line,
- char *msg,
- ...)
+notify (const line_ref *line, char *msg, ...)
{
va_list ap;
if (line != NULL)
fprintf (stdout, "%s %d: info: ", line->file_name, line->line_nr);
- va_start(ap, msg);
+ va_start (ap, msg);
vfprintf (stdout, msg, ap);
- va_end(ap);
+ va_end (ap);
}
void *
-zalloc(long size)
+zalloc (long size)
{
- void *memory = malloc(size);
+ void *memory = malloc (size);
if (memory == NULL)
ERROR ("zalloc failed");
- memset(memory, 0, size);
+ memset (memory, 0, size);
return memory;
}
@@ -103,16 +97,14 @@ a2i (const char *a)
int base = 10;
unsigned long long num = 0;
int looping;
-
+
while (isspace (*a))
a++;
-
- if (strcmp (a, "true") == 0
- || strcmp (a, "TRUE") == 0)
+
+ if (strcmp (a, "true") == 0 || strcmp (a, "TRUE") == 0)
return 1;
- if (strcmp (a, "false") == 0
- || strcmp (a, "false") == 0)
+ if (strcmp (a, "false") == 0 || strcmp (a, "false") == 0)
return 0;
if (*a == '-')
@@ -120,7 +112,7 @@ a2i (const char *a)
neg = 1;
a++;
}
-
+
if (*a == '0')
{
if (a[1] == 'x' || a[1] == 'X')
@@ -136,18 +128,18 @@ a2i (const char *a)
else
base = 8;
}
-
+
looping = 1;
while (looping)
{
int ch = *a++;
-
+
switch (base)
{
default:
looping = 0;
break;
-
+
case 2:
if (ch >= '0' && ch <= '1')
{
@@ -158,7 +150,7 @@ a2i (const char *a)
looping = 0;
}
break;
-
+
case 10:
if (ch >= '0' && ch <= '9')
{
@@ -169,7 +161,7 @@ a2i (const char *a)
looping = 0;
}
break;
-
+
case 8:
if (ch >= '0' && ch <= '7')
{
@@ -180,7 +172,7 @@ a2i (const char *a)
looping = 0;
}
break;
-
+
case 16:
if (ch >= '0' && ch <= '9')
{
@@ -201,26 +193,24 @@ a2i (const char *a)
break;
}
}
-
+
if (neg)
- num = - num;
+ num = -num;
return num;
}
unsigned
-target_a2i(int ms_bit_nr,
- const char *a)
+target_a2i (int ms_bit_nr, const char *a)
{
if (ms_bit_nr)
- return (ms_bit_nr - a2i(a));
+ return (ms_bit_nr - a2i (a));
else
- return a2i(a);
+ return a2i (a);
}
unsigned
-i2target(int ms_bit_nr,
- unsigned bit)
+i2target (int ms_bit_nr, unsigned bit)
{
if (ms_bit_nr)
return ms_bit_nr - bit;
@@ -230,20 +220,19 @@ i2target(int ms_bit_nr,
int
-name2i (const char *names,
- const name_map *map)
+name2i (const char *names, const name_map * map)
{
const name_map *curr;
const char *name = names;
while (*name != '\0')
{
/* find our name */
- char *end = strchr(name, ',');
+ char *end = strchr (name, ',');
char *next;
unsigned len;
if (end == NULL)
{
- end = strchr(name, '\0');
+ end = strchr (name, '\0');
next = end;
}
else
@@ -274,8 +263,7 @@ name2i (const char *names,
}
const char *
-i2name (const int i,
- const name_map *map)
+i2name (const int i, const name_map * map)
{
while (map->name != NULL)
{