From 7baf8840b6afb5e6ebb4e5e787e3268c00c7e250 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 5 Nov 2002 04:24:26 +0000 Subject: [PATCH] #174022 r=peterl, a=asa Get tester plugin building on OS/2 git-svn-id: svn://10.0.0.236/trunk@133000 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/plugin/Makefile.in | 3 + .../plugin/tools/tester/common/Makefile.in | 60 +++++++++++++++++++ .../plugin/tools/tester/common/np_entry.cpp | 6 +- .../plugin/tools/tester/common/pplib.cpp | 4 +- .../modules/plugin/tools/tester/common/xp.cpp | 18 +++--- .../plugin/tools/tester/include/Makefile.in | 51 ++++++++++++++++ .../plugin/tools/tester/include/loadstatus.h | 4 +- .../modules/plugin/tools/tester/include/xp.h | 39 +++++++++++- 8 files changed, 167 insertions(+), 18 deletions(-) create mode 100644 mozilla/modules/plugin/tools/tester/common/Makefile.in create mode 100644 mozilla/modules/plugin/tools/tester/include/Makefile.in diff --git a/mozilla/modules/plugin/Makefile.in b/mozilla/modules/plugin/Makefile.in index 42432fe008f..7f7b7f0f6bd 100644 --- a/mozilla/modules/plugin/Makefile.in +++ b/mozilla/modules/plugin/Makefile.in @@ -46,6 +46,9 @@ endif ifeq ($(OS_ARCH),OS2) DIRS += samples/default/os2 +ifdef ENABLE_TESTS +DIRS += tools/tester/common tools/tester/os2 +endif endif include $(topsrcdir)/config/rules.mk diff --git a/mozilla/modules/plugin/tools/tester/common/Makefile.in b/mozilla/modules/plugin/tools/tester/common/Makefile.in new file mode 100644 index 00000000000..4e1e807af22 --- /dev/null +++ b/mozilla/modules/plugin/tools/tester/common/Makefile.in @@ -0,0 +1,60 @@ +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = plugin +LIBRARY_NAME = plcommon_s +REQUIRES = java \ + plugin \ + $(NULL) + +CPPSRCS = \ + log.cpp \ + logfile.cpp \ + logger.cpp \ + loghlp.cpp \ + npn_gate.cpp \ + npp_gate.cpp \ + np_entry.cpp \ + plugbase.cpp \ + pplib.cpp \ + profile.cpp \ + script.cpp \ + scripter.cpp \ + scrpthlp.cpp \ + strconv.cpp \ + xp.cpp \ + $(NULL) + +FORCE_STATIC_LIB = 1 + +include $(topsrcdir)/config/rules.mk + +LOCAL_INCLUDES += \ + -I$(srcdir)/../include \ + $(NULL) + diff --git a/mozilla/modules/plugin/tools/tester/common/np_entry.cpp b/mozilla/modules/plugin/tools/tester/common/np_entry.cpp index fba93eb40b9..7cb9d5eada4 100644 --- a/mozilla/modules/plugin/tools/tester/common/np_entry.cpp +++ b/mozilla/modules/plugin/tools/tester/common/np_entry.cpp @@ -147,9 +147,9 @@ static NPError fillNetscapeFunctionTable(NPNetscapeFuncs* aNPNFuncs) /**************************************************/ /* */ /* Windows */ -/* */ +/* OS/2 */ /**************************************************/ -#ifdef XP_WIN +#if defined(XP_WIN) || defined(XP_OS2) NPError OSCALL NP_Initialize(NPNetscapeFuncs* aNPNFuncs) { @@ -170,7 +170,7 @@ NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* aNPPFuncs) return fillPluginFunctionTable(aNPPFuncs); } -#endif //XP_WIN +#endif //XP_WIN || XP_OS2 /**************************************************/ /* */ diff --git a/mozilla/modules/plugin/tools/tester/common/pplib.cpp b/mozilla/modules/plugin/tools/tester/common/pplib.cpp index 3c11eed5e2c..b9203d6e3d6 100644 --- a/mozilla/modules/plugin/tools/tester/common/pplib.cpp +++ b/mozilla/modules/plugin/tools/tester/common/pplib.cpp @@ -192,7 +192,7 @@ static char * readFileToNewAllocatedZeroTerminatedBuffer(XP_HFILE hFile) #ifdef XP_MAC iSize = 32000; /* HACK for the MAC */ #else - #ifdef XP_UNIX + #if defined(XP_UNIX) || defined(XP_OS2) struct stat buf; fstat(fileno(hFile), &buf); iSize = buf.st_size; @@ -471,7 +471,7 @@ BOOL PP_WriteString(char * szSection, char * szKey, char * szString, XP_HFILE hF return FALSE; } -#if (defined XP_MAC || defined XP_UNIX) +#if (defined XP_MAC || defined XP_UNIX || defined XP_OS2) rewind(hFile); #else // change file size diff --git a/mozilla/modules/plugin/tools/tester/common/xp.cpp b/mozilla/modules/plugin/tools/tester/common/xp.cpp index b89df20f4da..2627482a1de 100644 --- a/mozilla/modules/plugin/tools/tester/common/xp.cpp +++ b/mozilla/modules/plugin/tools/tester/common/xp.cpp @@ -54,7 +54,7 @@ BOOL XP_IsFile(LPSTR szFileName) OFSTRUCT of; return (HFILE_ERROR != OpenFile(szFileName, &of, OF_EXIST)); #endif -#ifdef XP_UNIX +#if defined(XP_UNIX) || defined(XP_OS2) struct stat s; return (stat(szFileName, &s) != -1); #endif @@ -70,10 +70,10 @@ void XP_DeleteFile(LPSTR szFileName) return; #endif // XP_WIN -#if (defined XP_UNIX || defined XP_MAC) +#if (defined XP_UNIX || defined XP_MAC || defined XP_OS2) remove(szFileName); return; -#endif // XP_UNIX || XP_MAC +#endif // XP_UNIX || XP_MAC || XP_OS2 } XP_HFILE XP_CreateFile(LPSTR szFileName) @@ -107,10 +107,10 @@ void XP_CloseFile(XP_HFILE hFile) return; #endif // XP_WIN -#if (defined UNIX || defined XP_MAC) +#if (defined UNIX || defined XP_MAC || defined XP_OS2) fclose(hFile); return; -#endif // UNIX || XP_MAC +#endif // UNIX || XP_MAC || XP_OS2 } } @@ -122,9 +122,9 @@ DWORD XP_WriteFile(XP_HFILE hFile, void * pBuf, int iSize) return dwRet; #endif // XP_WIN -#if (defined XP_UNIX || defined XP_MAC) +#if (defined XP_UNIX || defined XP_MAC || defined XP_OS2) return (DWORD)fwrite(pBuf, iSize, 1, hFile); -#endif // XP_UNIX || XP_MAC +#endif // XP_UNIX || XP_MAC || XP_OS2 } void XP_FlushFileBuffers(XP_HFILE hFile) @@ -134,9 +134,9 @@ void XP_FlushFileBuffers(XP_HFILE hFile) return; #endif // XP_WIN -#if (defined XP_UNIX || defined XP_MAC) +#if (defined XP_UNIX || defined XP_MAC || defined XP_OS2) fflush(hFile); -#endif // XP_UNIX || XP_MAC +#endif // XP_UNIX || XP_MAC || XP_OS2 } /****************************************/ diff --git a/mozilla/modules/plugin/tools/tester/include/Makefile.in b/mozilla/modules/plugin/tools/tester/include/Makefile.in new file mode 100644 index 00000000000..010f3f87c9f --- /dev/null +++ b/mozilla/modules/plugin/tools/tester/include/Makefile.in @@ -0,0 +1,51 @@ +# +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = plugin + +EXPORT_HEADERS = \ + action.h \ + comstrs.h \ + helpers.h \ + loadstatus.h \ + log.h \ + logfile.h \ + logger.h \ + loghlp.h \ + plugbase.h \ + pplib.h \ + profile.h \ + script.h \ + scripter.h \ + scrpthlp.h \ + strconv.h \ + xp.h \ + $(NULL) + +include $(topsrcdir)/config/rules.mk + diff --git a/mozilla/modules/plugin/tools/tester/include/loadstatus.h b/mozilla/modules/plugin/tools/tester/include/loadstatus.h index 7247672aabb..2f02723bab2 100644 --- a/mozilla/modules/plugin/tools/tester/include/loadstatus.h +++ b/mozilla/modules/plugin/tools/tester/include/loadstatus.h @@ -38,11 +38,11 @@ #ifndef __LOADSTATUS_H__ #define __LOADSTATUS_H__ -#ifdef XP_WIN +#if defined(XP_WIN) || defined(XP_OS2) HWND ShowLoadStatus(char * aMessage); void DestroyLoadStatus(HWND ahWnd); -#endif // XP_WIN +#endif // XP_WIN || XP_OS2 #endif // __LOADSTATUS_H__ diff --git a/mozilla/modules/plugin/tools/tester/include/xp.h b/mozilla/modules/plugin/tools/tester/include/xp.h index 4863cadf438..7429ba8e258 100644 --- a/mozilla/modules/plugin/tools/tester/include/xp.h +++ b/mozilla/modules/plugin/tools/tester/include/xp.h @@ -56,6 +56,31 @@ #endif //XP_WIN +/**************************************************/ +/* */ +/* OS/2 */ +/* */ +/**************************************************/ +#ifdef XP_OS2 + +#define INCL_PM +#define INCL_WIN + +#include +#include +#include +#include +#include +#include /* stat() */ +#include + +#include "npapi.h" +#include "npupp.h" + +#define XP_HFILE FILE* + +#endif //XP_OS2 + /**************************************************/ /* */ /* Unix */ @@ -178,8 +203,18 @@ NPError Private_SetValue(NPP instance, NPNVariable variable, void *value); /* Misc */ /* */ /**************************************************/ +#if defined(XP_OS2) +typedef unsigned short WORD; +typedef char* LPSTR; +typedef unsigned long DWORD; +typedef void *LPVOID; -#ifndef XP_WIN +#define wsprintf sprintf +#define IDYES MBID_YES +#define MB_ICONERROR MB_ERROR +#endif + +#if !defined(XP_WIN) && !defined(XP_OS2) #ifndef FALSE #define FALSE false @@ -215,7 +250,7 @@ NPError Private_SetValue(NPP instance, NPNVariable variable, void *value); #endif #endif -#endif //!XP_WIN +#endif //!XP_WIN && !XP_OS2 // File utilities BOOL XP_IsFile(LPSTR szFileName);