This commit is contained in:
Luke Howard 2002-04-16 04:25:44 +00:00
parent 491d2ae5b9
commit dda2e4cee0
13 changed files with 300 additions and 61 deletions

View File

@ -12,14 +12,15 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
int int

View File

@ -0,0 +1,20 @@
/* This file is necessary because both PERL headers */
/* and OpenLDAP define a number of macros without */
/* checking wether they're already defined */
#ifndef ASPERL_UNDEFS_H
#define ASPERL_UNDEFS_H
/* ActiveState Win32 PERL port support */
/* set in ldap/include/portable.h */
# ifdef HAVE_WIN32_ASPERL
/* The following macros are undefined to prevent */
/* redefinition in PERL headers*/
# undef gid_t
# undef uid_t
# undef mode_t
# undef caddr_t
# undef WIN32_LEAN_AND_MEAN
# endif
#endif

View File

@ -0,0 +1,186 @@
# Microsoft Developer Studio Project File - Name="backperl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=backperl - Win32 Single Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "backperl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "backperl.mak" CFG="backperl - Win32 Single Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "backperl - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "backperl - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "backperl - Win32 Single Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "backperl - Win32 Single Release" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "backperl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\Release"
# PROP Intermediate_Dir "..\..\..\Release\backperl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D "NO_STRICT" /D "HAVE_DES_CRYPT" /D "PERL_IMPLICIT_CONTEXT" /D "PERL_IMPLICIT_SYS" /D "PERL_MSVCRT_READFIX" /D "MULTIPLICITY" /YX /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "backperl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\Debug"
# PROP Intermediate_Dir "..\..\..\Debug\backperl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "PERL_IMPLICIT_CONTEXT" /D "PERL_IMPLICIT_SYS" /D "NO_STRICT" /D "HAVE_DES_FCRYPT" /D "PERL_MSVCRT_READFIX" /FR /YX /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "backperl - Win32 Single Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "backperl"
# PROP BASE Intermediate_Dir "backperl"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\..\SDebug"
# PROP Intermediate_Dir "..\..\..\SDebug\backperl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "backperl - Win32 Single Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "backldb0"
# PROP BASE Intermediate_Dir "backldb0"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\..\SRelease"
# PROP Intermediate_Dir "..\..\..\SRelease\backperl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "D:\perl\lib\CORE" /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_CONSOLE" /D "NO_STRICT" /D "HAVE_DES_FCRYPT" /D "PERL_IMPLICIT_CONTEXT" /D "PERL_IMPLICIT_SYS" /D "PERL_MSVCRT_READFIX" /YX /FD /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "backperl - Win32 Release"
# Name "backperl - Win32 Debug"
# Name "backperl - Win32 Single Debug"
# Name "backperl - Win32 Single Release"
# Begin Source File
SOURCE=.\add.c
# End Source File
# Begin Source File
SOURCE=.\asperl_undefs.h
# End Source File
# Begin Source File
SOURCE=.\bind.c
# End Source File
# Begin Source File
SOURCE=.\close.c
# End Source File
# Begin Source File
SOURCE=.\compare.c
# End Source File
# Begin Source File
SOURCE=.\config.c
# End Source File
# Begin Source File
SOURCE=.\delete.c
# End Source File
# Begin Source File
SOURCE=.\external.h
# End Source File
# Begin Source File
SOURCE=.\init.c
# End Source File
# Begin Source File
SOURCE=.\modify.c
# End Source File
# Begin Source File
SOURCE=.\modrdn.c
# End Source File
# Begin Source File
SOURCE=.\perl_back.h
# End Source File
# Begin Source File
SOURCE=.\search.c
# End Source File
# End Target
# End Project

View File

@ -10,17 +10,19 @@
*/ */
#include "portable.h" #include "portable.h"
/* init.c - initialize shell backend */ /* init.c - initialize Perl backend */
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h>
*/
#include <EXTERN.h>
#include <perl.h>
#include "slap.h" #include "slap.h"
#ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h>
#include <XSUB.h>
#include <perl.h>
#include "perl_back.h" #include "perl_back.h"
@ -46,12 +48,16 @@ perl_back_bind(
PerlBackend *perl_back = (PerlBackend *) be->be_private; PerlBackend *perl_back = (PerlBackend *) be->be_private;
#ifdef HAVE_WIN32_ASPERL
PERL_SET_CONTEXT( PERL_INTERPRETER );
#endif
ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex ); ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
{ {
dSP; ENTER; SAVETMPS; dSP; ENTER; SAVETMPS;
PUSHMARK(sp); PUSHMARK(SP);
XPUSHs( perl_back->pb_obj_ref ); XPUSHs( perl_back->pb_obj_ref );
XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0))); XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0)));
XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len))); XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));

View File

