From: Yves Orton Date: Thu, 27 Apr 2006 23:30:00 +0000 (+0000) Subject: Merge WinCE and Win32 directories -- Initial patch X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7bd379e81ea13d83ac434499c69ddde30e5c4259;hp=ff235dd6d6f5e19e11c9202d4a82fb8e5fbadadd;p=p5sagit%2Fp5-mst-13.2.git Merge WinCE and Win32 directories -- Initial patch Message-ID: <9b18b3110604271430k4de84685jec6535ded195ed94@mail.gmail.com> p4raw-id: //depot/perl@28003 --- diff --git a/win32/config_h.PL b/win32/config_h.PL index 957966c..ad2c9a3 100644 --- a/win32/config_h.PL +++ b/win32/config_h.PL @@ -2,8 +2,8 @@ BEGIN { warn "Running ".__FILE__."\n" }; BEGIN { - require "../lib/Config.pm"; - die "../Config.pm:$@" if $@; + require "Config.pm"; + die "Config.pm:$@" if $@; Config::->import; } use File::Compare qw(compare); @@ -18,6 +18,7 @@ while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/) } $opt{CONFIG_H} ||= 'config.h'; +$opt{CORE_DIR} ||= '../lib/CORE'; warn "Writing $opt{CONFIG_H}\n"; @@ -76,9 +77,9 @@ close(H); close(SH); -chmod(0666,"../lib/CORE/config.h"); -copy("$file.new","../lib/CORE/config.h") || die "Cannot copy:$!"; -chmod(0444,"../lib/CORE/config.h"); +chmod(0666,"$opt{CORE_DIR}/$opt{CONFIG_H}"); +copy("$file.new","$opt{CORE_DIR}/$opt{CONFIG_H}") || die "Cannot copy:$!"; +chmod(0444,"$opt{CORE_DIR}/$opt{CONFIG_H}"); if (compare("$file.new",$file)) { diff --git a/win32/dl_win32.xs b/win32/dl_win32.xs index b69ad27..6c094d2 100644 --- a/win32/dl_win32.xs +++ b/win32/dl_win32.xs @@ -119,7 +119,7 @@ dl_load_file(filename,flags=0) RETVAL = PerlProc_DynaLoad(filename); } else - RETVAL = (void*) GetModuleHandle(NULL); + RETVAL = (void*) Win_GetModuleHandle(NULL); DLDEBUG(2,PerlIO_printf(Perl_debug_log," libref=%x\n", RETVAL)); ST(0) = sv_newmortal() ; if (RETVAL == NULL) diff --git a/win32/include/sys/socket.h b/win32/include/sys/socket.h index d2ef6e7..e13e872 100644 --- a/win32/include/sys/socket.h +++ b/win32/include/sys/socket.h @@ -10,12 +10,50 @@ extern "C" { #endif +#ifndef _WINCE + #define WIN32_LEAN_AND_MEAN #ifdef __GNUC__ # define Win32_Winsock #endif #include +#else +/*_WINCE*/ +#ifndef FAR +#define FAR +#endif + +#define PASCAL __stdcall +#define WINAPI __stdcall + +#undef WORD +typedef int BOOL; +typedef unsigned short WORD; +typedef void* HANDLE; +typedef void* HWND; +typedef int (FAR WINAPI *FARPROC)(); + +typedef unsigned long DWORD; +typedef void *PVOID; + +#define IN +#define OUT + +#ifndef UNDER_CE +typedef struct _OVERLAPPED { + DWORD Internal; + DWORD InternalHigh; + DWORD Offset; + DWORD OffsetHigh; + HANDLE hEvent; +} OVERLAPPED, *LPOVERLAPPED; +#endif + +#undef HOST_NOT_FOUND + +#endif /*_WINCE*/ + /* Too late to include winsock2.h if winsock.h has already been loaded */ #ifndef _WINSOCKAPI_ # include diff --git a/win32/makeico.pl b/win32/makeico.pl index 2585cf0..12685f9 100644 --- a/win32/makeico.pl +++ b/win32/makeico.pl @@ -1,7 +1,12 @@ -binmode STDOUT; +if (@ARGV) { + open ICO, ">", shift or die $!; +} else { + *ICO= *STDOUT; +} +binmode ICO; while () { chomp; - print pack "H*", $_; + print ICO pack "H*", $_; } # Create new hex data with @@ -98,3 +103,4 @@ ff00ffffff00060606060606060606060606060606060606060606060606060d 0000000000000000000000000000ffff9e5cfbb77420fd9b7865fd9b2074fd5b 7320fd5b6e20fd137573f0017072e0036c65e0032077e4076e20e6076577c30f 6720ff9f6520ffff6f6effff6e20 + diff --git a/win32/perlhost.h b/win32/perlhost.h index ff90ca9..fe026dd 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -7,12 +7,16 @@ * License or the Artistic License, as specified in the README file. */ +#ifndef UNDER_CE #define CHECK_HOST_INTERP +#endif #ifndef ___PerlHost_H___ #define ___PerlHost_H___ +#ifndef UNDER_CE #include +#endif #include "iperlsys.h" #include "vmem.h" #include "vdir.h" @@ -823,6 +827,7 @@ PerlStdIOGetOSfhandle(struct IPerlStdIO* piPerl, int filenum) FILE* PerlStdIOFdupopen(struct IPerlStdIO* piPerl, FILE* pf) { +#ifndef UNDER_CE FILE* pfdup; fpos_t pos; char mode[3]; @@ -870,6 +875,9 @@ PerlStdIOFdupopen(struct IPerlStdIO* piPerl, FILE* pf) fsetpos(pfdup, &pos); } return pfdup; +#else + return 0; +#endif } struct IPerlStdIO perlStdIO = @@ -2132,6 +2140,10 @@ lookup(const void *arg1, const void *arg2) LPSTR* CPerlHost::Lookup(LPCSTR lpStr) { +#ifdef UNDER_CE + if (!m_lppEnvList || !m_dwEnvCount) + return NULL; +#endif if (!lpStr) return NULL; return (LPSTR*)bsearch(&lpStr, m_lppEnvList, m_dwEnvCount, sizeof(LPSTR), lookup); diff --git a/win32/perllib.c b/win32/perllib.c index 3acfca1..5ce8fe7 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -40,6 +40,9 @@ xs_init(pTHX) #ifdef PERL_IMPLICIT_SYS +/* WINCE: include replaced by: +extern "C" void win32_checkTLS(PerlInterpreter *host_perl); +*/ #include "perlhost.h" void @@ -48,11 +51,45 @@ win32_checkTLS(PerlInterpreter *host_perl) dTHX; if (host_perl != my_perl) { int *nowhere = NULL; - *nowhere = 0; +#ifdef _WIN_CE + printf(" ... bad in win32_checkTLS\n"); + printf(" %08X ne %08X\n",host_perl,my_perl); +#endif abort(); } } +#ifdef UNDER_CE +int GetLogicalDrives() { + return 0; /* no logical drives on CE */ +} +int GetLogicalDriveStrings(int size, char addr[]) { + return 0; /* no logical drives on CE */ +} +/* TBD */ +DWORD GetFullPathNameA(LPCSTR fn, DWORD blen, LPTSTR buf, LPSTR *pfile) { + return 0; +} +/* TBD */ +DWORD GetFullPathNameW(CONST WCHAR *fn, DWORD blen, WCHAR * buf, WCHAR **pfile) { + return 0; +} +/* TBD */ +DWORD SetCurrentDirectoryA(LPSTR pPath) { + return 0; +} +/* TBD */ +DWORD SetCurrentDirectoryW(CONST WCHAR *pPath) { + return 0; +} +int xcesetuid(uid_t id){return 0;} +int xceseteuid(uid_t id){ return 0;} +int xcegetuid() {return 0;} +int xcegeteuid(){ return 0;} +#endif + +/* WINCE??: include "perlhost.h" */ + EXTERN_C void perl_get_host_info(struct IPerlMemInfo* perlMemInfo, struct IPerlMemInfo* perlMemSharedInfo, @@ -177,7 +214,7 @@ RunPerl(int argc, char **argv, char **env) * Borland's CRT does the right thing to argv[0] already. */ char szModuleName[MAX_PATH]; - GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); + Win_GetModuleFileName(NULL, szModuleName, sizeof(szModuleName)); (void)win32_longpath(szModuleName); argv[0] = szModuleName; #endif @@ -254,7 +291,11 @@ DllMain(HANDLE hModule, /* DLL module handle */ setmode( fileno( stderr ), O_BINARY ); _fmode = O_BINARY; #endif + +#ifndef UNDER_CE DisableThreadLibraryCalls((HMODULE)hModule); +#endif + w32_perldll_handle = hModule; set_w32_module_name(); break; @@ -290,6 +331,7 @@ DllMain(HANDLE hModule, /* DLL module handle */ return TRUE; } + #if defined(USE_ITHREADS) && defined(PERL_IMPLICIT_SYS) EXTERN_C PerlInterpreter * perl_clone_host(PerlInterpreter* proto_perl, UV flags) { diff --git a/win32/vdir.h b/win32/vdir.h index 2dd7e34..10119ea 100644 --- a/win32/vdir.h +++ b/win32/vdir.h @@ -150,7 +150,7 @@ void VDir::Init(VDir* pDir, VMem *p) bManageDirectory = 0; driveBits = GetLogicalDrives(); if (GetLogicalDriveStrings(sizeof(szBuffer), szBuffer)) { - char* pEnv = GetEnvironmentStrings(); + char* pEnv = (char*)GetEnvironmentStrings(); char* ptr = szBuffer; for (index = 0; index < driveCount; ++index) { if (driveBits & (1<