]> Git Repo - binutils.git/blame - sim/igen/misc.h
Automatic date update in version.in
[binutils.git] / sim / igen / misc.h
CommitLineData
feaee4bd
AC
1/* The IGEN simulator generator for GDB, the GNU Debugger.
2
4a94e368 3 Copyright 2002-2022 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
c906108c
SS
22
23
24/* Frustrating header junk */
25
4e0bf4c4
AC
26enum
27{
c906108c
SS
28 default_insn_bit_size = 32,
29 max_insn_bit_size = 64,
30};
31
32
c906108c 33#include <ctype.h>
9850d2d8
MF
34#include <stdint.h>
35#include <stdio.h>
c906108c 36#include <stdlib.h>
9850d2d8 37#include <string.h>
c906108c 38
c0c7e6ce 39#include "ansidecl.h"
c906108c
SS
40
41#include "filter_host.h"
42
43typedef struct _line_ref line_ref;
4e0bf4c4
AC
44struct _line_ref
45{
c906108c
SS
46 const char *file_name;
47 int line_nr;
48};
49
50/* Error appends a new line, warning and notify do not */
c0c7e6ce
MF
51typedef void error_func (const line_ref *line, const char *msg, ...)
52 ATTRIBUTE_PRINTF (2, 3);
c906108c 53
16cceb84 54extern ATTRIBUTE_NORETURN error_func error;
c906108c
SS
55extern error_func warning;
56extern error_func notify;
57
58
59#define ERROR(EXPRESSION) \
60do { \
61 line_ref line; \
62 line.file_name = filter_filename (__FILE__); \
63 line.line_nr = __LINE__; \
3abad2f6 64 error (&line, EXPRESSION "\n"); \
c906108c
SS
65} while (0)
66
67#define ASSERT(EXPRESSION) \
68do { \
69 if (!(EXPRESSION)) { \
70 line_ref line; \
71 line.file_name = filter_filename (__FILE__); \
72 line.line_nr = __LINE__; \
3abad2f6 73 error (&line, "assertion failed - %s\n", #EXPRESSION); \
c906108c
SS
74 } \
75} while (0)
76
77#define ZALLOC(TYPE) ((TYPE*) zalloc (sizeof(TYPE)))
78#define NZALLOC(TYPE,N) ((TYPE*) zalloc (sizeof(TYPE) * (N)))
c906108c 79
4e0bf4c4 80extern void *zalloc (long size);
c906108c 81
4e0bf4c4 82extern unsigned target_a2i (int ms_bit_nr, const char *a);
c906108c 83
4e0bf4c4 84extern unsigned i2target (int ms_bit_nr, unsigned bit);
c906108c 85
4e0bf4c4 86extern unsigned long long a2i (const char *a);
c906108c
SS
87
88
89/* Try looking for name in the map table (returning the corresponding
90 integer value).
91
92 If the the sentinal (NAME == NULL) its value if >= zero is returned
93 as the default. */
94
4e0bf4c4
AC
95typedef struct _name_map
96{
c906108c
SS
97 const char *name;
98 int i;
4e0bf4c4
AC
99}
100name_map;
c906108c 101
4e0bf4c4 102extern int name2i (const char *name, const name_map * map);
c906108c 103
4e0bf4c4 104extern const char *i2name (const int i, const name_map * map);
This page took 2.259383 seconds and 4 git commands to generate.