OSDN Git Service

2010-05-21 Tobias Burnus <burnus@net-b.de>
[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 /* Get a new constructor structure.  */
25 gfc_constructor *gfc_constructor_get (void);
26
27 gfc_constructor_base gfc_constructor_get_base (void);
28
29 /* Copy a constructor structure.  */
30 gfc_constructor_base gfc_constructor_copy (gfc_constructor_base base);
31
32
33 /* Free a gfc_constructor structure.  */
34 void gfc_constructor_free (gfc_constructor_base base);
35
36
37 /* Given an constructor structure, append the expression node onto
38    the constructor. Returns the constructor node appended.  */
39 gfc_constructor *gfc_constructor_append (gfc_constructor_base *base,
40                                          gfc_constructor *c);
41
42 gfc_constructor *gfc_constructor_append_expr (gfc_constructor_base *base,
43                                               gfc_expr *e, locus *where);
44
45
46 /* Given an constructor structure, place the expression node at position.
47    Returns the constructor node inserted.  */
48 gfc_constructor *gfc_constructor_insert (gfc_constructor_base *base,
49                                          gfc_constructor *c, int n);
50
51 gfc_constructor *gfc_constructor_insert_expr (gfc_constructor_base *base,
52                                               gfc_expr *e, locus *where,
53                                               int n);
54
55 /* Given an array constructor expression and an element number (starting
56    at zero), return a pointer to the array element.  NULL is returned if
57    the size of the array has been exceeded. The expression node returned
58    remains a part of the array and should not be freed.  */
59
60 gfc_constructor *gfc_constructor_lookup (gfc_constructor_base base, int n);
61
62 /* Convenience function. Same as ...
63      gfc_constructor *c = gfc_constructor_lookup (base, n);
64      gfc_expr *e = c ? c->expr : NULL;
65 */
66 gfc_expr *gfc_constructor_lookup_expr (gfc_constructor_base base, int n);
67
68
69 int gfc_constructor_expr_foreach (gfc_constructor *ctor, int(*)(gfc_expr *));
70
71
72 void gfc_constructor_swap (gfc_constructor *ctor, int n, int m);
73
74
75
76 /* Get the first constructor node in the constructure structure.
77    Returns NULL if there is no such expression.  */
78 gfc_constructor *gfc_constructor_first (gfc_constructor_base base);
79
80 /* Get the next constructor node in the constructure structure.
81    Returns NULL if there is no next expression.  */
82 gfc_constructor *gfc_constructor_next (gfc_constructor *ctor);
83
84 gfc_constructor *gfc_constructor_advance (gfc_constructor *ctor, int n);
85
86 #endif /* GFC_CONSTRUCTOR_H */