PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
plperl.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * plperl.h
4  * Common include file for PL/Perl files
5  *
6  * This should be included _AFTER_ postgres.h and system include files
7  *
8  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1995, Regents of the University of California
10  *
11  * src/pl/plperl/plperl.h
12  */
13 
14 #ifndef PL_PERL_H
15 #define PL_PERL_H
16 
17 /* stop perl headers from hijacking stdio and other stuff on Windows */
18 #ifdef WIN32
19 #define WIN32IO_IS_STDIO
20 /*
21  * isnan is defined in both the perl and mingw headers. We don't use it,
22  * so this just clears up the compile warning.
23  */
24 #ifdef isnan
25 #undef isnan
26 #endif
27 #endif /* WIN32 */
28 
29 /*
30  * Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
31  * perl itself supplies doesn't seem to.
32  */
33 #define PERL_UNUSED_DECL pg_attribute_unused()
34 
35 /*
36  * Sometimes perl carefully scribbles on our *printf macros.
37  * So we undefine them here and redefine them after it's done its dirty deed.
38  */
39 
40 #ifdef USE_REPL_SNPRINTF
41 #undef snprintf
42 #undef vsnprintf
43 #endif
44 
45 
46 /*
47  * Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
48  * can compile against MULTIPLICITY Perl builds without including XSUB.h.
49  */
50 #define PERL_NO_GET_CONTEXT
51 #include "EXTERN.h"
52 #include "perl.h"
53 
54 /*
55  * We want to include XSUB.h only within .xs files, because on some platforms
56  * it undesirably redefines a lot of libc functions. But it must appear
57  * before ppport.h, so use a #define flag to control inclusion here.
58  */
59 #ifdef PG_NEED_PERL_XSUB_H
60 #include "XSUB.h"
61 #endif
62 
63 /* put back our snprintf and vsnprintf */
64 #ifdef USE_REPL_SNPRINTF
65 #ifdef snprintf
66 #undef snprintf
67 #endif
68 #ifdef vsnprintf
69 #undef vsnprintf
70 #endif
71 #ifdef __GNUC__
72 #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
73 #define snprintf(...) pg_snprintf(__VA_ARGS__)
74 #else
75 #define vsnprintf pg_vsnprintf
76 #define snprintf pg_snprintf
77 #endif /* __GNUC__ */
78 #endif /* USE_REPL_SNPRINTF */
79 
80 /* perl version and platform portability */
81 #define NEED_eval_pv
82 #define NEED_newRV_noinc
83 #define NEED_sv_2pv_flags
84 #include "ppport.h"
85 
86 /* perl may have a different width of "bool", don't buy it */
87 #ifdef bool
88 #undef bool
89 #endif
90 
91 /* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
92 #ifndef HeUTF8
93 #define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
94  SvUTF8(HeKEY_sv(he)) : \
95  (U32)HeKUTF8(he))
96 #endif
97 
98 /* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
99 #ifndef GvCV_set
100 #define GvCV_set(gv, cv) (GvCV(gv) = cv)
101 #endif
102 
103 /* Perl 5.19.4 changed array indices from I32 to SSize_t */
104 #if PERL_BCDVERSION >= 0x5019004
105 #define AV_SIZE_MAX SSize_t_MAX
106 #else
107 #define AV_SIZE_MAX I32_MAX
108 #endif
109 
110 /* declare routines from plperl.c for access by .xs files */
111 HV *plperl_spi_exec(char *, int);
112 void plperl_return_next(SV *);
113 SV *plperl_spi_query(char *);
114 SV *plperl_spi_fetchrow(char *);
115 SV *plperl_spi_prepare(char *, int, SV **);
116 HV *plperl_spi_exec_prepared(char *, HV *, int, SV **);
117 SV *plperl_spi_query_prepared(char *, int, SV **);
118 void plperl_spi_freeplan(char *);
119 void plperl_spi_cursor_close(char *);
120 char *plperl_sv_to_literal(SV *, char *);
121 void plperl_util_elog(int level, SV *msg);
122 
123 #endif /* PL_PERL_H */
void plperl_spi_freeplan(char *)
Definition: plperl.c:3880
char * plperl_sv_to_literal(SV *, char *)
Definition: plperl.c:1414
SV * plperl_spi_fetchrow(char *)
Definition: plperl.c:3403
void plperl_spi_cursor_close(char *)
Definition: plperl.c:3476
void plperl_return_next(SV *)
Definition: plperl.c:3197
SV * plperl_spi_query(char *)
Definition: plperl.c:3333
HV * plperl_spi_exec_prepared(char *, HV *, int, SV **)
Definition: plperl.c:3637
HV * plperl_spi_exec(char *, int)
Definition: plperl.c:3085
SV * plperl_spi_prepare(char *, int, SV **)
Definition: plperl.c:3489
void plperl_util_elog(int level, SV *msg)
Definition: plperl.c:3922
SV * plperl_spi_query_prepared(char *, int, SV **)
Definition: plperl.c:3764