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
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 /* required for perl API */
47 #include "EXTERN.h"
48 #include "perl.h"
49 #include "XSUB.h"
50 
51 /* put back our snprintf and vsnprintf */
52 #ifdef USE_REPL_SNPRINTF
53 #ifdef snprintf
54 #undef snprintf
55 #endif
56 #ifdef vsnprintf
57 #undef vsnprintf
58 #endif
59 #ifdef __GNUC__
60 #define vsnprintf(...) pg_vsnprintf(__VA_ARGS__)
61 #define snprintf(...) pg_snprintf(__VA_ARGS__)
62 #else
63 #define vsnprintf pg_vsnprintf
64 #define snprintf pg_snprintf
65 #endif /* __GNUC__ */
66 #endif /* USE_REPL_SNPRINTF */
67 
68 /* perl version and platform portability */
69 #define NEED_eval_pv
70 #define NEED_newRV_noinc
71 #define NEED_sv_2pv_flags
72 #include "ppport.h"
73 
74 /* perl may have a different width of "bool", don't buy it */
75 #ifdef bool
76 #undef bool
77 #endif
78 
79 /* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
80 #ifndef HeUTF8
81 #define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
82  SvUTF8(HeKEY_sv(he)) : \
83  (U32)HeKUTF8(he))
84 #endif
85 
86 /* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
87 #ifndef GvCV_set
88 #define GvCV_set(gv, cv) (GvCV(gv) = cv)
89 #endif
90 
91 /* Perl 5.19.4 changed array indices from I32 to SSize_t */
92 #if PERL_BCDVERSION >= 0x5019004
93 #define AV_SIZE_MAX SSize_t_MAX
94 #else
95 #define AV_SIZE_MAX I32_MAX
96 #endif
97 
98 /* declare routines from plperl.c for access by .xs files */
99 HV *plperl_spi_exec(char *, int);
100 void plperl_return_next(SV *);
101 SV *plperl_spi_query(char *);
102 SV *plperl_spi_fetchrow(char *);
103 SV *plperl_spi_prepare(char *, int, SV **);
104 HV *plperl_spi_exec_prepared(char *, HV *, int, SV **);
105 SV *plperl_spi_query_prepared(char *, int, SV **);
106 void plperl_spi_freeplan(char *);
107 void plperl_spi_cursor_close(char *);
108 char *plperl_sv_to_literal(SV *, char *);
109 
110 #endif /* PL_PERL_H */
void plperl_spi_freeplan(char *)
Definition: plperl.c:3794
char * plperl_sv_to_literal(SV *, char *)
Definition: plperl.c:1374
SV * plperl_spi_fetchrow(char *)
Definition: plperl.c:3320
void plperl_spi_cursor_close(char *)
Definition: plperl.c:3392
void plperl_return_next(SV *)
Definition: plperl.c:3148
SV * plperl_spi_query(char *)
Definition: plperl.c:3250
HV * plperl_spi_exec_prepared(char *, HV *, int, SV **)
Definition: plperl.c:3553
HV * plperl_spi_exec(char *, int)
Definition: plperl.c:3034
SV * plperl_spi_prepare(char *, int, SV **)
Definition: plperl.c:3405
SV * plperl_spi_query_prepared(char *, int, SV **)
Definition: plperl.c:3678