1!
2! Copyright (c) 2006-2018, NVIDIA CORPORATION.  All rights reserved.
3!
4! Licensed under the Apache License, Version 2.0 (the "License");
5! you may not use this file except in compliance with the License.
6! You may obtain a copy of the License at
7!
8!     http://www.apache.org/licenses/LICENSE-2.0
9!
10! Unless required by applicable law or agreed to in writing, software
11! distributed under the License is distributed on an "AS IS" BASIS,
12! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13! See the License for the specific language governing permissions and
14! limitations under the License.
15!
16
17!          THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT
18!   WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT
19!   NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
20!   FITNESS FOR A PARTICULAR PURPOSE.
21!
22
23
24! iso_c_bind.f90
25! 32/64 bit  linux and windows.  Add further targets as required.
26
27        module ISO_C_BINDING
28#ifdef PGDLL
29!DEC$ ATTRIBUTES DLLEXPORT :: ISO_C_BINDING
30#endif
31
32        public
33        integer C_INT
34        parameter ( C_INT = 4)
35        integer C_SHORT
36        parameter ( C_SHORT = 2 )
37
38#if defined(TARGET_WIN_X8664)
39        integer C_LONG
40        parameter ( C_LONG = 4 )
41        integer C_INTPTR_T
42        parameter ( C_INTPTR_T = 8 )
43        integer C_SIZE_T
44        parameter ( C_SIZE_T = 8  )
45#else
46        integer C_LONG
47        parameter ( C_LONG = 8 )
48        integer C_INTPTR_T
49        parameter ( C_INTPTR_T = 8 )
50        integer C_SIZE_T
51        parameter ( C_SIZE_T = 8  )
52#endif
53
54        type C_PTR
55        private
56        integer (C_INTPTR_T) val
57        end type C_PTR
58
59        type C_FUNPTR
60        private
61        integer (C_INTPTR_T) val
62        end type C_FUNPTR
63
64        integer C_LONG_LONG
65        parameter ( C_LONG_LONG =  8 )
66        integer C_SIGNED_CHAR
67        parameter ( C_SIGNED_CHAR = 1 )
68
69! stdint.h
70        integer C_INT8_T
71        parameter ( C_INT8_T = 1 )
72        integer C_INT16_T
73        parameter ( C_INT16_T = 2 )
74        integer C_INT32_T
75        parameter ( C_INT32_T = 4 )
76        integer C_INT64_T
77        parameter ( C_INT64_T = 8 )
78        integer C_INT_LEAST8_T
79        parameter ( C_INT_LEAST8_T = 1)
80        integer C_INT_LEAST16_T
81        parameter ( C_INT_LEAST16_T = 2 )
82        integer C_INT_LEAST32_T
83        parameter ( C_INT_LEAST32_T = 4 )
84        integer C_INT_LEAST64_T
85        parameter ( C_INT_LEAST64_T = 8 )
86        integer C_INT_FAST8_T
87        parameter ( C_INT_FAST8_T =  1)
88        integer C_INT_FAST16_T
89        parameter ( C_INT_FAST16_T = 8 )
90        integer  C_INT_FAST32_T
91        parameter ( C_INT_FAST32_T = 8 )
92        integer C_INT_FAST64_T
93        parameter ( C_INT_FAST64_T = 8 )
94        integer C_INTMAX_T
95        parameter ( C_INTMAX_T = 8)
96        integer C_FLOAT
97        parameter ( C_FLOAT = 4 )
98        integer C_DOUBLE
99        parameter ( C_DOUBLE = 8 )
100        integer C_LONG_DOUBLE
101        parameter ( C_LONG_DOUBLE = 8  )
102        integer C_FLOAT_COMPLEX
103        parameter ( C_FLOAT_COMPLEX = 4 )
104        integer C_DOUBLE_COMPLEX
105        parameter ( C_DOUBLE_COMPLEX = 8 )
106        integer C_LONG_DOUBLE_COMPLEX
107        parameter ( C_LONG_DOUBLE_COMPLEX = 8  )
108        integer C_BOOL
109        parameter ( C_BOOL =  1 )
110        integer C_CHAR
111         parameter ( C_CHAR = 1 )
112! C character values
113        character(1) C_NULL_CHAR
114        parameter (  C_NULL_CHAR = '\0' )
115
116        character(1) C_ALERT
117        parameter (  C_ALERT = '\a')
118
119        character(1) C_BACKSPACE
120        parameter (  C_BACKSPACE = '\b')
121
122        character(1) C_FORM_FEED
123        parameter (  C_FORM_FEED = '\f')
124
125        character(1) C_NEW_LINE
126        parameter (  C_NEW_LINE = '\n')
127
128        character(1) C_CARRIAGE_RETURN
129        parameter (  C_CARRIAGE_RETURN = '\r')
130
131        character(1) C_HORIZONTAL_TAB
132        parameter (  C_HORIZONTAL_TAB = '\t')
133
134        character(1) C_VERTICAL_TAB
135        parameter (  C_VERTICAL_TAB =  '\v')
136
137        type (C_PTR),    parameter :: C_NULL_PTR    = C_PTR(0)
138        type (C_FUNPTR), parameter :: C_NULL_FUNPTR = C_FUNPTR(0)
139
140! 04/2009 are adding some code, which will require the .o file gets linked in
141        interface operator (.eq.)
142            module procedure compare_eq_cptrs
143        end interface
144
145        interface operator (.ne.)
146            module procedure compare_ne_cptrs
147        end interface
148
149        interface operator (.eq.)
150            module procedure compare_eq_cfunptrs
151        end interface
152
153        interface operator (.ne.)
154            module procedure compare_ne_cfunptrs
155        end interface
156
157        contains
158            logical function compare_eq_cptrs(a,b)
159            type(C_PTR) :: a,b
160            compare_eq_cptrs = (a%val .eq. b%val)
161            return
162            end function
163
164            logical function compare_ne_cptrs(a,b)
165            type(C_PTR) :: a,b
166            compare_ne_cptrs = (a%val .ne. b%val)
167            return
168            end function
169
170            logical function compare_eq_cfunptrs(a,b)
171            type(C_FUNPTR) :: a,b
172            compare_eq_cfunptrs = (a%val .eq. b%val)
173            return
174            end function
175
176            logical function compare_ne_cfunptrs(a,b)
177            type(C_FUNPTR) :: a,b
178            compare_ne_cfunptrs = (a%val .ne. b%val)
179            return
180            end function
181
182        end module  ISO_C_BINDING
183