OSDN Git Service

* arith.c: Change copyright header to refer to version 3 of the GNU General
[pf3gnuchains/gcc-fork.git] / gcc / fortran / iso-c-binding.def
1 /* Copyright (C) 2006, 2007 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) 
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 /* The arguments to NAMED_*CST are:
43      -- an internal name
44      -- the symbol name in the module, as seen by Fortran code
45      -- the value it has, for use in trans-types.c  */
46
47 NAMED_INTCST (ISOCBINDING_INT, "c_int", gfc_c_int_kind)
48 NAMED_INTCST (ISOCBINDING_SHORT, "c_short", \
49               get_int_kind_from_node (short_integer_type_node))
50 NAMED_INTCST (ISOCBINDING_LONG, "c_long", \
51               get_int_kind_from_node (long_integer_type_node))
52 NAMED_INTCST (ISOCBINDING_LONG_LONG, "c_long_long", \
53               get_int_kind_from_node (long_long_integer_type_node))
54
55 NAMED_INTCST (ISOCBINDING_INTMAX_T, "c_intmax_t", \
56               get_int_kind_from_node (intmax_type_node))
57 NAMED_INTCST (ISOCBINDING_INTPTR_T, "c_intptr_t", \
58               get_int_kind_from_node (ptr_type_node))
59 NAMED_INTCST (ISOCBINDING_SIZE_T, "c_size_t", \
60               gfc_index_integer_kind)
61 NAMED_INTCST (ISOCBINDING_SIGNED_CHAR, "c_signed_char", \
62               get_int_kind_from_node (signed_char_type_node))
63
64 NAMED_INTCST (ISOCBINDING_INT8_T, "c_int8_t", get_int_kind_from_width (8))
65 NAMED_INTCST (ISOCBINDING_INT16_T, "c_int16_t", get_int_kind_from_width (16))
66 NAMED_INTCST (ISOCBINDING_INT32_T, "c_int32_t", get_int_kind_from_width (32))
67 NAMED_INTCST (ISOCBINDING_INT64_T, "c_int64_t", get_int_kind_from_width (64))
68
69 NAMED_INTCST (ISOCBINDING_INT_LEAST8_T, "c_int_least8_t", \
70               get_int_kind_from_minimal_width (8))
71 NAMED_INTCST (ISOCBINDING_INT_LEAST16_T, "c_int_least16_t", \
72               get_int_kind_from_minimal_width (16))
73 NAMED_INTCST (ISOCBINDING_INT_LEAST32_T, "c_int_least32_t", \
74               get_int_kind_from_minimal_width (32))
75 NAMED_INTCST (ISOCBINDING_INT_LEAST64_T, "c_int_least64_t", \
76               get_int_kind_from_minimal_width (64))
77
78 /* TODO: Implement c_int_fast*_t. Depends on PR 448.  */ 
79 NAMED_INTCST (ISOCBINDING_INT_FAST8_T, "c_int_fast8_t", -2)
80 NAMED_INTCST (ISOCBINDING_INT_FAST16_T, "c_int_fast16_t", -2)
81 NAMED_INTCST (ISOCBINDING_INT_FAST32_T, "c_int_fast32_t", -2)
82 NAMED_INTCST (ISOCBINDING_INT_FAST64_T, "c_int_fast64_t", -2)
83
84 NAMED_REALCST (ISOCBINDING_FLOAT, "c_float", \
85                get_real_kind_from_node (float_type_node))
86 NAMED_REALCST (ISOCBINDING_DOUBLE, "c_double", \
87                get_real_kind_from_node (double_type_node))
88 NAMED_REALCST (ISOCBINDING_LONG_DOUBLE, "c_long_double", \
89                get_real_kind_from_node (long_double_type_node))
90 NAMED_CMPXCST (ISOCBINDING_FLOAT_COMPLEX, "c_float_complex", \
91                get_real_kind_from_node (float_type_node))
92 NAMED_CMPXCST (ISOCBINDING_DOUBLE_COMPLEX, "c_double_complex", \
93                get_real_kind_from_node (double_type_node))
94 NAMED_CMPXCST (ISOCBINDING_LONG_DOUBLE_COMPLEX, "c_long_double_complex", \
95                get_real_kind_from_node (long_double_type_node))
96
97 NAMED_LOGCST (ISOCBINDING_BOOL, "c_bool", \
98               get_int_kind_from_width (BOOL_TYPE_SIZE))
99
100 NAMED_CHARKNDCST (ISOCBINDING_CHAR, "c_char", gfc_default_character_kind)
101
102 #ifndef NAMED_CHARCST
103 # define NAMED_CHARCST(a,b,c) 
104 #endif
105
106 /* Use langhooks to deal with host to target translations.  */ 
107 NAMED_CHARCST (ISOCBINDING_NULL_CHAR, "c_null_char", \
108                lang_hooks.to_target_charset ('\0'))
109 NAMED_CHARCST (ISOCBINDING_ALERT, "c_alert", \
110                lang_hooks.to_target_charset ('\a'))
111 NAMED_CHARCST (ISOCBINDING_BACKSPACE, "c_backspace", \
112                lang_hooks.to_target_charset ('\b'))
113 NAMED_CHARCST (ISOCBINDING_FORM_FEED, "c_form_feed", \
114                lang_hooks.to_target_charset ('\f'))
115 NAMED_CHARCST (ISOCBINDING_NEW_LINE, "c_new_line", \
116                lang_hooks.to_target_charset ('\n'))
117 NAMED_CHARCST (ISOCBINDING_CARRIAGE_RETURN, "c_carriage_return", \
118                lang_hooks.to_target_charset ('\r'))
119 NAMED_CHARCST (ISOCBINDING_HORIZONTAL_TAB, "c_horizontal_tab", \
120                lang_hooks.to_target_charset ('\t'))
121 NAMED_CHARCST (ISOCBINDING_VERTICAL_TAB, "c_vertical_tab", \
122                lang_hooks.to_target_charset ('\v'))
123
124 #ifndef DERIVED_TYPE
125 # define DERIVED_TYPE(a,b,c) 
126 #endif
127
128 DERIVED_TYPE (ISOCBINDING_PTR, "c_ptr", \
129               get_int_kind_from_node (ptr_type_node))
130 DERIVED_TYPE (ISOCBINDING_NULL_PTR, "c_null_ptr", \
131               get_int_kind_from_node (ptr_type_node))
132 DERIVED_TYPE (ISOCBINDING_FUNPTR, "c_funptr", \
133               get_int_kind_from_node (ptr_type_node))
134 DERIVED_TYPE (ISOCBINDING_NULL_FUNPTR, "c_null_funptr", \
135               get_int_kind_from_node (ptr_type_node))
136
137   
138 #ifndef PROCEDURE
139 # define PROCEDURE(a,b) 
140 #endif
141
142 PROCEDURE (ISOCBINDING_F_POINTER, "c_f_pointer")
143 PROCEDURE (ISOCBINDING_ASSOCIATED, "c_associated")
144 PROCEDURE (ISOCBINDING_LOC, "c_loc")
145 PROCEDURE (ISOCBINDING_FUNLOC, "c_funloc")
146
147 /* Insert c_f_procpointer, though unsupported for now.  */
148 PROCEDURE (ISOCBINDING_F_PROCPOINTER, "c_f_procpointer")
149
150 #undef NAMED_INTCST
151 #undef NAMED_REALCST
152 #undef NAMED_CMPXCST
153 #undef NAMED_LOGCST
154 #undef NAMED_CHARCST
155 #undef NAMED_CHARKNDCST
156 #undef DERIVED_TYPE
157 #undef PROCEDURE