OSDN Git Service

Rationalise perl header inclusions via a common include file, which also
authorAndrew Dunstan <andrew@dunslane.net>
Sun, 8 Jan 2006 22:27:52 +0000 (22:27 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Sun, 8 Jan 2006 22:27:52 +0000 (22:27 +0000)
declares routines in plperl.c and spi_internal.c used in other files.

Along the way, also stop perl from hijacking stdio and other stuff on Windows.

src/pl/plperl/SPI.xs
src/pl/plperl/plperl.c
src/pl/plperl/plperl.h [new file with mode: 0644]
src/pl/plperl/spi_internal.c
src/pl/plperl/spi_internal.h [deleted file]

index 8d14f09..9d3dc39 100644 (file)
@@ -4,12 +4,7 @@
 #undef _
 
 /* perl stuff */
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-
-#include "spi_internal.h"
+#include "plperl.h"
 
 
 /*
index d0a7988..4375eb0 100644 (file)
@@ -33,7 +33,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.98 2005/12/29 14:28:31 adunstan Exp $
+ *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.99 2006/01/08 22:27:52 adunstan Exp $
  *
  **********************************************************************/
 
 extern DLLIMPORT bool check_function_bodies;
 
 /* perl stuff */
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-#include "spi_internal.h"
-
-/* just in case these symbols aren't provided */
-#ifndef pTHX_
-#define pTHX_
-#define pTHX void
-#endif
-
+#include "plperl.h"
 
 /**********************************************************************
  * The information we cache about loaded procedures
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
new file mode 100644 (file)
index 0000000..c881865
--- /dev/null
@@ -0,0 +1,49 @@
+/*-------------------------------------------------------------------------
+ *
+ * plperl.h
+ *    Common include file for PL/Perl files
+ *
+ * This should be included _AFTER_ postgres.h and system include files
+ *
+ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1995, Regents of the University of California
+ *
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.h,v 1.1 2006/01/08 22:27:52 adunstan Exp $
+ */
+
+#ifndef PL_PERL_H
+#define PL_PERL_H
+
+/* stop perl headers from hijacking stdio and other stuff on Windows */
+#ifdef WIN32
+#define WIN32IO_IS_STDIO
+#endif 
+
+/* required for perl API */
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "ppport.h"
+
+/* just in case these symbols aren't provided */
+#ifndef pTHX_
+#define pTHX_
+#define pTHX void
+#endif
+
+/* routines from spi_internal.c */
+int                    spi_DEBUG(void);
+int                    spi_LOG(void);
+int                    spi_INFO(void);
+int                    spi_NOTICE(void);
+int                    spi_WARNING(void);
+int                    spi_ERROR(void);
+
+/* routines from plperl.c */
+HV                *plperl_spi_exec(char *, int);
+void           plperl_return_next(SV *);
+SV                *plperl_spi_query(char *);
+SV                *plperl_spi_fetchrow(char *);
+
+
+#endif /* PL_PERL_H */
index c022d7d..7ca771d 100644 (file)
@@ -8,8 +8,8 @@
 /* Defined by Perl */
 #undef _
 
-#include "spi_internal.h"
-
+/* perl stuff */
+#include "plperl.h"
 
 int
 spi_DEBUG(void)
diff --git a/src/pl/plperl/spi_internal.h b/src/pl/plperl/spi_internal.h
deleted file mode 100644 (file)
index 4d2c407..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-
-int                    spi_DEBUG(void);
-
-int                    spi_LOG(void);
-
-int                    spi_INFO(void);
-
-int                    spi_NOTICE(void);
-
-int                    spi_WARNING(void);
-
-int                    spi_ERROR(void);
-
-/* this is actually in plperl.c */
-HV                *plperl_spi_exec(char *, int);
-void           plperl_return_next(SV *);
-SV                *plperl_spi_query(char *);
-SV                *plperl_spi_fetchrow(char *);