more complete support for implicit thread/interpreter pointer,
[p5sagit/p5-mst-13.2.git] / globals.c
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 PERLVARI
10 #define PERLVARI(x, y, z) PL_##x = z;
11 #undef PERLVARIC
12 #define PERLVARIC(x, y, z) PL_##x = z;
13
14 CPerlObj::CPerlObj(IPerlMem* ipM, IPerlEnv* ipE, IPerlStdIO* ipStd,
15                    IPerlLIO* ipLIO, IPerlDir* ipD, IPerlSock* ipS,
16                    IPerlProc* ipP)
17 {
18     memset(((char*)this)+sizeof(void*), 0, sizeof(CPerlObj)-sizeof(void*));
19
20 #include "thrdvar.h"
21 #include "intrpvar.h"
22 #include "perlvars.h"
23
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;
31 }
32
33 void*
34 CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl)
35 {
36     if(pvtbl != NULL)
37         return pvtbl->Malloc(nSize);
38
39     return NULL;
40 }
41
42 int&
43 CPerlObj::ErrorNo(void)
44 {
45     return errno;
46 }
47
48 void
49 CPerlObj::Init(void)
50 {
51 }
52
53 #ifdef WIN32            /* XXX why are these needed? */
54 bool
55 Perl_do_exec(pTHX_ char *cmd)
56 {
57     return PerlProc_Cmd(cmd);
58 }
59
60 int
61 S_do_aspawn(pTHX_ void *vreally, void **vmark, void **vsp)
62 {
63     return PerlProc_aspawn(vreally, vmark, vsp);
64 }
65 #endif  /* WIN32 */
66
67 #endif   /* PERL_OBJECT */