OSDN Git Service

gcc/
[pf3gnuchains/gcc-fork.git] / gcc / read-md.h
1 /* MD reader definitions.
2    Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
4    Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #include "obstack.h"
23 #include "hashtab.h"
24
25 /* Holds one symbol or number in the .md file.  */
26 struct md_name {
27   /* The name as it appeared in the .md file.  Names are syntactically
28      limited to the length of this buffer.  */
29   char buffer[256];
30
31   /* The name that should actually be used by the generator programs.
32      This is an expansion of NAME, after things like constant substitution.  */
33   char *string;
34 };
35
36 /* This structure represents a constant defined by define_constant.
37    NAME is the name of the constant and VALUE is the string it
38    expands to.  */
39 struct md_constant {
40   char *name;
41   char *value;
42 };
43
44 extern FILE *read_md_file;
45 extern int read_md_lineno;
46 extern const char *read_md_filename;
47 extern struct obstack string_obstack;
48
49 /* Read the next character from the MD file.  */
50
51 static inline int
52 read_char (void)
53 {
54   int ch;
55
56   ch = getc (read_md_file);
57   if (ch == '\n')
58     read_md_lineno++;
59   return ch;
60 }
61
62 /* Put back CH, which was the last character read from the MD file.  */
63
64 static inline void
65 unread_char (int ch)
66 {
67   if (ch == '\n')
68     read_md_lineno--;
69   ungetc (ch, read_md_file);
70 }
71
72 extern hashval_t leading_string_hash (const void *);
73 extern int leading_string_eq_p (const void *, const void *);
74 extern void copy_md_ptr_loc (const void *, const void *);
75 extern void print_md_ptr_loc (const void *);
76 extern const char *join_c_conditions (const char *, const char *);
77 extern void print_c_condition (const char *);
78 extern void message_with_line (int, const char *, ...) ATTRIBUTE_PRINTF_2;
79 extern void error_with_line (int, const char *, ...) ATTRIBUTE_PRINTF_2;
80 extern void fatal_with_file_and_line (const char *, ...)
81   ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
82 extern void fatal_expected_char (int, int) ATTRIBUTE_NORETURN;
83 extern int read_skip_spaces (void);
84 extern void read_name (struct md_name *);
85 extern char *read_quoted_string (void);
86 extern char *read_string (int);
87 extern int n_comma_elts (const char *);
88 extern const char *scan_comma_elt (const char **);
89 extern void read_constants (void);
90 extern void traverse_md_constants (htab_trav, void *);
91 extern void init_md_reader (void);