Header And Logo

PostgreSQL
| The world's most advanced open source database.

plperl.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * plperl.h
00004  *    Common include file for PL/Perl files
00005  *
00006  * This should be included _AFTER_ postgres.h and system include files
00007  *
00008  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00009  * Portions Copyright (c) 1995, Regents of the University of California
00010  *
00011  * src/pl/plperl/plperl.h
00012  */
00013 
00014 #ifndef PL_PERL_H
00015 #define PL_PERL_H
00016 
00017 /* stop perl headers from hijacking stdio and other stuff on Windows */
00018 #ifdef WIN32
00019 #define WIN32IO_IS_STDIO
00020 /*
00021  * isnan is defined in both the perl and mingw headers. We don't use it,
00022  * so this just clears up the compile warning.
00023  */
00024 #ifdef isnan
00025 #undef isnan
00026 #endif
00027 #endif
00028 
00029 /*
00030  * Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one
00031  * perl itself supplies doesn't seem to.
00032  */
00033 #if defined(__GNUC__)
00034 #define PERL_UNUSED_DECL __attribute__ ((unused))
00035 #endif
00036 
00037 /*
00038  * Sometimes perl carefully scribbles on our *printf macros.
00039  * So we undefine them here and redefine them after it's done its dirty deed.
00040  */
00041 
00042 #ifdef USE_REPL_SNPRINTF
00043 #undef snprintf
00044 #undef vsnprintf
00045 #endif
00046 
00047 
00048 /* required for perl API */
00049 #include "EXTERN.h"
00050 #include "perl.h"
00051 #include "XSUB.h"
00052 
00053 /* put back our snprintf and vsnprintf */
00054 #ifdef USE_REPL_SNPRINTF
00055 #ifdef snprintf
00056 #undef snprintf
00057 #endif
00058 #ifdef vsnprintf
00059 #undef vsnprintf
00060 #endif
00061 #ifdef __GNUC__
00062 #define vsnprintf(...)  pg_vsnprintf(__VA_ARGS__)
00063 #define snprintf(...)   pg_snprintf(__VA_ARGS__)
00064 #else
00065 #define vsnprintf       pg_vsnprintf
00066 #define snprintf        pg_snprintf
00067 #endif   /* __GNUC__ */
00068 #endif   /* USE_REPL_SNPRINTF */
00069 
00070 /* perl version and platform portability */
00071 #define NEED_eval_pv
00072 #define NEED_newRV_noinc
00073 #define NEED_sv_2pv_flags
00074 #include "ppport.h"
00075 
00076 /* perl may have a different width of "bool", don't buy it */
00077 #ifdef bool
00078 #undef bool
00079 #endif
00080 
00081 /* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
00082 #ifndef HeUTF8
00083 #define HeUTF8(he)             ((HeKLEN(he) == HEf_SVKEY) ?            \
00084                                 SvUTF8(HeKEY_sv(he)) :                 \
00085                                 (U32)HeKUTF8(he))
00086 #endif
00087 
00088 /* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
00089 #ifndef GvCV_set
00090 #define GvCV_set(gv, cv)        (GvCV(gv) = cv)
00091 #endif
00092 
00093 /* declare routines from plperl.c for access by .xs files */
00094 HV         *plperl_spi_exec(char *, int);
00095 void        plperl_return_next(SV *);
00096 SV         *plperl_spi_query(char *);
00097 SV         *plperl_spi_fetchrow(char *);
00098 SV         *plperl_spi_prepare(char *, int, SV **);
00099 HV         *plperl_spi_exec_prepared(char *, HV *, int, SV **);
00100 SV         *plperl_spi_query_prepared(char *, int, SV **);
00101 void        plperl_spi_freeplan(char *);
00102 void        plperl_spi_cursor_close(char *);
00103 char       *plperl_sv_to_literal(SV *, char *);
00104 
00105 
00106 
00107 #endif   /* PL_PERL_H */