This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
another bug in change#3386 (CATCH_SET wasn't reverted correctly)
[perl5.git] / miniperlmain.c
1 /*
2  * "The Road goes ever on and on, down from the door where it began."
3  */
4
5 #ifdef OEMVS
6 #pragma runopts(HEAP(1M,32K,ANYWHERE,KEEP,8K,4K))
7 #endif
8
9
10 #include "EXTERN.h"
11 #define PERL_IN_MINIPERLMAIN_C
12 #include "perl.h"
13
14 static void xs_init (pTHX);
15 static PerlInterpreter *my_perl;
16 static struct perl_thread *thr;         /* XXXXXX testing */
17
18 #if defined (__MINT__) || defined (atarist)
19 /* The Atari operating system doesn't have a dynamic stack.  The
20    stack size is determined from this value.  */
21 long _stksize = 64 * 1024;
22 #endif
23
24 int
25 main(int argc, char **argv, char **env)
26 {
27     int exitstatus;
28
29 #ifdef PERL_GLOBAL_STRUCT
30 #define PERLVAR(var,type) /**/
31 #define PERLVARA(var,type) /**/
32 #define PERLVARI(var,type,init) PL_Vars.var = init;
33 #define PERLVARIC(var,type,init) PL_Vars.var = init;
34 #include "perlvars.h"
35 #undef PERLVAR
36 #undef PERLVARA
37 #undef PERLVARI
38 #undef PERLVARIC
39 #endif
40
41     PERL_SYS_INIT(&argc,&argv);
42
43     if (!PL_do_undump) {
44         my_perl = perl_alloc();
45         if (!my_perl)
46             exit(1);
47         perl_construct( my_perl );
48         PL_perl_destruct_level = 0;
49     }
50
51     exitstatus = perl_parse( my_perl, xs_init, argc, argv, (char **) NULL );
52     if (!exitstatus) {
53         exitstatus = perl_run( my_perl );
54     }
55
56     perl_destruct( my_perl );
57     perl_free( my_perl );
58
59     PERL_SYS_TERM();
60
61     exit( exitstatus );
62     return exitstatus;
63 }
64
65 /* Register any extra external extensions */
66
67 /* Do not delete this line--writemain depends on it */
68
69 static void
70 xs_init(pTHX)
71 {
72   dXSUB_SYS;
73 }