OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [c-pretty-print.h] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 280 jeremybenn
/* Various declarations for the C and C++ pretty-printers.
2
   Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
3
   Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free
9
Software Foundation; either version 3, or (at your option) any later
10
version.
11
 
12
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13
WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING3.  If not see
19
<http://www.gnu.org/licenses/>.  */
20
 
21
#ifndef GCC_C_PRETTY_PRINTER
22
#define GCC_C_PRETTY_PRINTER
23
 
24
#include "tree.h"
25
#include "c-common.h"
26
#include "pretty-print.h"
27
 
28
 
29
typedef enum
30
  {
31
     pp_c_flag_abstract = 1 << 1,
32
     pp_c_flag_last_bit = 2
33
  } pp_c_pretty_print_flags;
34
 
35
 
36
/* The data type used to bundle information necessary for pretty-printing
37
   a C or C++ entity.  */
38
typedef struct c_pretty_print_info c_pretty_printer;
39
 
40
/* The type of a C pretty-printer 'member' function.  */
41
typedef void (*c_pretty_print_fn) (c_pretty_printer *, tree);
42
 
43
/* The datatype that contains information necessary for pretty-printing
44
   a tree that represents a C construct.  Any pretty-printer for a
45
   language using C/c++ syntax can derive from this datatype and reuse
46
   facilities provided here.  It can do so by having a subobject of type
47
   c_pretty_printer and override the macro pp_c_base to return a pointer
48
   to that subobject.  Such a pretty-printer has the responsibility to
49
   initialize the pp_base() part, then call pp_c_pretty_printer_init
50
   to set up the components that are specific to the C pretty-printer.
51
   A derived pretty-printer can override any function listed in the
52
   vtable below.  See cp/cxx-pretty-print.h and cp/cxx-pretty-print.c
53
   for an example of derivation.  */
54
struct c_pretty_print_info
55
{
56
  pretty_printer base;
57
  /* Points to the first element of an array of offset-list.
58
     Not used yet.  */
59
  int *offset_list;
60
 
61
  pp_flags flags;
62
 
63
  /* These must be overridden by each of the C and C++ front-end to
64
     reflect their understanding of syntactic productions when they differ.  */
65
  c_pretty_print_fn declaration;
66
  c_pretty_print_fn declaration_specifiers;
67
  c_pretty_print_fn declarator;
68
  c_pretty_print_fn abstract_declarator;
69
  c_pretty_print_fn direct_abstract_declarator;
70
  c_pretty_print_fn type_specifier_seq;
71
  c_pretty_print_fn direct_declarator;
72
  c_pretty_print_fn ptr_operator;
73
  c_pretty_print_fn parameter_list;
74
  c_pretty_print_fn type_id;
75
  c_pretty_print_fn simple_type_specifier;
76
  c_pretty_print_fn function_specifier;
77
  c_pretty_print_fn storage_class_specifier;
78
  c_pretty_print_fn initializer;
79
 
80
  c_pretty_print_fn statement;
81
 
82
  c_pretty_print_fn constant;
83
  c_pretty_print_fn id_expression;
84
  c_pretty_print_fn primary_expression;
85
  c_pretty_print_fn postfix_expression;
86
  c_pretty_print_fn unary_expression;
87
  c_pretty_print_fn multiplicative_expression;
88
  c_pretty_print_fn conditional_expression;
89
  c_pretty_print_fn assignment_expression;
90
  c_pretty_print_fn expression;
91
};
92
 
93
/* Override the pp_base macro.  Derived pretty-printers should not
94
   touch this macro.  Instead they should override pp_c_base instead.  */
95
#undef pp_base
96
#define pp_base(PP)  (&pp_c_base (PP)->base)
97
 
98
 
99
#define pp_c_tree_identifier(PPI, ID)              \
100
   pp_c_identifier (PPI, IDENTIFIER_POINTER (ID))
101
 
102
#define pp_declaration(PPI, T)                    \
103
   pp_c_base (PPI)->declaration (pp_c_base (PPI), T)
104
#define pp_declaration_specifiers(PPI, D)         \
105
   pp_c_base (PPI)->declaration_specifiers (pp_c_base (PPI), D)
106
#define pp_abstract_declarator(PP, D)             \
107
   pp_c_base (PP)->abstract_declarator (pp_c_base (PP), D)
108
#define pp_type_specifier_seq(PPI, D)             \
109
   pp_c_base (PPI)->type_specifier_seq (pp_c_base (PPI), D)
110
#define pp_declarator(PPI, D)                     \
111
   pp_c_base (PPI)->declarator (pp_c_base (PPI), D)
112
#define pp_direct_declarator(PPI, D)              \
113
   pp_c_base (PPI)->direct_declarator (pp_c_base (PPI), D)
114
#define pp_direct_abstract_declarator(PP, D)      \
115
   pp_c_base (PP)->direct_abstract_declarator (pp_c_base (PP), D)
116
#define pp_ptr_operator(PP, D)                    \
117
   pp_c_base (PP)->ptr_operator (pp_c_base (PP), D)
118
#define pp_parameter_list(PPI, T)                 \
119
  pp_c_base (PPI)->parameter_list (pp_c_base (PPI), T)
120
#define pp_type_id(PPI, D)                        \
121
  pp_c_base (PPI)->type_id (pp_c_base (PPI), D)
122
#define pp_simple_type_specifier(PP, T)           \
123
  pp_c_base (PP)->simple_type_specifier (pp_c_base (PP), T)
