libgfortran.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* Header file to the Fortran front-end and runtime library
  2. Copyright (C) 2007-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. /* Flags to specify which standard/extension contains a feature.
  16. Note that no features were obsoleted nor deleted in F2003.
  17. Please remember to keep those definitions in sync with
  18. gfortran.texi. */
  19. /* For now, use F2015 = GFC_STD_GNU. */
  20. #define GFC_STD_F2015 (1<<5) /* PLACEHOLDER for Fortran 2015. */
  21. #define GFC_STD_F2008_TS (1<<9) /* POST-F2008 technical reports. */
  22. #define GFC_STD_F2008_OBS (1<<8) /* Obsolescent in F2008. */
  23. #define GFC_STD_F2008 (1<<7) /* New in F2008. */
  24. #define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
  25. #define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
  26. #define GFC_STD_F2003 (1<<4) /* New in F2003. */
  27. #define GFC_STD_F95 (1<<3) /* New in F95. */
  28. #define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
  29. #define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
  30. #define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or
  31. obsolescent in later standards. */
  32. /* Bitmasks for the various FPE that can be enabled. These need to be straight integers
  33. e.g., 8 instead of (1<<3), because they will be included in Fortran source. */
  34. #define GFC_FPE_INVALID 1
  35. #define GFC_FPE_DENORMAL 2
  36. #define GFC_FPE_ZERO 4
  37. #define GFC_FPE_OVERFLOW 8
  38. #define GFC_FPE_UNDERFLOW 16
  39. #define GFC_FPE_INEXACT 32
  40. /* Defines for floating-point rounding modes. */
  41. #define GFC_FPE_DOWNWARD 1
  42. #define GFC_FPE_TONEAREST 2
  43. #define GFC_FPE_TOWARDZERO 3
  44. #define GFC_FPE_UPWARD 4
  45. /* Size of the buffer required to store FPU state for any target.
  46. In particular, this has to be larger than fenv_t on all glibc targets.
  47. Currently, the winner is x86_64 with 32 bytes. */
  48. #define GFC_FPE_STATE_BUFFER_SIZE 32
  49. /* Bitmasks for the various runtime checks that can be enabled. */
  50. #define GFC_RTCHECK_BOUNDS (1<<0)
  51. #define GFC_RTCHECK_ARRAY_TEMPS (1<<1)
  52. #define GFC_RTCHECK_RECURSION (1<<2)
  53. #define GFC_RTCHECK_DO (1<<3)
  54. #define GFC_RTCHECK_POINTER (1<<4)
  55. #define GFC_RTCHECK_MEM (1<<5)
  56. #define GFC_RTCHECK_ALL (GFC_RTCHECK_BOUNDS | GFC_RTCHECK_ARRAY_TEMPS \
  57. | GFC_RTCHECK_RECURSION | GFC_RTCHECK_DO \
  58. | GFC_RTCHECK_POINTER | GFC_RTCHECK_MEM)
  59. /* Special unit numbers used to convey certain conditions. Numbers -3
  60. thru -9 available. NEWUNIT values start at -10. */
  61. #define GFC_INTERNAL_UNIT -1
  62. #define GFC_INVALID_UNIT -2
  63. /* Possible values for the CONVERT I/O specifier. */
  64. /* Keep in sync with GFC_FLAG_CONVERT_* in gcc/flags.h. */
  65. typedef enum
  66. {
  67. GFC_CONVERT_NONE = -1,
  68. GFC_CONVERT_NATIVE = 0,
  69. GFC_CONVERT_SWAP,
  70. GFC_CONVERT_BIG,
  71. GFC_CONVERT_LITTLE
  72. }
  73. unit_convert;
  74. /* Runtime errors. */
  75. typedef enum
  76. {
  77. LIBERROR_FIRST = -3, /* Marker for the first error. */
  78. LIBERROR_EOR = -2, /* End of record, must be negative. */
  79. LIBERROR_END = -1, /* End of file, must be negative. */
  80. LIBERROR_OK = 0, /* Indicates success, must be zero. */
  81. LIBERROR_OS = 5000, /* OS error, more info in errno. */
  82. LIBERROR_OPTION_CONFLICT,
  83. LIBERROR_BAD_OPTION,
  84. LIBERROR_MISSING_OPTION,
  85. LIBERROR_ALREADY_OPEN,
  86. LIBERROR_BAD_UNIT,
  87. LIBERROR_FORMAT,
  88. LIBERROR_BAD_ACTION,
  89. LIBERROR_ENDFILE,
  90. LIBERROR_BAD_US,
  91. LIBERROR_READ_VALUE,
  92. LIBERROR_READ_OVERFLOW,
  93. LIBERROR_INTERNAL,
  94. LIBERROR_INTERNAL_UNIT,
  95. LIBERROR_ALLOCATION,
  96. LIBERROR_DIRECT_EOR,
  97. LIBERROR_SHORT_RECORD,
  98. LIBERROR_CORRUPT_FILE,
  99. LIBERROR_INQUIRE_INTERNAL_UNIT, /* Must be different from STAT_STOPPED_IMAGE. */
  100. LIBERROR_LAST /* Not a real error, the last error # + 1. */
  101. }
  102. libgfortran_error_codes;
  103. /* Must kept in sync with libgfortrancaf.h. */
  104. typedef enum
  105. {
  106. GFC_STAT_UNLOCKED = 0,
  107. GFC_STAT_LOCKED,
  108. GFC_STAT_LOCKED_OTHER_IMAGE,
  109. GFC_STAT_STOPPED_IMAGE = 6000, /* See LIBERROR_INQUIRE_INTERNAL_UNIT above. */
  110. GFC_STAT_FAILED_IMAGE
  111. }
  112. libgfortran_stat_codes;
  113. typedef enum
  114. {
  115. GFC_CAF_ATOMIC_ADD = 1,
  116. GFC_CAF_ATOMIC_AND,
  117. GFC_CAF_ATOMIC_OR,
  118. GFC_CAF_ATOMIC_XOR
  119. } libcaf_atomic_codes;
  120. /* For CO_REDUCE. */
  121. #define GFC_CAF_BYREF (1<<0)
  122. #define GFC_CAF_HIDDENLEN (1<<1)
  123. #define GFC_CAF_ARG_VALUE (1<<2)
  124. #define GFC_CAF_ARG_DESC (1<<3)
  125. /* Default unit number for preconnected standard input and output. */
  126. #define GFC_STDIN_UNIT_NUMBER 5
  127. #define GFC_STDOUT_UNIT_NUMBER 6
  128. #define GFC_STDERR_UNIT_NUMBER 0
  129. /* FIXME: Increase to 15 for Fortran 2008. Also needs changes to
  130. GFC_DTYPE_RANK_MASK. See PR 36825. */
  131. #define GFC_MAX_DIMENSIONS 7
  132. #define GFC_DTYPE_RANK_MASK 0x07
  133. #define GFC_DTYPE_TYPE_SHIFT 3
  134. #define GFC_DTYPE_TYPE_MASK 0x38
  135. #define GFC_DTYPE_SIZE_SHIFT 6
  136. /* Basic types. BT_VOID is used by ISO C Binding so funcs like c_f_pointer
  137. can take any arg with the pointer attribute as a param. These are also
  138. used in the run-time library for IO. */
  139. typedef enum
  140. { BT_UNKNOWN = 0, BT_INTEGER, BT_LOGICAL, BT_REAL, BT_COMPLEX,
  141. BT_DERIVED, BT_CHARACTER, BT_CLASS, BT_PROCEDURE, BT_HOLLERITH, BT_VOID,
  142. BT_ASSUMED
  143. }
  144. bt;