This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ext/ + -Wall
[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)
51371543
GS
9#undef PERLVARA
10#define PERLVARA(x, n, y)
3dfd1da1 11#undef PERLVARI
7766f137 12#define PERLVARI(x, y, z) interp.x = z;
3dfd1da1 13#undef PERLVARIC
7766f137 14#define PERLVARIC(x, y, z) interp.x = z;
3dfd1da1 15
7766f137
GS
16CPerlObj::CPerlObj(IPerlMem* ipM, IPerlMem* ipMS, IPerlMem* ipMP,
17 IPerlEnv* ipE, IPerlStdIO* ipStd,
864dbfa3
GS
18 IPerlLIO* ipLIO, IPerlDir* ipD, IPerlSock* ipS,
19 IPerlProc* ipP)
76e3520e
GS
20{
21 memset(((char*)this)+sizeof(void*), 0, sizeof(CPerlObj)-sizeof(void*));
3dfd1da1
GS
22
23#include "thrdvar.h"
24#include "intrpvar.h"
3dfd1da1 25
51371543 26 PL_Mem = ipM;
7766f137
GS
27 PL_MemShared = ipMS;
28 PL_MemParse = ipMP;
51371543
GS
29 PL_Env = ipE;
30 PL_StdIO = ipStd;
31 PL_LIO = ipLIO;
32 PL_Dir = ipD;
33 PL_Sock = ipS;
34 PL_Proc = ipP;
76e3520e
GS
35}
36
37void*
38CPerlObj::operator new(size_t nSize, IPerlMem *pvtbl)
39{
3075ddba 40 if(pvtbl)
0cb96387 41 return pvtbl->pMalloc(pvtbl, nSize);
2b260de0
GS
42#ifndef __MINGW32__
43 /* operator new is supposed to throw std::bad_alloc */
76e3520e 44 return NULL;
2b260de0 45#endif
76e3520e
GS
46}
47
12a98ad5 48#ifndef __BORLANDC__
76e3520e 49void
3075ddba
GS
50CPerlObj::operator delete(void *pPerl, IPerlMem *pvtbl)
51{
52 if(pvtbl)
53 pvtbl->pFree(pvtbl, pPerl);
54}
12a98ad5 55#endif
3075ddba 56
0cb96387
GS
57#ifdef WIN32 /* XXX why are these needed? */
58bool
59Perl_do_exec(char *cmd)
60{
61 return PerlProc_Cmd(cmd);
62}
63
64int
65CPerlObj::do_aspawn(void *vreally, void **vmark, void **vsp)
66{
67 return PerlProc_aspawn(vreally, vmark, vsp);
68}
69#endif /* WIN32 */
70
76e3520e 71#endif /* PERL_OBJECT */
c5be433b
GS
72
73int
74Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...)
75{
c5be433b
GS
76 va_list(arglist);
77 va_start(arglist, format);
78 return PerlIO_vprintf(stream, format, arglist);
79}
682fc664 80
b0316773
JH
81int
82Perl_printf_nocontext(const char *format, ...)
83{
b0316773
JH
84 va_list(arglist);
85 va_start(arglist, format);
86 return PerlIO_vprintf(PerlIO_stdout(), format, arglist);
87}
88
682fc664 89#include "perlapi.h" /* bring in PL_force_link_funcs */