OSDN Git Service

2009-03-27 Vladimir Makarov <vmakarov@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / scan.h
1 /* scan.h - Utility declarations for scan-decls and fix-header programs.
2    Copyright (C) 1993, 1998, 1999, 2003, 2004, 2007, 2008 Free Software
3    Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify it
6    under the terms of the GNU General Public License as published by the
7    Free Software Foundation; either version 3, or (at your option) any
8    later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; see the file COPYING3.  If not see
17    <http://www.gnu.org/licenses/>.  */
18
19 #include <stdio.h>
20
21 typedef struct sstring
22 {
23   char *base;
24   char *ptr;
25   char *limit;
26 } sstring;
27
28 #define INIT_SSTRING(STR) ((STR)->base = 0, (STR)->ptr = 0, (STR)->limit = 0)
29 #define FREE_SSTRING(STR) do { if ((STR)->base) free (STR)->base; } while(0)
30 #define SSTRING_PUT(STR, C) do {\
31   if ((STR)->limit <= (STR)->ptr) make_sstring_space (STR, 1); \
32   *(STR)->ptr++ = (C); } while (0)
33 #define SSTRING_LENGTH(STR) ((STR)->ptr - (STR)->base)
34 #define MAKE_SSTRING_SPACE(STR, COUNT) \
35   if ((STR)->limit - (STR)->ptr < (COUNT)) make_sstring_space (STR, COUNT);
36
37 struct partial_proto;
38 struct fn_decl
39 {
40   const char *fname;
41   const char *rtype;
42   const char *params;
43   struct partial_proto *partial;
44 };
45
46 struct cpp_token;
47
48 extern void sstring_append (sstring *, sstring *);
49 extern void make_sstring_space (sstring *, int);
50 extern int skip_spaces (FILE *, int);
51 extern int scan_ident (FILE *, sstring *, int);
52 extern int scan_string (FILE *, sstring *, int);
53 extern int read_upto (FILE *, sstring *, int);
54 extern unsigned long hash (const char *);
55 extern void recognized_function (const struct cpp_token *,
56                                  unsigned int, int, int);
57 extern void recognized_extern (const struct cpp_token *);
58 extern unsigned int hashstr (const char *, unsigned int);
59
60 extern int scan_decls (struct cpp_reader *, int, char **);
61
62 /* get_token is a simple C lexer.  */
63 #define IDENTIFIER_TOKEN 300
64 #define CHAR_TOKEN 301
65 #define STRING_TOKEN 302
66 #define INT_TOKEN 303
67 extern int get_token (FILE *, sstring *);
68
69 /* Current file and line number, taking #-directives into account */
70 extern int source_lineno;
71 extern sstring source_filename;
72 /* Current physical line number */
73 extern int lineno;
74
75 extern struct line_maps line_table;