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