diff options
author | Craig Burley <burley@gnu.org> | 1998-05-22 06:32:18 -0400 |
---|---|---|
committer | Dave Love <fx@gcc.gnu.org> | 1998-05-22 10:32:18 +0000 |
commit | 5a276a25c603bea17c90bf907e1d5bf14998186d (patch) | |
tree | 8df364a299ab2b75b299926afe0332fabc7755e8 /libf2c | |
parent | aa43c90be934eae9e0065a79b7819c9ce0ea519a (diff) | |
download | gcc-5a276a25c603bea17c90bf907e1d5bf14998186d.zip gcc-5a276a25c603bea17c90bf907e1d5bf14998186d.tar.gz gcc-5a276a25c603bea17c90bf907e1d5bf14998186d.tar.bz2 |
Break up main() into separate .o's so making and linking against shared...
Tue May 19 12:50:27 1998 Craig Burley <burley@gnu.org>
Break up main() into separate .o's so making and
linking against shared libraries with non-Fortran
main() routines is easier:
* Makefile.in (MISC): Add setarg.o and setsig.o.
* libF77/Makefile.in (MISC): Ditto.
* libF77/setarg.c: New file, contains f_setarg().
* libF77/setsig.c: New file, contains f_setsig().
* libF77/getarg_.c: Rename xarg* to f__xarg*.
* libF77/iargc_.c: Ditto
From-SVN: r19956
Diffstat (limited to 'libf2c')
-rw-r--r-- | libf2c/ChangeLog | 12 | ||||
-rw-r--r-- | libf2c/Makefile.in | 6 | ||||
-rw-r--r-- | libf2c/libF77/Makefile.in | 2 | ||||
-rw-r--r-- | libf2c/libF77/getarg_.c | 8 | ||||
-rw-r--r-- | libf2c/libF77/iargc_.c | 4 | ||||
-rw-r--r-- | libf2c/libF77/main.c | 81 | ||||
-rw-r--r-- | libf2c/libF77/setarg.c | 29 | ||||
-rw-r--r-- | libf2c/libF77/setsig.c | 101 |
8 files changed, 156 insertions, 87 deletions
diff --git a/libf2c/ChangeLog b/libf2c/ChangeLog index 6ce28d3..e6e930b 100644 --- a/libf2c/ChangeLog +++ b/libf2c/ChangeLog @@ -1,3 +1,15 @@ +Tue May 19 12:50:27 1998 Craig Burley <burley@gnu.org> + + Break up main() into separate .o's so making and + linking against shared libraries with non-Fortran + main() routines is easier: + * Makefile.in (MISC): Add setarg.o and setsig.o. + * libF77/Makefile.in (MISC): Ditto. + * libF77/setarg.c: New file, contains f_setarg(). + * libF77/setsig.c: New file, contains f_setsig(). + * libF77/getarg_.c: Rename xarg* to f__xarg*. + * libF77/iargc_.c: Ditto + Sat May 2 16:44:46 1998 Craig Burley <burley@gnu.org> * libF77/signal_.c, libI77/dfe.c, libI77/due.c, diff --git a/libf2c/Makefile.in b/libf2c/Makefile.in index aee6638..5469cc5 100644 --- a/libf2c/Makefile.in +++ b/libf2c/Makefile.in @@ -83,7 +83,8 @@ MISC = libF77/F77_aloc.o libF77/VersionF.o libF77/main.o libF77/s_rnge.o \ libF77/abort_.o libF77/getarg_.o libF77/iargc_.o libF77/getenv_.o \ libF77/signal_.o libF77/s_stop.o libF77/s_paus.o libF77/system_.o \ libF77/cabs.o libF77/derf_.o libF77/derfc_.o libF77/erf_.o \ - libF77/erfc_.o libF77/sig_die.o libF77/exit_.o + libF77/erfc_.o libF77/sig_die.o libF77/exit_.o \ + libF77/setarg.o libF77/setsig.o POW = libF77/pow_ci.o libF77/pow_dd.o libF77/pow_di.o libF77/pow_hh.o \ libF77/pow_ii.o libF77/pow_ri.o libF77/pow_zi.o libF77/pow_zz.o \ libF77/pow_qq.o @@ -236,5 +237,4 @@ maintainer-clean: distclean rebuilt: ${srcdir}/configure ${srcdir}/libU77/configure -.PHONY: libf77 libi77 libu77 rebuilt mostlyclean clean distclean \ - maintainer-clean all +.PHONY: rebuilt mostlyclean clean distclean maintainer-clean all diff --git a/libf2c/libF77/Makefile.in b/libf2c/libF77/Makefile.in index 266e22b..d8d97a8 100644 --- a/libf2c/libF77/Makefile.in +++ b/libf2c/libF77/Makefile.in @@ -34,7 +34,7 @@ VPATH = @srcdir@ MISC = F77_aloc.o VersionF.o main.o s_rnge.o abort_.o getarg_.o iargc_.o\ getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o\ - derf_.o derfc_.o erf_.o erfc_.o sig_die.o exit_.o + derf_.o derfc_.o erf_.o erfc_.o sig_die.o exit_.o setarg.o setsig.o POW = pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o \ pow_qq.o CX = c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o diff --git a/libf2c/libF77/getarg_.c b/libf2c/libF77/getarg_.c index eaded2e..5cf3ffb 100644 --- a/libf2c/libF77/getarg_.c +++ b/libf2c/libF77/getarg_.c @@ -12,13 +12,13 @@ VOID G77_getarg_0 (n, s, ls) ftnint *n; register char *s; ftnlen ls; void G77_getarg_0 (ftnint *n, register char *s, ftnlen ls) #endif { -extern int xargc; -extern char **xargv; +extern int f__xargc; +extern char **f__xargv; register char *t; register int i; -if(*n>=0 && *n<xargc) - t = xargv[*n]; +if(*n>=0 && *n<f__xargc) + t = f__xargv[*n]; else t = ""; for(i = 0; i<ls && *t!='\0' ; ++i) diff --git a/libf2c/libF77/iargc_.c b/libf2c/libF77/iargc_.c index 7ce5e08..1e04c77 100644 --- a/libf2c/libF77/iargc_.c +++ b/libf2c/libF77/iargc_.c @@ -6,6 +6,6 @@ ftnint G77_iargc_0 () ftnint G77_iargc_0 (void) #endif { -extern int xargc; -return ( xargc - 1 ); +extern int f__xargc; +return ( f__xargc - 1 ); } diff --git a/libf2c/libF77/main.c b/libf2c/libF77/main.c index 343d7bd..17bf449 100644 --- a/libf2c/libF77/main.c +++ b/libf2c/libF77/main.c @@ -3,12 +3,6 @@ #include <stdio.h> #include "signal1.h" -#ifndef SIGIOT -#ifdef SIGABRT -#define SIGIOT SIGABRT -#endif -#endif - #ifndef KR_headers #undef VOID #include <stdlib.h> @@ -41,61 +35,13 @@ extern VOID f_exit(); #endif #ifdef KR_headers -extern VOID f_init(), sig_die(); +extern VOID f_init(); extern int MAIN__(); -#define Int /* int */ #else -extern void f_init(void), sig_die(char*, int); +extern void f_init(void); extern int MAIN__(void); -#define Int int #endif -static VOID sigfdie(Sigarg) -{ -Use_Sigarg; -sig_die("Floating Exception", 1); -} - - -static VOID sigidie(Sigarg) -{ -Use_Sigarg; -sig_die("IOT Trap", 1); -} - -#ifdef SIGQUIT -static VOID sigqdie(Sigarg) -{ -Use_Sigarg; -sig_die("Quit signal", 1); -} -#endif - - -static VOID sigindie(Sigarg) -{ -Use_Sigarg; -sig_die("Interrupt", 0); -} - -static VOID sigtdie(Sigarg) -{ -Use_Sigarg; -sig_die("Killed", 0); -} - -#ifdef SIGTRAP -static VOID sigtrdie(Sigarg) -{ -Use_Sigarg; -sig_die("Trace trap", 1); -} -#endif - - -int xargc; -char **xargv; - #ifdef __cplusplus } #endif @@ -106,27 +52,8 @@ main(argc, argv) int argc; char **argv; main(int argc, char **argv) #endif { -xargc = argc; -xargv = argv; -signal1(SIGFPE, sigfdie); /* ignore underflow, enable overflow */ -#ifdef SIGIOT -signal1(SIGIOT, sigidie); -#endif -#ifdef SIGTRAP -signal1(SIGTRAP, sigtrdie); -#endif -#ifdef SIGQUIT -if(signal1(SIGQUIT,sigqdie) == SIG_IGN) - signal1(SIGQUIT, SIG_IGN); -#endif -if(signal1(SIGINT, sigindie) == SIG_IGN) - signal1(SIGINT, SIG_IGN); -signal1(SIGTERM,sigtdie); - -#ifdef pdp11 - ldfps(01200); /* detect overflow as an exception */ -#endif - +f_setarg(argc, argv); +f_setsig(); f_init(); #ifndef NO_ONEXIT ONEXIT(f_exit); diff --git a/libf2c/libF77/setarg.c b/libf2c/libF77/setarg.c new file mode 100644 index 0000000..929860a --- /dev/null +++ b/libf2c/libF77/setarg.c @@ -0,0 +1,29 @@ +/* Set up the global argc/argv info for use by getarg_, iargc_, and + g77's inlined intrinsic equivalents. */ + +#ifndef KR_headers +#undef VOID +#include <stdlib.h> +#endif + +#ifndef VOID +#define VOID void +#endif + +int f__xargc; +char **f__xargv; + +#ifdef __cplusplus + } +#endif + + void +#ifdef KR_headers +f_setarg(argc, argv) int argc; char **argv; +#else +f_setarg(int argc, char **argv) +#endif +{ +f__xargc = argc; +f__xargv = argv; +} diff --git a/libf2c/libF77/setsig.c b/libf2c/libF77/setsig.c new file mode 100644 index 0000000..8fde2fa --- /dev/null +++ b/libf2c/libF77/setsig.c @@ -0,0 +1,101 @@ +/* Set up the signal behavior. */ + +#include <stdio.h> +#include "signal1.h" + +#ifndef SIGIOT +#ifdef SIGABRT +#define SIGIOT SIGABRT +#endif +#endif + +#ifndef KR_headers +#undef VOID +#include <stdlib.h> +#endif + +#ifndef VOID +#define VOID void +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef KR_headers +extern VOID sig_die(); +#define Int /* int */ +#else +extern void sig_die(char*, int); +#define Int int +#endif + +static VOID sigfdie(Sigarg) +{ +Use_Sigarg; +sig_die("Floating Exception", 1); +} + + +static VOID sigidie(Sigarg) +{ +Use_Sigarg; +sig_die("IOT Trap", 1); +} + +#ifdef SIGQUIT +static VOID sigqdie(Sigarg) +{ +Use_Sigarg; +sig_die("Quit signal", 1); +} +#endif + + +static VOID sigindie(Sigarg) +{ +Use_Sigarg; +sig_die("Interrupt", 0); +} + +static VOID sigtdie(Sigarg) +{ +Use_Sigarg; +sig_die("Killed", 0); +} + +#ifdef SIGTRAP +static VOID sigtrdie(Sigarg) +{ +Use_Sigarg; +sig_die("Trace trap", 1); +} +#endif + + +#ifdef __cplusplus + } +#endif + + void +f_setsig() +{ +signal1(SIGFPE, sigfdie); /* ignore underflow, enable overflow */ +#ifdef SIGIOT +signal1(SIGIOT, sigidie); +#endif +#ifdef SIGTRAP +signal1(SIGTRAP, sigtrdie); +#endif +#ifdef SIGQUIT +if(signal1(SIGQUIT,sigqdie) == SIG_IGN) + signal1(SIGQUIT, SIG_IGN); +#endif +if(signal1(SIGINT, sigindie) == SIG_IGN) + signal1(SIGINT, SIG_IGN); +signal1(SIGTERM,sigtdie); + +#ifdef pdp11 + ldfps(01200); /* detect overflow as an exception */ +#endif +} |