PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Lib/perl5/perlmain.i

#
Swig | 82 lines | 54 code | 17 blank | 11 comment | 0 complexity | 3317bbc37b93bf1f5894dfc31f4336ee MD5 | raw file
 1/* -----------------------------------------------------------------------------
 2 * perlmain.i
 3 *
 4 * Code to statically rebuild perl5.
 5 * ----------------------------------------------------------------------------- */
 6
 7#ifdef AUTODOC
 8%subsection "perlmain.i"
 9%text %{
10This module provides support for building a new version of the
11Perl executable.  This will be necessary on systems that do
12not support shared libraries and may be necessary with C++
13extensions.  
14
15This module may only build a stripped down version of the
16Perl executable.   Thus, it may be necessary (or desirable)
17to hand-edit this file for your particular application.  To
18do this, simply copy this file from swig_lib/perl5/perlmain.i
19to your working directory and make the appropriate modifications.
20
21This library file works with Perl 5.003.  It may work with earlier
22versions, but it hasn't been tested.  As far as I know, this
23library is C++ safe.
24%}
25#endif
26
27%{
28
29static void xs_init _((pTHX));
30static PerlInterpreter *my_perl;
31
32int perl_eval(char *string) {
33  char *argv[2];
34  argv[0] = string;
35  argv[1] = (char *) 0;
36  return perl_call_argv("eval",0,argv);
37}
38
39int
40main(int argc, char **argv, char **env)
41{
42    int exitstatus;
43
44    my_perl = perl_alloc();
45    if (!my_perl)
46       exit(1);
47    perl_construct( my_perl );
48
49    exitstatus = perl_parse( my_perl, xs_init, argc, argv, (char **) NULL );
50    if (exitstatus)
51	exit( exitstatus );
52
53    /* Initialize all of the module variables */
54
55    exitstatus = perl_run( my_perl );
56
57    perl_destruct( my_perl );
58    perl_free( my_perl );
59
60    exit( exitstatus );
61}
62
63/* Register any extra external extensions */
64
65/* Do not delete this line--writemain depends on it */
66/* EXTERN_C void boot_DynaLoader _((CV* cv)); */
67
68static void
69xs_init(pTHX)
70{
71/*  dXSUB_SYS; */
72    char *file = __FILE__;
73    {
74      /*        newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); */
75	newXS(SWIG_name, SWIG_init, file);
76#ifdef SWIGMODINIT
77	SWIGMODINIT
78#endif
79    }
80}
81
82%}