Regen Configure, modlib, toc.
[p5sagit/p5-mst-13.2.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 #ifdef MYMALLOC
7 /* sbrk is limited to first heap segement so make it big */
8 #pragma runopts(HEAP(8M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
9 #else
10 #pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
11 #endif
12 #endif
13
14
15 #include "EXTERN.h"
16 #define PERL_IN_MINIPERLMAIN_C
17 #include "perl.h"
18
19 static void xs_init (pTHX);
20 static PerlInterpreter *my_perl;
21
22 #if defined (__MINT__) || defined (atarist)
23 /* The Atari operating system doesn't have a dynamic stack.  The
24    stack size is determined from this value.  */
25 long _stksize = 64 * 1024;
26 #endif
27
28 int
29 main(int argc, char **argv, char **env)
30 {
31     int exitstatus;
32
33 #ifdef PERL_GLOBAL_STRUCT
34 #define PERLVAR(var,type) /**/
35 #define PERLVARA(var,type) /**/
36 #define PERLVARI(var,type,init) PL_Vars.var = init;
37 #define PERLVARIC(var,type,init) PL_Vars.var = init;
38 #include "perlvars.h"
39 #undef PERLVAR
40 #undef PERLVARA
41 #undef PERLVARI
42 #undef PERLVARIC
43 #endif
44
45     /* if user wants control of gprof profiling off by default */
46     /* noop unless Configure is given -Accflags=-DPERL_GPROF_CONTROL */
47     PERL_GPROF_MONCONTROL(0);
48
49     PERL_SYS_INIT3(&argc,&argv,&env);
50
51 #ifdef USE_ITHREADS
52     PTHREAD_ATFORK(Perl_atfork_lock,
53                    Perl_atfork_unlock,
54                    Perl_atfork_unlock);
55 #endif
56
57     if (!PL_do_undump) {
58         my_perl = perl_alloc();
59         if (!my_perl)
60             exit(1);
61         perl_construct(my_perl);
62         PL_perl_destruct_level = 0;
63     }
64
65     exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
66     if (!exitstatus) {
67         exitstatus = perl_run(my_perl);
68     }
69
70     perl_destruct(my_perl);
71     perl_free(my_perl);
72
73     PERL_SYS_TERM();
74
75     exit(exitstatus);
76     return exitstatus;
77 }
78
79 /* Register any extra external extensions */
80
81 /* Do not delete this line--writemain depends on it */
82
83 static void
84 xs_init(pTHX)
85 {
86     dXSUB_SYS;
87 }