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
This commit is contained in:
parent
aa43c90be9
commit
5a276a25c6
8 changed files with 156 additions and 87 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
29
libf2c/libF77/setarg.c
Normal file
29
libf2c/libF77/setarg.c
Normal file
|
@ -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;
|
||||
}
|
101
libf2c/libF77/setsig.c
Normal file
101
libf2c/libF77/setsig.c
Normal file
|
@ -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
|
||||
}
|
Loading…
Add table
Reference in a new issue