diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-22 15:15:22 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-04-22 15:15:22 +0000 |
commit | 011f1a1a00b94fe919083a224d5df636f05ae32a (patch) | |
tree | cd77ae1fdc3803f999aabf2d8c618c7a1a9a0a76 /NetWare | |
parent | e41d30bc98dce1dea5c4a5747bd838c25bdeda5d (diff) | |
download | perl-011f1a1a00b94fe919083a224d5df636f05ae32a.tar.gz |
NetWare changeover from Watcom to Codewarrior, from C Aditya.
p4raw-id: //depot/perl@16076
Diffstat (limited to 'NetWare')
-rw-r--r-- | NetWare/MP.imp | 5 | ||||
-rw-r--r-- | NetWare/Makefile | 751 | ||||
-rw-r--r-- | NetWare/Nwmain.c | 12 | ||||
-rw-r--r-- | NetWare/bat/CWbuild.bat | 4 | ||||
-rw-r--r-- | NetWare/config.wc | 4 | ||||
-rw-r--r-- | NetWare/dl_netware.xs | 2 | ||||
-rw-r--r-- | NetWare/interface.h | 4 | ||||
-rw-r--r-- | NetWare/iperlhost.h | 4 | ||||
-rw-r--r-- | NetWare/nw5.c | 11 | ||||
-rw-r--r-- | NetWare/nw5sck.c | 8 | ||||
-rw-r--r-- | NetWare/nwhashcls.cpp | 269 | ||||
-rw-r--r-- | NetWare/nwhashcls.h | 79 | ||||
-rw-r--r-- | NetWare/nwperlhost.h | 1699 | ||||
-rw-r--r-- | NetWare/nwvmem.h | 340 | ||||
-rw-r--r-- | NetWare/perllib.cpp | 273 | ||||
-rw-r--r-- | NetWare/splittree.pl | 24 | ||||
-rw-r--r-- | NetWare/t/NWScripts.pl | 2 | ||||
-rw-r--r-- | NetWare/testnlm/type/type.c | 2 |
18 files changed, 3058 insertions, 435 deletions
diff --git a/NetWare/MP.imp b/NetWare/MP.imp new file mode 100644 index 0000000000..fc382914cf --- /dev/null +++ b/NetWare/MP.imp @@ -0,0 +1,5 @@ +# MPK Symbols not defined in the sdk import files +# Created by: Guruprasad on 25th May 2000 +kSemaphoreTimedWait, +kEnterNetWare, +kDelayThread diff --git a/NetWare/Makefile b/NetWare/Makefile index bda9695cab..e7f6ce720c 100644 --- a/NetWare/Makefile +++ b/NetWare/Makefile @@ -1,7 +1,7 @@ ## -## Makefile to build Perl on NetWare using Microsoft NMAKE and Watcom tools +## Makefile to build Perl on NetWare using Microsoft NMAKE and CodeWarrior tools ## -## This will build perl.nlm, perl.lib and extensions called NLPs +## This will build perl.nlm, perl.lib and extensions called NLMs ## ## @@ -13,11 +13,12 @@ ## ## This file is created by using the makefile that creates Windows Perl as the reference -## Author: sgp -## Date Created: 13th July 2000 -## Date Modified: 29th Mar 2001 - +## Author: +## Date Created: 25th March 2002 +## Date Modified: # Name of the NLM + + NLM_NAME = perl.nlm NLM_NAME8 = Perl @@ -31,6 +32,7 @@ NW_FLAGS = -DNETWARE -DNLM_PLATFORM -DNETDB_USE_INTERNET REL_DIR = Release DEB_DIR = Debug + !ifndef MAKE_TYPE #MAKE_TYPE = Release !message "Run bat\buildtype.bat to set the build type before continuing.\n" @@ -44,101 +46,106 @@ XDCTOOL = mpkxdc !ifndef MPKBASE #MPKBASE = p:\mpk !message "Run bat\setnwbld.bat to set the NetWare MPK SDK before continuing.\n" -!error !endif #ifndef MPKBASE -NLM_INCLUDE_MP = $(MPKBASE)\include +NLM_INCLUDE_MP = -I$(MPKBASE)\include MPKTOOL = $(MPKBASE)\$(XDCTOOL) !else MPKMESSAGE = Non MPK Build... NLM_INCLUDE_MP = MPKTOOL = -!endif #ifdef USE_MPK +!endif #ifdef USE_MPK + +!ifndef NLM_VERSION +NLM_VERSION = 3,20,0 +!endif !ifndef NLMSDKBASE #NLMSDKBASE = P:\ndk\nwsdk !message "Run bat\setnwbld.bat to set the NetWare SDK before continuing.\n" !error -!endif #ifndef NLMSDKBASE +!endif #ifndef NLMSDKBASE +UCSINC = p:\apps\script\sw\ucs-inc NLMIMPORTS = $(NLMSDKBASE)\imports -!ifdef WATCOM -C_COMPILER = wcc386 -CPP_COMPILER = wpp386 -NLM_LINK = wlink -NLM_LIB = lib386 -TOOL_HEADERS = $(WATCOM)\H;$(WATCOM)\H\NT -TOOL_PATH = $(WATCOM)\BINNT;$(WATCOM)\BINW -CCFLAGS = /zp1 /5s /w1 /zq /ms /otexanih /fpi -COMPILER_FLAG = -DWATCOM -ERROR_FLAG = -Fr -!if "$(MAKE_TYPE)"=="Debug" -BLDDIR = $(DEB_DIR) -BLDMESG = Debug version, -!ifdef USE_D2 -BS_CFLAGS = /od /d2 /en /st /hc -DDEBUGGING -DUSE_D2 $(DBG_FLAG) -BLDMESG = $(BLDMESG) Using /d2 option -!else -BS_CFLAGS = /od /d1 /en /st /hc -DDEBUGGING $(DBG_FLAG) -BLDMESG = $(BLDMESG) Using /d1 option -!endif #!ifdef USE_D2 -! else -BLDDIR = $(REL_DIR) -BLDMESG = Release version -BS_CFLAGS = -!endif #if "$(MAKE_TYPE)"=="Debug" -!else #ifdef WATCOM -!ifdef CODEWARRIOR -# Here comes the CW tools - TO BE FILLED TO BUILD WITH CW - -C_COMPILER = -CPP_COMPILER = -NLM_LINK = -NLM_LIB = +!ifndef SECURITYBASE +SECURITYBASE = P:\apps\script\sw\nwsec +!message "Run bat\SetSecSdk.bat to set the Security paths before continuing.\n" +#!error +!endif #!ifndef MAKE_TYPE +SECURITY_IMPORTS = $(SECURITYBASE)\imports + + # Here comes the CW tools - TO BE FILLED TO BUILD WITH CW - +MODULE_DESC = "Perl 5.7.3 for NetWare" +CCTYPE = CodeWarrior +C_COMPILER = mwccnlm -c +CPP_COMPILER = mwccnlm +LINK = mwldnlm +LD = mwldnlm +NLM_LIB = mwldnlm -type library TOOL_HEADERS = TOOL_PATH = -CCFLAGS = -COMPILER_FLAG = -ERROR_FLAG = +CWCPPFLAGS = -cpp_exceptions on -wchar_t off -bool on -w on -ansi off +CCFLAGS = -maxerrors 25 -processor Pentium -align packed \ + -w nounusedarg -msext on -sym on -sym codeview4 -sym internal \ + -DN_PLAT_NLM -DNLM=1 -D__NO_MATH_OPS -msgstyle gcc +COMPILER_FLAG = -d NETWARE +ERROR_FLAG = -sym on -sym codeview4 -sym internal +LDFLAGS = -type generic -stacksize 16384 -zerobss \ + -nofail -msgstyle gcc -nostderr -w on \ + -nlmversion $(NLM_VERSION) \ + -copy "Copyright (C) 2000-01\, 2002 Novell\, Inc. All Rights Reserved." \ + -sym on -sym codeview4 -sym internal -osym perl.sym + # Debug flags comes here - Not mandatory - required only for debug build !if "$(MAKE_TYPE)"=="Debug" BLDDIR = $(DEB_DIR) -BLDMESG = Debug version, +BLDMESG = Debug version, !ifdef USE_D2 -BS_CFLAGS = +BS_CFLAGS = -opt off -inline off -sym on -sym codeview4 -sym internal -DDEBUGGING -DDKFBPON BLDMESG = $(BLDMESG) Using /d2 option +##LDFLAGS = $(LDFLAGS) -sym on -sym codeview4 -sym internal -osym $(BLDDIR)\$*.sym +LDFLAGS = $(LDFLAGS) -sym on -sym codeview4 -sym internal +## -osym $(BLDDIR)\$(NLM_NAME8).sym !else -BS_CFLAGS = +BS_CFLAGS = -opt off -inline off -sym on -sym codeview4 -sym internal -DDEBUGGING -DDKFBPON BLDMESG = $(BLDMESG) Using /d1 option -!endif #!ifdef USE_D2 -! else +##LDFLAGS = $(LDFLAGS) -sym on -sym codeview4 -sym internal -osym $(BLDDIR)\$*.sym +LDFLAGS = $(LDFLAGS) -sym on -sym codeview4 -sym internal +## -osym $(BLDDIR)\$(NLM_NAME8).sym +!endif #!ifdef USE_D2 +!else BLDDIR = $(REL_DIR) BLDMESG = Release version +##BS_CFLAGS = -opt speed -inline smart -inline auto -sym off BS_CFLAGS = -!endif #if "$(MAKE_TYPE)"=="Debug" -!else #!ifdef CODEWARRIOR -!message "Tools base directory is not defined. Run bat\setnwbld.bat before proceeding" -!error -Run bat\setnwbld.bat -!endif #!ifdef CODEWARRIOR -!endif #ifdef WATCOM +!endif #if "$(MAKE_TYPE)"=="Debug" #!ifdef CODEWARRIOR ADD_LOCDEFS = -DPERL_CORE NLM_INCLUDE = -I$(NLMSDKBASE)\include NLM_INCLUDE_NLM = -I$(NLMSDKBASE)\include\nlm NLM_INCLUDE_NLM_SYS = -I$(NLMSDKBASE)\include\nlm\sys +NLM_INCLUDE_OBSLETE = -I$(NLMSDKBASE)\include\nlm\obsolete +# SECURITY_INCLUDE = -I$(SECURITYBASE)\include +NLM_INCLUDE_UCS = -I$(UCSINC) +!if "$(NW_EXTNS)"=="yes" INCLUDE_NW = -I.\include +!endif INC_PREV = -I.. -INC_THIS = -I.\ +INC_THIS = -I. -NLM_INCLUDE_PATH = $(NLMSDKBASE)\include\nlm;$(NLMSDKBASE)\include;$(NLMSDKBASE)\include\nlm\sys;$(NLM_INCLUDE_MP);$(TOOL_HEADERS) - -INCLUDE = $(NLM_INCLUDE_PATH) +NLM_INCLUDE_PATH = $(NLM_INCLUDE) $(NLM_INCLUDE_NLM) $(NLM_INCLUDE_NLM_SYS) $(NLM_INCLUDE_OBSLETE) \ + $(NLM_INCLUDE_MP) $(NLM_INCLUDE_UCS) $(TOOL_HEADERS) +INCLUDE = $(INC_THIS) $(INC_PREV) -I- $(NLM_INCLUDE_PATH) PATH = $(PATH);$(TOOL_PATH) -NLM_INCLUDES = -I$(COREDIR) $(INCLUDE_NW) $(INC_THIS) $(INC_PREV) +NLM_INCLUDES = -I$(COREDIR) $(INCLUDE_NW) + +CCFLAGS = $(CCFLAGS) $(INCLUDE) -COMPLER_FLAGS = $(CCFLAGS) $(BS_CFLAGS) $(ADD_BUILDOPT) $(NW_FLAGS) $(COMPILER_FLAG) $(MPKFLAGS) +COMPLER_FLAGS = $(BS_CFLAGS) $(ADD_BUILDOPT) $(NW_FLAGS) $(COMPILER_FLAG) $(MPKFLAGS) $(CCFLAGS) + # Source file list NW_H_FILES = \ @@ -151,14 +158,15 @@ NW_H_FILES = \ .\nwplglob.h \ .\nwtinfo.h \ .\nwutil.h \ - .\nwperlsys.h \ + .\nwhashcls.h \ NW_HOST_H_FILES = \ .\iperlhost.h \ .\interface.h \ .\netware.h \ .\nw5sck.h \ - .\nwperlsys.h \ + .\nwperlhost.h \ + CLIB_H_FILES = \ .\clibsdio.h \ @@ -178,18 +186,23 @@ NW_SRC = \ .\nwtinfo.c \ .\nwutil.c \ +NW_CPP_SRC = \ + .\nwhashcls.cpp \ + .\interface.cpp \ + .\perllib.cpp \ + EXT_MAIN_SRC = \ .\Main.c \ PERL_IO_SRC = \ ..\perlio.c -PERL_LIB_SRC = \ - .\interface.c \ - .\nwperlsys.c \ - +CLIBSTUF_OBJ = \ + .\CLIBstuf.obj +#PERL_TMP_OBJ = $(PERL_TEMP_SRC:.c=.obj) NW_SRC_OBJ = $(NW_SRC:.c=.obj) +NW_CPP_SRC_OBJ = $(NW_CPP_SRC:.cpp=.obj) NLM_MICROCORE_OBJ = $(MICROCORE_SRC:.c=.obj) PERL_LIB_OBJ = $(PERL_LIB_SRC:.c=.obj) PERL_IO_OBJ = $(PERL_IO_SRC:.c=.obj) @@ -198,14 +211,16 @@ EXT_MAIN_OBJ = $(EXT_MAIN_SRC:.c=.obj) # For dependency checking # $(BLDDIR) in place of Release or Debug is not working, should look into this - sgp -!if "$(BLDDIR)"=="Release" +!if "$(BLDDIR)"=="Release" NLM_OBJ = $(NLM_CORE_OBJ:..\=.\Release\) NEWTARE_OBJ_DEP = $(NW_SRC_OBJ:.\=.\Release\) +NEWTARE_CPP_OBJ_DEP = $(NW_CPP_SRC_OBJ:.\=.\Release\) PERL_LIB_OBJ_DEP = $(PERL_LIB_OBJ:.\=.\Release\) PERL_IO_OBJ_DEP = $(PERL_IO_OBJ:..\=.\Release\) !else NLM_OBJ = $(NLM_CORE_OBJ:..\=.\Debug\) NEWTARE_OBJ_DEP = $(NW_SRC_OBJ:.\=.\Debug\) +NEWTARE_CPP_OBJ_DEP = $(NW_CPP_SRC_OBJ:.\=.\Debug\) PERL_LIB_OBJ_DEP = $(PERL_LIB_OBJ:.\=.\Debug\) PERL_IO_OBJ_DEP = $(PERL_IO_OBJ:..\=.\Debug\) !endif @@ -221,6 +236,7 @@ NW_CFG_VARS = \ "INST_NW_VER=$(INST_NW_VER)" \ "archname=$(ARCHNAME)" \ "cc=$(C_COMPILER)" \ + "ar=$(LINK)" \ "ccflags=$(COMPLER_FLAGS)" \ "cf_email=$(EMAIL)" \ "d_crypt=$(D_CRYPT)" \ @@ -238,16 +254,15 @@ NW_CFG_VARS = \ "useithreads=$(USE_ITHREADS)" \ "usethreads=$(USE_5005THREADS)" \ "usemultiplicity=$(USE_MULTI)" \ - "ld=$(NLM_LINK)" \ + "ld=$(LINK)" \ "base_import=$(BASE_IMPORT_FILES)" \ "LINK_FLAGS=$(LINK_FLAGS:"=\")" \ "optimize=" \ - "d_times=define" \ "d_stdio_cnt_lval=undef" \ "d_stdio_ptr_lval=undef" \ "d_stdiobase=undef" \ "d_stdstdio=undef" \ - "d_times=undef" \ + "d_times=undef" \ "direntrytype=DIR" \ "nlm_version=$(NLM_VERSION)" \ "d_archname=NetWare" \ @@ -258,72 +273,70 @@ NW_CFG_VARS = \ NW_CFGSH_TMPL = config.wc NW_CFGH_TMPL = config_H.wc -SOCKET_NLP = $(AUTODIR)\Socket\Socket.nlp -FCNTL_NLP = $(AUTODIR)\Fcntl\Fcntl.nlp -IO_NLP = $(AUTODIR)\IO\IO.nlp -OPCODE_NLP = $(AUTODIR)\Opcode\Opcode.nlp -SDBM_FILE_NLP = $(AUTODIR)\SDBM_File\SDBM_File.nlp -POSIX_NLP = $(AUTODIR)\POSIX\POSIX.nlp -ATTRS_NLP = $(AUTODIR)\attrs\attrs.nlp -THREAD_NLP = $(AUTODIR)\Thread\Thread.nlp -B_NLP = $(AUTODIR)\B\B.nlp -DUMPER_NLP = $(AUTODIR)\Data\Dumper\Dumper.nlp -PEEK_NLP = $(AUTODIR)\Devel\Peek\Peek.nlp -RE_NLP = $(AUTODIR)\re\re.nlp -BYTELOADER_NLP = $(AUTODIR)\ByteLoader\ByteLoader.nlp -DPROF_NLP = $(AUTODIR)\Devel\DProf\DProf.nlp -GLOB_NLP = $(AUTODIR)\File\Glob\Glob.nlp -HOSTNAME_NLP = $(AUTODIR)\Sys\Hostname\Hostname.nlp -CWD_NLP = $(AUTODIR)\Cwd\Cwd.nlp -STORABLE_NLP = $(AUTODIR)\Storable\Storable.nlp -LISTUTIL_NLP = $(AUTODIR)\List\Util\Util.nlp -MIMEBASE64_NLP = $(AUTODIR)\MIME\Base64\Base64.nlp -XSTYPEMAP_NLP = $(AUTODIR)\XS\Typemap\Typemap.nlp -UNICODENORMALIZE_NLP = $(AUTODIR)\XS\Typemap\Typemap.nlp - -EXTENSION_NLP = \ - $(FCNTL_NLP) \ - $(BYTELOADER_NLP) \ - $(IO_NLP) \ - $(SOCKET_NLP) \ - $(OPCODE_NLP) \ - $(B_NLP) \ - $(ATTRS_NLP) \ - $(SDBM_FILE_NLP) \ - $(POSIX_NLP) \ - $(THREAD_NLP) \ - $(DUMPER_NLP) \ - $(GLOB_NLP) \ - $(PEEK_NLP) \ - $(RE_NLP) \ - $(DPROF_NLP) \ - $(HOSTNAME_NLP) \ - $(STORABLE_NLP) \ - $(LISTUTIL_NLP) \ - $(MIMEBASE64_NLP) \ - $(XSTYPEMAP_NLP) \ - $(UNICODENORMALIZE_NLP) \ -# $(CWD_NLP) \ -# cwd.pm needs to be modifed for NetWare. - - -# Begin - Following is required to build NetWare specific extensions Perl2UCS, UCSExt & CGI2Perl - -PERL2UCS = $(EXTDIR)\Perl2UCS\Perl2UCS -UCSEXT = $(EXTDIR)\UCSExt\UCSExt -CGI2PERL = CGI2Perl\CGI2Perl - -PERL2UCS_NLP = $(AUTODIR)\Perl2UCS\Perl2UCS.nlp -UCSEXT_NLP = $(AUTODIR)\UCSExt\UCSExt.nlp -CGI2PERL_NLP = \CGI2Perl\CGI2Perl.nlp +SOCKET_NLM = $(AUTODIR)\Socket\Socket.NLM +FCNTL_NLM = $(AUTODIR)\Fcntl\Fcntl.NLM +IO_NLM = $(AUTODIR)\IO\IO.NLM +OPCODE_NLM = $(AUTODIR)\Opcode\Opcode.NLM +SDBM_FILE_NLM = $(AUTODIR)\SDBM_File\SDBM_File.NLM +POSIX_NLM = $(AUTODIR)\POSIX\POSIX.NLM +ATTRS_NLM = $(AUTODIR)\attrs\attrs.NLM +THREAD_NLM = $(AUTODIR)\Thread\Thread.NLM +B_NLM = $(AUTODIR)\B\B.NLM +DUMPER_NLM = $(AUTODIR)\Data\Dumper\Dumper.NLM +PEEK_NLM = $(AUTODIR)\Devel\Peek\Peek.NLM +RE_NLM = $(AUTODIR)\re\re.NLM +BYTELOADER_NLM = $(AUTODIR)\ByteLoader\ByteLoader.NLM +DPROF_NLM = $(AUTODIR)\Devel\DProf\DProf.NLM +GLOB_NLM = $(AUTODIR)\File\Glob\Glob.NLM +HOSTNAME_NLM = $(AUTODIR)\Sys\Hostname\Hostname.NLM +CWD_NLM = $(EXTDIR)\Cwd\Cwd.NLM +STORABLE_NLM = $(EXTDIR)\Storable\Storable.NLM +LISTUTIL_NLM = $(EXTDIR)\List\Util.NLM +MIMEBASE64_NLM = $(EXTDIR)\MIME\Base64\Base64.NLM +XSTYPEMAP_NLM = $(EXTDIR)\XS\Typemap\Typemap.NLM +UNICODENORMALIZE_NLM = $(EXTDIR)\Unicode\Normalize\Normalize.NLM + +EXTENSION_NLM = \ + $(SDBM_FILE_NLM) \ + $(POSIX_NLM) \ + $(THREAD_NLM) \ + $(DUMPER_NLM) \ + $(GLOB_NLM) \ + $(PEEK_NLM) \ + $(RE_NLM) \ + $(DPROF_NLM) \ + $(HOSTNAME_NLM) \ + $(CWD_NLM) \ + $(STORABLE_NLM) \ + $(LISTUTIL_NLM) \ + $(MIMEBASE64_NLM) \ + $(XSTYPEMAP_NLM) \ + $(FCNTL_NLM) \ + $(SOCKET_NLM) \ + $(OPCODE_NLM) \ + $(B_NLM) \ + $(ATTRS_NLM) \ + $(BYTELOADER_NLM) \ + $(IO_NLM) \ + $(UNICODENORMALIZE_NLM) + +# Begin - Following is required to build NetWare specific extensions CGI2Perl, Perl2UCS and UCSExt + +CGI2PERL = CGI2Perl\CGI2Perl +PERL2UCS = $(EXTDIR)\Perl2UCS\Perl2UCS +UCSExt = $(EXTDIR)\Perl2UCS\UCSExt + +CGI2PERL_NLM = \CGI2Perl\CGI2Perl.NLM +PERL2UCS_NLM = $(AUTODIR)\Perl2UCS\Perl2UCS.NLM +UCSExt_NLM = $(AUTODIR)\UCSExt\UCSExt.NLM NETWARE_EXTNS = \ - $(PERL2UCS_NLP) \ - $(UCSEXT_NLP) \ - $(CGI2PERL_NLP) + $(CGI2PERL_NLM) \ + $(UCSExt_NLM) \ + $(PERL2UCS_NLM) \ -# End +# End ECHO_SRC = TestNLM\echo\echo.c TYPE_SRC = TestNLM\type\type.c @@ -342,15 +355,15 @@ SCREEN = 'none' !endif !ifndef NLM_DESCRIPTION -NLM_DESCRIPTION = $(NLM_NAME8) for Netware +NLM_DESCRIPTION = $(NLM_NAME8) for NetWare !endif !ifndef NLM_VERSION -NLM_VERSION = 5.72.0 +NLM_VERSION = 3.1.0 !endif !ifndef NLM_EXT -NLM_EXT = NLM +NLM_EXT = NLM !endif !ifndef BUILT @@ -358,7 +371,8 @@ BUILT = $(BLDDIR)\$(NLM_NAME8).$(NLM_EXT) !endif !ifndef BASE_IMPORT_FILES -BASE_IMPORT_FILES = Import @$(NLMIMPORTS)\clib.imp, @$(NLMIMPORTS)\nlmlib.imp, @$(NLMIMPORTS)\threads.imp, @$(NLMIMPORTS)\nit.imp, @$(NLMIMPORTS)\socklib.imp, @$(NLMIMPORTS)\fpsm.imp, @$(NLMIMPORTS)\lib0.imp +BASE_IMPORT_FILES = Import @$(NLMIMPORTS)\clib.imp, @$(NLMIMPORTS)\nlmlib.imp, @$(NLMIMPORTS)\threads.imp, @$(NLMIMPORTS)\nit.imp, @$(NLMIMPORTS)\socklib.imp, \ +@$(NLMIMPORTS)\fpsm.imp, @$(NLMIMPORTS)\lib0.imp, @$(SECURITY_IMPORTS)\nwsec.imp !endif !ifdef USE_MPK @@ -368,32 +382,18 @@ BASE_IMPORT_FILES = $(BASE_IMPORT_FILES), @$(MPKBASE)\import\mpkorg.imp !ifndef BASE_IMPORT_FNS BASE_IMPORT_FNS = Import ImportSymbol, GetSystemConsoleScreen, LoadModule !endif - -!ifdef WATCOM -NWLIBPATH = $(WATCOM)\lib386\netware -LIBPATH386 = $(WATCOM)\lib386 -LIBPATH = $(NWLIBPATH);$(LIBPATH386) -!else #!ifdef WATCOM -!ifdef CODEWARRIOR -NWLIBPATH = -LIBPATH386 = -LIBPATH = -!else #!ifdef CODEWARRIOR -!error Please define the tools base directory before proceeding -!endif #!ifdef CODEWARRIOR -!endif #!ifdef WATCOM - + + !ifndef BASE_LIBRARIES -!ifdef WATCOM -BASE_LIBRARIES = Library plib3s.lib,math3s.lib,clib3s.lib -!else -!ifdef CODEWARRIOR +#!ifdef WATCOM +#BASE_LIBRARIES = Library plib3s.lib,math3s.lib,clib3s.lib +#!else +!ifdef CODEWAR BASE_LIBRARIES = !endif #!ifdef CODEWARRIOR -!endif #!ifdef WATCOM -!endif #!ifndef BASE_LIBRARIES - -COPYRIGHT = (C) Copyright 2001-2002 Novell Inc. All rights reserved. +!endif + +COPYRIGHT = (C) Copyright 2002 Novell Inc. All Rights Reserved. EXPORTS = Export @perl.imp @@ -401,7 +401,7 @@ EXPORTS = Export @perl.imp # Set these to wherever you want "nmake install" to put your # newly built perl. # -INST_DRV = c: +INST_DRV = C: INST_TOP = $(INST_DRV)\perl INST_NW_DRV = i: @@ -419,7 +419,7 @@ INST_NW_TOP2 = $(INST_NW_DRV)\perl # versioned installation can be obtained by setting INST_TOP above to a # path that includes an arbitrary version string. # -INST_VER = \5.7.3 +INST_VER = \5.7.2 # # Comment this out if you DON'T want your perl installation to have @@ -436,6 +436,7 @@ INST_ARCH = \$(ARCHNAME) # uncomment to enable multiple interpreters. This is need for fork() # emulation. # + USE_MULTI = define # @@ -456,7 +457,6 @@ USE_IMP_SYS = define # else USE_STDIO will be defined. #USE_PERLIO = define #USE_STDIO = define - # # WARNING! This option is deprecated and will eventually go away (enable # USE_ITHREADS instead). @@ -587,6 +587,7 @@ ARCHNAME = $(ARCHNAME)-perlio #ADD_BUILDOPT = $(ADD_BUILDOPT) -DUSE_STDIO !ENDIF + ARCHDIR = ..\lib\$(ARCHNAME) COREDIR = ..\lib\CORE AUTODIR = ..\lib\auto @@ -621,7 +622,7 @@ o = .obj # Rules # -.SUFFIXES : .c $(o) .nlm .lib .nlp +.SUFFIXES : .c $(o) .nlm .lib .NLM # @@ -657,6 +658,7 @@ UTILS = \ ..\x2p\s2p MAKE = nmake -nologo +#NMAKE = $(C_COMPILER) $(INCLUDE) $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(ERROR_FLAG) $(*F).c -o $@ XCOPY = xcopy /f /r /i /d RCOPY = xcopy /f /r /i /e /d @@ -759,8 +761,8 @@ CORE_NOCFG_H = \ ..\EXTERN.h \ ..\perlvars.h \ ..\intrpvar.h \ - ..\thrdvar.h - + ..\thrdvar.h + CORE_H = $(CORE_NOCFG_H) .\config.h DLL_OBJ = $(DLL_SRC:.c=.obj) @@ -771,28 +773,27 @@ DYNAMIC_EXT = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B re \ Storable/Storable List/Util MIME/Base64/Base64 \ XS/Typemap/Typemap Unicode/Normalize/Normalize Sys/Hostname - STATIC_EXT = DynaLoader NONXS_EXT = Errno -DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader -SOCKET = $(EXTDIR)\Socket\Socket -FCNTL = $(EXTDIR)\Fcntl\Fcntl -OPCODE = $(EXTDIR)\Opcode\Opcode -SDBM_FILE = $(EXTDIR)\SDBM_File\SDBM_File +DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader +SOCKET = $(EXTDIR)\Socket\Socket +FCNTL = $(EXTDIR)\Fcntl\Fcntl +OPCODE = $(EXTDIR)\Opcode\Opcode +SDBM_FILE = $(EXTDIR)\SDBM_File\SDBM_File IO = $(EXTDIR)\IO\IO -POSIX = $(EXTDIR)\POSIX\POSIX -ATTRS = $(EXTDIR)\attrs\attrs -THREAD = $(EXTDIR)\Thread\Thread +POSIX = $(EXTDIR)\POSIX\POSIX +ATTRS = $(EXTDIR)\attrs\attrs +THREAD = $(EXTDIR)\Thread\Thread B = $(EXTDIR)\B\B RE = $(EXTDIR)\re\re -DUMPER = $(EXTDIR)\Data\Dumper\Dumper -ERRNO = $(EXTDIR)\Errno\Errno -PEEK = $(EXTDIR)\Devel\Peek\Peek -BYTELOADER = $(EXTDIR)\ByteLoader\ByteLoader -DPROF = $(EXTDIR)\Devel\DProf\DProf -GLOB = $(EXTDIR)\File\Glob\Glob -HOSTNAME = $(EXTDIR)\Sys\Hostname\Hostname +DUMPER = $(EXTDIR)\Data\Dumper\Dumper +ERRNO = $(EXTDIR)\Errno\Errno +PEEK = $(EXTDIR)\Devel\Peek\Peek +BYTELOADER = $(EXTDIR)\ByteLoader\ByteLoader +DPROF = $(EXTDIR)\Devel\DProf\DProf +GLOB = $(EXTDIR)\File\Glob\Glob +HOSTNAME = $(EXTDIR)\Sys\Hostname\Hostname CWD = $(EXTDIR)\Cwd\Cwd STORABLE = $(EXTDIR)\Storable\Storable LISTUTIL = $(EXTDIR)\List\Util @@ -802,7 +803,7 @@ UNICODENORMALIZE = $(EXTDIR)\Unicode\Normalize\Normalize ERRNO_PM_NW = $(LIBDIR)\Errno.pm -EXTENSION_C = \ +EXTENSION_C = \ $(SOCKET).c \ $(FCNTL).c \ $(OPCODE).c \ @@ -838,7 +839,7 @@ POD2TEXT = $(PODDIR)\pod2text # Top targets # -all : .cleanoldfiles .\nwconfig.h $(CONFIGPM) $(NLM_NAME) $(EXTENSION_NLP) $(EXTENSION_NPM) $(TEST_NLMS) $(NETWARE_EXTNS) +all : .cleanoldfiles .\nwconfig.h $(CONFIGPM) $(NLM_NAME) $(EXTENSION_NPM) $(NETWARE_EXTNS) $(TEST_NLMS) $(EXTENSION_NLM) #------------------------------------------------------------ @@ -877,65 +878,44 @@ $(MINIMOD) : $(MINIPERL) ..\minimod.pl ..\x2p\a2p$(o) : ..\x2p\a2p.c @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(C_COMPILER) -I..\x2p $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\x2p\a2p.c - + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) -I..\x2p $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) + ..\x2p\hash$(o) : ..\x2p\hash.c @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(C_COMPILER) -I..\x2p $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\x2p\hash.c - + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) -I..\x2p $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) + ..\x2p\str$(o) : ..\x2p\str.c @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(C_COMPILER) -I..\x2p $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\x2p\str.c + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) -I..\x2p $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) ..\x2p\util$(o) : ..\x2p\util.c @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(C_COMPILER) -I..\x2p $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\x2p\util.c + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) -I..\x2p $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) ..\x2p\walk$(o) : ..\x2p\walk.c @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(C_COMPILER) -I..\x2p $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\x2p\walk.c - + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) -I..\x2p $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) + $(X2P) : $(MINIPERL) $(X2P_OBJ) + @echo Building $@.......... $(MINIPERL) ..\x2p\find2perl.PL $(MINIPERL) ..\x2p\s2p.PL +# Linker definitions and lining come here for CODEWARRIOR + @echo $(BASE_IMPORT_FILES) > $*.def + @echo MODULE clib >> $*.def + @echo Import @perl.imp >> $*.def !ifdef USE_XDC $(MPKTOOL) $(XDCFLAGS) $*.xdc + @echo Import Mp.imp >> $*.def + @echo xdcdata $*.xdc >> $*.def !endif -!ifdef WATCOM - @$(NLM_LINK) @<<$*.link - Form Novell NLM 'Awk to Perl converter' - Name $(X2P) - Option Quiet - Option Version = $(NLM_VERSION) - Option Copyright '$(COPYRIGHT)' - Option Caseexact - Option Map=$*.map, Verbose, screenname 'System Console' - Option Stack=32k - Option SYMFILE=$*.sym -!ifdef USE_XDC - OPTION XDCDATA=$*.xdc -!endif - Option NoDefaultLibs - $(EXTRA_LINK_OPTION) -!if "$(MAKE_TYPE)"=="Debug" - Debug novell - Debug codeview -!endif -LibPath $(LIBPATH) - $(BASE_LIBRARIES) - Module clib - $(BASE_IMPORT_FNS) - $(BASE_IMPORT_FILES) - $(ADD_IMPORT_FNS) -Import @perl.imp - $(EXPORTS) - File $(X2P_OBJ:.obj=,) .\$(BLDDIR)\clibstuf.obj -<<KEEP -!else -!ifdef CODEWARRIOR -# Linker definitions and lining come here for CODEWARRIOR -!endif -!endif +## $(LINK) $(LDFLAGS) $(BS_CFLAGS) -desc "Awk to Perl Translator" $(X2P_OBJ) $(BLDDIR)\clibstuf.obj -commandfile $*.def -o $@ + $(LINK) $(LDFLAGS) -desc "Awk to Perl Translator" $(X2P_OBJ) $(BLDDIR)\clibstuf.obj -commandfile $*.def -o $@ $(EXTDIR)\DynaLoader\dl_netware.xs: dl_netware.xs copy dl_netware.xs $(EXTDIR)\DynaLoader\dl_netware.xs @@ -945,7 +925,7 @@ HEADERS : @copy << stdio.h >\nwnul /* - * (C) Copyright 2001-2002 Novell Inc. All rights reserved. + * (C) Copyright 2002 Novell Inc. All Rights Reserved. * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -957,7 +937,7 @@ HEADERS : * DESCRIPTION : Generated header file, do not edit. See makefile. * This header file causes the includer to use clibstuf.h * The purpose of clibstuf is to make sure that Perl, cgi2perl and - * all the perl extension nlm's (*.NLP) use the Novell Netware CLIB versions + * all the perl extension nlm's (*.NLM) use the Novell Netware CLIB versions * of standard functions. This code loads up a whole bunch of function pointers * to point at the standard CLIB functions. * Author : HYAK @@ -982,7 +962,7 @@ HEADERS : @copy << string.h >\nwnul /* - * (C) Copyright 2001-2002 Novell Inc. All rights reserved. + * (C) Copyright 2002 Novell Inc. All Rights Reserved. * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -994,7 +974,7 @@ HEADERS : * DESCRIPTION : Generated header file, do not edit. See makefile. * This header file causes the includer to use clibstuf.h * The purpose of clibstuf is to make sure that Perl, cgi2perl and - * all the perl extension nlm's (*.NLP) use the Novell Netware CLIB versions + * all the perl extension nlm's (*.NLM) use the Novell Netware CLIB versions * of standard functions. This code loads up a whole bunch of function pointers * to point at the standard CLIB functions. * Author : HYAK @@ -1017,99 +997,64 @@ HEADERS : @copy string.h $(COREDIR) -$(NLM_NAME): MESSAGE HEADERS $(BLDDIR)\nwnul $(NLM_OBJ) $(NEWTARE_OBJ_DEP) $(PERL_IO_OBJ_DEP) $(PERL_LIB_OBJ_DEP) $(DLL_OBJ) .XDC $(PERLIMPLIB) $(EXT_MAIN_OBJ) +$(NLM_NAME): MESSAGE HEADERS $(BLDDIR)\nul $(NLM_OBJ) $(NEWTARE_OBJ_DEP) $(NEWTARE_CPP_OBJ_DEP) $(PERL_IO_OBJ_DEP) $(DLL_OBJ) \ + $(PERLIMPLIB) $(EXT_MAIN_OBJ) $(PERL_TEMP_OBJ) #$(PERL_LIB_OBJ) @echo======= Linking $@ at $(MAKEDIR)\$(BLDDIR) ======= -!ifdef WATCOM - @$(NLM_LINK) @<<$(BLDDIR)\$*.link - Form Novell NLM '$(NLM_DESCRIPTION)' - Name $(BUILT) - Option Quiet - Option Version = $(NLM_VERSION) - Option Copyright '$(COPYRIGHT)' - Option Caseexact - Option Map=$(BLDDIR)\$(NLM_NAME8).map, Verbose, screenname $(SCREEN) - Option Stack=1000 -!ifdef NLM_NAME8 - Option SYMFILE=$(BLDDIR)\$(NLM_NAME8).sym -!ifdef USE_XDC - OPTION XDCDATA=$(BLDDIR)\$(NLM_NAME8).xdc -!endif -!else - Option SYMFILE=$(BLDDIR)\$(NLM_NAME).sym -!ifdef USE_XDC - OPTION XDCDATA=$(BLDDIR)\$(NLM_NAME).xdc -!endif -!endif - Option NoDefaultLibs - $(EXTRA_LINK_OPTION) -!if "$(MAKE_TYPE)"=="Debug" - # Debug all - Debug novell - Debug codeview -!endif -LibPath $(LIBPATH) - $(BASE_LIBRARIES) - Module clib - Module netdb - $(BASE_IMPORT_FNS) - $(BASE_IMPORT_FILES) - $(ADD_IMPORT_FNS) -Import @perl.imp - $(EXPORTS) - File $(NEWTARE_OBJ_DEP:.obj=.obj,) $(NLM_OBJ:.obj=.obj,) $(PERL_IO_OBJ_DEP:.obj=.obj,) $(PERL_LIB_OBJ_DEP:.obj=.obj,) $(DLL_OBJ:.obj=.obj,) -<<KEEP -!else -!ifdef CODEWARRIOR # Linker definitions and lining come here for CODEWARRIOR -!endif -!endif - copy ..\win32\splittree.pl .. - $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) - - -!if "$(MAKE_TYPE)"=="Debug" + @echo $(BASE_IMPORT_FILES) > $*.def + @echo MODULE clib >> $*.def + @echo MODULE netdb >> $*.def +# @echo MODULE nwsec >> $*.def + @echo $(EXPORTS) >> $*.def +!ifdef USE_XDC + @echo======= Creating XDC file + @echo Import Mp.imp >> $*.def !ifdef NLM_NAME8 - .\bat\cvpack $(BLDDIR)\$(NLM_NAME8).sym + $(MPKTOOL) $(XDCFLAGS) $(BLDDIR)\$(NLM_NAME8).xdc + @echo xdcdata $(BLDDIR)\$(NLM_NAME8).xdc >> $*.def !else - .\bat\cvpack $(BLDDIR)\$(NLM_NAME).sym + $(MPKTOOL) $(XDCFLAGS) $(BLDDIR)\$(NLM_NAME).xdc + @echo xdcdata $(BLDDIR)\$(NLM_NAME).xdc >> $*.def !endif !endif - +## $(LINK) $(LDFLAGS) $(BS_CFLAGS) -desc "Perl 5.6.1 for NetWare" $(NEWTARE_OBJ_DEP:.obj=.obj) $(NLM_OBJ:.obj=.obj) $(PERL_IO_OBJ_DEP:.obj=.obj) $(DLL_OBJ:.obj=.obj) $(NEWTARE_CPP_OBJ_DEP:.obj=.obj) -commandfile $*.def -o .\$(BLDDIR)\$@ + $(LINK) $(LDFLAGS) -desc $(MODULE_DESC) $(NEWTARE_OBJ_DEP:.obj=.obj) $(NLM_OBJ:.obj=.obj) $(PERL_IO_OBJ_DEP:.obj=.obj) $(DLL_OBJ:.obj=.obj) $(NEWTARE_CPP_OBJ_DEP:.obj=.obj) -commandfile $*.def -o .\$(BLDDIR)\$@ + copy splittree.pl .. + $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR) + @echo ========Linked $@ ========== +##!if "$(MAKE_TYPE)"=="Debug" +##!ifdef NLM_NAME8 +## .\bat\cvpack $(BLDDIR)\$(NLM_NAME8).sym +##!else +## .\bat\cvpack $(BLDDIR)\$(NLM_NAME).sym +##!endif +##!endif @echo======= Finished building $(BUILT). - -# Create the debug\release directory if not existing -$(BLDDIR)\nwnul: - @echo . . . . mkdir $(BLDDIR) - @mkdir $(BLDDIR) + +# Create the debug or release directory if not existing +$(BLDDIR)\nul: + @echo . . . . mkdir $(BLDDIR) + @mkdir $(BLDDIR) + @echo '$(BLDDIR)' directory created. MESSAGE: @echo======= $(MAKE_ACTION)ing $(NLM_NAME) at $(MAKEDIR)\$(BLDDIR) ======= - -.XDC: -!ifdef USE_XDC - @echo======= Creating XDC file -!ifdef NLM_NAME8 - $(MPKTOOL) $(XDCFLAGS) $(BLDDIR)\$(NLM_NAME8).xdc -!else - $(MPKTOOL) $(XDCFLAGS) $(BLDDIR)\$(NLM_NAME).xdc -!endif -!endif - -$(PERLIMPLIB): perllib.def - $(NLM_LIB) -def:perllib.def -out:$(PERLIMPLIB) - $(XCOPY) $(PERLIMPLIB) $(COREDIR) - -perllib.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl - $(MINIPERL) -w ..\makedef.pl PLATFORM=netware FILETYPE=def $(BS_CFLAGS) $(DEFINES) $(ADD_BUILDOPT) \ - CCTYPE=$(CCTYPE) > perllib.def - $(MINIPERL) -w ..\makedef.pl PLATFORM=netware FILETYPE=imp $(BS_CFLAGS) $(DEFINES) $(ADD_BUILDOPT) \ - CCTYPE=$(CCTYPE) > perl.imp - + +$(PERLIMPLIB): perllib.imp + +perllib.imp : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl +# $(MINIPERL) -w ..\makedef.pl PLATFORM=netware FILETYPE=def $(ADD_BUILDOPT) \ +# CCTYPE=$(CCTYPE) > perllib.def + @echo (Perl) > perl.imp + $(MINIPERL) -w ..\makedef.pl PLATFORM=netware FILETYPE=imp $(BS_CFLAGS) $(DEFINES) $(ADD_BUILDOPT) \ + CCTYPE=$(CCTYPE) >> perl.imp + copy perl.imp $(COREDIR) + $(DLL_OBJ) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c - @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(C_COMPILER) @<<$(BLDDIR)\$(*F).options - $(NLM_INCLUDES) -I$(EXTDIR)\DynaLoader\ $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$(BLDDIR)\$(*F).err $(EXTDIR)\DynaLoader\$(*F).c -<<KEEP + @echo $(MPKMESSAGE)...$(BLDMESG)...$@ + @$(C_COMPILER) $(NLM_INCLUDES) $(COMPLER_FLAGS) $(NLM_INCLUDES) $(ADD_LOCDEFS) $(ERROR_FLAG) -I$(EXTDIR)\DynaLoader \ + $(EXTDIR)\DynaLoader\$(*F).c -o $@ + @echo $(@) Done. $(DYNALOADER).c : $(MINIPERL) $(EXTDIR)\DynaLoader\dl_netware.xs $(CONFIGPM) if not exist $(AUTODIR) mkdir $(AUTODIR) @@ -1122,38 +1067,35 @@ $(DYNALOADER).c : $(MINIPERL) $(EXTDIR)\DynaLoader\dl_netware.xs $(CONFIGPM) cd $(EXTDIR)\$(*B) $(XSUBPP) dl_netware.xs > $(*B).c cd ..\..\netware + @echo Dynaloader Done -$(PERL_LIB_OBJ_DEP) : $(NW_HOST_H_FILES) $(*F).c - @echo $(MPKMESSAGE)...$(BLDMESG)...$@ - @$(CPP_COMPILER) @<<$(BLDDIR)\$(*F).options - -I.. $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err $(*F).c -<<KEEP $(PERL_IO_OBJ_DEP) : ..\$(*F).c @echo $(MPKMESSAGE) $(BLDMESG) $@ - @$(C_COMPILER) @<<$(BLDDIR)\$(*F).options - $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\$(*F).c -<<KEEP + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) $(ADD_LOCDEFS) $(ERROR_FLAG) ..\$(*F).c -o $@ + @echo Built $(@) $(NLM_OBJ) : ..\$(*F).c @echo $(MPKMESSAGE) $(BLDMESG) $@ - @$(C_COMPILER) @<<$(BLDDIR)\$(*F).options - $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err ..\$(*F).c -<<KEEP - + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) $(ADD_LOCDEFS) $(ERROR_FLAG) ..\$(*F).c -o $@ + @echo Built $(@) + + $(NEWTARE_OBJ_DEP) : $(NW_H_FILES) $(NW_HOST_H_FILES) $(*F).c @echo $(MPKMESSAGE) $(BLDMESG) $@ - @$(C_COMPILER) @<<$(BLDDIR)\$(*F).options - $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err $(*F).c -<<KEEP + $(C_COMPILER) $(COMPLER_FLAGS) $(NLM_INCLUDES) $(ADD_LOCDEFS) $(ERROR_FLAG) $(*F).c -o $@ + @echo Built $(@) -$(EXT_MAIN_OBJ) : $(CLIB_H_FILES) +$(NEWTARE_CPP_OBJ_DEP) : $(NW_H_FILES) $(NW_HOST_H_FILES) $(*F).cpp @echo $(MPKMESSAGE) $(BLDMESG) $@ - @$(C_COMPILER) @<<$(BLDDIR)\$(*F).options - $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err $(*F).c -<<KEEP - $(NLM_LIB) $@ $(NLMIMPORTS)\prelude.obj -out:$*.lib - @copy $*.lib $(COREDIR) + $(C_COMPILER) $(CWCPPFLAGS) $(COMPLER_FLAGS) $(NLM_INCLUDES) $(ADD_LOCDEFS) $(ERROR_FLAG) $(*F).cpp -o $@ + @echo Built $(@) + +$(EXT_MAIN_OBJ) : $(CLIB_H_FILES) + @echo $(MPKMESSAGE) $(BLDMESG) $@ + $(C_COMPILER) $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(ERROR_FLAG) $(*F).c -o $@ + $(LD) -type library $@ -o $*.lib + @copy $*.lib $(COREDIR) # Delete any files that might have got created during building miniperl.exe # config.sh will definitely be created @@ -1184,139 +1126,141 @@ $(EXT_MAIN_OBJ) : $(CLIB_H_FILES) config.nw5 : $(NW_CFGSH_TMPL) copy $(NW_CFGSH_TMPL) config.nw5 -$(SOCKET_NLP): $(NLM_NAME) $(SOCKET).xs +$(SOCKET_NLM): $(NLM_NAME) $(SOCKET).xs cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(HOSTNAME_NLP): $(NLM_NAME) $(HOSTNAME).xs +$(HOSTNAME_NLM): $(NLM_NAME) $(HOSTNAME).xs cd $(EXTDIR)\Sys\$(*B) ..\..\..\miniperl -I..\..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(FCNTL_NLP): +$(FCNTL_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(IO_NLP): +$(IO_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(OPCODE_NLP): +$(OPCODE_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(B_NLP): +$(B_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(DUMPER_NLP): +$(DUMPER_NLM): cd $(EXTDIR)\Data\$(*B) ..\..\..\miniperl -I..\..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(PEEK_NLP): +$(PEEK_NLM): cd $(EXTDIR)\Devel\$(*B) ..\..\..\miniperl -I..\..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(RE_NLP): +$(RE_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(BYTELOADER_NLP): +$(BYTELOADER_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(DPROF_NLP): +$(DPROF_NLM): cd $(EXTDIR)\Devel\$(*B) ..\..\..\miniperl -I..\..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(GLOB_NLP): +$(GLOB_NLM): cd $(EXTDIR)\File\$(*B) ..\..\..\miniperl -I..\..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(POSIX_NLP): +$(POSIX_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(THREAD_NLP): +$(THREAD_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(ATTRS_NLP): +$(ATTRS_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(SDBM_FILE_NLP): +$(SDBM_FILE_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(CWD_NLP): +$(CWD_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(STORABLE_NLP): +$(STORABLE_NLM): cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware -$(LISTUTIL_NLP): +$(LISTUTIL_NLM): cd $(EXTDIR)\List\$(*B) ..\..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(MIMEBASE64_NLP): +$(MIMEBASE64_NLM): cd $(EXTDIR)\Mime\$(*B) ..\..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(XSTYPEMAP_NLP): +$(XSTYPEMAP_NLM): cd $(EXTDIR)\XS\$(*B) ..\..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware -$(UNICODENORMALIZE_NLP): +$(UNICODENORMALIZE_NLM): cd $(EXTDIR)\Unicode\$(*B) ..\..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\..\netware + $(ERRNO_PM_NW): +# @echo Building $@ cd $(EXTDIR)\$(*B) ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl $(MAKE) @@ -1324,98 +1268,66 @@ $(ERRNO_PM_NW): $(ECHO_SRC_OBJ): $*.c @echo $(MPKMESSAGE) $(BLDMESG) $@ - @$(C_COMPILER) @<<$*.options - $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err $*.c -<<KEEP + $(C_COMPILER) $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) $(ECHO_NLM): $(ECHO_SRC_OBJ) @echo======= Linking $@ ======= +# Linker definitions and lining come here for CODEWARRIOR + @echo $(BASE_IMPORT_FILES) > $*.def + @echo MODULE clib >> $*.def + @echo Import @perl.imp >> $*.def !ifdef USE_XDC $(MPKTOOL) $(XDCFLAGS) $*.xdc + @echo Import @MP.imp >> $*.def + @echo xdcdata $*.xdc >> $*.def !endif -!ifdef WATCOM - @$(NLM_LINK) @<<$*.link - Form Novell NLM 'DOS echo emulation for Perl Testing' Name $@ - Option Quiet Option Version = $(NLM_VERSION) Option Copyright '$(COPYRIGHT)' Option Caseexact Option Map=$*.map, Verbose, screenname 'System Console' Option Stack=1000 Option SYMFILE=$*.sym Option NoDefaultLibs -!ifdef USE_XDC - OPTION XDCDATA=$*.xdc -!endif - $(EXTRA_LINK_OPTION) -!if "$(MAKE_TYPE)"=="Debug" - Debug novell - Debug codeview -!endif -LibPath $(LIBPATH) - $(BASE_LIBRARIES) Module clib $(BASE_IMPORT_FNS) $(BASE_IMPORT_FILES) $(ADD_IMPORT_FNS) -Import @perl.imp - $(EXPORTS) - File $(ECHO_SRC_OBJ:.obj=.obj,) .\$(BLDDIR)\clibstuf.obj -<<KEEP -!else -!ifdef CODEWARRIOR -# Linker definitions and lining come here for CODEWARRIOR -!endif -!endif +## $(LINK) $(LDFLAGS) $(BS_CFLAGS) -desc "DOS Echo emulation for Perl testing" $(ECHO_SRC_OBJ) $(BLDDIR)\clibstuf.obj -commandfile $*.def -o $@ + $(LINK) $(LDFLAGS) -desc "DOS Echo emulation for Perl testing" $(ECHO_SRC_OBJ) $(BLDDIR)\clibstuf.obj -commandfile $*.def -o $@ @echo======= Linking Complete ======= $(TYPE_SRC_OBJ): $*.c @echo $(MPKMESSAGE) $(BLDMESG) $@ - @$(C_COMPILER) @<<$*.options - $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(OBJOUT_FLAG)$@ $(ERROR_FLAG)$*.err $*.c -<<KEEP - + $(C_COMPILER) $(NLM_INCLUDES) $(COMPLER_FLAGS) $(ADD_LOCDEFS) $(ERROR_FLAG) $*.c -o $@ + @echo Built $(@) + $(TYPE_NLM): $(TYPE_SRC_OBJ) @echo======= Linking $@ ======= +# Linker definitions and lining come here for CODEWARRIOR + @echo $(BASE_IMPORT_FILES) > $*.def + @echo MODULE clib >> $*.def + @echo Import @perl.imp >> $*.def !ifdef USE_XDC $(MPKTOOL) $(XDCFLAGS) $*.xdc + @echo Import @MP.imp >> $*.def + @echo xdcdata $*.xdc >> $*.def !endif -!ifdef WATCOM - @$(NLM_LINK) @<<$*.link - Form Novell NLM 'DOS type emulation for Perl Testing' Name $@ - Option Quiet Option Version = $(NLM_VERSION) Option Copyright '$(COPYRIGHT)' Option Caseexact Option Map=$*.map, Verbose, screenname 'System Console' Option Stack=1000 Option SYMFILE=$*.sym -!ifdef USE_XDC - OPTION XDCDATA=$*.xdc -!endif - Option NoDefaultLibs - $(EXTRA_LINK_OPTION) -!if "$(MAKE_TYPE)"=="Debug" - Debug novell - Debug codeview -!endif -LibPath $(LIBPATH) - $(BASE_LIBRARIES) Module clib $(BASE_IMPORT_FNS) $(BASE_IMPORT_FILES) $(ADD_IMPORT_FNS) -Import @perl.imp - $(EXPORTS) - File $(TYPE_SRC_OBJ:.obj=.obj,) .\$(BLDDIR)\clibstuf.obj -<<KEEP -!else -!ifdef CODEWARRIOR -# Linker definitions and lining come here for CODEWARRIOR -!endif -!endif +## $(LINK) $(LDFLAGS) $(BS_CFLAGS) -desc "DOS Type emulation for Perl testing" $(TYPE_SRC_OBJ) $(BLDDIR)\clibstuf.obj -commandfile $*.def -o $@ + $(LINK) $(LDFLAGS) -desc "DOS Type emulation for Perl testing" $(TYPE_SRC_OBJ) $(BLDDIR)\clibstuf.obj -commandfile $*.def -o $@ @echo======= Linking Complete ======= + # Build NetWare specific extensions -$(CGI2PERL_NLP): +$(CGI2PERL_NLM): !if "$(NW_EXTNS)"=="yes" cd $(*B) - ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl + ..\..\miniperl -I..\..\lib Makefile.PL "CCCDLFLAGS=-bool on -lang c++" PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware !endif -$(PERL2UCS_NLP): +$(PERL2UCS_NLM): !if "$(NW_EXTNS)"=="yes" cd $(EXTDIR)\$(*B) - ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl + ..\..\miniperl -I..\..\lib Makefile.PL "CCCDLFLAGS=-bool on -lang c++" PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware !endif -$(UCSEXT_NLP): +$(UCSExt_NLM): !if "$(NW_EXTNS)"=="yes" cd $(EXTDIR)\$(*B) - ..\..\miniperl -I..\..\lib Makefile.PL PERL_CORE=1 INSTALLDIRS=perl + ..\..\miniperl -I..\..\lib Makefile.PL "CCCDLFLAGS=-bool on -lang c++" PERL_CORE=1 INSTALLDIRS=perl $(MAKE) cd ..\..\netware !endif @@ -1425,7 +1337,7 @@ nwclean: -rmdir /s /q $(DEB_DIR) @if exist .\stdio.h del /f /q .\stdio.h @if exist .\string.h del /f /q .\string.h - @if exist .\Main.obj del /f /q .\Main.obj + @if exist .\Main.obj del /f /q .\Main.obj @if exist .\Main.lib del /f /q .\Main.lib @if exist .\config.nw5 del /f /q .\config.nw5 @if exist .\perl.imp del /f /q .\perl.imp @@ -1537,4 +1449,3 @@ clean : -@erase ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat -@erase ..\x2p\*.nlm ..\x2p\*.bat - diff --git a/NetWare/Nwmain.c b/NetWare/Nwmain.c index ce901e6b95..029c24948d 100644 --- a/NetWare/Nwmain.c +++ b/NetWare/Nwmain.c @@ -119,7 +119,11 @@ int fnFpSetMode(FILE* fp, int mode, int *err); void fnGetPerlScreenName(char *sPerlScreenName); - +void fnGetPerlScreenName(char *sPerlScreenName); +void fnSetupNamespace(void); +char *getcwd(char [], int); +void fnRunScript(ScriptData* psdata); +void nw_freeenviron(); /*============================================================================================ @@ -177,7 +181,7 @@ void main(int argc, char *argv[]) char sNUL[MAX_DN_BYTES] = {'\0'}; strcpy(sNUL, NWDEFPERLROOT); - strcat(sNUL, "\\nwnul"); + strcat(sNUL, "\\nul"); if (access((const char *)sNUL, 0) != 0) { // The file, "nul" is not found and so create the file. @@ -299,7 +303,7 @@ void fnSigTermHandler(int sig) // while (!fnTerminateThreadInfo() && k < 5) { - sleep(1); + nw_sleep(1); k++; } } @@ -309,7 +313,7 @@ void fnSigTermHandler(int sig) char sNUL[MAX_DN_BYTES] = {'\0'}; strcpy(sNUL, NWDEFPERLROOT); - strcat(sNUL, "\\nwnul"); + strcat(sNUL, "\\nul"); if (access((const char *)sNUL, 0) == 0) { // The file, "nul" is found and so delete it. diff --git a/NetWare/bat/CWbuild.bat b/NetWare/bat/CWbuild.bat new file mode 100644 index 0000000000..e3f72bf9da --- /dev/null +++ b/NetWare/bat/CWbuild.bat @@ -0,0 +1,4 @@ +call buildtype r +call setsecsdk p:\apps\script\sw\nwsec +call setnwbld p:\apps\ndk\nwsdk p:\apps\script\sw\cw p:\apps\mpk +call mpkbuild on diff --git a/NetWare/config.wc b/NetWare/config.wc index e2c788f5ed..fc1cc18a96 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -44,7 +44,7 @@ byteorder='1234' c='' castflags='0' cat='type' -cc='cl' +cc='mwccnlm' cccdlflags=' ' ccdlflags=' ' ccflags='-MD -DNETWARE' @@ -443,7 +443,7 @@ def_perlroot='sys:\perl\scripts' def_temp='sys:\perl\temp' defvoidused='15' direntrytype='DIR' -dlext='nlp' +dlext='nlm' dlsrc='dl_netware.xs' doublesize='8' drand01='(rand()/(double)((unsigned)1<<RANDBITS))' diff --git a/NetWare/dl_netware.xs b/NetWare/dl_netware.xs index e02396b84a..7e11f71c04 100644 --- a/NetWare/dl_netware.xs +++ b/NetWare/dl_netware.xs @@ -111,7 +111,7 @@ dl_load_file(filename,flags=0) //initialize UCS, this has to be terminated when the script finishes execution //Is the script intending to use UCS Extensions? //This should be done once per script execution - if ((strcmp(mod_name,"Perl2UCS.nlp")==0) || (strcmp(mod_name,"UCSExt.nlp")==0)) + if ((strcmp(mod_name,"Perl2UCS.nlm")==0) || (strcmp(mod_name,"UCSExt.nlm")==0)) { unsigned int moduleHandle = 0; moduleHandle = FindNLMHandle("UCSCORE.NLM"); diff --git a/NetWare/interface.h b/NetWare/interface.h index 44d61524ed..b6dd4a076e 100644 --- a/NetWare/interface.h +++ b/NetWare/interface.h @@ -38,8 +38,8 @@ public: void PerlDestroy(PerlInterpreter *my_perl); void PerlFree(PerlInterpreter *my_perl); - bool RegisterWithThreadTable(void); - bool UnregisterWithThreadTable(void); + //bool RegisterWithThreadTable(void); + //bool UnregisterWithThreadTable(void); }; diff --git a/NetWare/iperlhost.h b/NetWare/iperlhost.h index 53bc87901d..3204c2cca9 100644 --- a/NetWare/iperlhost.h +++ b/NetWare/iperlhost.h @@ -36,8 +36,8 @@ public: virtual void PerlDestroy(PerlInterpreter *my_perl) = 0; virtual void PerlFree(PerlInterpreter *my_perl) = 0; - virtual bool RegisterWithThreadTable(void)=0; - virtual bool UnregisterWithThreadTable(void)=0; + //virtual bool RegisterWithThreadTable(void)=0; + //virtual bool UnregisterWithThreadTable(void)=0; }; extern "C" IPerlHost* AllocStdPerl(); diff --git a/NetWare/nw5.c b/NetWare/nw5.c index b217e1cf5f..ea6d849951 100644 --- a/NetWare/nw5.c +++ b/NetWare/nw5.c @@ -581,8 +581,8 @@ nw_open(const char *path, int flag, ...) pmode = va_arg(ap, int); va_end(ap); - if (stricmp(path, "/dev/nul")==0) - path = "NWNUL"; + if (stricmp(path, "/dev/null")==0) + path = "NUL"; return open(path, flag, pmode); } @@ -968,3 +968,10 @@ fork(void) return 0; } + +// added to remove undefied symbol error in CodeWarrior compilation +int +Perl_Ireentrant_buffer_ptr(aTHX) +{ + return 0; +} diff --git a/NetWare/nw5sck.c b/NetWare/nw5sck.c index 91b8afd14b..46069a3ab2 100644 --- a/NetWare/nw5sck.c +++ b/NetWare/nw5sck.c @@ -185,25 +185,33 @@ nw_getservent(void) void nw_sethostent(int stayopen) { +#ifdef HAS_SETHOSTENT sethostent(stayopen); +#endif } void nw_setnetent(int stayopen) { +#ifdef HAS_SETNETENT setnetent(stayopen); +#endif } void nw_setprotoent(int stayopen) { +#ifdef HAS_SETPROTENT setprotoent(stayopen); +#endif } void nw_setservent(int stayopen) { +#ifdef HAS_SETSERVENT setservent(stayopen); +#endif } int diff --git a/NetWare/nwhashcls.cpp b/NetWare/nwhashcls.cpp new file mode 100644 index 0000000000..1c582a59ad --- /dev/null +++ b/NetWare/nwhashcls.cpp @@ -0,0 +1,269 @@ +/* + * Copyright © 2001 Novell, Inc. All Rights Reserved. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * FILENAME : hashcls.cpp + * DESCRIPTION : Implementation of Equivalent of Hash class, NWPerlHashList and + NWPerlKeyHashList + * + * Author : Srivathsa M + * Date Created : July 26 2001 + */ + +#include "nwhashcls.h" + +NWPerlHashList::NWPerlHashList() +{ + //initialize the hash list to null + for(int i=0;i<BUCKET_SIZE;i++) + MemListHash[i] = NULL; + DEBUGPRINT("In constructor\n"); +} + +NWPerlHashList::~NWPerlHashList() +{ + DEBUGPRINT("In destructor\n"); + removeAll(); +} + +int +NWPerlHashList::insert(void *ldata) +{ + HASHNODE *list = new HASHNODE; + if (list) { + list->data = ldata; + list->next = NULL; + unsigned long Bucket = ((unsigned long)ldata) % BUCKET_SIZE; + if (MemListHash[Bucket]) { + //Elements existing, insert at the beginning + list->next = MemListHash[Bucket]; + MemListHash[Bucket] = list; + DEBUGPRINT("Inserted to %d\n",Bucket); + } else { + //First element + MemListHash[Bucket] = list; + DEBUGPRINT("Inserted first time to %d\n",Bucket); + } + return 1; + } else + return 0; +} + +int +NWPerlHashList::remove(void *ldata) +{ + unsigned long Bucket = ((unsigned long)ldata) % BUCKET_SIZE; + HASHNODE *list = MemListHash[Bucket]; + if (list) { + int found = 0; + HASHNODE *next =list; + HASHNODE *prev =NULL; + do + { + if (list->data != ldata) { + prev = list; + list = list->next; + } + else { + found = 1; + next = list->next; + /*if(list->data) + { + free(list->data); + list->data = NULL; + }*/ + //ConsolePrintf ("A:%x;",list->data); + delete list; + list = NULL; + if (prev) { + prev->next = next; + } else { + MemListHash[Bucket]=next; + } + DEBUGPRINT("Removed element from %d\n",Bucket); + } + ThreadSwitchWithDelay(); + } while(list && !found); +// if (!found) +// ConsolePrintf("Couldn;t find %x in Bucket %d\n",ldata,Bucket); + return(found); + } + return 1; +} + + +void NWPerlHashList::forAll( register void (*user_fn)(void *, void*), void *data ) const +{ + + for(int i=0; i<BUCKET_SIZE; i++) + { + HASHNODE *next = MemListHash[i]; + while(next) + { + HASHNODE *temp = next->next; + if(next->data) + { + DEBUGPRINT("- To remove element from bucket %d\n",i); + user_fn( next->data, data ); + } + next = temp; + ThreadSwitchWithDelay(); + } + } + return ; +}; + +void NWPerlHashList::removeAll( ) const +{ + + for(int i=0; i<BUCKET_SIZE; i++) + { + HASHNODE *next = MemListHash[i]; + while(next) + { + HASHNODE *temp = next->next; + delete next; + next = temp; + ThreadSwitchWithDelay(); + } + } + return ; +}; + +/** +NWPerlKeyHashList::NWPerlKeyHashList() +{ + //initialize the hash list to null + for(int i=0;i<BUCKET_SIZE;i++) + MemListHash[i] = NULL; + DEBUGPRINT("In constructor\n"); +} + +NWPerlKeyHashList::~NWPerlKeyHashList() +{ + DEBUGPRINT("In destructor\n"); + removeAll(); +} + +int +NWPerlKeyHashList::insert(void *key, void *ldata) +{ + KEYHASHNODE *list = new KEYHASHNODE; + if (list) { + list->key = key; + list->data = ldata; + list->next = NULL; + unsigned long Bucket = ((unsigned long)key) % BUCKET_SIZE; + if (MemListHash[Bucket]) { + //Elements existing, insert at the beginning + list->next = MemListHash[Bucket]; + MemListHash[Bucket] = list; + DEBUGPRINT("Inserted to %d\n",Bucket); + } else { + //First element + MemListHash[Bucket] = list; + DEBUGPRINT("Inserted first time to %d\n",Bucket); + } + return 1; + } else + return 0; +} + +int +NWPerlKeyHashList::remove(void *key) +{ + unsigned long Bucket = ((unsigned long)key) % BUCKET_SIZE; + KEYHASHNODE *list = MemListHash[Bucket]; + if (list) { + int found = 0; + KEYHASHNODE *next =list; + KEYHASHNODE *prev =NULL; + do + { + if (list->key != key) { + prev = list; + list = list->next; + } + else { + found = 1; + next = list->next; + delete list; + list = NULL; + if (prev) { + prev->next = next; + } else { + MemListHash[Bucket]=next; + } + DEBUGPRINT("Removed element from %d\n",Bucket); + } + } while(list && !found); +// if (!found) +// ConsolePrintf("Couldn;t find %x in Bucket %d\n",key,Bucket); + return(found); + } + return 1; +} + + +void NWPerlKeyHashList::forAll( register void (*user_fn)(void *, void*), void *data ) const +{ + + for(int i=0; i<BUCKET_SIZE; i++) + { + KEYHASHNODE *next = MemListHash[i]; + while(next) + { + KEYHASHNODE *temp = next->next; + if(next->data) + { + DEBUGPRINT("- To remove element from bucket %d\n",i); + user_fn( next->data, data ); + } + next = temp; + ThreadSwitchWithDelay(); + } + } + return ; +}; + +int NWPerlKeyHashList::find(void *key,void **pData) +{ + for(int i=0; i<BUCKET_SIZE; i++) + { + KEYHASHNODE *next = MemListHash[i]; + while(next) + { + if(next->key==key) + { + *pData=next->data; + return 1; + } + next = next->next; + ThreadSwitchWithDelay(); + } + } + return 0; +} + +void NWPerlKeyHashList::removeAll( ) const +{ + + for(int i=0; i<BUCKET_SIZE; i++) + { + KEYHASHNODE *next = MemListHash[i]; + while(next) + { + KEYHASHNODE *temp = next->next; + delete next; + next = temp; + ThreadSwitchWithDelay(); + } + } + return ; +}; +**/ diff --git a/NetWare/nwhashcls.h b/NetWare/nwhashcls.h new file mode 100644 index 0000000000..88956afb86 --- /dev/null +++ b/NetWare/nwhashcls.h @@ -0,0 +1,79 @@ + +/* + * Copyright © 2001 Novell, Inc. All Rights Reserved. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * FILENAME : nwhashcls.h + * DESCRIPTION : Equivalent of Hash class + * + * Author : Srivathsa M + * Date Created : July 26 2001 + */ +#include <stdio.h> +#include <conio.h> +#include <process.h> + +#define BUCKET_SIZE 37 + +struct HASHNODE +{ + void *data; + struct HASHNODE *next; +}; + +typedef void (*HASHFORALLFUN)(void *, void *); + +class NWPerlHashList +{ +private: + HASHNODE* MemListHash[BUCKET_SIZE]; + void removeAll() const; + +public: + ~NWPerlHashList(); + NWPerlHashList(); + int insert(void *lData); + int remove(void *lData); + void forAll( void (*)(void *, void*), void * ) const; +}; + +struct KEYHASHNODE +{ + void *key; + void *data; + KEYHASHNODE *next; +}; + +/** +typedef void (*KEYHASHFORALLFUN)(void *, void *); + +class NWPerlKeyHashList +{ +private: + KEYHASHNODE* MemListHash[BUCKET_SIZE]; + void removeAll() const; + +public: + ~NWPerlKeyHashList(); + NWPerlKeyHashList(); + int insert(void *key, void *lData); + int remove(void *key); + void forAll( void (*)(void *, void*), void * ) const; + int find(void *key, void **pData); +}; +**/ + +//#define DEBUG_HASH 1 + +#ifdef DEBUG_HASH +#define DEBUGPRINT ConsolePrintf +#else +#define DEBUGPRINT +#endif + + diff --git a/NetWare/nwperlhost.h b/NetWare/nwperlhost.h new file mode 100644 index 0000000000..002bc676e0 --- /dev/null +++ b/NetWare/nwperlhost.h @@ -0,0 +1,1699 @@ + +/* + * Copyright © 2001 Novell, Inc. All Rights Reserved. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * FILENAME : nwperlhost.h + * DESCRIPTION : This is modelled on the perlhost.h module of Win32 port. + * This is the host that include all the functions for running Perl within a class. + * Author : SGP, HYAK + * Date : January 2001. + * + */ + + + +#ifndef ___NWPerlHost_H___ +#define ___NWPerlHost_H___ + + +#include "iperlsys.h" +#include "nwvmem.h" + +#include "nw5sck.h" +#include "netware.h" + +#define LPBYTE unsigned char * + +#if !defined(PERL_OBJECT) +START_EXTERN_C +#endif /* PERL_OBJECT */ + +extern int do_spawn2(char *cmd, int exectype); +extern int do_aspawn(void *vreally, void **vmark, void **vsp); +extern void Perl_init_os_extras(void); + +#if !defined(PERL_OBJECT) +END_EXTERN_C +#endif /* PERL_OBJECT */ + +#ifdef PERL_OBJECT +extern int g_do_aspawn(void *vreally, void **vmark, void **vsp); +#define do_aspawn g_do_aspawn +#endif /* PERL_OBJECT */ + +class CPerlHost +{ +public: + CPerlHost(void); + CPerlHost(struct IPerlMem** ppMem, struct IPerlMem** ppMemShared, + struct IPerlMem** ppMemParse, struct IPerlEnv** ppEnv, + struct IPerlStdIO** ppStdIO, struct IPerlLIO** ppLIO, + struct IPerlDir** ppDir, struct IPerlSock** ppSock, + struct IPerlProc** ppProc); + CPerlHost(const CPerlHost& host); + virtual ~CPerlHost(void); + + static CPerlHost* IPerlMem2Host(struct IPerlMem* piPerl); + static CPerlHost* IPerlMemShared2Host(struct IPerlMem* piPerl); + static CPerlHost* IPerlMemParse2Host(struct IPerlMem* piPerl); + static CPerlHost* IPerlEnv2Host(struct IPerlEnv* piPerl); + static CPerlHost* IPerlStdIO2Host(struct IPerlStdIO* piPerl); + static CPerlHost* IPerlLIO2Host(struct IPerlLIO* piPerl); + static CPerlHost* IPerlDir2Host(struct IPerlDir* piPerl); + static CPerlHost* IPerlSock2Host(struct IPerlSock* piPerl); + static CPerlHost* IPerlProc2Host(struct IPerlProc* piPerl); + +/* IPerlMem */ + inline void* Malloc(size_t size) { return m_pVMem->Malloc(size); }; + inline void* Realloc(void* ptr, size_t size) { return m_pVMem->Realloc(ptr, size); }; + inline void Free(void* ptr) { m_pVMem->Free(ptr); }; + inline void* Calloc(size_t num, size_t size){ return m_pVMem->Calloc(num, size); }; + +/* IPerlMemShared */ + inline void* MallocShared(size_t size) + { + return m_pVMemShared->Malloc(size); + }; + inline void* ReallocShared(void* ptr, size_t size) { return m_pVMemShared->Realloc(ptr, size); }; + inline void FreeShared(void* ptr) { m_pVMemShared->Free(ptr); }; + inline void* CallocShared(size_t num, size_t size) + { + size_t count = num*size; + void* lpVoid = MallocShared(count); + + return lpVoid; + }; + +/* IPerlMemParse */ + inline void* MallocParse(size_t size) { return m_pVMemParse->Malloc(size); }; + inline void* ReallocParse(void* ptr, size_t size) { return m_pVMemParse->Realloc(ptr, size); }; + inline void FreeParse(void* ptr) { m_pVMemParse->Free(ptr); }; + inline void* CallocParse(size_t num, size_t size) + { + size_t count = num*size; + void* lpVoid = MallocParse(count); + + return lpVoid; + }; + +/* IPerlEnv */ + char *Getenv(const char *varname); + int Putenv(const char *envstring); + inline char *Getenv(const char *varname, unsigned long *len) + { + *len = 0; + char *e = Getenv(varname); + if (e) + *len = strlen(e); + return e; + } + + +public: + +/* IPerlDIR */ + + +/* IPerllProc */ + void Abort(void); + void Exit(int status); + void _Exit(int status); + int Execl(const char *cmdname, const char *arg0, const char *arg1, const char *arg2, const char *arg3); + int Execv(const char *cmdname, const char *const *argv); + int Execvp(const char *cmdname, const char *const *argv); + +public: + + struct IPerlMem m_hostperlMem; + struct IPerlMem m_hostperlMemShared; + struct IPerlMem m_hostperlMemParse; + struct IPerlEnv m_hostperlEnv; + struct IPerlStdIO m_hostperlStdIO; + struct IPerlLIO m_hostperlLIO; + struct IPerlDir m_hostperlDir; + struct IPerlSock m_hostperlSock; + struct IPerlProc m_hostperlProc; + + struct IPerlMem* m_pHostperlMem; + struct IPerlMem* m_pHostperlMemShared; + struct IPerlMem* m_pHostperlMemParse; + struct IPerlEnv* m_pHostperlEnv; + struct IPerlStdIO* m_pHostperlStdIO; + struct IPerlLIO* m_pHostperlLIO; + struct IPerlDir* m_pHostperlDir; + struct IPerlSock* m_pHostperlSock; + struct IPerlProc* m_pHostperlProc; + +protected: + + VMem* m_pVMem; + VMem* m_pVMemShared; + VMem* m_pVMemParse; +}; + + +#define STRUCT2PTR(x, y) (CPerlHost*)(((LPBYTE)x)-offsetof(CPerlHost, y)) + +inline CPerlHost* IPerlMem2Host(struct IPerlMem* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlMem); +} + +inline CPerlHost* IPerlMemShared2Host(struct IPerlMem* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlMemShared); +} + +inline CPerlHost* IPerlMemParse2Host(struct IPerlMem* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlMemParse); +} + +inline CPerlHost* IPerlEnv2Host(struct IPerlEnv* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlEnv); +} + +inline CPerlHost* IPerlStdIO2Host(struct IPerlStdIO* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlStdIO); +} + +inline CPerlHost* IPerlLIO2Host(struct IPerlLIO* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlLIO); +} + +inline CPerlHost* IPerlDir2Host(struct IPerlDir* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlDir); +} + +inline CPerlHost* IPerlSock2Host(struct IPerlSock* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlSock); +} + +inline CPerlHost* IPerlProc2Host(struct IPerlProc* piPerl) +{ + return STRUCT2PTR(piPerl, m_hostperlProc); +} + + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlMem2Host(x) + + +/* IPerlMem */ +void* +PerlMemMalloc(struct IPerlMem* piPerl, size_t size) +{ + return IPERL2HOST(piPerl)->Malloc(size); +} +void* +PerlMemRealloc(struct IPerlMem* piPerl, void* ptr, size_t size) +{ + return IPERL2HOST(piPerl)->Realloc(ptr, size); +} +void +PerlMemFree(struct IPerlMem* piPerl, void* ptr) +{ + IPERL2HOST(piPerl)->Free(ptr); +} +void* +PerlMemCalloc(struct IPerlMem* piPerl, size_t num, size_t size) +{ + return IPERL2HOST(piPerl)->Calloc(num, size); +} + + +struct IPerlMem perlMem = +{ + PerlMemMalloc, + PerlMemRealloc, + PerlMemFree, + PerlMemCalloc, +}; + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlMemShared2Host(x) + +/* IPerlMemShared */ +void* +PerlMemSharedMalloc(struct IPerlMem* piPerl, size_t size) +{ + return IPERL2HOST(piPerl)->MallocShared(size); +} +void* +PerlMemSharedRealloc(struct IPerlMem* piPerl, void* ptr, size_t size) +{ + return IPERL2HOST(piPerl)->ReallocShared(ptr, size); +} +void +PerlMemSharedFree(struct IPerlMem* piPerl, void* ptr) +{ + IPERL2HOST(piPerl)->FreeShared(ptr); +} +void* +PerlMemSharedCalloc(struct IPerlMem* piPerl, size_t num, size_t size) +{ + return IPERL2HOST(piPerl)->CallocShared(num, size); +} + + +struct IPerlMem perlMemShared = +{ + PerlMemSharedMalloc, + PerlMemSharedRealloc, + PerlMemSharedFree, + PerlMemSharedCalloc, +}; + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlMemParse2Host(x) + +/* IPerlMemParse */ +void* +PerlMemParseMalloc(struct IPerlMem* piPerl, size_t size) +{ + return IPERL2HOST(piPerl)->MallocParse(size); +} +void* +PerlMemParseRealloc(struct IPerlMem* piPerl, void* ptr, size_t size) +{ + return IPERL2HOST(piPerl)->ReallocParse(ptr, size); +} +void +PerlMemParseFree(struct IPerlMem* piPerl, void* ptr) +{ + IPERL2HOST(piPerl)->FreeParse(ptr); +} +void* +PerlMemParseCalloc(struct IPerlMem* piPerl, size_t num, size_t size) +{ + return IPERL2HOST(piPerl)->CallocParse(num, size); +} + + +struct IPerlMem perlMemParse = +{ + PerlMemParseMalloc, + PerlMemParseRealloc, + PerlMemParseFree, + PerlMemParseCalloc, +}; + + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlEnv2Host(x) + +/* IPerlEnv */ +char* +PerlEnvGetenv(struct IPerlEnv* piPerl, const char *varname) +{ + return IPERL2HOST(piPerl)->Getenv(varname); +}; + +int +PerlEnvPutenv(struct IPerlEnv* piPerl, const char *envstring) +{ + return IPERL2HOST(piPerl)->Putenv(envstring); +}; + +char* +PerlEnvGetenv_len(struct IPerlEnv* piPerl, const char* varname, unsigned long* len) +{ + return IPERL2HOST(piPerl)->Getenv(varname, len); +} + +int +PerlEnvUname(struct IPerlEnv* piPerl, struct utsname *name) +{ + return nw_uname(name); +} + +void +PerlEnvClearenv(struct IPerlEnv* piPerl) +{ + // If removed, compilation fails while compiling CGI2Perl. +} + +void* +PerlEnvGetChildenv(struct IPerlEnv* piPerl) +{ + // If removed, compilation fails while compiling CGI2Perl. + return NULL; +} + +void +PerlEnvFreeChildenv(struct IPerlEnv* piPerl, void* childEnv) +{ + // If removed, compilation fails while compiling CGI2Perl. +} + +char* +PerlEnvGetChilddir(struct IPerlEnv* piPerl) +{ + // If removed, compilation fails while compiling CGI2Perl. + return NULL; +} + +void +PerlEnvFreeChilddir(struct IPerlEnv* piPerl, char* childDir) +{ + // If removed, compilation fails while compiling CGI2Perl. +} + +struct IPerlEnv perlEnv = +{ + PerlEnvGetenv, + PerlEnvPutenv, + PerlEnvGetenv_len, + PerlEnvUname, + PerlEnvClearenv, + PerlEnvGetChildenv, + PerlEnvFreeChildenv, + PerlEnvGetChilddir, + PerlEnvFreeChilddir, +}; + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlStdIO2Host(x) + +/* PerlStdIO */ +PerlIO* +PerlStdIOStdin(struct IPerlStdIO* piPerl) +{ + return (PerlIO*)nw_stdin(); +} + +PerlIO* +PerlStdIOStdout(struct IPerlStdIO* piPerl) +{ + return (PerlIO*)nw_stdout(); +} + +PerlIO* +PerlStdIOStderr(struct IPerlStdIO* piPerl) +{ + return (PerlIO*)nw_stderr(); +} + +PerlIO* +PerlStdIOOpen(struct IPerlStdIO* piPerl, const char *path, const char *mode) +{ + return (PerlIO*)nw_fopen(path, mode); +} + +int +PerlStdIOClose(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_fclose(((FILE*)pf)); +} + +int +PerlStdIOEof(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_feof((FILE*)pf); +} + +int +PerlStdIOError(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_ferror((FILE*)pf); +} + +void +PerlStdIOClearerr(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + nw_clearerr((FILE*)pf); +} + +int +PerlStdIOGetc(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_getc((FILE*)pf); +} + +char* +PerlStdIOGetBase(struct IPerlStdIO* piPerl, PerlIO* pf) +{ +#ifdef FILE_base + FILE *f = (FILE*)pf; + return FILE_base(f); +#else + return Nullch; +#endif +} + +int +PerlStdIOGetBufsiz(struct IPerlStdIO* piPerl, PerlIO* pf) +{ +#ifdef FILE_bufsiz + FILE *f = (FILE*)pf; + return FILE_bufsiz(f); +#else + return (-1); +#endif +} + +int +PerlStdIOGetCnt(struct IPerlStdIO* piPerl, PerlIO* pf) +{ +#ifdef USE_STDIO_PTR + FILE *f = (FILE*)pf; + return FILE_cnt(f); +#else + return (-1); +#endif +} + +char* +PerlStdIOGetPtr(struct IPerlStdIO* piPerl, PerlIO* pf) +{ +#ifdef USE_STDIO_PTR + FILE *f = (FILE*)pf; + return FILE_ptr(f); +#else + return Nullch; +#endif +} + +char* +PerlStdIOGets(struct IPerlStdIO* piPerl, PerlIO* pf, char* s, int n) +{ + return nw_fgets(s, n, (FILE*)pf); +} + +int +PerlStdIOPutc(struct IPerlStdIO* piPerl, PerlIO* pf, int c) +{ + return nw_fputc(c, (FILE*)pf); +} + +int +PerlStdIOPuts(struct IPerlStdIO* piPerl, PerlIO* pf, const char *s) +{ + return nw_fputs(s, (FILE*)pf); +} + +int +PerlStdIOFlush(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_fflush((FILE*)pf); +} + +int +PerlStdIOUngetc(struct IPerlStdIO* piPerl, int c, PerlIO* pf) //(J) +{ + return nw_ungetc(c, (FILE*)pf); +} + +int +PerlStdIOFileno(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_fileno((FILE*)pf); +} + +PerlIO* +PerlStdIOFdopen(struct IPerlStdIO* piPerl, int fd, const char *mode) +{ + return (PerlIO*)nw_fdopen(fd, mode); +} + +PerlIO* +PerlStdIOReopen(struct IPerlStdIO* piPerl, const char*path, const char*mode, PerlIO* pf) +{ + return (PerlIO*)nw_freopen(path, mode, (FILE*)pf); +} + +SSize_t +PerlStdIORead(struct IPerlStdIO* piPerl, void *buffer, Size_t size, Size_t dummy, PerlIO* pf) +{ + return nw_fread(buffer, 1, size, (FILE*)pf); +} + +SSize_t +PerlStdIOWrite(struct IPerlStdIO* piPerl, const void *buffer, Size_t size, Size_t dummy, PerlIO* pf) +//PerlStdIOWrite(struct IPerlStdIO* piPerl, PerlIO* pf, const void *buffer, Size_t size) +{ + return nw_fwrite(buffer, 1, size, (FILE*)pf); +} + +void +PerlStdIOSetBuf(struct IPerlStdIO* piPerl, PerlIO* pf, char* buffer) +{ + nw_setbuf((FILE*)pf, buffer); +} + +int +PerlStdIOSetVBuf(struct IPerlStdIO* piPerl, PerlIO* pf, char* buffer, int type, Size_t size) +{ + return nw_setvbuf((FILE*)pf, buffer, type, size); +} + +void +PerlStdIOSetCnt(struct IPerlStdIO* piPerl, PerlIO* pf, int n) +{ +#ifdef STDIO_CNT_LVALUE + FILE *f = (FILE*)pf; + FILE_cnt(f) = n; +#endif +} + +void +PerlStdIOSetPtrCnt(struct IPerlStdIO* piPerl, PerlIO* pf, char * ptr, int n) +{ +#ifdef STDIO_PTR_LVALUE + FILE *f = (FILE*)pf; + FILE_ptr(f) = ptr; + FILE_cnt(f) = n; +#endif +} + +void +PerlStdIOSetlinebuf(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + nw_setvbuf((FILE*)pf, NULL, _IOLBF, 0); +} + +int +PerlStdIOPrintf(struct IPerlStdIO* piPerl, PerlIO* pf, const char *format,...) +{ + va_list(arglist); + va_start(arglist, format); + return nw_vfprintf((FILE*)pf, format, arglist); +} + +int +PerlStdIOVprintf(struct IPerlStdIO* piPerl, PerlIO* pf, const char *format, va_list arglist) +{ + return nw_vfprintf((FILE*)pf, format, arglist); +} + +long +PerlStdIOTell(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + return nw_ftell((FILE*)pf); +} + +int +PerlStdIOSeek(struct IPerlStdIO* piPerl, PerlIO* pf, off_t offset, int origin) +{ + return nw_fseek((FILE*)pf, offset, origin); +} + +void +PerlStdIORewind(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + nw_rewind((FILE*)pf); +} + +PerlIO* +PerlStdIOTmpfile(struct IPerlStdIO* piPerl) +{ + return (PerlIO*)nw_tmpfile(); +} + +int +PerlStdIOGetpos(struct IPerlStdIO* piPerl, PerlIO* pf, Fpos_t *p) +{ + return nw_fgetpos((FILE*)pf, p); +} + +int +PerlStdIOSetpos(struct IPerlStdIO* piPerl, PerlIO* pf, const Fpos_t *p) +{ + return nw_fsetpos((FILE*)pf, p); +} + +void +PerlStdIOInit(struct IPerlStdIO* piPerl) +{ + // If removed, compilation error occurs. +} + +void +PerlStdIOInitOSExtras(struct IPerlStdIO* piPerl) +{ + Perl_init_os_extras(); +} + + +int +PerlStdIOOpenOSfhandle(struct IPerlStdIO* piPerl, long osfhandle, int flags) +{ + return nw_open_osfhandle(osfhandle, flags); +} + +int +PerlStdIOGetOSfhandle(struct IPerlStdIO* piPerl, int filenum) +{ + return nw_get_osfhandle(filenum); +} + +PerlIO* +PerlStdIOFdupopen(struct IPerlStdIO* piPerl, PerlIO* pf) +{ + PerlIO* pfdup=NULL; + fpos_t pos=0; + char mode[3]={'\0'}; + int fileno = nw_dup(nw_fileno((FILE*)pf)); + + /* open the file in the same mode */ + if(((FILE*)pf)->_flag & _IOREAD) { + mode[0] = 'r'; + mode[1] = 0; + } + else if(((FILE*)pf)->_flag & _IOWRT) { + mode[0] = 'a'; + mode[1] = 0; + } + else if(((FILE*)pf)->_flag & _IORW) { + mode[0] = 'r'; + mode[1] = '+'; + mode[2] = 0; + } + + /* it appears that the binmode is attached to the + * file descriptor so binmode files will be handled + * correctly + */ + pfdup = (PerlIO*)nw_fdopen(fileno, mode); + + /* move the file pointer to the same position */ + if (!fgetpos((FILE*)pf, &pos)) { + fsetpos((FILE*)pfdup, &pos); + } + return pfdup; +} + +struct IPerlStdIO perlStdIO = +{ + PerlStdIOStdin, + PerlStdIOStdout, + PerlStdIOStderr, + PerlStdIOOpen, + PerlStdIOClose, + PerlStdIOEof, + PerlStdIOError, + PerlStdIOClearerr, + PerlStdIOGetc, + PerlStdIOGetBase, + PerlStdIOGetBufsiz, + PerlStdIOGetCnt, + PerlStdIOGetPtr, + PerlStdIOGets, + PerlStdIOPutc, + PerlStdIOPuts, + PerlStdIOFlush, + PerlStdIOUngetc, + PerlStdIOFileno, + PerlStdIOFdopen, + PerlStdIOReopen, + PerlStdIORead, + PerlStdIOWrite, + PerlStdIOSetBuf, + PerlStdIOSetVBuf, + PerlStdIOSetCnt, + PerlStdIOSetPtrCnt, + PerlStdIOSetlinebuf, + PerlStdIOPrintf, + PerlStdIOVprintf, + PerlStdIOTell, + PerlStdIOSeek, + PerlStdIORewind, + PerlStdIOTmpfile, + PerlStdIOGetpos, + PerlStdIOSetpos, + PerlStdIOInit, + PerlStdIOInitOSExtras, + PerlStdIOFdupopen, +}; + + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlLIO2Host(x) + +/* IPerlLIO */ +int +PerlLIOAccess(struct IPerlLIO* piPerl, const char *path, int mode) +{ + return nw_access(path, mode); +} + +int +PerlLIOChmod(struct IPerlLIO* piPerl, const char *filename, int pmode) +{ + return nw_chmod(filename, pmode); +} + +int +PerlLIOChown(struct IPerlLIO* piPerl, const char *filename, uid_t owner, gid_t group) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlLIOChsize(struct IPerlLIO* piPerl, int handle, long size) +{ + return (nw_chsize(handle,size)); +} + +int +PerlLIOClose(struct IPerlLIO* piPerl, int handle) +{ + return nw_close(handle); +} + +int +PerlLIODup(struct IPerlLIO* piPerl, int handle) +{ + return nw_dup(handle); +} + +int +PerlLIODup2(struct IPerlLIO* piPerl, int handle1, int handle2) +{ + return nw_dup2(handle1, handle2); +} + +int +PerlLIOFlock(struct IPerlLIO* piPerl, int fd, int oper) +{ + //On NetWare simulate flock by locking a range on the file + return nw_flock(fd, oper); +} + +int +PerlLIOFileStat(struct IPerlLIO* piPerl, int handle, struct stat *buffer) +{ + return fstat(handle, buffer); +} + +int +PerlLIOIOCtl(struct IPerlLIO* piPerl, int i, unsigned int u, char *data) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlLIOIsatty(struct IPerlLIO* piPerl, int fd) +{ + return nw_isatty(fd); +} + +int +PerlLIOLink(struct IPerlLIO* piPerl, const char*oldname, const char *newname) +{ + return nw_link(oldname, newname); +} + +long +PerlLIOLseek(struct IPerlLIO* piPerl, int handle, long offset, int origin) +{ + return nw_lseek(handle, offset, origin); +} + +int +PerlLIOLstat(struct IPerlLIO* piPerl, const char *path, struct stat *buffer) +{ + return nw_stat(path, buffer); +} + +char* +PerlLIOMktemp(struct IPerlLIO* piPerl, char *Template) +{ + return(nw_mktemp(Template)); +} + +int +PerlLIOOpen(struct IPerlLIO* piPerl, const char *filename, int oflag) +{ + return nw_open(filename, oflag); +} + +int +PerlLIOOpen3(struct IPerlLIO* piPerl, const char *filename, int oflag, int pmode) +{ + return nw_open(filename, oflag, pmode); +} + +int +PerlLIORead(struct IPerlLIO* piPerl, int handle, void *buffer, unsigned int count) +{ + return nw_read(handle, buffer, count); +} + +int +PerlLIORename(struct IPerlLIO* piPerl, const char *OldFileName, const char *newname) +{ + return nw_rename(OldFileName, newname); +} + +int +PerlLIOSetmode(struct IPerlLIO* piPerl, FILE *fp, int mode) +{ + return nw_setmode(fp, mode); +} + +int +PerlLIONameStat(struct IPerlLIO* piPerl, const char *path, struct stat *buffer) +{ + return nw_stat(path, buffer); +} + +char* +PerlLIOTmpnam(struct IPerlLIO* piPerl, char *string) +{ + return tmpnam(string); +} + +int +PerlLIOUmask(struct IPerlLIO* piPerl, int pmode) +{ + return umask(pmode); +} + +int +PerlLIOUnlink(struct IPerlLIO* piPerl, const char *filename) +{ + return nw_unlink(filename); +} + +int +PerlLIOUtime(struct IPerlLIO* piPerl, char *filename, struct utimbuf *times) +{ + return nw_utime(filename, times); +} + +int +PerlLIOWrite(struct IPerlLIO* piPerl, int handle, const void *buffer, unsigned int count) +{ + return nw_write(handle, buffer, count); +} + +struct IPerlLIO perlLIO = +{ + PerlLIOAccess, + PerlLIOChmod, + PerlLIOChown, + PerlLIOChsize, + PerlLIOClose, + PerlLIODup, + PerlLIODup2, + PerlLIOFlock, + PerlLIOFileStat, + PerlLIOIOCtl, + PerlLIOIsatty, + PerlLIOLink, + PerlLIOLseek, + PerlLIOLstat, + PerlLIOMktemp, + PerlLIOOpen, + PerlLIOOpen3, + PerlLIORead, + PerlLIORename, + PerlLIOSetmode, + PerlLIONameStat, + PerlLIOTmpnam, + PerlLIOUmask, + PerlLIOUnlink, + PerlLIOUtime, + PerlLIOWrite, +}; + + +#undef IPERL2HOST +#define IPERL2HOST(x) IPerlDir2Host(x) + +/* IPerlDIR */ +int +PerlDirMakedir(struct IPerlDir* piPerl, const char *dirname, int mode) +{ + return mkdir(dirname); +} + +int +PerlDirChdir(struct IPerlDir* piPerl, const char *dirname) +{ + return nw_chdir(dirname); +} + +int +PerlDirRmdir(struct IPerlDir* piPerl, const char *dirname) +{ + return nw_rmdir(dirname); +} + +int +PerlDirClose(struct IPerlDir* piPerl, DIR *dirp) +{ + return nw_closedir(dirp); +} + +DIR* +PerlDirOpen(struct IPerlDir* piPerl, char *filename) +{ + return nw_opendir(filename); +} + +struct direct * +PerlDirRead(struct IPerlDir* piPerl, DIR *dirp) +{ + return nw_readdir(dirp); +} + +void +PerlDirRewind(struct IPerlDir* piPerl, DIR *dirp) +{ + nw_rewinddir(dirp); +} + +void +PerlDirSeek(struct IPerlDir* piPerl, DIR *dirp, long loc) +{ + nw_seekdir(dirp, loc); +} + +long +PerlDirTell(struct IPerlDir* piPerl, DIR *dirp) +{ + return nw_telldir(dirp); +} + +struct IPerlDir perlDir = +{ + PerlDirMakedir, + PerlDirChdir, + PerlDirRmdir, + PerlDirClose, + PerlDirOpen, + PerlDirRead, + PerlDirRewind, + PerlDirSeek, + PerlDirTell, +}; + + +/* IPerlSock */ +u_long +PerlSockHtonl(struct IPerlSock* piPerl, u_long hostlong) +{ + return(nw_htonl(hostlong)); +} + +u_short +PerlSockHtons(struct IPerlSock* piPerl, u_short hostshort) +{ + return(nw_htons(hostshort)); +} + +u_long +PerlSockNtohl(struct IPerlSock* piPerl, u_long netlong) +{ + return nw_ntohl(netlong); +} + +u_short +PerlSockNtohs(struct IPerlSock* piPerl, u_short netshort) +{ + return nw_ntohs(netshort); +} + +SOCKET PerlSockAccept(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* addr, int* addrlen) +{ + return nw_accept(s, addr, addrlen); +} + +int +PerlSockBind(struct IPerlSock* piPerl, SOCKET s, const struct sockaddr* name, int namelen) +{ + return nw_bind(s, name, namelen); +} + +int +PerlSockConnect(struct IPerlSock* piPerl, SOCKET s, const struct sockaddr* name, int namelen) +{ + return nw_connect(s, name, namelen); +} + +void +PerlSockEndhostent(struct IPerlSock* piPerl) +{ + nw_endhostent(); +} + +void +PerlSockEndnetent(struct IPerlSock* piPerl) +{ + nw_endnetent(); +} + +void +PerlSockEndprotoent(struct IPerlSock* piPerl) +{ + nw_endprotoent(); +} + +void +PerlSockEndservent(struct IPerlSock* piPerl) +{ + nw_endservent(); +} + +struct hostent* +PerlSockGethostbyaddr(struct IPerlSock* piPerl, const char* addr, int len, int type) +{ + return(nw_gethostbyaddr(addr,len,type)); +} + +struct hostent* +PerlSockGethostbyname(struct IPerlSock* piPerl, const char* name) +{ + return nw_gethostbyname(name); +} + +struct hostent* +PerlSockGethostent(struct IPerlSock* piPerl) +{ + return(nw_gethostent()); +} + +int +PerlSockGethostname(struct IPerlSock* piPerl, char* name, int namelen) +{ + return nw_gethostname(name,namelen); +} + +struct netent * +PerlSockGetnetbyaddr(struct IPerlSock* piPerl, long net, int type) +{ + return nw_getnetbyaddr(net, type); +} + +struct netent * +PerlSockGetnetbyname(struct IPerlSock* piPerl, const char *name) +{ + return nw_getnetbyname((char*)name); +} + +struct netent * +PerlSockGetnetent(struct IPerlSock* piPerl) +{ + return nw_getnetent(); +} + +int PerlSockGetpeername(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* name, int* namelen) +{ + return nw_getpeername(s, name, namelen); +} + +struct protoent* +PerlSockGetprotobyname(struct IPerlSock* piPerl, const char* name) +{ + return nw_getprotobyname(name); +} + +struct protoent* +PerlSockGetprotobynumber(struct IPerlSock* piPerl, int number) +{ + return nw_getprotobynumber(number); +} + +struct protoent* +PerlSockGetprotoent(struct IPerlSock* piPerl) +{ + return nw_getprotoent(); +} + +struct servent* +PerlSockGetservbyname(struct IPerlSock* piPerl, const char* name, const char* proto) +{ + return nw_getservbyname((char*)name, (char*)proto); +} + +struct servent* +PerlSockGetservbyport(struct IPerlSock* piPerl, int port, const char* proto) +{ + return nw_getservbyport(port, proto); +} + +struct servent* +PerlSockGetservent(struct IPerlSock* piPerl) +{ + return nw_getservent(); +} + +int +PerlSockGetsockname(struct IPerlSock* piPerl, SOCKET s, struct sockaddr* name, int* namelen) +{ + return nw_getsockname(s, name, namelen); +} + +int +PerlSockGetsockopt(struct IPerlSock* piPerl, SOCKET s, int level, int optname, char* optval, int* optlen) +{ + return nw_getsockopt(s, level, optname, optval, optlen); +} + +unsigned long +PerlSockInetAddr(struct IPerlSock* piPerl, const char* cp) +{ + return(nw_inet_addr(cp)); +} + +char* +PerlSockInetNtoa(struct IPerlSock* piPerl, struct in_addr in) +{ + return nw_inet_ntoa(in); +} + +int +PerlSockListen(struct IPerlSock* piPerl, SOCKET s, int backlog) +{ + return (nw_listen(s, backlog)); +} + +int +PerlSockRecv(struct IPerlSock* piPerl, SOCKET s, char* buffer, int len, int flags) +{ + return (nw_recv(s, buffer, len, flags)); +} + +int +PerlSockRecvfrom(struct IPerlSock* piPerl, SOCKET s, char* buffer, int len, int flags, struct sockaddr* from, int* fromlen) +{ + return nw_recvfrom(s, buffer, len, flags, from, fromlen); +} + +int +PerlSockSelect(struct IPerlSock* piPerl, int nfds, char* readfds, char* writefds, char* exceptfds, const struct timeval* timeout) +{ + return nw_select(nfds, (fd_set*) readfds, (fd_set*) writefds, (fd_set*) exceptfds, timeout); +} + +int +PerlSockSend(struct IPerlSock* piPerl, SOCKET s, const char* buffer, int len, int flags) +{ + return (nw_send(s, buffer, len, flags)); +} + +int +PerlSockSendto(struct IPerlSock* piPerl, SOCKET s, const char* buffer, int len, int flags, const struct sockaddr* to, int tolen) +{ + return(nw_sendto(s, buffer, len, flags, to, tolen)); +} + +void +PerlSockSethostent(struct IPerlSock* piPerl, int stayopen) +{ + nw_sethostent(stayopen); +} + +void +PerlSockSetnetent(struct IPerlSock* piPerl, int stayopen) +{ + nw_setnetent(stayopen); +} + +void +PerlSockSetprotoent(struct IPerlSock* piPerl, int stayopen) +{ + nw_setprotoent(stayopen); +} + +void +PerlSockSetservent(struct IPerlSock* piPerl, int stayopen) +{ + nw_setservent(stayopen); +} + +int +PerlSockSetsockopt(struct IPerlSock* piPerl, SOCKET s, int level, int optname, const char* optval, int optlen) +{ + return nw_setsockopt(s, level, optname, optval, optlen); +} + +int +PerlSockShutdown(struct IPerlSock* piPerl, SOCKET s, int how) +{ + return nw_shutdown(s, how); +} + +SOCKET +PerlSockSocket(struct IPerlSock* piPerl, int af, int type, int protocol) +{ + return nw_socket(af, type, protocol); +} + +int +PerlSockSocketpair(struct IPerlSock* piPerl, int domain, int type, int protocol, int* fds) +{ + dTHX; // (J) dTHXo + Perl_croak(aTHX_ "socketpair not implemented!\n"); + return 0; +} + +int +PerlSockIoctlsocket(struct IPerlSock* piPerl, SOCKET s, long cmd, u_long *argp) +{ + dTHX; // (J) dTHXo + Perl_croak(aTHX_ "ioctlsocket not implemented!\n"); + return 0; +} + +struct IPerlSock perlSock = +{ + PerlSockHtonl, + PerlSockHtons, + PerlSockNtohl, + PerlSockNtohs, + PerlSockAccept, + PerlSockBind, + PerlSockConnect, + PerlSockEndhostent, + PerlSockEndnetent, + PerlSockEndprotoent, + PerlSockEndservent, + PerlSockGethostname, + PerlSockGetpeername, + PerlSockGethostbyaddr, + PerlSockGethostbyname, + PerlSockGethostent, + PerlSockGetnetbyaddr, + PerlSockGetnetbyname, + PerlSockGetnetent, + PerlSockGetprotobyname, + PerlSockGetprotobynumber, + PerlSockGetprotoent, + PerlSockGetservbyname, + PerlSockGetservbyport, + PerlSockGetservent, + PerlSockGetsockname, + PerlSockGetsockopt, + PerlSockInetAddr, + PerlSockInetNtoa, + PerlSockListen, + PerlSockRecv, + PerlSockRecvfrom, + PerlSockSelect, + PerlSockSend, + PerlSockSendto, + PerlSockSethostent, + PerlSockSetnetent, + PerlSockSetprotoent, + PerlSockSetservent, + PerlSockSetsockopt, + PerlSockShutdown, + PerlSockSocket, + PerlSockSocketpair, + //Following commented by sgp bcos of comiplation error too many initializers (E279) +// PerlSockClosesocket, +}; + + +/* IPerlProc */ + +#define EXECF_EXEC 1 +#define EXECF_SPAWN 2 + +void +PerlProcAbort(struct IPerlProc* piPerl) +{ + nw_abort(); +} + +char * +PerlProcCrypt(struct IPerlProc* piPerl, const char* clear, const char* salt) +{ + return nw_crypt(clear, salt); +} + +void +PerlProcExit(struct IPerlProc* piPerl, int status) +{ +// exit(status); + dTHX; + //dJMPENV; + JMPENV_JUMP(2); +} + +void +PerlProc_Exit(struct IPerlProc* piPerl, int status) +{ +// _exit(status); + dTHX; + //dJMPENV; + JMPENV_JUMP(2); +} + +int +PerlProcExecl(struct IPerlProc* piPerl, const char *cmdname, const char *arg0, const char *arg1, const char *arg2, const char *arg3) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlProcExecv(struct IPerlProc* piPerl, const char *cmdname, const char *const *argv) +{ + return nw_execvp((char *)cmdname, (char **)argv); +} + +int +PerlProcExecvp(struct IPerlProc* piPerl, const char *cmdname, const char *const *argv) +{ + return nw_execvp((char *)cmdname, (char **)argv); +} + +uid_t +PerlProcGetuid(struct IPerlProc* piPerl) +{ + // If removed, compilation error occurs. + return 0; +} + +uid_t +PerlProcGeteuid(struct IPerlProc* piPerl) +{ + // If removed, compilation error occurs. + return 0; +} + +gid_t +PerlProcGetgid(struct IPerlProc* piPerl) +{ + // If removed, compilation error occurs. + return 0; +} + +gid_t +PerlProcGetegid(struct IPerlProc* piPerl) +{ + // If removed, compilation error occurs. + return 0; +} + +char * +PerlProcGetlogin(struct IPerlProc* piPerl) +{ + // If removed, compilation error occurs. + return NULL; +} + +int +PerlProcKill(struct IPerlProc* piPerl, int pid, int sig) +{ + return nw_kill(pid, sig); +} + +int +PerlProcKillpg(struct IPerlProc* piPerl, int pid, int sig) +{ + dTHX; // (J) dTHXo + Perl_croak(aTHX_ "killpg not implemented!\n"); + return 0; +} + +int +PerlProcPauseProc(struct IPerlProc* piPerl) +{ + return nw_sleep((32767L << 16) + 32767); +} + +PerlIO* +PerlProcPopen(struct IPerlProc* piPerl, const char *command, const char *mode) +{ + dTHX; // (J) dTHXo + PERL_FLUSHALL_FOR_CHILD; + + return (PerlIO*)nw_Popen((char *)command, (char *)mode, (int *)errno); +} + +int +PerlProcPclose(struct IPerlProc* piPerl, PerlIO *stream) +{ + return nw_Pclose((FILE*)stream, (int *)errno); +} + +int +PerlProcPipe(struct IPerlProc* piPerl, int *phandles) +{ + return nw_Pipe((int *)phandles, (int *)errno); +} + +int +PerlProcSetuid(struct IPerlProc* piPerl, uid_t u) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlProcSetgid(struct IPerlProc* piPerl, gid_t g) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlProcSleep(struct IPerlProc* piPerl, unsigned int s) +{ + return nw_sleep(s); +} + +int +PerlProcTimes(struct IPerlProc* piPerl, struct tms *timebuf) +{ + return nw_times(timebuf); +} + +int +PerlProcWait(struct IPerlProc* piPerl, int *status) +{ + return nw_wait(status); +} + +int +PerlProcWaitpid(struct IPerlProc* piPerl, int pid, int *status, int flags) +{ + return nw_waitpid(pid, status, flags); +} + +Sighandler_t +PerlProcSignal(struct IPerlProc* piPerl, int sig, Sighandler_t subcode) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlProcFork(struct IPerlProc* piPerl) +{ + // If removed, compilation error occurs. + return 0; +} + +int +PerlProcGetpid(struct IPerlProc* piPerl) +{ + return nw_getpid(); +} + +BOOL +PerlProcDoCmd(struct IPerlProc* piPerl, char *cmd) +{ + do_spawn2(cmd, EXECF_EXEC); + return FALSE; +} + +int +PerlProcSpawn(struct IPerlProc* piPerl, char* cmds) +{ + return do_spawn2(cmds, EXECF_SPAWN); +} + +int +PerlProcSpawnvp(struct IPerlProc* piPerl, int mode, const char *cmdname, const char *const *argv) +{ + return nw_spawnvp(mode, (char *)cmdname, (char **)argv); +} + +int +PerlProcASpawn(struct IPerlProc* piPerl, void *vreally, void **vmark, void **vsp) +{ + return do_aspawn(vreally, vmark, vsp); +} + +struct IPerlProc perlProc = +{ + PerlProcAbort, + PerlProcCrypt, + PerlProcExit, + PerlProc_Exit, + PerlProcExecl, + PerlProcExecv, + PerlProcExecvp, + PerlProcGetuid, + PerlProcGeteuid, + PerlProcGetgid, + PerlProcGetegid, + PerlProcGetlogin, + PerlProcKill, + PerlProcKillpg, + PerlProcPauseProc, + PerlProcPopen, + PerlProcPclose, + PerlProcPipe, + PerlProcSetuid, + PerlProcSetgid, + PerlProcSleep, + PerlProcTimes, + PerlProcWait, + PerlProcWaitpid, + PerlProcSignal, + PerlProcFork, + PerlProcGetpid, +/* PerlProcDynaLoader, + PerlProcGetOSError, + PerlProcDoCmd, + PerlProcSpawn, + PerlProcSpawnvp, + PerlProcASpawn,*/ +}; + + +/* + * CPerlHost + */ + +CPerlHost::CPerlHost(void) +{ + m_pVMem = new VMem(); + m_pVMemShared = new VMem(); + m_pVMemParse = new VMem(); + + memcpy(&m_hostperlMem, &perlMem, sizeof(perlMem)); + memcpy(&m_hostperlMemShared, &perlMemShared, sizeof(perlMemShared)); + memcpy(&m_hostperlMemParse, &perlMemParse, sizeof(perlMemParse)); + memcpy(&m_hostperlEnv, &perlEnv, sizeof(perlEnv)); + memcpy(&m_hostperlStdIO, &perlStdIO, sizeof(perlStdIO)); + memcpy(&m_hostperlLIO, &perlLIO, sizeof(perlLIO)); + memcpy(&m_hostperlDir, &perlDir, sizeof(perlDir)); + memcpy(&m_hostperlSock, &perlSock, sizeof(perlSock)); + memcpy(&m_hostperlProc, &perlProc, sizeof(perlProc)); + + m_pHostperlMem = &m_hostperlMem; + m_pHostperlMemShared = &m_hostperlMemShared; + m_pHostperlMemParse = &m_hostperlMemParse; + m_pHostperlEnv = &m_hostperlEnv; + m_pHostperlStdIO = &m_hostperlStdIO; + m_pHostperlLIO = &m_hostperlLIO; + m_pHostperlDir = &m_hostperlDir; + m_pHostperlSock = &m_hostperlSock; + m_pHostperlProc = &m_hostperlProc; +} + +#define SETUPEXCHANGE(xptr, iptr, table) \ + STMT_START { \ + if (xptr) { \ + iptr = *xptr; \ + *xptr = &table; \ + } \ + else { \ + iptr = &table; \ + } \ + } STMT_END + +CPerlHost::CPerlHost(struct IPerlMem** ppMem, struct IPerlMem** ppMemShared, + struct IPerlMem** ppMemParse, struct IPerlEnv** ppEnv, + struct IPerlStdIO** ppStdIO, struct IPerlLIO** ppLIO, + struct IPerlDir** ppDir, struct IPerlSock** ppSock, + struct IPerlProc** ppProc) +{ + m_pVMem = new VMem(); + m_pVMemShared = new VMem(); + m_pVMemParse = new VMem(); + + memcpy(&m_hostperlMem, &perlMem, sizeof(perlMem)); + memcpy(&m_hostperlMemShared, &perlMemShared, sizeof(perlMemShared)); + memcpy(&m_hostperlMemParse, &perlMemParse, sizeof(perlMemParse)); + memcpy(&m_hostperlEnv, &perlEnv, sizeof(perlEnv)); + memcpy(&m_hostperlStdIO, &perlStdIO, sizeof(perlStdIO)); + memcpy(&m_hostperlLIO, &perlLIO, sizeof(perlLIO)); + memcpy(&m_hostperlDir, &perlDir, sizeof(perlDir)); + memcpy(&m_hostperlSock, &perlSock, sizeof(perlSock)); + memcpy(&m_hostperlProc, &perlProc, sizeof(perlProc)); + + SETUPEXCHANGE(ppMem, m_pHostperlMem, m_hostperlMem); + SETUPEXCHANGE(ppMemShared, m_pHostperlMemShared, m_hostperlMemShared); + SETUPEXCHANGE(ppMemParse, m_pHostperlMemParse, m_hostperlMemParse); + SETUPEXCHANGE(ppEnv, m_pHostperlEnv, m_hostperlEnv); + SETUPEXCHANGE(ppStdIO, m_pHostperlStdIO, m_hostperlStdIO); + SETUPEXCHANGE(ppLIO, m_pHostperlLIO, m_hostperlLIO); + SETUPEXCHANGE(ppDir, m_pHostperlDir, m_hostperlDir); + SETUPEXCHANGE(ppSock, m_pHostperlSock, m_hostperlSock); + SETUPEXCHANGE(ppProc, m_pHostperlProc, m_hostperlProc); +} +#undef SETUPEXCHANGE + +CPerlHost::CPerlHost(const CPerlHost& host) +{ + memcpy(&m_hostperlMem, &perlMem, sizeof(perlMem)); + memcpy(&m_hostperlMemShared, &perlMemShared, sizeof(perlMemShared)); + memcpy(&m_hostperlMemParse, &perlMemParse, sizeof(perlMemParse)); + memcpy(&m_hostperlEnv, &perlEnv, sizeof(perlEnv)); + memcpy(&m_hostperlStdIO, &perlStdIO, sizeof(perlStdIO)); + memcpy(&m_hostperlLIO, &perlLIO, sizeof(perlLIO)); + memcpy(&m_hostperlDir, &perlDir, sizeof(perlDir)); + memcpy(&m_hostperlSock, &perlSock, sizeof(perlSock)); + memcpy(&m_hostperlProc, &perlProc, sizeof(perlProc)); + + m_pHostperlMem = &m_hostperlMem; + m_pHostperlMemShared = &m_hostperlMemShared; + m_pHostperlMemParse = &m_hostperlMemParse; + m_pHostperlEnv = &m_hostperlEnv; + m_pHostperlStdIO = &m_hostperlStdIO; + m_pHostperlLIO = &m_hostperlLIO; + m_pHostperlDir = &m_hostperlDir; + m_pHostperlSock = &m_hostperlSock; + m_pHostperlProc = &m_hostperlProc; + +} + +CPerlHost::~CPerlHost(void) +{ + if ( m_pVMemParse ) delete m_pVMemParse; + if ( m_pVMemShared ) delete m_pVMemShared; + if ( m_pVMem ) delete m_pVMem; +} + +char* +CPerlHost::Getenv(const char *varname) +{ + // getenv is always present. In old CLIB, it is implemented + // to always return NULL. With java loaded on NW411, it will + // return values set by envset. Is correctly implemented by + // CLIB on MOAB. + // + return getenv(varname); +} + +int +CPerlHost::Putenv(const char *envstring) +{ + return(putenv(envstring)); +} + + +#endif /* ___NWPerlHost_H___ */ + diff --git a/NetWare/nwvmem.h b/NetWare/nwvmem.h new file mode 100644 index 0000000000..5999d88381 --- /dev/null +++ b/NetWare/nwvmem.h @@ -0,0 +1,340 @@ + +/* + * Copyright © 2001 Novell, Inc. All Rights Reserved. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * FILENAME : NWVMem.h + * DESCRIPTION : Memory management for Perl Interpreter on NetWare. + * Watcom's hash table is used to store memory pointers. + * All malloc's, realloc's, free's go through this. + * Author : HYAK, SGP + * Date : Januray 2001. + * + */ + + + +#ifndef ___NWVMEM_H_INC___ +#define ___NWVMEM_H_INC___ + + +#include "win32ish.h" // For "BOOL", "TRUE" and "FALSE" +#include <nwhashcls.h> // CW changes +#include <nwmalloc.h> +#include "string.h" + + + +class VMem +{ +public: + VMem(); + virtual ~VMem(); + virtual void* Malloc(size_t size); + virtual void* Realloc(void* pMem, size_t size); + virtual void Free(void* pMem); + virtual void* Calloc(size_t num, size_t size); + +protected: + BOOL m_dontTouchHashLists; +// WCValHashTable<void*>* m_allocList; + NWPerlHashList *m_allocList; // CW changes +}; + + + + +/*============================================================================================ + + Function : fnAllocListHash + + Description : Hashing function for hash table of memory allocations. + + Parameters : invalue (IN). + + Returns : unsigned. + +==============================================================================================*/ + +unsigned fnAllocListHash(void* const& invalue) +{ + return (((unsigned) invalue & 0x0000ff00) >> 8); +} + + + +/*============================================================================================ + + Function : fnFreeMemEntry + + Description : Called for each outstanding memory allocation at the end of a script run. + Frees the outstanding allocations + + Parameters : ptr (IN). + context (IN) + + Returns : Nothing. + +==============================================================================================*/ + +void fnFreeMemEntry(void* ptr, void* context) +{ + VMem* pVMem = (VMem*) context; + + if(ptr && pVMem) + { + pVMem->Free(ptr); + ptr=NULL; + pVMem = NULL; + context = NULL; + } +} + + + +/*============================================================================================ + + Function : VMem Constructor + + Description : + + Parameters : + + Returns : + +==============================================================================================*/ + +VMem::VMem() +{ + //Constructor + m_dontTouchHashLists = FALSE; + m_allocList = NULL; + // m_allocList = new WCValHashTable<void*> (fnAllocListHash, 256); + m_allocList = new NWPerlHashList(); // CW changes +} + + + +/*============================================================================================ + + Function : VMem Destructor + + Description : + + Parameters : + + Returns : + +==============================================================================================*/ + +VMem::~VMem(void) +{ + //Destructor + m_dontTouchHashLists = TRUE; + if (m_allocList) + { + m_allocList->forAll(fnFreeMemEntry, (void*) this); + + delete m_allocList; + m_allocList = NULL; + } + m_dontTouchHashLists = FALSE; +} + + + +/*============================================================================================ + + Function : VMem::Malloc + + Description : Allocates memory. + + Parameters : size (IN) - Size of memory to be allocated. + + Returns : Pointer to the allocated memory block. + +==============================================================================================*/ + +void* VMem::Malloc(size_t size) +{ + void *ptr = NULL; + + if (size <= 0) + return NULL; + + ptr = malloc(size); + if (ptr) + { + if(m_allocList) + m_allocList->insert(ptr); + } + else + { + m_dontTouchHashLists = TRUE; + if (m_allocList) + { + m_allocList->forAll(fnFreeMemEntry, (void*) this); + delete m_allocList; + m_allocList = NULL; + } + m_dontTouchHashLists = FALSE; + + // Serious error since memory allocation falied. So, exiting... + ExitThread(TSR_THREAD, 1); + } + + return(ptr); +} + + + +/*============================================================================================ + + Function : VMem::Realloc + + Description : Reallocates block of memory. + + Parameters : block (IN) - Points to a previously allocated memory block. + size (IN) - Size of memory to be allocated. + + Returns : Pointer to the allocated memory block. + +==============================================================================================*/ + +void* VMem::Realloc(void* block, size_t size) +{ + void *ptr = NULL; + + if (size <= 0) + return NULL; + + ptr = realloc(block, size); + if (ptr) + { + if (block) + { + if (m_allocList) + m_allocList->remove(block); + } + if (m_allocList) + m_allocList->insert(ptr); + } + else + { + m_dontTouchHashLists = TRUE; + if (m_allocList) + { + m_allocList->forAll(fnFreeMemEntry, (void*) this); + delete m_allocList; + m_allocList = NULL; + } + m_dontTouchHashLists = FALSE; + + // Serious error since memory allocation falied. So, exiting... + ExitThread(TSR_THREAD, 1); + } + + return(ptr); +} + + + +/*============================================================================================ + + Function : VMem::Calloc + + Description : Allocates and clears memory space for an array of objects. + + Parameters : num (IN) - Specifies the number of objects. + size (IN) - Size of each object. + + Returns : Pointer to the allocated memory block. + +==============================================================================================*/ + +void* VMem::Calloc(size_t num, size_t size) +{ + void *ptr = NULL; + + if (size <= 0) + return NULL; + + ptr = calloc(num, size); + if (ptr) + { + if(m_allocList) + m_allocList->insert(ptr); + } + else + { + m_dontTouchHashLists = TRUE; + if (m_allocList) + { + m_allocList->forAll(fnFreeMemEntry, (void*) this); + delete m_allocList; + m_allocList = NULL; + } + m_dontTouchHashLists = FALSE; + + // Serious error since memory allocation falied. So, exiting... + ExitThread(TSR_THREAD, 1); + } + + return(ptr); +} + + + +/*============================================================================================ + + Function : VMem::Free + + Description : Frees allocated memory. + + Parameters : p (IN) - Points to the allocated memory. + + Returns : Nothing. + +==============================================================================================*/ + +void VMem::Free(void* p) +{ + // Final clean up, free all the nodes from the hash list + if (m_dontTouchHashLists) + { + if(p) + { + free(p); + p = NULL; + } + } + else + { + if(p && m_allocList) + { + if (m_allocList->remove(p)) + { + free(p); + p = NULL; + } + else + { + // If it comes here, that means that the memory pointer is not contained in the hash list. + // But no need to free now, since if is deleted here, it will result in an abend!! + // If the memory is still there, it will be cleaned during final cleanup anyway. + } + } + } + + + return; +} + + +#endif //___NWVMEM_H_INC___ + diff --git a/NetWare/perllib.cpp b/NetWare/perllib.cpp new file mode 100644 index 0000000000..a9eb824860 --- /dev/null +++ b/NetWare/perllib.cpp @@ -0,0 +1,273 @@ + +/* + * Copyright © 2001 Novell, Inc. All Rights Reserved. + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * FILENAME : perllib.c + * DESCRIPTION : Library functions for parsing and running Perl. + * This is based on the perllib.c file of Win32 port. + * Author : SGP + * Date : January 2001. + * + */ + +/* + * "The Road goes ever on and on, down from the door where it began." + */ + + + +#include "EXTERN.h" +#include "perl.h" + + +#ifdef PERL_OBJECT +#define NO_XSLOCKS +#endif + +//CHKSGP +//Including this is giving premature end-of-file error during compilation +//#include "XSUB.h" + +#ifdef PERL_IMPLICIT_SYS + +#include "nw5iop.h" +#include <fcntl.h> + +#endif //PERL_IMPLICIT_SYS + + +#ifdef PERL_IMPLICIT_SYS + +#include "nwperlhost.h" +#define w32_internal_host (PL_sys_intern.internal_host) // (J) + + +EXTERN_C void +perl_get_host_info(struct IPerlMemInfo* perlMemInfo, + struct IPerlMemInfo* perlMemSharedInfo, + struct IPerlMemInfo* perlMemParseInfo, + struct IPerlEnvInfo* perlEnvInfo, + struct IPerlStdIOInfo* perlStdIOInfo, + struct IPerlLIOInfo* perlLIOInfo, + struct IPerlDirInfo* perlDirInfo, + struct IPerlSockInfo* perlSockInfo, + struct IPerlProcInfo* perlProcInfo) +{ + if (perlMemInfo) { + Copy(&perlMem, &perlMemInfo->perlMemList, perlMemInfo->nCount, void*); + perlMemInfo->nCount = (sizeof(struct IPerlMem)/sizeof(void*)); + } + if (perlMemSharedInfo) { + Copy(&perlMem, &perlMemSharedInfo->perlMemList, perlMemSharedInfo->nCount, void*); + perlMemSharedInfo->nCount = (sizeof(struct IPerlMem)/sizeof(void*)); + } + if (perlMemParseInfo) { + Copy(&perlMem, &perlMemParseInfo->perlMemList, perlMemParseInfo->nCount, void*); + perlMemParseInfo->nCount = (sizeof(struct IPerlMem)/sizeof(void*)); + } + if (perlEnvInfo) { + Copy(&perlEnv, &perlEnvInfo->perlEnvList, perlEnvInfo->nCount, void*); + perlEnvInfo->nCount = (sizeof(struct IPerlEnv)/sizeof(void*)); + } + if (perlStdIOInfo) { + Copy(&perlStdIO, &perlStdIOInfo->perlStdIOList, perlStdIOInfo->nCount, void*); + perlStdIOInfo->nCount = (sizeof(struct IPerlStdIO)/sizeof(void*)); + } + if (perlLIOInfo) { + Copy(&perlLIO, &perlLIOInfo->perlLIOList, perlLIOInfo->nCount, void*); + perlLIOInfo->nCount = (sizeof(struct IPerlLIO)/sizeof(void*)); + } + if (perlDirInfo) { + Copy(&perlDir, &perlDirInfo->perlDirList, perlDirInfo->nCount, void*); + perlDirInfo->nCount = (sizeof(struct IPerlDir)/sizeof(void*)); + } + if (perlSockInfo) { + Copy(&perlSock, &perlSockInfo->perlSockList, perlSockInfo->nCount, void*); + perlSockInfo->nCount = (sizeof(struct IPerlSock)/sizeof(void*)); + } + if (perlProcInfo) { + Copy(&perlProc, &perlProcInfo->perlProcList, perlProcInfo->nCount, void*); + perlProcInfo->nCount = (sizeof(struct IPerlProc)/sizeof(void*)); + } +} + +EXTERN_C PerlInterpreter* +perl_alloc_override(struct IPerlMem** ppMem, struct IPerlMem** ppMemShared, + struct IPerlMem** ppMemParse, struct IPerlEnv** ppEnv, + struct IPerlStdIO** ppStdIO, struct IPerlLIO** ppLIO, + struct IPerlDir** ppDir, struct IPerlSock** ppSock, + struct IPerlProc** ppProc) +{ + PerlInterpreter *my_perl = NULL; + CPerlHost* pHost = new CPerlHost(ppMem, ppMemShared, ppMemParse, ppEnv, + ppStdIO, ppLIO, ppDir, ppSock, ppProc); + + if (pHost) { + my_perl = perl_alloc_using(pHost->m_pHostperlMem, + pHost->m_pHostperlMemShared, + pHost->m_pHostperlMemParse, + pHost->m_pHostperlEnv, + pHost->m_pHostperlStdIO, + pHost->m_pHostperlLIO, + pHost->m_pHostperlDir, + pHost->m_pHostperlSock, + pHost->m_pHostperlProc); + if (my_perl) { +#ifdef PERL_OBJECT + CPerlObj* pPerl = (CPerlObj*)my_perl; +#endif + w32_internal_host = pHost; + } + } + return my_perl; +} + +EXTERN_C PerlInterpreter* +perl_alloc(void) +{ + PerlInterpreter* my_perl = NULL; + CPerlHost* pHost = new CPerlHost(); + if (pHost) { + my_perl = perl_alloc_using(pHost->m_pHostperlMem, + pHost->m_pHostperlMemShared, + pHost->m_pHostperlMemParse, + pHost->m_pHostperlEnv, + pHost->m_pHostperlStdIO, + pHost->m_pHostperlLIO, + pHost->m_pHostperlDir, + pHost->m_pHostperlSock, + pHost->m_pHostperlProc); + if (my_perl) { +#ifdef PERL_OBJECT + CPerlObj* pPerl = (CPerlObj*)my_perl; +#endif + //The following Should be uncommented - CHKSGP + w32_internal_host = pHost; + } + } + return my_perl; +} + +EXTERN_C void +nw_delete_internal_host(void *h) +{ + CPerlHost *host = (CPerlHost*)h; + if(host && h) + { + delete host; + host=NULL; + h=NULL; + } +} + +#ifdef PERL_OBJECT + +EXTERN_C void +perl_construct(PerlInterpreter* my_perl) +{ + CPerlObj* pPerl = (CPerlObj*)my_perl; + try + { + Perl_construct(); + } + catch(...) + { + win32_fprintf(stderr, "%s\n", + "Error: Unable to construct data structures"); + perl_free(my_perl); + } +} + +EXTERN_C void +perl_destruct(PerlInterpreter* my_perl) +{ + CPerlObj* pPerl = (CPerlObj*)my_perl; +#ifdef DEBUGGING + Perl_destruct(); +#else + try + { + Perl_destruct(); + } + catch(...) + { + } +#endif +} + +EXTERN_C void +perl_free(PerlInterpreter* my_perl) +{ + CPerlObj* pPerl = (CPerlObj*)my_perl; + void *host = w32_internal_host; +#ifdef DEBUGGING + Perl_free(); +#else + try + { + Perl_free(); + } + catch(...) + { + } +#endif + win32_delete_internal_host(host); + PERL_SET_THX(NULL); +} + +EXTERN_C int +perl_run(PerlInterpreter* my_perl) +{ + CPerlObj* pPerl = (CPerlObj*)my_perl; + int retVal; +#ifdef DEBUGGING + retVal = Perl_run(); +#else + try + { + retVal = Perl_run(); + } + catch(...) + { + win32_fprintf(stderr, "Error: Runtime exception\n"); + retVal = -1; + } +#endif + return retVal; +} + +EXTERN_C int +perl_parse(PerlInterpreter* my_perl, void (*xsinit)(CPerlObj*), int argc, char** argv, char** env) +{ + int retVal; + CPerlObj* pPerl = (CPerlObj*)my_perl; +#ifdef DEBUGGING + retVal = Perl_parse(xsinit, argc, argv, env); +#else + try + { + retVal = Perl_parse(xsinit, argc, argv, env); + } + catch(...) + { + win32_fprintf(stderr, "Error: Parse exception\n"); + retVal = -1; + } +#endif + *win32_errno() = 0; + return retVal; +} + +#undef PL_perl_destruct_level +#define PL_perl_destruct_level int dummy + +#endif /* PERL_OBJECT */ +#endif /* PERL_IMPLICIT_SYS */ + + diff --git a/NetWare/splittree.pl b/NetWare/splittree.pl new file mode 100644 index 0000000000..3c76daadb1 --- /dev/null +++ b/NetWare/splittree.pl @@ -0,0 +1,24 @@ +use DirHandle; +use AutoSplit; + +sub splitthis { +my ($top,$base,$dest) = @_; +my $d = new DirHandle $base; +if (defined $d) { + while (defined($_ = $d->read)) { + next if $_ eq "."; + next if $_ eq ".."; + my $entry = "$base\\$_"; + my $entrywithouttop = $entry; + $entrywithouttop =~ s/^$top//; + if (-d $entry) {splitthis ($top,$entry,$dest);} + else { + next unless ($entry=~/pm$/i); + #print "Will run autosplit on $entry to $dest\n"; + autosplit($entry,$dest,0,1,1); + }; + }; + }; +} + +splitthis $ARGV[0],$ARGV[0],$ARGV[1]; diff --git a/NetWare/t/NWScripts.pl b/NetWare/t/NWScripts.pl index c659b0d165..2c18c38cfd 100644 --- a/NetWare/t/NWScripts.pl +++ b/NetWare/t/NWScripts.pl @@ -11,7 +11,7 @@ $DirName = "t"; # These scripts have problems (either abend or hang) as of now (11 May 2001). # So, they are commented out in the corresponding auto scripts, io.pl and lib.pl -@ScriptsNotUsed = ("t/io/openpid.t", "t/lib/filehandle.t", "t/lib/memoize/t/expire_module_t.t", "t/lib/NEXT/t/next.t", "t/lib/Math/BigInt/t/require.t", "t/ext/B/t/debug.t","t/lib/IPC/Open3.t", "t/ext/B/t/showlex.t", "t/op/subst_wamp.t", "t/uni/upper.t"); +@ScriptsNotUsed = ("t/io/openpid.t", "t/lib/filehandle.t", "t/lib/memoize/t/expire_module_t.t", "t/lib/NEXT/t/next.t", "t/lib/Math/BigInt/t/require.t", "t/ext/B/t/debug.t","t/lib/IPC/Open3.t", "t/ext/B/t/showlex.t", "t/op/subst_wamp.t", "t/uni/upper.t", "t/lib/Net/t/ftp.t"); opendir(DIR, $DirName); @Dirs = readdir(DIR); diff --git a/NetWare/testnlm/type/type.c b/NetWare/testnlm/type/type.c index 8d5c394255..c680fcd4f0 100644 --- a/NetWare/testnlm/type/type.c +++ b/NetWare/testnlm/type/type.c @@ -24,7 +24,7 @@ void main (int argc, char** argv) fnInitGpfGlobals(); SetCurrentNameSpace(NWOS2_NAME_SPACE); - defaultDir = getenv("PERL_ROOT"); + defaultDir = (char *)getenv("PERL_ROOT"); if (!defaultDir || (strlen(defaultDir) == 0)) defaultDir = "sys:\\perl\\scripts"; chdir(defaultDir); |