Debian Codegraph @

debian/external_deps/fetk/punc/src/vf2c/main.c

raw
1 /* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
2
3 #include "stdio.h"
4 #include "signal1.h"
5
6 #define MHOLST_NO_MAIN 1
7
8 #ifndef SIGIOT
9 #ifdef SIGABRT
10 #define SIGIOT SIGABRT
11 #endif
12 #endif
13
14 #ifndef KR_headers
15 #undef VOID
16 #include "stdlib.h"
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 #endif
21
22 #ifndef VOID
23 #define VOID void
24 #endif
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #ifdef NO__STDC
31 #define ONEXIT onexit
32 extern VOID f_exit();
33 #else
34 #ifndef KR_headers
35 extern void f_exit(void);
36 #ifndef NO_ONEXIT
37 #define ONEXIT atexit
38 extern int atexit(void (*)(void));
39 #endif
40 #else
41 #ifndef NO_ONEXIT
42 #define ONEXIT onexit
43 extern VOID f_exit();
44 #endif
45 #endif
46 #endif
47
48 #ifdef KR_headers
49 extern VOID f_init(), sig_die();
50 #ifndef MHOLST_NO_MAIN
51 extern int MAIN__();
52 #endif
53 #define Int /* int */
54 #else
55 extern void f_init(void), sig_die(char*, int);
56 #ifndef MHOLST_NO_MAIN
57 extern int MAIN__(void);
58 #endif
59 #define Int int
60 #endif
61
62 static VOID sigfdie(Sigarg)
63 {
64 Use_Sigarg;
65 sig_die("Floating Exception", 1);
66 }
67
68
69 static VOID sigidie(Sigarg)
70 {
71 Use_Sigarg;
72 sig_die("IOT Trap", 1);
73 }
74
75 #ifdef SIGQUIT
76 static VOID sigqdie(Sigarg)
77 {
78 Use_Sigarg;
79 sig_die("Quit signal", 1);
80 }
81 #endif
82
83
84 static VOID sigindie(Sigarg)
85 {
86 Use_Sigarg;
87 sig_die("Interrupt", 0);
88 }
89
90 static VOID sigtdie(Sigarg)
91 {
92 Use_Sigarg;
93 sig_die("Killed", 0);
94 }
95
96 #ifdef SIGTRAP
97 static VOID sigtrdie(Sigarg)
98 {
99 Use_Sigarg;
100 sig_die("Trace trap", 1);
101 }
102 #endif
103
104
105 int xargc;
106 char **xargv;
107
108 #ifdef __cplusplus
109 }
110 #endif
111
112 #ifdef KR_headers
113 main(argc, argv) int argc; char **argv;
114 #else
115 int main(int argc, char **argv)
116 #endif
117 {
118 xargc = argc;
119 xargv = argv;
120 signal1(SIGFPE, sigfdie); /* ignore underflow, enable overflow */
121 #ifdef SIGIOT
122 signal1(SIGIOT, sigidie);
123 #endif
124 #ifdef SIGTRAP
125 signal1(SIGTRAP, sigtrdie);
126 #endif
127 #ifdef SIGQUIT
128 if(signal1(SIGQUIT,sigqdie) == SIG_IGN)
129 signal1(SIGQUIT, SIG_IGN);
130 #endif
131 if(signal1(SIGINT, sigindie) == SIG_IGN)
132 signal1(SIGINT, SIG_IGN);
133 signal1(SIGTERM,sigtdie);
134
135 #ifdef pdp11
136 ldfps(01200); /* detect overflow as an exception */
137 #endif
138
139 f_init();
140 #ifndef NO_ONEXIT
141 ONEXIT(f_exit);
142 #endif
143 #ifndef MHOLST_NO_MAIN
144 MAIN__();
145 #endif
146 #ifdef NO_ONEXIT
147 f_exit();
148 #endif
149 exit(0); /* exit(0) rather than return(0) to bypass Cray bug */
150 return 0; /* For compilers that complain of missing return values; */
151 /* others will complain that this is unreachable code. */
152 }
153 #ifdef __cplusplus
154 }
155 #endif