home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl502b.zip / old / perlmain.c
C/C++ Source or Header  |  1994-10-21  |  1KB  |  56 lines

  1. /*
  2.  * "The Road goes ever on and on, down from the door where it began."
  3.  */
  4.  
  5. #include "INTERN.h"
  6. #include "perl.h"
  7.  
  8. static void xs_init _((void));
  9. static PerlInterpreter *my_perl;
  10.  
  11. /* This value may be raised by extensions for testing purposes */
  12. int perl_destruct_level = 0; /* 0=none, 1=full, 2=full with checks */
  13.  
  14. int
  15. main(argc, argv, env)
  16. int argc;
  17. char **argv;
  18. char **env;
  19. {
  20.     int exitstatus;
  21.  
  22. #ifdef VMS
  23.     getredirection(&argc,&argv);
  24. #endif
  25.  
  26.     if (!do_undump) {
  27.     my_perl = perl_alloc();
  28.     if (!my_perl)
  29.         exit(1);
  30.     perl_construct( my_perl );
  31.     }
  32.  
  33.     exitstatus = perl_parse( my_perl, xs_init, argc, argv, env );
  34.     if (exitstatus)
  35.     exit( exitstatus );
  36.  
  37.     exitstatus = perl_run( my_perl );
  38.  
  39.     perl_destruct( my_perl, perl_destruct_level );
  40.     perl_free( my_perl );
  41.  
  42.     exit( exitstatus );
  43. }
  44.  
  45. /* Register any extra external extensions */
  46.  
  47. static void
  48. xs_init()
  49. {
  50.     /* Do not delete this line--writemain depends on it */
  51.     char *file = __FILE__;
  52.     {   extern void boot_DynaLoader _((CV* cv));
  53.         newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file);
  54.     }
  55. }
  56.