Integrate with Sarathy.
[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);
2b260de0 40#ifndef __MINGW32__
41 /* operator new is supposed to throw std::bad_alloc */
76e3520e 42 return NULL;
2b260de0 43#endif
76e3520e 44}
45
76e3520e 46void
3075ddba 47CPerlObj::operator delete(void *pPerl, IPerlMem *pvtbl)
48{
49 if(pvtbl)
50 pvtbl->pFree(pvtbl, pPerl);
51}
52
53void
76e3520e 54CPerlObj::Init(void)
55{
76e3520e 56}
57
0cb96387 58#ifdef WIN32 /* XXX why are these needed? */
59bool
60Perl_do_exec(char *cmd)
61{
62 return PerlProc_Cmd(cmd);
63}
64
65int
66CPerlObj::do_aspawn(void *vreally, void **vmark, void **vsp)
67{
68 return PerlProc_aspawn(vreally, vmark, vsp);
69}
70#endif /* WIN32 */
71
76e3520e 72#endif /* PERL_OBJECT */
c5be433b 73
74int
75Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
76{
77 dTHX;
78 va_list(arglist);
79 va_start(arglist, format);
80 return PerlIO_vprintf(stream, format, arglist);
81}