]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/igen/misc.h
Updated Spanish translation for the BFD sub-directory.
[thirdparty/binutils-gdb.git] / sim / igen / misc.h
CommitLineData
feaee4bd
AC
1/* The IGEN simulator generator for GDB, the GNU Debugger.
2
1d506c26 3 Copyright 2002-2024 Free Software Foundation, Inc.
feaee4bd
AC
4
5 Contributed by Andrew Cagney.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
4744ac1b 11 the Free Software Foundation; either version 3 of the License, or
feaee4bd
AC
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
4744ac1b 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
feaee4bd 21
339e44f8
MF
22#ifndef IGEN_MISC_H
23#define IGEN_MISC_H
c906108c
SS
24
25/* Frustrating header junk */
26
4e0bf4c4
AC
27enum
28{
c906108c
SS
29 default_insn_bit_size = 32,
30 max_insn_bit_size = 64,
31};
32
33
c906108c 34#include <ctype.h>
9850d2d8
MF
35#include <stdint.h>
36#include <stdio.h>
c906108c 37#include <stdlib.h>
9850d2d8 38#include <string.h>
c906108c 39
c0c7e6ce 40#include "ansidecl.h"
c906108c
SS
41
42#include "filter_host.h"
43
44typedef struct _line_ref line_ref;
4e0bf4c4
AC
45struct _line_ref
46{
c906108c
SS
47 const char *file_name;
48 int line_nr;
49};
50
51/* Error appends a new line, warning and notify do not */
c0c7e6ce 52typedef void error_func (const line_ref *line, const char *msg, ...)
f0f0b063 53 ATTRIBUTE_PRINTF_2;
c906108c 54
f0f0b063
MF
55extern error_func error ATTRIBUTE_PRINTF_2 ATTRIBUTE_NORETURN;
56extern error_func warning ATTRIBUTE_PRINTF_2;
57extern error_func notify ATTRIBUTE_PRINTF_2;
c906108c
SS
58
59
ef993dfa 60#define ERROR(EXPRESSION, args...) \
c906108c
SS
61do { \
62 line_ref line; \
63 line.file_name = filter_filename (__FILE__); \
64 line.line_nr = __LINE__; \
ef993dfa 65 error (&line, EXPRESSION "\n", ## args); \
c906108c
SS
66} while (0)
67
68#define ASSERT(EXPRESSION) \
69do { \
70 if (!(EXPRESSION)) { \
71 line_ref line; \
72 line.file_name = filter_filename (__FILE__); \
73 line.line_nr = __LINE__; \
3abad2f6 74 error (&line, "assertion failed - %s\n", #EXPRESSION); \
c906108c
SS
75 } \
76} while (0)
77
78#define ZALLOC(TYPE) ((TYPE*) zalloc (sizeof(TYPE)))
79#define NZALLOC(TYPE,N) ((TYPE*) zalloc (sizeof(TYPE) * (N)))
c906108c 80
4e0bf4c4 81extern void *zalloc (long size);
c906108c 82
4e0bf4c4 83extern unsigned target_a2i (int ms_bit_nr, const char *a);
c906108c 84
4e0bf4c4 85extern unsigned i2target (int ms_bit_nr, unsigned bit);
c906108c 86
4e0bf4c4 87extern unsigned long long a2i (const char *a);
c906108c
SS
88
89
90/* Try looking for name in the map table (returning the corresponding
91 integer value).
92
93 If the the sentinal (NAME == NULL) its value if >= zero is returned
94 as the default. */
95
4e0bf4c4
AC
96typedef struct _name_map
97{
c906108c
SS
98 const char *name;
99 int i;
4e0bf4c4
AC
100}
101name_map;
c906108c 102
4e0bf4c4 103extern int name2i (const char *name, const name_map * map);
c906108c 104
4e0bf4c4 105extern const char *i2name (const int i, const name_map * map);
339e44f8
MF
106
107#endif /* IGEN_MISC_H */