OSDN Git Service

2010-10-06 Mikael Morin <mikael@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / iso-c-binding.def
1 /* Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
5 GCC is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 3, or (at your option) any later
8 version.
9
10 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING3.  If not see
17 <http://www.gnu.org/licenses/>.  */
18
19 /* This file contains the definition of the types provided by the
20    Fortran 2003 ISO_C_BINDING intrinsic module.  */
21
22 #ifndef NAMED_INTCST
23 # define NAMED_INTCST(a,b,c,d) 
24 #endif
25
26 #ifndef NAMED_REALCST
27 # define NAMED_REALCST(a,b,c) 
28 #endif
29
30 #ifndef NAMED_CMPXCST
31 # define NAMED_CMPXCST(a,b,c) 
32 #endif
33
34 #ifndef NAMED_LOGCST
35 # define NAMED_LOGCST(a,b,c) 
36 #endif
37
38 #ifndef NAMED_CHARKNDCST
39 # define NAMED_CHARKNDCST(a,b,c) 
40 #endif
41
42 #ifndef NAMED_FUNCTION
43 # define NAMED_FUNCTION(a,b,c,d)
44 #endif
45
46 /* The arguments to NAMED_*CST are:
47      -- an internal name
48      -- the symbol name in the module, as seen by Fortran code
49      -- the value it has, for use in trans-types.c  
50      -- the standard that supports this type  */
51
52 NAMED_INTCST (ISOCBINDING_INT, "c_int", gfc_c_int_kind, GFC_STD_F2003)
53 NAMED_INTCST (ISOCBINDING_SHORT, "c_short", \
54               get_int_kind_from_node (short_integer_type_node), GFC_STD_F2003)
55 NAMED_INTCST (ISOCBINDING_LONG, "c_long", \
56               get_int_kind_from_node (long_integer_type_node), GFC_STD_F2003)
57 NAMED_INTCST (ISOCBINDING_LONG_LONG, "c_long_long", \
58               get_int_kind_from_node (long_long_integer_type_node), GFC_STD_F2003)
59
60 NAMED_INTCST (ISOCBINDING_INTMAX_T, "c_intmax_t", \
61               get_int_kind_from_name (INTMAX_TYPE), GFC_STD_F2003)
62 NAMED_INTCST (ISOCBINDING_INTPTR_T, "c_intptr_t", \
63               get_int_kind_from_name (INTPTR_TYPE), GFC_STD_F2003)
64 NAMED_INTCST (ISOCBINDING_SIZE_T, "c_size_t", \
65               gfc_index_integer_kind, GFC_STD_F2003)
66 NAMED_INTCST (ISOCBINDING_SIGNED_CHAR, "c_signed_char", \
67               get_int_kind_from_node (signed_char_type_node), GFC_STD_F2003)
68
69 NAMED_INTCST (ISOCBINDING_INT8_T, "c_int8_t", \
70               get_int_kind_from_name (INT8_TYPE), GFC_STD_F2003)
71 NAMED_INTCST (ISOCBINDING_INT16_T, "c_int16_t", \
72               get_int_kind_from_name (INT16_TYPE), GFC_STD_F2003)
73 NAMED_INTCST (ISOCBINDING_INT32_T, "c_int32_t", \
74               get_int_kind_from_name (INT32_TYPE), GFC_STD_F2003)
75 NAMED_INTCST (ISOCBINDING_INT64_T, "c_int64_t", \
76               get_int_kind_from_name (INT64_TYPE), GFC_STD_F2003)
77 /* GNU Extension.  */
78 NAMED_INTCST (ISOCBINDING_INT128_T, "c_int128_t", \
79               get_int_kind_from_width (128), GFC_STD_GNU)
80
81 NAMED_INTCST (ISOCBINDING_INT_LEAST8_T, "c_int_least8_t", \
82               get_int_kind_from_name (INT_LEAST8_TYPE), GFC_STD_F2003)
83 NAMED_INTCST (ISOCBINDING_INT_LEAST16_T, "c_int_least16_t", \
84               get_int_kind_from_name (INT_LEAST16_TYPE), GFC_STD_F2003)
85 NAMED_INTCST (ISOCBINDING_INT_LEAST32_T, "c_int_least32_t", \
86               get_int_kind_from_name (INT_LEAST32_TYPE), GFC_STD_F2003)
87 NAMED_INTCST (ISOCBINDING_INT_LEAST64_T, "c_int_least64_t", \
88               get_int_kind_from_name (INT_LEAST64_TYPE), GFC_STD_F2003)
89 /* GNU Extension.  */
90 NAMED_INTCST (ISOCBINDING_INT_LEAST128_T, "c_int_least128_t", \
91               get_int_kind_from_minimal_width (128), GFC_STD_GNU)
92
93 NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", \
94               get_int_kind_from_name (INT_FAST8_TYPE), GFC_STD_F2003)
95 NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", \
96               get_int_kind_from_name (INT_FAST16_TYPE), GFC_STD_F2003)
97 NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", \
98               get_int_kind_from_name (INT_FAST32_TYPE), GFC_STD_F2003)
99 NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", \
100               get_int_kind_from_name (INT_FAST64_TYPE), GFC_STD_F2003)
101 /* GNU Extension.  */
102 NAMED_INTCST (ISOCBINDING_INT_FAST128_T, "c_int_fast128_t",
103               get_int_kind_from_width (128), GFC_STD_GNU)
104
105 NAMED_REALCST (ISOCBINDING_FLOAT, "c_float", \
106                get_real_kind_from_node (float_type_node))
107 NAMED_REALCST (ISOCBINDING_DOUBLE, "c_double", \
108                get_real_kind_from_node (double_type_node))
109 NAMED_REALCST (ISOCBINDING_LONG_DOUBLE, "c_long_double", \
110                get_real_kind_from_node (long_double_type_node))
111 NAMED_CMPXCST (ISOCBINDING_FLOAT_COMPLEX, "c_float_complex", \
112                get_real_kind_from_node (float_type_node))
113 NAMED_CMPXCST (ISOCBINDING_DOUBLE_COMPLEX, "c_double_complex", \
114                get_real_kind_from_node (double_type_node))
115 NAMED_CMPXCST (ISOCBINDING_LONG_DOUBLE_COMPLEX, "c_long_double_complex", \
116                get_real_kind_from_node (long_double_type_node))
117
118 NAMED_LOGCST (ISOCBINDING_BOOL, "c_bool", \
119               get_int_kind_from_width (BOOL_TYPE_SIZE))
120
121 NAMED_CHARKNDCST (ISOCBINDING_CHAR, "c_char", gfc_default_character_kind)
122
123 #ifndef NAMED_CHARCST
124 # define NAMED_CHARCST(a,b,c) 
125 #endif
126
127 /* Use langhooks to deal with host to target translations.  */ 
128 NAMED_CHARCST (ISOCBINDING_NULL_CHAR, "c_null_char", \
129                lang_hooks.to_target_charset ('\0'))
130 NAMED_CHARCST (ISOCBINDING_ALERT, "c_alert", \
131                lang_hooks.to_target_charset ('\a'))
132 NAMED_CHARCST (ISOCBINDING_BACKSPACE, "c_backspace", \
133                lang_hooks.to_target_charset ('\b'))
134 NAMED_CHARCST (ISOCBINDING_FORM_FEED, "c_form_feed", \
135                lang_hooks.to_target_charset ('\f'))
136 NAMED_CHARCST (ISOCBINDING_NEW_LINE, "c_new_line", \
137                lang_hooks.to_target_charset ('\n'))
138 NAMED_CHARCST (ISOCBINDING_CARRIAGE_RETURN, "c_carriage_return", \
139                lang_hooks.to_target_charset ('\r'))
140 NAMED_CHARCST (ISOCBINDING_HORIZONTAL_TAB, "c_horizontal_tab", \
141                lang_hooks.to_target_charset ('\t'))
142 NAMED_CHARCST (ISOCBINDING_VERTICAL_TAB, "c_vertical_tab", \
143                lang_hooks.to_target_charset ('\v'))
144
145 #ifndef DERIVED_TYPE
146 # define DERIVED_TYPE(a,b,c) 
147 #endif
148
149 DERIVED_TYPE (ISOCBINDING_PTR, "c_ptr", \
150               get_int_kind_from_node (ptr_type_node))
151 DERIVED_TYPE (ISOCBINDING_NULL_PTR, "c_null_ptr", \
152               get_int_kind_from_node (ptr_type_node))
153 DERIVED_TYPE (ISOCBINDING_FUNPTR, "c_funptr", \
154               get_int_kind_from_node (ptr_type_node))
155 DERIVED_TYPE (ISOCBINDING_NULL_FUNPTR, "c_null_funptr", \
156               get_int_kind_from_node (ptr_type_node))
157
158   
159 #ifndef PROCEDURE
160 # define PROCEDURE(a,b) 
161 #endif
162
163 PROCEDURE (ISOCBINDING_F_POINTER, "c_f_pointer")
164 PROCEDURE (ISOCBINDING_ASSOCIATED, "c_associated")
165 PROCEDURE (ISOCBINDING_LOC, "c_loc")
166 PROCEDURE (ISOCBINDING_FUNLOC, "c_funloc")
167 PROCEDURE (ISOCBINDING_F_PROCPOINTER, "c_f_procpointer")
168
169 /* The arguments to NAMED_FUNCTIONS are:
170      -- the ISYM
171      -- the symbol name in the module, as seen by Fortran code
172      -- the Fortran standard  */
173
174 NAMED_FUNCTION (ISOCBINDING_C_SIZEOF, "c_sizeof", \
175                 GFC_ISYM_C_SIZEOF, GFC_STD_F2008)
176
177
178 #undef NAMED_INTCST
179 #undef NAMED_REALCST
180 #undef NAMED_CMPXCST
181 #undef NAMED_LOGCST
182 #undef NAMED_CHARCST
183 #undef NAMED_CHARKNDCST
184 #undef DERIVED_TYPE
185 #undef PROCEDURE
186 #undef NAMED_FUNCTION