r=peterl, a=asa
Get tester plugin building on OS/2
This commit is contained in:
mkaply%us.ibm.com 2002-11-05 04:24:26 +00:00
parent 9166a49fd9
commit 4400205984
8 changed files with 167 additions and 18 deletions

View File

@ -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

View File

@ -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)

View File

@ -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
/**************************************************/
/* */

View File

@ -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

View File

@ -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
}
/****************************************/

View File

@ -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

View File

@ -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__

View File

@ -56,6 +56,31 @@
#endif //XP_WIN
/**************************************************/
/* */
/* OS/2 */
/* */
/**************************************************/
#ifdef XP_OS2
#define INCL_PM
#define INCL_WIN
#include <os2.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h> /* stat() */
#include <sys/stat.h>
#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);