diff options
author | Yves Orton <demerphq@gmail.com> | 2006-04-27 23:30:00 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-04-28 15:29:30 +0000 |
commit | 7bd379e81ea13d83ac434499c69ddde30e5c4259 (patch) | |
tree | 3757e557c4cfa29634e1679af997c866f4fa10a4 /win32 | |
parent | ff235dd6d6f5e19e11c9202d4a82fb8e5fbadadd (diff) | |
download | perl-7bd379e81ea13d83ac434499c69ddde30e5c4259.tar.gz |
Merge WinCE and Win32 directories -- Initial patch
Message-ID: <9b18b3110604271430k4de84685jec6535ded195ed94@mail.gmail.com>
p4raw-id: //depot/perl@28003
Diffstat (limited to 'win32')
-rw-r--r-- | win32/config_h.PL | 11 | ||||
-rw-r--r-- | win32/dl_win32.xs | 2 | ||||
-rw-r--r-- | win32/include/sys/socket.h | 38 | ||||
-rw-r--r-- | win32/makeico.pl | 10 | ||||
-rw-r--r-- | win32/perlhost.h | 12 | ||||
-rw-r--r-- | win32/perllib.c | 46 | ||||
-rw-r--r-- | win32/vdir.h | 2 | ||||
-rw-r--r-- | win32/vmem.h | 2 | ||||
-rw-r--r-- | win32/win32.h | 12 |
9 files changed, 124 insertions, 11 deletions
diff --git a/win32/config_h.PL b/win32/config_h.PL index 957966c59f..ad2c9a3afa 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 b69ad27c7b..6c094d22fd 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 d2ef6e7752..e13e872fe1 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 <windows.h> +#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 <winsock2.h> diff --git a/win32/makeico.pl b/win32/makeico.pl index 2585cf0d68..12685f9ef6 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 (<DATA>) { 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 ff90ca90da..fe026dde1f 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 <signal.h> +#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 3acfca1204..5ce8fe7694 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 2dd7e34cc6..10119ead9e 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<<index)) { diff --git a/win32/vmem.h b/win32/vmem.h index 31aa07e3a4..1373121f11 100644 --- a/win32/vmem.h +++ b/win32/vmem.h @@ -21,7 +21,9 @@ #ifndef ___VMEM_H_INC___ #define ___VMEM_H_INC___ +#ifndef _WIN_CE #define _USE_MSVCRT_MEM_ALLOC +#endif #define _USE_LINKED_LIST // #define _USE_BUDDY_BLOCKS diff --git a/win32/win32.h b/win32/win32.h index 7be8482ce4..60309491d0 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -563,5 +563,17 @@ EXTERN_C _CRTIMP ioinfo* __pioinfo[]; DllExport void *win32_signal_context(void); #define PERL_GET_SIG_CONTEXT win32_signal_context() +#ifdef _WIN_CE +#define Win_GetModuleHandle XCEGetModuleHandleA +#define Win_GetProcAddress XCEGetProcAddressA +#define Win_GetModuleFileName XCEGetModuleFileNameA +#define Win_CreateSemaphore CreateSemaphoreW +#else +#define Win_GetModuleHandle GetModuleHandle +#define Win_GetProcAddress GetProcAddress +#define Win_GetModuleFileName GetModuleFileName +#define Win_CreateSemaphore CreateSemaphore +#endif + #endif /* _INC_WIN32_PERL5 */ |