1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include "build-config.h"
42 error (char *msg
, ...)
54 void *memory
= malloc(size
);
56 error("zalloc failed\n");
57 memset(memory
, 0, size
);
62 dumpf (int indent
, char *msg
, ...)
65 for (; indent
> 0; indent
--)
90 if (a
[1] == 'x' || a
[1] == 'X') {
108 if (ch
>= '0' && ch
<= '9') {
109 num
= (num
* 10) + (ch
- '0');
116 if (ch
>= '0' && ch
<= '7') {
117 num
= (num
* 8) + (ch
- '0');
124 if (ch
>= '0' && ch
<= '9') {
125 num
= (num
* 16) + (ch
- '0');
126 } else if (ch
>= 'a' && ch
<= 'f') {
127 num
= (num
* 16) + (ch
- 'a' + 10);
128 } else if (ch
>= 'A' && ch
<= 'F') {
129 num
= (num
* 16) + (ch
- 'A' + 10);
144 target_a2i(int ms_bit_nr
,
148 return (ms_bit_nr
- a2i(a
));
154 i2target(int ms_bit_nr
,
158 return ms_bit_nr
- bit
;
165 name2i(const char *names
,
168 const name_map
*curr
;
169 const char *name
= names
;
170 while (*name
!= '\0') {
172 char *end
= strchr(name
, ',');
176 end
= strchr(name
, '\0');
185 while (curr
->name
!= NULL
) {
186 if (strncmp(curr
->name
, name
, len
) == 0
187 && strlen(curr
->name
) == len
)
193 /* nothing found, possibly return a default */
195 while (curr
->name
!= NULL
)
200 error("%s contains no valid names\n", names
);
208 while (map
->name
!= NULL
) {
213 error("map lookup failed for %d\n", i
);
This page took 0.033242 seconds and 4 git commands to generate.