| 1 |
/* Array and structure constructors |
| 2 |
Copyright (C) 2009-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify it under |
| 7 |
the terms of the GNU General Public License as published by the Free |
| 8 |
Software Foundation; either version 3, or (at your option) any later |
| 9 |
version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 |
for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
#ifndef GFC_CONSTRUCTOR_H |
| 21 |
#define GFC_CONSTRUCTOR_H |
| 22 |
|
| 23 |
/* Get a new constructor structure. */ |
| 24 |
gfc_constructor *gfc_constructor_get (void); |
| 25 |
|
| 26 |
/* Copy a constructor structure. */ |
| 27 |
gfc_constructor_base gfc_constructor_copy (gfc_constructor_base base); |
| 28 |
|
| 29 |
|
| 30 |
/* Free a gfc_constructor structure. */ |
| 31 |
void gfc_constructor_free (gfc_constructor_base base); |
| 32 |
|
| 33 |
|
| 34 |
/* Given an constructor structure, append the expression node onto |
| 35 |
the constructor. Returns the constructor node appended. */ |
| 36 |
gfc_constructor *gfc_constructor_append (gfc_constructor_base *base, |
| 37 |
gfc_constructor *c); |
| 38 |
|
| 39 |
gfc_constructor *gfc_constructor_append_expr (gfc_constructor_base *base, |
| 40 |
gfc_expr *e, locus *where); |
| 41 |
|
| 42 |
|
| 43 |
/* Given an constructor structure, place the expression node at position. |
| 44 |
Returns the constructor node inserted. */ |
| 45 |
gfc_constructor *gfc_constructor_insert (gfc_constructor_base *base, |
| 46 |
gfc_constructor *c, int n); |
| 47 |
|
| 48 |
gfc_constructor *gfc_constructor_insert_expr (gfc_constructor_base *base, |
| 49 |
gfc_expr *e, locus *where, |
| 50 |
int n); |
| 51 |
|
| 52 |
/* Given an array constructor expression and an element number (starting |
| 53 |
at zero), return a pointer to the array element. NULL is returned if |
| 54 |
the size of the array has been exceeded. The expression node returned |
| 55 |
remains a part of the array and should not be freed. */ |
| 56 |
|
| 57 |
gfc_constructor *gfc_constructor_lookup (gfc_constructor_base base, int n); |
| 58 |
|
| 59 |
/* Convenience function. Same as ... |
| 60 |
gfc_constructor *c = gfc_constructor_lookup (base, n); |
| 61 |
gfc_expr *e = c ? c->expr : NULL; |
| 62 |
*/ |
| 63 |
gfc_expr *gfc_constructor_lookup_expr (gfc_constructor_base base, int n); |
| 64 |
|
| 65 |
/* Get the first constructor node in the constructure structure. |
| 66 |
Returns NULL if there is no such expression. */ |
| 67 |
gfc_constructor *gfc_constructor_first (gfc_constructor_base base); |
| 68 |
|
| 69 |
/* Get the next constructor node in the constructure structure. |
| 70 |
Returns NULL if there is no next expression. */ |
| 71 |
gfc_constructor *gfc_constructor_next (gfc_constructor *ctor); |
| 72 |
|
| 73 |
/* Remove the gfc_constructor node from the splay tree. */ |
| 74 |
void gfc_constructor_remove (gfc_constructor *); |
| 75 |
|
| 76 |
/* Return first constructor node after offset. */ |
| 77 |
gfc_constructor *gfc_constructor_lookup_next (gfc_constructor_base, int); |
| 78 |
|
| 79 |
#endif /* GFC_CONSTRUCTOR_H */ |