OSDN Git Service

* configure.in (m68*-*-rtemscoff*): New target, formal name for
[pf3gnuchains/gcc-fork.git] / gcc / cpphash.h
1 /* Part of CPP library.  (Macro hash table support.)
2    Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
17
18 /* different kinds of things that can appear in the value field
19    of a hash node. */
20 union hashval
21 {
22   const char *cpval;            /* some predefined macros */
23   DEFINITION *defn;             /* #define */
24   struct hashnode *aschain;     /* #assert */
25 };
26
27 struct hashnode {
28   struct hashnode *next;        /* double links for easy deletion */
29   struct hashnode *prev;
30   struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
31                                    chain is kept, in case the node is the head
32                                    of the chain and gets deleted. */
33   enum node_type type;          /* type of special token */
34   int length;                   /* length of token, for quick comparison */
35   U_CHAR *name;                 /* the actual name */
36   union hashval value;          /* pointer to expansion, or whatever */
37 };
38
39 typedef struct hashnode HASHNODE;
40
41 /* Some definitions for the hash table.  The hash function MUST be
42    computed as shown in hashf () below.  That is because the rescan
43    loop computes the hash value `on the fly' for most tokens,
44    in order to avoid the overhead of a lot of procedure calls to
45    the hashf () function.  Hashf () only exists for the sake of
46    politeness, for use when speed isn't so important. */
47
48 #define HASHSTEP(old, c) ((old << 2) + c)
49 #define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
50
51 extern HASHNODE *cpp_install      PARAMS ((cpp_reader *, const U_CHAR *, int,
52                                            enum node_type, const char *, int));
53 extern int hashf                  PARAMS ((const U_CHAR *, int, int));
54 extern void delete_macro          PARAMS ((HASHNODE *));
55
56 extern MACRODEF create_definition PARAMS ((U_CHAR *, U_CHAR *,
57                                            cpp_reader *, int));
58 extern int compare_defs           PARAMS ((cpp_reader *, DEFINITION *,
59                                            DEFINITION *));
60 extern void macroexpand           PARAMS ((cpp_reader *, HASHNODE *));
61 extern void dump_definition       PARAMS ((cpp_reader *, MACRODEF));