1 #include "INTERN.h" 2 #define PERL_IN_GLOBALS_C 3 #include "perl.h" 4 5 #ifdef PERL_OBJECT 6 7 #undef PERLVAR 8 #define PERLVAR(x, y) 9 #undef PERLVARA 10 #define PERLVARA(x, n, y) 11 #undef PERLVARI 12 #define PERLVARI(x, y, z) interp.x = z; 13 #undef PERLVARIC 14 #define PERLVARIC(x, y, z) interp.x = z; 15 16 CPerlObj::CPerlObj(IPerlMem* ipM, IPerlMem* ipMS, IPerlMem* ipMP, 17 IPerlEnv* ipE, IPerlStdIO* ipStd, 18 IPerlLIO* ipLIO, IPerlDir* ipD, IPerlSock* ipS, 19 IPerlProc* ipP) 20 { 21 memset(((char*)this)+sizeof(void*), 0, sizeof(CPerlObj)-sizeof(void*)); 22 23 #include "thrdvar.h" 24 #include "intrpvar.h" 25 26 PL_Mem = ipM; 27 PL_MemShared = ipMS; 28 PL_MemParse = ipMP; 29 PL_Env = ipE; 30 PL_StdIO = ipStd; 31 PL_LIO = ipLIO; 32 PL_Dir = ipD; 33 PL_Sock = ipS; 34 PL_Proc = ipP; 35 } 36 37 void* 38 CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl) 39 { 40 if(pvtbl) 41 return pvtbl->pMalloc(pvtbl, nSize); 42 #ifndef __MINGW32__ 43 /* operator new is supposed to throw std::bad_alloc */ 44 return NULL; 45 #endif 46 } 47 48 #ifndef __BORLANDC__ 49 void 50 CPerlObj::operator delete(void *pPerl, IPerlMem *pvtbl) 51 { 52 if(pvtbl) 53 pvtbl->pFree(pvtbl, pPerl); 54 } 55 #endif 56 57 #ifdef WIN32 /* XXX why are these needed? */ 58 bool 59 Perl_do_exec(char *cmd) 60 { 61 return PerlProc_Cmd(cmd); 62 } 63 64 int 65 CPerlObj::do_aspawn(void *vreally, void **vmark, void **vsp) 66 { 67 return PerlProc_aspawn(vreally, vmark, vsp); 68 } 69 #endif /* WIN32 */ 70 71 #endif /* PERL_OBJECT */ 72 73 int 74 Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...) 75 { 76 dTHX; 77 va_list(arglist); 78 va_start(arglist, format); 79 return PerlIO_vprintf(stream, format, arglist); 80 } 81 82 int 83 Perl_printf_nocontext(const char *format, ...) 84 { 85 dTHX; 86 va_list(arglist); 87 va_start(arglist, format); 88 return PerlIO_vprintf(PerlIO_stdout(), format, arglist); 89 } 90 91 #include "perlapi.h" /* bring in PL_force_link_funcs */ 92