constructor.h 3.1 KB

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