This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
test tweak
[perl5.git] / globals.c
CommitLineData
ecfc5424 1#include "INTERN.h"
864dbfa3 2#define PERL_IN_GLOBALS_C
ecfc5424 3#include "perl.h"
76e3520e
GS
4
5#ifdef PERL_OBJECT
76e3520e 6
3dfd1da1
GS
7#undef PERLVAR
8#define PERLVAR(x, y)
9#undef PERLVARI
4c2891ed 10#define PERLVARI(x, y, z) PL_##x = z;
3dfd1da1 11#undef PERLVARIC
4c2891ed 12#define PERLVARIC(x, y, z) PL_##x = z;
3dfd1da1 13
76e3520e 14CPerlObj::CPerlObj(IPerlMem* ipM, IPerlEnv* ipE, IPerlStdIO* ipStd,
864dbfa3
GS
15 IPerlLIO* ipLIO, IPerlDir* ipD, IPerlSock* ipS,
16 IPerlProc* ipP)
76e3520e
GS
17{
18 memset(((char*)this)+sizeof(void*), 0, sizeof(CPerlObj)-sizeof(void*));
3dfd1da1
GS
19
20#include "thrdvar.h"
21#include "intrpvar.h"
22#include "perlvars.h"
23
4c2891ed
GS
24 PL_piMem = ipM;
25 PL_piENV = ipE;
26 PL_piStdIO = ipStd;
27 PL_piLIO = ipLIO;
28 PL_piDir = ipD;
29 PL_piSock = ipS;
30 PL_piProc = ipP;
76e3520e
GS
31}
32
33void*
34CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl)
35{
36 if(pvtbl != NULL)
0cb96387 37 return pvtbl->pMalloc(pvtbl, nSize);
76e3520e
GS
38
39 return NULL;
40}
41
42int&
0cb96387 43Perl_ErrorNo(void)
76e3520e 44{
5a092403 45 return errno;
76e3520e
GS
46}
47
48void
49CPerlObj::Init(void)
50{
76e3520e
GS
51}
52
0cb96387
GS
53int
54CPerlObj::fprintf(PerlIO *stream, const char *format, ...)
55{
56 va_list(arglist);
57 va_start(arglist, format);
58 return PerlIO_vprintf(stream, format, arglist);
59}
60
61#ifdef WIN32 /* XXX why are these needed? */
62bool
63Perl_do_exec(char *cmd)
64{
65 return PerlProc_Cmd(cmd);
66}
67
68int
69CPerlObj::do_aspawn(void *vreally, void **vmark, void **vsp)
70{
71 return PerlProc_aspawn(vreally, vmark, vsp);
72}
73#endif /* WIN32 */
74
76e3520e 75#endif /* PERL_OBJECT */