* macro.c (buffer_and_nest): Skip labels regardless of
[deliverable/binutils-gdb.git] / gas / macro.h
CommitLineData
fea17916 1/* macro.h - header file for macro support for gas
2da5c037 2 Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2002, 2003, 2004
f7e42eb4 3 Free Software Foundation, Inc.
252b5132
RH
4
5 Written by Steve and Judy Chamberlain of Cygnus Support,
6 sac@cygnus.com
7
8 This file is part of GAS, the GNU Assembler.
9
10 GAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 GAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GAS; see the file COPYING. If not, write to the Free
4b4da160
NC
22 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
23 02110-1301, USA. */
252b5132
RH
24
25#ifndef MACRO_H
26
27#define MACRO_H
28
29#include "ansidecl.h"
30#include "sb.h"
31
a01b9fa4 32/* Structures used to store macros.
9f10757c
TW
33
34 Each macro knows its name and included text. It gets built with a
35 list of formal arguments, and also keeps a hash table which points
36 into the list to speed up formal search. Each formal knows its
37 name and its default value. Each time the macro is expanded, the
47eebc20 38 formals get the actual values attached to them. */
9f10757c 39
fea17916 40/* Describe the formal arguments to a macro. */
9f10757c 41
ef99799a 42typedef struct formal_struct {
fea17916
NC
43 struct formal_struct *next; /* Next formal in list. */
44 sb name; /* Name of the formal. */
45 sb def; /* The default value. */
46 sb actual; /* The actual argument (changed on each expansion). */
47 int index; /* The index of the formal 0..formal_count - 1. */
6eaeac8a
JB
48 enum formal_type
49 {
50 FORMAL_OPTIONAL,
51 FORMAL_REQUIRED,
52 FORMAL_VARARG
53 } type; /* The kind of the formal. */
ef99799a 54} formal_entry;
9f10757c
TW
55
56/* Other values found in the index field of a formal_entry. */
57#define QUAL_INDEX (-1)
58#define NARG_INDEX (-2)
59#define LOCAL_INDEX (-3)
60
fea17916 61/* Describe the macro. */
9f10757c 62
fea17916
NC
63typedef struct macro_struct
64{
65 sb sub; /* Substitution text. */
66 int formal_count; /* Number of formal args. */
67 formal_entry *formals; /* Pointer to list of formal_structs. */
68 struct hash_control *formal_hash; /* Hash table of formals. */
02ddf156
JB
69 const char *name; /* Macro name. */
70 char *file; /* File the macro was defined in. */
71 unsigned int line; /* Line number of definition. */
ef99799a 72} macro_entry;
9f10757c 73
252b5132
RH
74/* Whether any macros have been defined. */
75
76extern int macro_defined;
77
78/* The macro nesting level. */
79
80extern int macro_nest;
81
c1d05a60
NC
82/* The macro hash table. */
83
84extern struct hash_control *macro_hash;
85
254d758c 86extern int buffer_and_nest (const char *, const char *, sb *, int (*) (sb *));
252b5132 87extern void macro_init
254d758c 88 (int, int, int, int (*) (const char *, int, sb *, int *));
caa32fe5 89extern void macro_set_alternate (int);
254d758c 90extern void macro_mri_mode (int);
252b5132 91extern const char *define_macro
02ddf156 92 (int, sb *, sb *, int (*) (sb *), char *, unsigned int, const char **);
254d758c
KH
93extern int check_macro (const char *, sb *, const char **, macro_entry **);
94extern void delete_macro (const char *);
95extern const char *expand_irp (int, int, sb *, sb *, int (*) (sb *));
252b5132
RH
96
97#endif
This page took 0.264344 seconds and 4 git commands to generate.