OSDN Git Service

2006-01-28 Kenneth Zadeck <zadeck@naturalbridge.com>
[pf3gnuchains/gcc-fork.git] / libgomp / fortran.c
1 /* Copyright (C) 2005 Free Software Foundation, Inc.
2    Contributed by Jakub Jelinek <jakub@redhat.com>.
3
4    This file is part of the GNU OpenMP Library (libgomp).
5
6    Libgomp is free software; you can redistribute it and/or modify it
7    under the terms of the GNU Lesser General Public License as published by
8    the Free Software Foundation; either version 2.1 of the License, or
9    (at your option) any later version.
10
11    Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
12    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13    FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
14    more details.
15
16    You should have received a copy of the GNU Lesser General Public License
17    along with libgomp; see the file COPYING.LIB.  If not, write to the
18    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19    MA 02110-1301, USA.  */
20
21 /* As a special exception, if you link this library with other files, some
22    of which are compiled with GCC, to produce an executable, this library
23    does not by itself cause the resulting executable to be covered by the
24    GNU General Public License.  This exception does not however invalidate
25    any other reasons why the executable file might be covered by the GNU
26    General Public License.  */
27
28 /* This file contains Fortran wrapper routines.  */
29
30 #include "libgomp.h"
31 #include "libgomp_f.h"
32 #include <stdlib.h>
33
34 #ifdef HAVE_ATTRIBUTE_ALIAS
35 /* Use internal aliases if possible.  */
36 # define ialias_redirect(fn) \
37   extern __typeof (fn) fn __asm__ ("gomp_ialias_" #fn) attribute_hidden;
38 ialias_redirect (omp_init_lock)
39 ialias_redirect (omp_init_nest_lock)
40 ialias_redirect (omp_destroy_lock)
41 ialias_redirect (omp_destroy_nest_lock)
42 ialias_redirect (omp_set_lock)
43 ialias_redirect (omp_set_nest_lock)
44 ialias_redirect (omp_unset_lock)
45 ialias_redirect (omp_unset_nest_lock)
46 ialias_redirect (omp_test_lock)
47 ialias_redirect (omp_test_nest_lock)
48 ialias_redirect (omp_set_dynamic)
49 ialias_redirect (omp_set_nested)
50 ialias_redirect (omp_set_num_threads)
51 ialias_redirect (omp_get_dynamic)
52 ialias_redirect (omp_get_nested)
53 ialias_redirect (omp_in_parallel)
54 ialias_redirect (omp_get_max_threads)
55 ialias_redirect (omp_get_num_procs)
56 ialias_redirect (omp_get_num_threads)
57 ialias_redirect (omp_get_thread_num)
58 ialias_redirect (omp_get_wtick)
59 ialias_redirect (omp_get_wtime)
60 #endif        
61
62 void
63 omp_init_lock_ (omp_lock_arg_t lock)
64 {
65 #ifndef OMP_LOCK_DIRECT
66   omp_lock_arg (lock) = malloc (sizeof (omp_lock_t));
67 #endif
68   omp_init_lock (omp_lock_arg (lock));
69 }
70
71 void
72 omp_init_nest_lock_ (omp_nest_lock_arg_t lock)
73 {
74 #ifndef OMP_NEST_LOCK_DIRECT
75   omp_nest_lock_arg (lock) = malloc (sizeof (omp_nest_lock_t));
76 #endif
77   omp_init_nest_lock (omp_nest_lock_arg (lock));
78 }
79
80 void
81 omp_destroy_lock_ (omp_lock_arg_t lock)
82 {
83   omp_destroy_lock (omp_lock_arg (lock));
84 #ifndef OMP_LOCK_DIRECT
85   free (omp_lock_arg (lock));
86   omp_lock_arg (lock) = NULL;
87 #endif
88 }
89
90 void
91 omp_destroy_nest_lock_ (omp_nest_lock_arg_t lock)
92 {
93   omp_destroy_nest_lock (omp_nest_lock_arg (lock));
94 #ifndef OMP_NEST_LOCK_DIRECT
95   free (omp_nest_lock_arg (lock));
96   omp_nest_lock_arg (lock) = NULL;
97 #endif
98 }
99
100 void
101 omp_set_lock_ (omp_lock_arg_t lock)
102 {
103   omp_set_lock (omp_lock_arg (lock));
104 }
105
106 void
107 omp_set_nest_lock_ (omp_nest_lock_arg_t lock)
108 {
109   omp_set_nest_lock (omp_nest_lock_arg (lock));
110 }
111
112 void
113 omp_unset_lock_ (omp_lock_arg_t lock)
114 {
115   omp_unset_lock (omp_lock_arg (lock));
116 }
117
118 void
119 omp_unset_nest_lock_ (omp_nest_lock_arg_t lock)
120 {
121   omp_unset_nest_lock (omp_nest_lock_arg (lock));
122 }
123
124 void
125 omp_set_dynamic_ (const int32_t *set)
126 {
127   omp_set_dynamic (*set);
128 }
129
130 void
131 omp_set_dynamic_8_ (const int64_t *set)
132 {
133   omp_set_dynamic (*set);
134 }
135
136 void
137 omp_set_nested_ (const int32_t *set)
138 {
139   omp_set_nested (*set);
140 }
141
142 void
143 omp_set_nested_8_ (const int64_t *set)
144 {
145   omp_set_nested (*set);
146 }
147
148 void
149 omp_set_num_threads_ (const int32_t *set)
150 {
151   omp_set_num_threads (*set);
152 }
153
154 void
155 omp_set_num_threads_8_ (const int64_t *set)
156 {
157   omp_set_num_threads (*set);
158 }
159
160 int32_t
161 omp_get_dynamic_ (void)
162 {
163   return omp_get_dynamic ();
164 }
165
166 int32_t
167 omp_get_nested_ (void)
168 {
169   return omp_get_nested ();
170 }
171
172 int32_t
173 omp_in_parallel_ (void)
174 {
175   return omp_in_parallel ();
176 }
177
178 int32_t
179 omp_test_lock_ (omp_lock_arg_t lock)
180 {
181   return omp_test_lock (omp_lock_arg (lock));
182 }
183
184 int32_t
185 omp_get_max_threads_ (void)
186 {
187   return omp_get_max_threads ();
188 }
189
190 int32_t
191 omp_get_num_procs_ (void)
192 {
193   return omp_get_num_procs ();
194 }
195
196 int32_t
197 omp_get_num_threads_ (void)
198 {
199   return omp_get_num_threads ();
200 }
201
202 int32_t
203 omp_get_thread_num_ (void)
204 {
205   return omp_get_thread_num ();
206 }
207
208 int32_t
209 omp_test_nest_lock_ (omp_nest_lock_arg_t lock)
210 {
211   return omp_test_nest_lock (omp_nest_lock_arg (lock));
212 }
213
214 double
215 omp_get_wtick_ (void)
216 {
217   return omp_get_wtick ();
218 }
219
220 double
221 omp_get_wtime_ (void)
222 {
223   return omp_get_wtime ();
224 }