Use -static when testing --gc-sections on native targets
[official-gcc.git] / libf2c / f2cext.c
blob56f9490c6f5191f0078e2d3ed0ce1953b2b88986
1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2 This file is part of GNU Fortran run-time library.
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published
6 by the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 GNU Fortran is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with GNU Fortran; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #include <math.h> /* for j0 et al */
20 #include <f2c.h>
21 typedef void *sig_proc; /* For now, this will have to do. */
23 #ifdef Labort
24 int abort_ (void) {
25 extern int G77_abort_0 (void);
26 return G77_abort_0 ();
28 #endif
30 #ifdef Lderf
31 double derf_ (doublereal *x) {
32 extern double G77_derf_0 (doublereal *x);
33 return G77_derf_0 (x);
35 #endif
37 #ifdef Lderfc
38 double derfc_ (doublereal *x) {
39 extern double G77_derfc_0 (doublereal *x);
40 return G77_derfc_0 (x);
42 #endif
44 #ifdef Lef1asc
45 int ef1asc_ (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb) {
46 extern int G77_ef1asc_0 (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb);
47 return G77_ef1asc_0 (a, la, b, lb);
49 #endif
51 #ifdef Lef1cmc
52 integer ef1cmc_ (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb) {
53 extern integer G77_ef1cmc_0 (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb);
54 return G77_ef1cmc_0 (a, la, b, lb);
56 #endif
58 #ifdef Lerf
59 double erf_ (real *x) {
60 extern double G77_erf_0 (real *x);
61 return G77_erf_0 (x);
63 #endif
65 #ifdef Lerfc
66 double erfc_ (real *x) {
67 extern double G77_erfc_0 (real *x);
68 return G77_erfc_0 (x);
70 #endif
72 #ifdef Lexit
73 void exit_ (integer *rc) {
74 extern void G77_exit_0 (integer *rc);
75 G77_exit_0 (rc);
77 #endif
79 #ifdef Lgetarg
80 void getarg_ (ftnint *n, char *s, ftnlen ls) {
81 extern void G77_getarg_0 (ftnint *n, char *s, ftnlen ls);
82 G77_getarg_0 (n, s, ls);
84 #endif
86 #ifdef Lgetenv
87 void getenv_ (char *fname, char *value, ftnlen flen, ftnlen vlen) {
88 extern void G77_getenv_0 (char *fname, char *value, ftnlen flen, ftnlen vlen);
89 G77_getenv_0 (fname, value, flen, vlen);
91 #endif
93 #ifdef Liargc
94 ftnint iargc_ (void) {
95 extern ftnint G77_iargc_0 (void);
96 return G77_iargc_0 ();
98 #endif
100 #ifdef Lsignal
101 void *signal_ (integer *sigp, sig_proc proc) {
102 extern void *G77_signal_0 (integer *sigp, sig_proc proc);
103 return G77_signal_0 (sigp, proc);
105 #endif
107 #ifdef Lsystem
108 integer system_ (char *s, ftnlen n) {
109 extern integer G77_system_0 (char *s, ftnlen n);
110 return G77_system_0 (s, n);
112 #endif
114 #ifdef Lflush
115 int flush_ (void) {
116 extern int G77_flush_0 (void);
117 return G77_flush_0 ();
119 #endif
121 #ifdef Lftell
122 integer ftell_ (integer *Unit) {
123 extern integer G77_ftell_0 (integer *Unit);
124 return G77_ftell_0 (Unit);
126 #endif
128 #ifdef Lfseek
129 integer fseek_ (integer *Unit, integer *offset, integer *xwhence) {
130 extern integer G77_fseek_0 (integer *Unit, integer *offset, integer *xwhence);
131 return G77_fseek_0 (Unit, offset, xwhence);
133 #endif
135 #ifdef Laccess
136 integer access_ (const char *name, const char *mode, ftnlen Lname, ftnlen Lmode) {
137 extern integer G77_access_0 (const char *name, const char *mode, ftnlen Lname, ftnlen Lmode);
138 return G77_access_0 (name, mode, Lname, Lmode);
140 #endif
142 #ifdef Lalarm
143 integer alarm_ (integer *seconds, sig_proc proc, integer *status) {
144 extern integer G77_alarm_0 (integer *seconds, sig_proc proc);
145 return G77_alarm_0 (seconds, proc);
147 #endif
149 #ifdef Lbesj0
150 double besj0_ (const real *x) {
151 return j0 (*x);
153 #endif
155 #ifdef Lbesj1
156 double besj1_ (const real *x) {
157 return j1 (*x);
159 #endif
161 #ifdef Lbesjn
162 double besjn_ (const integer *n, real *x) {
163 return jn (*n, *x);
165 #endif
167 #ifdef Lbesy0
168 double besy0_ (const real *x) {
169 return y0 (*x);
171 #endif
173 #ifdef Lbesy1
174 double besy1_ (const real *x) {
175 return y1 (*x);
177 #endif
179 #ifdef Lbesyn
180 double besyn_ (const integer *n, real *x) {
181 return yn (*n, *x);
183 #endif
185 #ifdef Lchdir
186 integer chdir_ (const char *name, const ftnlen Lname) {
187 extern integer G77_chdir_0 (const char *name, const ftnlen Lname);
188 return G77_chdir_0 (name, Lname);
190 #endif
192 #ifdef Lchmod
193 integer chmod_ (const char *name, const char *mode, const ftnlen Lname, const ftnlen Lmode) {
194 extern integer G77_chmod_0 (const char *name, const char *mode, const ftnlen Lname, const ftnlen Lmode);
195 return G77_chmod_0 (name, mode, Lname, Lmode);
197 #endif
199 #ifdef Lctime
200 void ctime_ (char *chtime, const ftnlen Lchtime, longint *xstime) {
201 extern void G77_ctime_0 (char *chtime, const ftnlen Lchtime, longint *xstime);
202 G77_ctime_0 (chtime, Lchtime, xstime);
204 #endif
206 #ifdef Ldate_y2kbuggy
207 int date_ (char *buf, ftnlen buf_len) {
208 /* Fail to link, so user sees attempt to invoke non-Y2K-compliant
209 routine. */
210 extern int G77_date_y2kbuggy_0 (char *buf, ftnlen buf_len);
211 return G77_date_y2kbuggy_0 (buf, buf_len);
213 #endif
215 #ifdef Ldate_y2kbug
216 int date_y2kbug__ (char *buf, ftnlen buf_len) {
217 /* If user wants to invoke the non-Y2K-compliant routine via
218 an `EXTERNAL' interface, avoiding the warning via g77's
219 `INTRINSIC' interface, force coding of "y2kbug" string in
220 user's program. */
221 extern int G77_date_y2kbug_0 (char *buf, ftnlen buf_len);
222 return G77_date_y2kbug_0 (buf, buf_len);
224 #endif
226 #ifdef Ldbesj0
227 double dbesj0_ (const double *x) {
228 return j0 (*x);
230 #endif
232 #ifdef Ldbesj1
233 double dbesj1_ (const double *x) {
234 return j1 (*x);
236 #endif
238 #ifdef Ldbesjn
239 double dbesjn_ (const integer *n, double *x) {
240 return jn (*n, *x);
242 #endif
244 #ifdef Ldbesy0
245 double dbesy0_ (const double *x) {
246 return y0 (*x);
248 #endif
250 #ifdef Ldbesy1
251 double dbesy1_ (const double *x) {
252 return y1 (*x);
254 #endif
256 #ifdef Ldbesyn
257 double dbesyn_ (const integer *n, double *x) {
258 return yn (*n, *x);
260 #endif
262 #ifdef Ldtime
263 double dtime_ (real tarray[2]) {
264 extern double G77_dtime_0 (real tarray[2]);
265 return G77_dtime_0 (tarray);
267 #endif
269 #ifdef Letime
270 double etime_ (real tarray[2]) {
271 extern double G77_etime_0 (real tarray[2]);
272 return G77_etime_0 (tarray);
274 #endif
276 #ifdef Lfdate
277 void fdate_ (char *ret_val, ftnlen ret_val_len) {
278 extern void G77_fdate_0 (char *ret_val, ftnlen ret_val_len);
279 G77_fdate_0 (ret_val, ret_val_len);
281 #endif
283 #ifdef Lfgetc
284 integer fgetc_ (const integer *lunit, char *c, ftnlen Lc) {
285 extern integer G77_fgetc_0 (const integer *lunit, char *c, ftnlen Lc);
286 return G77_fgetc_0 (lunit, c, Lc);
288 #endif
290 #ifdef Lfget
291 integer fget_ (char *c, const ftnlen Lc) {
292 extern integer G77_fget_0 (char *c, const ftnlen Lc);
293 return G77_fget_0 (c, Lc);
295 #endif
297 #ifdef Lflush1
298 int flush1_ (const integer *lunit) {
299 extern int G77_flush1_0 (const integer *lunit);
300 return G77_flush1_0 (lunit);
302 #endif
304 #ifdef Lfnum
305 integer fnum_ (integer *lunit) {
306 extern integer G77_fnum_0 (integer *lunit);
307 return G77_fnum_0 (lunit);
309 #endif
311 #ifdef Lfputc
312 integer fputc_ (const integer *lunit, const char *c, const ftnlen Lc) {
313 extern integer G77_fputc_0 (const integer *lunit, const char *c, const ftnlen Lc);
314 return G77_fputc_0 (lunit, c, Lc);
316 #endif
318 #ifdef Lfput
319 integer fput_ (const char *c, const ftnlen Lc) {
320 extern integer G77_fput_0 (const char *c, const ftnlen Lc);
321 return G77_fput_0 (c, Lc);
323 #endif
325 #ifdef Lfstat
326 integer fstat_ (const integer *lunit, integer statb[13]) {
327 extern integer G77_fstat_0 (const integer *lunit, integer statb[13]);
328 return G77_fstat_0 (lunit, statb);
330 #endif
332 #ifdef Lgerror
333 int gerror_ (char *str, ftnlen Lstr) {
334 extern int G77_gerror_0 (char *str, ftnlen Lstr);
335 return G77_gerror_0 (str, Lstr);
337 #endif
339 #ifdef Lgetcwd
340 integer getcwd_ (char *str, const ftnlen Lstr) {
341 extern integer G77_getcwd_0 (char *str, const ftnlen Lstr);
342 return G77_getcwd_0 (str, Lstr);
344 #endif
346 #ifdef Lgetgid
347 integer getgid_ (void) {
348 extern integer G77_getgid_0 (void);
349 return G77_getgid_0 ();
351 #endif
353 #ifdef Lgetlog
354 int getlog_ (char *str, const ftnlen Lstr) {
355 extern int G77_getlog_0 (char *str, const ftnlen Lstr);
356 return G77_getlog_0 (str, Lstr);
358 #endif
360 #ifdef Lgetpid
361 integer getpid_ (void) {
362 extern integer G77_getpid_0 (void);
363 return G77_getpid_0 ();
365 #endif
367 #ifdef Lgetuid
368 integer getuid_ (void) {
369 extern integer G77_getuid_0 (void);
370 return G77_getuid_0 ();
372 #endif
374 #ifdef Lgmtime
375 int gmtime_ (const integer *stime, integer tarray[9]) {
376 extern int G77_gmtime_0 (const integer *stime, integer tarray[9]);
377 return G77_gmtime_0 (stime, tarray);
379 #endif
381 #ifdef Lhostnm
382 integer hostnm_ (char *name, ftnlen Lname) {
383 extern integer G77_hostnm_0 (char *name, ftnlen Lname);
384 return G77_hostnm_0 (name, Lname);
386 #endif
388 #ifdef Lidate
389 int idate_ (int iarray[3]) {
390 extern int G77_idate_0 (int iarray[3]);
391 return G77_idate_0 (iarray);
393 #endif
395 #ifdef Lierrno
396 integer ierrno_ (void) {
397 extern integer G77_ierrno_0 (void);
398 return G77_ierrno_0 ();
400 #endif
402 #ifdef Lirand
403 integer irand_ (integer *flag) {
404 extern integer G77_irand_0 (integer *flag);
405 return G77_irand_0 (flag);
407 #endif
409 #ifdef Lisatty
410 logical isatty_ (integer *lunit) {
411 extern logical G77_isatty_0 (integer *lunit);
412 return G77_isatty_0 (lunit);
414 #endif
416 #ifdef Litime
417 int itime_ (integer tarray[3]) {
418 extern int G77_itime_0 (integer tarray[3]);
419 return G77_itime_0 (tarray);
421 #endif
423 #ifdef Lkill
424 integer kill_ (const integer *pid, const integer *signum) {
425 extern integer G77_kill_0 (const integer *pid, const integer *signum);
426 return G77_kill_0 (pid, signum);
428 #endif
430 #ifdef Llink
431 integer link_ (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2) {
432 extern integer G77_link_0 (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2);
433 return G77_link_0 (path1, path2, Lpath1, Lpath2);
435 #endif
437 #ifdef Llnblnk
438 integer lnblnk_ (char *str, ftnlen str_len) {
439 extern integer G77_lnblnk_0 (char *str, ftnlen str_len);
440 return G77_lnblnk_0 (str, str_len);
442 #endif
444 #ifdef Llstat
445 integer lstat_ (const char *name, integer statb[13], const ftnlen Lname) {
446 extern integer G77_lstat_0 (const char *name, integer statb[13], const ftnlen Lname);
447 return G77_lstat_0 (name, statb, Lname);
449 #endif
451 #ifdef Lltime
452 int ltime_ (const integer *stime, integer tarray[9]) {
453 extern int G77_ltime_0 (const integer *stime, integer tarray[9]);
454 return G77_ltime_0 (stime, tarray);
456 #endif
458 #ifdef Lmclock
459 longint mclock_ (void) {
460 extern longint G77_mclock_0 (void);
461 return G77_mclock_0 ();
463 #endif
465 #ifdef Lperror
466 int perror_ (const char *str, const ftnlen Lstr) {
467 extern int G77_perror_0 (const char *str, const ftnlen Lstr);
468 return G77_perror_0 (str, Lstr);
470 #endif
472 #ifdef Lrand
473 double rand_ (integer *flag) {
474 extern double G77_rand_0 (integer *flag);
475 return G77_rand_0 (flag);
477 #endif
479 #ifdef Lrename
480 integer rename_ (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2) {
481 extern integer G77_rename_0 (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2);
482 return G77_rename_0 (path1, path2, Lpath1, Lpath2);
484 #endif
486 #ifdef Lsecnds
487 double secnds_ (real *r) {
488 extern double G77_secnds_0 (real *r);
489 return G77_secnds_0 (r);
491 #endif
493 #ifdef Lsecond
494 double second_ () {
495 extern double G77_second_0 ();
496 return G77_second_0 ();
498 #endif
500 #ifdef Lsleep
501 int sleep_ (const integer *seconds) {
502 extern int G77_sleep_0 (const integer *seconds);
503 return G77_sleep_0 (seconds);
505 #endif
507 #ifdef Lsrand
508 int srand_ (const integer *seed) {
509 extern int G77_srand_0 (const integer *seed);
510 return G77_srand_0 (seed);
512 #endif
514 #ifdef Lstat
515 integer stat_ (const char *name, integer statb[13], const ftnlen Lname) {
516 extern integer G77_stat_0 (const char *name, integer statb[13], const ftnlen Lname);
517 return G77_stat_0 (name, statb, Lname);
519 #endif
521 #ifdef Lsymlnk
522 integer symlnk_ (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2) {
523 extern integer G77_symlnk_0 (const char *path1, const char *path2, const ftnlen Lpath1, const ftnlen Lpath2);
524 return G77_symlnk_0 (path1, path2, Lpath1, Lpath2);
526 #endif
528 #ifdef Ltime
529 longint time_ (void) {
530 extern longint G77_time_0 (void);
531 return G77_time_0 ();
533 #endif
535 #ifdef Lttynam
536 void ttynam_ (char *ret_val, ftnlen ret_val_len, integer *lunit) {
537 extern void G77_ttynam_0 (char *ret_val, ftnlen ret_val_len, integer *lunit);
538 G77_ttynam_0 (ret_val, ret_val_len, lunit);
540 #endif
542 #ifdef Lumask
543 integer umask_ (integer *mask) {
544 extern integer G77_umask_0 (integer *mask);
545 return G77_umask_0 (mask);
547 #endif
549 #ifdef Lunlink
550 integer unlink_ (const char *str, const ftnlen Lstr) {
551 extern integer G77_unlink_0 (const char *str, const ftnlen Lstr);
552 return G77_unlink_0 (str, Lstr);
554 #endif
556 #ifdef Lvxtidt_y2kbuggy
557 int vxtidate_ (integer *m, integer *d, integer *y) {
558 /* Fail to link, so user sees attempt to invoke non-Y2K-compliant
559 routine. */
560 extern int G77_vxtidate_y2kbuggy_0 (integer *m, integer *d, integer *y);
561 return G77_vxtidate_y2kbuggy_0 (m, d, y);
563 #endif
565 #ifdef Lvxtidt_y2kbug
566 int vxtidate_y2kbug__ (integer *m, integer *d, integer *y) {
567 /* If user wants to invoke the non-Y2K-compliant routine via
568 an `EXTERNAL' interface, avoiding the warning via g77's
569 `INTRINSIC' interface, force coding of "y2kbug" string in
570 user's program. */
571 extern int G77_vxtidate_y2kbug_0 (integer *m, integer *d, integer *y);
572 return G77_vxtidate_y2kbug_0 (m, d, y);
574 #endif
576 #ifdef Lvxttim
577 void vxttime_ (char chtime[8], const ftnlen Lchtime) {
578 extern void G77_vxttime_0 (char chtime[8], const ftnlen Lchtime);
579 G77_vxttime_0 (chtime, Lchtime);
581 #endif