Debian Codegraph @

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

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