@ -13,14 +13,15 @@
/* init.c - initialize shell backend */ /* init.c - initialize shell backend */
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
/********************************************************** /**********************************************************
@ -36,7 +37,7 @@ perl_back_close(
{ {
ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex ); ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
perl_destruct(perl_interpreter); perl_destruct(PERL_INTERPRETER);
ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex ); ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
@ -48,8 +49,8 @@ perl_back_destroy(
BackendInfo *bd BackendInfo *bd
) )
{ {
perl_free(perl_interpreter); perl_free(PERL_INTERPRETER);
perl_interpreter = NULL; PERL_INTERPRETER = NULL;
ldap_pvt_thread_mutex_destroy( &perl_interpreter_mutex ); ldap_pvt_thread_mutex_destroy( &perl_interpreter_mutex );

View File

@ -12,14 +12,15 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
/********************************************************** /**********************************************************

View File

@ -10,17 +10,17 @@
*/ */
#include "portable.h" #include "portable.h"
/* init.c - initialize shell backend */
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"

View File

@ -12,14 +12,15 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
int int

View File

@ -13,23 +13,23 @@
/* init.c - initialize shell backend */ /* init.c - initialize shell backend */
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h>
*/
#include <EXTERN.h>
#include <perl.h>
#include "slap.h" #include "slap.h"
#ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h>
#include <XSUB.h>
#include <perl.h>
#include "perl_back.h" #include "perl_back.h"
static void perl_back_xs_init LDAP_P((void)); static void perl_back_xs_init LDAP_P((PERL_BACK_XS_INIT_PARAMS));
EXT void boot_DynaLoader LDAP_P((CV* cv)); EXT void boot_DynaLoader LDAP_P((PERL_BACK_BOOT_DYNALOADER_PARAMS));
PerlInterpreter *perl_interpreter = NULL; PerlInterpreter *PERL_INTERPRETER = NULL;
ldap_pvt_thread_mutex_t perl_interpreter_mutex; ldap_pvt_thread_mutex_t perl_interpreter_mutex;
#ifdef SLAPD_PERL_DYNAMIC #ifdef SLAPD_PERL_DYNAMIC
@ -64,16 +64,16 @@ perl_back_initialize(
Debug( LDAP_DEBUG_TRACE, "perl backend open\n", 0, 0, 0 ); Debug( LDAP_DEBUG_TRACE, "perl backend open\n", 0, 0, 0 );
if( perl_interpreter != NULL ) { if( PERL_INTERPRETER != NULL ) {
Debug( LDAP_DEBUG_ANY, "perl backend open: already opened\n", Debug( LDAP_DEBUG_ANY, "perl backend open: already opened\n",
0, 0, 0 ); 0, 0, 0 );
return 1; return 1;
} }
perl_interpreter = perl_alloc(); PERL_INTERPRETER = perl_alloc();
perl_construct(perl_interpreter); perl_construct(PERL_INTERPRETER);
perl_parse(perl_interpreter, perl_back_xs_init, 3, embedding, (char **)NULL); perl_parse(PERL_INTERPRETER, perl_back_xs_init, 3, embedding, (char **)NULL);
perl_run(perl_interpreter); perl_run(PERL_INTERPRETER);
bi->bi_open = perl_back_open; bi->bi_open = perl_back_open;
bi->bi_config = 0; bi->bi_config = 0;

View File

@ -12,14 +12,15 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
int int

View File

@ -25,14 +25,15 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
int int

View File

@ -17,9 +17,29 @@ LDAP_BEGIN_DECL
#define PERL_IS_5_6 #define PERL_IS_5_6
#endif #endif
extern PerlInterpreter *perl_interpreter;
extern ldap_pvt_thread_mutex_t perl_interpreter_mutex; extern ldap_pvt_thread_mutex_t perl_interpreter_mutex;
#ifdef HAVE_WIN32_ASPERL
/* We should be using the PL_errgv, I think */
/* All the old style variables are prefixed with PL_ now */
# define errgv PL_errgv
# define na PL_na
#endif
#ifdef HAVE_WIN32_ASPERL
/* pTHX is needed often now */
# define PERL_INTERPRETER my_perl
# define PERL_BACK_XS_INIT_PARAMS pTHX
# define PERL_BACK_BOOT_DYNALOADER_PARAMS pTHX, CV *cv
#else
# define PERL_INTERPRETER perl_interpreter
# define PERL_BACK_XS_INIT_PARAMS void
# define PERL_BACK_BOOT_DYNALOADER_PARAMS CV *cv
#endif
extern PerlInterpreter *PERL_INTERPRETER;
typedef struct perl_backend_instance { typedef struct perl_backend_instance {
char *pb_module_name; char *pb_module_name;
SV *pb_obj_ref; SV *pb_obj_ref;

View File

@ -12,14 +12,15 @@
#include "portable.h" #include "portable.h"
#include <stdio.h> #include <stdio.h>
/* #include <ac/types.h>
#include <ac/socket.h> #include "slap.h"
*/ #ifdef HAVE_WIN32_ASPERL
#include "asperl_undefs.h"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include "slap.h"
#include "perl_back.h" #include "perl_back.h"
/********************************************************** /**********************************************************