This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
DB_File 1.68 update from Paul Marquess
[perl5.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 PERLVARA
10 #define PERLVARA(x, n, y)
11 #undef PERLVARI
12 #define PERLVARI(x, y, z) PL_##x = z;
13 #undef PERLVARIC
14 #define PERLVARIC(x, y, z) PL_##x = z;
15
16 CPerlObj::CPerlObj(IPerlMem* ipM, IPerlEnv* ipE, IPerlStdIO* ipStd,
17                    IPerlLIO* ipLIO, IPerlDir* ipD, IPerlSock* ipS,
18                    IPerlProc* ipP)
19 {
20     memset(((char*)this)+sizeof(void*), 0, sizeof(CPerlObj)-sizeof(void*));
21
22 #include "thrdvar.h"
23 #include "intrpvar.h"
24 #include "perlvars.h"
25
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;
33 }
34
35 void*
36 CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl)
37 {
38     if(pvtbl)
39         return pvtbl->pMalloc(pvtbl, nSize);
40
41     return NULL;
42 }
43
44 void
45 CPerlObj::operator delete(void *pPerl, IPerlMem *pvtbl)
46 {
47     if(pvtbl)
48         pvtbl->pFree(pvtbl, pPerl);
49 }
50
51 void
52 CPerlObj::Init(void)
53 {
54 }
55
56 #ifdef WIN32            /* XXX why are these needed? */
57 bool
58 Perl_do_exec(char *cmd)
59 {
60     return PerlProc_Cmd(cmd);
61 }
62
63 int
64 CPerlObj::do_aspawn(void *vreally, void **vmark, void **vsp)
65 {
66     return PerlProc_aspawn(vreally, vmark, vsp);
67 }
68 #endif  /* WIN32 */
69
70 #endif   /* PERL_OBJECT */
71
72 int
73 Perl_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 }