124
#define pp_function_specifier(PP, D)              \
125
  pp_c_base (PP)->function_specifier (pp_c_base (PP), D)
126
#define pp_storage_class_specifier(PP, D)         \
127
  pp_c_base (PP)->storage_class_specifier (pp_c_base (PP), D);
128
 
129
#define pp_statement(PPI, S)                      \
130
  pp_c_base (PPI)->statement (pp_c_base (PPI), S)
131
 
132
#define pp_constant(PP, E) \
133
  pp_c_base (PP)->constant (pp_c_base (PP), E)
134
#define pp_id_expression(PP, E)  \
135
  pp_c_base (PP)->id_expression (pp_c_base (PP), E)
136
#define pp_primary_expression(PPI, E)             \
137
  pp_c_base (PPI)->primary_expression (pp_c_base (PPI), E)
138
#define pp_postfix_expression(PPI, E)             \
139
  pp_c_base (PPI)->postfix_expression (pp_c_base (PPI), E)
140
#define pp_unary_expression(PPI, E)               \
141
  pp_c_base (PPI)->unary_expression (pp_c_base (PPI), E)
142
#define pp_initializer(PPI, E)                    \
143
  pp_c_base (PPI)->initializer (pp_c_base (PPI), E)
144
#define pp_multiplicative_expression(PPI, E)      \
145
  pp_c_base (PPI)->multiplicative_expression (pp_c_base (PPI), E)
146
#define pp_conditional_expression(PPI, E)         \
147
  pp_c_base (PPI)->conditional_expression (pp_c_base (PPI), E)
148
#define pp_assignment_expression(PPI, E)          \
149
   pp_c_base (PPI)->assignment_expression (pp_c_base (PPI), E)
150
#define pp_expression(PP, E)                      \
151
   pp_c_base (PP)->expression (pp_c_base (PP), E)
152
 
153
 
154
/* Returns the c_pretty_printer base object of PRETTY-PRINTER.  This
155
   macro must be overridden by any subclass of c_pretty_print_info.  */
156
#define pp_c_base(PP)  (PP)
157
 
158
extern void pp_c_pretty_printer_init (c_pretty_printer *);
159
void pp_c_whitespace (c_pretty_printer *);
160
void pp_c_left_paren (c_pretty_printer *);
161
void pp_c_right_paren (c_pretty_printer *);
162
void pp_c_left_brace (c_pretty_printer *);
163
void pp_c_right_brace (c_pretty_printer *);
164
void pp_c_left_bracket (c_pretty_printer *);
165
void pp_c_right_bracket (c_pretty_printer *);
166
void pp_c_dot (c_pretty_printer *);
167
void pp_c_ampersand (c_pretty_printer *);
168
void pp_c_star (c_pretty_printer *);
169
void pp_c_arrow (c_pretty_printer *);
170
void pp_c_semicolon (c_pretty_printer *);
171
void pp_c_complement (c_pretty_printer *);
172
void pp_c_exclamation (c_pretty_printer *);
173
void pp_c_space_for_pointer_operator (c_pretty_printer *, tree);
174
 
175
/* Declarations.  */
176
void pp_c_tree_decl_identifier (c_pretty_printer *, tree);
177
void pp_c_function_definition (c_pretty_printer *, tree);
178
void pp_c_attributes (c_pretty_printer *, tree);
179
void pp_c_type_qualifier_list (c_pretty_printer *, tree);
180
void pp_c_parameter_type_list (c_pretty_printer *, tree);
181
void pp_c_declaration (c_pretty_printer *, tree);
182
void pp_c_declaration_specifiers (c_pretty_printer *, tree);
183
void pp_c_declarator (c_pretty_printer *, tree);
184
void pp_c_direct_declarator (c_pretty_printer *, tree);
185
void pp_c_specifier_qualifier_list (c_pretty_printer *, tree);
186
void pp_c_function_specifier (c_pretty_printer *, tree);
187
void pp_c_type_id (c_pretty_printer *, tree);
188
void pp_c_direct_abstract_declarator (c_pretty_printer *, tree);
189
void pp_c_type_specifier (c_pretty_printer *, tree);
190
void pp_c_storage_class_specifier (c_pretty_printer *, tree);
191
/* Statements.  */
192
void pp_c_statement (c_pretty_printer *, tree);
193
/* Expressions.  */
194
void pp_c_expression (c_pretty_printer *, tree);
195
void pp_c_logical_or_expression (c_pretty_printer *, tree);
196
void pp_c_expression_list (c_pretty_printer *, tree);
197
void pp_c_constructor_elts (c_pretty_printer *, VEC(constructor_elt,gc) *);
198
void pp_c_call_argument_list (c_pretty_printer *, tree);
199
void pp_c_unary_expression (c_pretty_printer *, tree);
200
void pp_c_cast_expression (c_pretty_printer *, tree);
201
void pp_c_postfix_expression (c_pretty_printer *, tree);
202
void pp_c_primary_expression (c_pretty_printer *, tree);
203
void pp_c_init_declarator (c_pretty_printer *, tree);
204
void pp_c_constant (c_pretty_printer *, tree);
205
void pp_c_id_expression (c_pretty_printer *, tree);
206
void pp_c_ws_string (c_pretty_printer *, const char *);
207
void pp_c_identifier (c_pretty_printer *, const char *);
208
void pp_c_string_literal (c_pretty_printer *, tree);
209
 
210
void print_c_tree (FILE *file, tree t);
211
 
212
#endif /* GCC_C_PRETTY_PRINTER */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.