OSDN Git Service

* c-common.c (c_common_reswords): Add _Static_assert for C.
[pf3gnuchains/gcc-fork.git] / gcc / fortran / constructor.h
1 /* Array and structure constructors
2    Copyright (C) 2009, 2010
3    Free Software Foundation, Inc.
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 GFC_CONSTRUCTOR_H
22 #define GFC_CONSTRUCTOR_H
23
24 #include "gfortran.h"
25 #include "splay-tree.h"
26
27
28 /* Get a new constructor structure.  */
29 gfc_constructor *gfc_constructor_get (void);
30
31 gfc_constructor_base gfc_constructor_get_base (void);
32
33 /* Copy a constructor structure.  */
34 gfc_constructor_base gfc_constructor_copy (gfc_constructor_base base);
35
36
37 /* Free a gfc_constructor structure.  */
38 void gfc_constructor_free (gfc_constructor_base base);
39
40
41 /* Given an constructor structure, append the expression node onto
42    the constructor. Returns the constructor node appended.  */
43 gfc_constructor *gfc_constructor_append (gfc_constructor_base *base,
44                                          gfc_constructor *c);
45
46 gfc_constructor *gfc_constructor_append_expr (gfc_constructor_base *base,
47                                               gfc_expr *e, locus *where);
48
49
50 /* Given an constructor structure, place the expression node at position.
51    Returns the constructor node inserted.  */
52 gfc_constructor *gfc_constructor_insert (gfc_constructor_base *base,
53                                          gfc_constructor *c, int n);
54
55 gfc_constructor *gfc_constructor_insert_expr (gfc_constructor_base *base,
56                                               gfc_expr *e, locus *where,
57                                               int n);
58
59 /* Given an array constructor expression and an element number (starting
60    at zero), return a pointer to the array element.  NULL is returned if
61    the size of the array has been exceeded. The expression node returned
62    remains a part of the array and should not be freed.  */
63
64 gfc_constructor *gfc_constructor_lookup (gfc_constructor_base base, int n);
65
66 /* Convenience function. Same as ...
67      gfc_constructor *c = gfc_constructor_lookup (base, n);
68      gfc_expr *e = c ? c->expr : NULL;
69 */
70 gfc_expr *gfc_constructor_lookup_expr (gfc_constructor_base base, int n);
71
72
73 int gfc_constructor_expr_foreach (gfc_constructor *ctor, int(*)(gfc_expr *));
74
75
76 void gfc_constructor_swap (gfc_constructor *ctor, int n, int m);
77
78
79
80 /* Get the first constructor node in the constructure structure.
81    Returns NULL if there is no such expression.  */
82 gfc_constructor *gfc_constructor_first (gfc_constructor_base base);
83
84 /* Get the next constructor node in the constructure structure.
85    Returns NULL if there is no next expression.  */
86 gfc_constructor *gfc_constructor_next (gfc_constructor *ctor);
87
88 gfc_constructor *gfc_constructor_advance (gfc_constructor *ctor, int n);
89
90 #endif /* GFC_CONSTRUCTOR_H */