From: Ilya Zakharevich <ilya@math.ohio-state.edu>
[p5sagit/p5-mst-13.2.git] / globals.c
CommitLineData
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
4c2891ed 12#define PERLVARI(x, y, z) PL_##x = z;
3dfd1da1 13#undef PERLVARIC
4c2891ed 14#define PERLVARIC(x, y, z) PL_##x = z;
3dfd1da1 15
76e3520e 16CPerlObj::CPerlObj(IPerlMem* ipM, IPerlEnv* ipE, IPerlStdIO* ipStd,
864dbfa3 17 IPerlLIO* ipLIO, IPerlDir* ipD, IPerlSock* ipS,
18 IPerlProc* ipP)
76e3520e 19{
20 memset(((char*)this)+sizeof(void*), 0, sizeof(CPerlObj)-sizeof(void*));
3dfd1da1 21
22#include "thrdvar.h"
23#include "intrpvar.h"
24#include "perlvars.h"
25
51371543 26 PL_Mem = ipM;
27 PL_Env = ipE;
28 PL_StdIO = ipStd;
29 PL_LIO = ipLIO;
30 PL_Dir = ipD;
31 PL_Sock = ipS;
32 PL_Proc = ipP;
76e3520e 33}
34
35void*
36CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl)
37{
3075ddba 38 if(pvtbl)
0cb96387 39 return pvtbl->pMalloc(pvtbl, nSize);
76e3520e 40
41 return NULL;
42}
43
76e3520e 44void
3075ddba 45CPerlObj::operator delete(void *pPerl, IPerlMem *pvtbl)
46{
47 if(pvtbl)
48 pvtbl->pFree(pvtbl, pPerl);
49}
50
51void
76e3520e 52CPerlObj::Init(void)
53{
76e3520e 54}
55
0cb96387 56#ifdef WIN32 /* XXX why are these needed? */
57bool
58Perl_do_exec(char *cmd)
59{
60 return PerlProc_Cmd(cmd);
61}
62
63int
64CPerlObj::do_aspawn(void *vreally, void **vmark, void **vsp)
65{
66 return PerlProc_aspawn(vreally, vmark, vsp);
67}
68#endif /* WIN32 */
69
76e3520e 70#endif /* PERL_OBJECT */
c5be433b 71
72int
73Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
74{
75 dTHX;
76 va_list(arglist);
77 va_start(arglist, format);
78 return PerlIO_vprintf(stream, format, arglist);
79}