Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@@ -0,0 +1,148 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/base/domstubs.idl
*/
#ifndef __gen_domstubs_h__
#define __gen_domstubs_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
typedef PRUint64 DOMTimeStamp;
class nsIDOMAttr; /* forward declaration */
class nsIDOMCDATASection; /* forward declaration */
class nsIDOMCharacterData; /* forward declaration */
class nsIDOMComment; /* forward declaration */
class nsIDOMDOMImplementation; /* forward declaration */
class nsIDOMDocument; /* forward declaration */
class nsIDOMDocumentFragment; /* forward declaration */
class nsIDOMDocumentType; /* forward declaration */
class nsIDOMElement; /* forward declaration */
class nsIDOMEntity; /* forward declaration */
class nsIDOMEntityReference; /* forward declaration */
class nsIDOMNSDocument; /* forward declaration */
class nsIDOMNamedNodeMap; /* forward declaration */
class nsIDOMNode; /* forward declaration */
class nsIDOMNodeList; /* forward declaration */
class nsIDOMNotation; /* forward declaration */
class nsIDOMProcessingInstruction; /* forward declaration */
class nsIDOMText; /* forward declaration */
class nsIDOMDOMStringList; /* forward declaration */
class nsIDOMNameList; /* forward declaration */
class DOMException; /* forward declaration */
class RangeException; /* forward declaration */
class nsIDOMStyleSheetList; /* forward declaration */
class nsIDOMLinkStyle; /* forward declaration */
class nsIDOMStyleSheet; /* forward declaration */
class nsIDOMMediaList; /* forward declaration */
class nsIDOMAbstractView; /* forward declaration */
class nsIDOMDocumentView; /* forward declaration */
class nsIDOMWindow; /* forward declaration */
class nsIDOMWindowInternal; /* forward declaration */
class nsIDOMWindowCollection; /* forward declaration */
class nsIDOMPlugin; /* forward declaration */
class nsIDOMPluginArray; /* forward declaration */
class nsIDOMMimeType; /* forward declaration */
class nsIDOMMimeTypeArray; /* forward declaration */
class nsIDOMBarProp; /* forward declaration */
class nsIDOMNavigator; /* forward declaration */
class nsIDOMScreen; /* forward declaration */
class nsIDOMHistory; /* forward declaration */
class nsIDOMEvent; /* forward declaration */
class nsIDOMEventTarget; /* forward declaration */
class nsIDOMEventListener; /* forward declaration */
class nsIDOMEventGroup; /* forward declaration */
class nsIDOMHTMLElement; /* forward declaration */
class nsIDOMHTMLFormElement; /* forward declaration */
class nsIDOMHTMLCollection; /* forward declaration */
class nsIDOMCSSValue; /* forward declaration */
class nsIDOMCSSValueList; /* forward declaration */
class nsIDOMCSSPrimitiveValue; /* forward declaration */
class nsIDOMCSSRule; /* forward declaration */
class nsIDOMCSSRuleList; /* forward declaration */
class nsIDOMCSSStyleSheet; /* forward declaration */
class nsIDOMCSSStyleDeclaration; /* forward declaration */
class nsIDOMCounter; /* forward declaration */
class nsIDOMRect; /* forward declaration */
class nsIDOMRGBColor; /* forward declaration */
class nsIDOMCSSStyleRule; /* forward declaration */
class nsIDOMCSSStyleRuleCollection; /* forward declaration */
class nsIDOMHTMLTableCaptionElement; /* forward declaration */
class nsIDOMHTMLTableSectionElement; /* forward declaration */
class nsIDOMRange; /* forward declaration */
class nsIDOMCRMFObject; /* forward declaration */
class nsIDOMCrypto; /* forward declaration */
class nsIDOMPkcs11; /* forward declaration */
#endif /* __gen_domstubs_h__ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,182 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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):
*
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 2000
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 03/27/2000 IBM Corp. Set JNICALL to Optlink for
* use in OS2
*/
/*******************************************************************************
* Netscape version of jni_md.h -- depends on jri_md.h
******************************************************************************/
#ifndef JNI_MD_H
#define JNI_MD_H
#include "prtypes.h" /* needed for _declspec */
/*******************************************************************************
* WHAT'S UP WITH THIS FILE?
*
* This is where we define the mystical JNI_PUBLIC_API macro that works on all
* platforms. If you're running with Visual C++, Symantec C, or Borland's
* development environment on the PC, you're all set. Or if you're on the Mac
* with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
* matter.
* Changes by sailesh on 9/26
* There are two symbols used in the declaration of the JNI functions
* and native code that uses the JNI:
* JNICALL - specifies the calling convention
* JNIEXPORT - specifies export status of the function
*
* The syntax to specify calling conventions is different in Win16 and
* Win32 - the brains at Micro$oft at work here. JavaSoft in their
* infinite wisdom cares for no platform other than Win32, and so they
* just define these two symbols as:
#define JNIEXPORT __declspec(dllexport)
#define JNICALL __stdcall
* We deal with this, in the way JRI defines the JRI_PUBLIC_API, by
* defining a macro called JNI_PUBLIC_API. Any of our developers who
* wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to
* be able to export functions properly.
* Since we must also maintain compatibility with JavaSoft, we
* continue to define the symbol JNIEXPORT. However, use of this
* internally is deprecated, since it will cause a mess on Win16.
* We _do not_ need a new symbol called JNICALL. Instead we
* redefine JNICALL in the same way JRI_CALLBACK was defined.
******************************************************************************/
/* DLL Entry modifiers... */
#if defined(XP_OS2)
# ifdef XP_OS2_VACPP
# define JNI_PUBLIC_API(ResultType) ResultType _System
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNICALL _Optlink
# define JNIEXPORT
# else
# define JNI_PUBLIC_API(ResultType) ResultType
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNICALL
# define JNIEXPORT
# endif
/* Win32 */
#elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER) || defined(__GNUC__)
# if defined(WIN32) || defined(_WIN32)
# define JNI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType __stdcall
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType
# define JNICALL __stdcall
# else /* !_WIN32 */
# if defined(_WINDLL)
# define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
# define JNICALL __loadds
# else /* !WINDLL */
# define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __export
# define JNICALL __export
# endif /* !WINDLL */
# endif /* !_WIN32 */
# elif defined(__BORLANDC__)
# if defined(WIN32) || defined(_WIN32)
# define JNI_PUBLIC_API(ResultType) __export ResultType
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) __export ResultType
# define JNICALL
# else /* !_WIN32 */
# define JNI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
# define JNICALL _loadds
# endif
# else
# error Unsupported PC development environment.
# endif
# ifndef IS_LITTLE_ENDIAN
# define IS_LITTLE_ENDIAN
# endif
/* This is the stuff inherited from JavaSoft .. */
# define JNIEXPORT __declspec(dllexport)
/* Mac */
#elif macintosh || Macintosh || THINK_C
# if defined(__MWERKS__) /* Metrowerks */
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif
# endif /* !GENERATINGCFM */
# define JNI_PUBLIC_API(ResultType) __declspec(export) ResultType
# define JNI_PUBLIC_VAR(VarType) JNI_PUBLIC_API(VarType)
# define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultType)
# elif defined(__SC__) /* Symantec */
# error What are the Symantec defines? (warren@netscape.com)
# elif macintosh && applec /* MPW */
# error Please upgrade to the latest MPW compiler (SC).
# else
# error Unsupported Mac development environment.
# endif
# define JNICALL
/* This is the stuff inherited from JavaSoft .. */
# define JNIEXPORT
/* Unix or else */
#else
# define JNI_PUBLIC_API(ResultType) ResultType
# define JNI_PUBLIC_VAR(VarType) VarType
# define JNI_NATIVE_STUB(ResultType) ResultType
# define JNICALL
/* This is the stuff inherited from JavaSoft .. */
# define JNIEXPORT
#endif
#ifndef FAR /* for non-Win16 */
#define FAR
#endif
/* Get the rest of the stuff from jri_md.h */
#include "jri_md.h"
#endif /* JNI_MD_H */

View File

@@ -0,0 +1,689 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*******************************************************************************
* Java Runtime Interface
******************************************************************************/
#ifndef JRI_H
#define JRI_H
#include "jritypes.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*******************************************************************************
* JRIEnv
******************************************************************************/
/* The type of the JRIEnv interface. */
typedef struct JRIEnvInterface JRIEnvInterface;
/* The type of a JRIEnv instance. */
typedef const JRIEnvInterface* JRIEnv;
/*******************************************************************************
* JRIEnv Operations
******************************************************************************/
#define JRI_DefineClass(env, classLoader, buf, bufLen) \
(((*(env))->DefineClass)(env, JRI_DefineClass_op, classLoader, buf, bufLen))
#define JRI_FindClass(env, name) \
(((*(env))->FindClass)(env, JRI_FindClass_op, name))
#define JRI_Throw(env, obj) \
(((*(env))->Throw)(env, JRI_Throw_op, obj))
#define JRI_ThrowNew(env, clazz, message) \
(((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message))
#define JRI_ExceptionOccurred(env) \
(((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op))
#define JRI_ExceptionDescribe(env) \
(((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op))
#define JRI_ExceptionClear(env) \
(((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op))
#define JRI_NewGlobalRef(env, ref) \
(((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref))
#define JRI_DisposeGlobalRef(env, gref) \
(((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref))
#define JRI_GetGlobalRef(env, gref) \
(((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref))
#define JRI_SetGlobalRef(env, gref, ref) \
(((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref))
#define JRI_IsSameObject(env, a, b) \
(((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b))
#define JRI_NewObject(env) ((*(env))->NewObject)
#define JRI_NewObjectV(env, clazz, methodID, args) \
(((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args))
#define JRI_NewObjectA(env, clazz, method, args) \
(((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args))
#define JRI_GetObjectClass(env, obj) \
(((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj))
#define JRI_IsInstanceOf(env, obj, clazz) \
(((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz))
#define JRI_GetMethodID(env, clazz, name, sig) \
(((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig))
#define JRI_CallMethod(env) ((*(env))->CallMethod)
#define JRI_CallMethodV(env, obj, methodID, args) \
(((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args))
#define JRI_CallMethodA(env, obj, methodID, args) \
(((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args))
#define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean)
#define JRI_CallMethodBooleanV(env, obj, methodID, args) \
(((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args))
#define JRI_CallMethodBooleanA(env, obj, methodID, args) \
(((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args))
#define JRI_CallMethodByte(env) ((*(env))->CallMethodByte)
#define JRI_CallMethodByteV(env, obj, methodID, args) \
(((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args))
#define JRI_CallMethodByteA(env, obj, methodID, args) \
(((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args))
#define JRI_CallMethodChar(env) ((*(env))->CallMethodChar)
#define JRI_CallMethodCharV(env, obj, methodID, args) \
(((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args))
#define JRI_CallMethodCharA(env, obj, methodID, args) \
(((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args))
#define JRI_CallMethodShort(env) ((*(env))->CallMethodShort)
#define JRI_CallMethodShortV(env, obj, methodID, args) \
(((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args))
#define JRI_CallMethodShortA(env, obj, methodID, args) \
(((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args))
#define JRI_CallMethodInt(env) ((*(env))->CallMethodInt)
#define JRI_CallMethodIntV(env, obj, methodID, args) \
(((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args))
#define JRI_CallMethodIntA(env, obj, methodID, args) \
(((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args))
#define JRI_CallMethodLong(env) ((*(env))->CallMethodLong)
#define JRI_CallMethodLongV(env, obj, methodID, args) \
(((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args))
#define JRI_CallMethodLongA(env, obj, methodID, args) \
(((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args))
#define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat)
#define JRI_CallMethodFloatV(env, obj, methodID, args) \
(((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args))
#define JRI_CallMethodFloatA(env, obj, methodID, args) \
(((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args))
#define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble)
#define JRI_CallMethodDoubleV(env, obj, methodID, args) \
(((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args))
#define JRI_CallMethodDoubleA(env, obj, methodID, args) \
(((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args))
#define JRI_GetFieldID(env, clazz, name, sig) \
(((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig))
#define JRI_GetField(env, obj, fieldID) \
(((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID))
#define JRI_GetFieldBoolean(env, obj, fieldID) \
(((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID))
#define JRI_GetFieldByte(env, obj, fieldID) \
(((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID))
#define JRI_GetFieldChar(env, obj, fieldID) \
(((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID))
#define JRI_GetFieldShort(env, obj, fieldID) \
(((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID))
#define JRI_GetFieldInt(env, obj, fieldID) \
(((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID))
#define JRI_GetFieldLong(env, obj, fieldID) \
(((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID))
#define JRI_GetFieldFloat(env, obj, fieldID) \
(((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID))
#define JRI_GetFieldDouble(env, obj, fieldID) \
(((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID))
#define JRI_SetField(env, obj, fieldID, value) \
(((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value))
#define JRI_SetFieldBoolean(env, obj, fieldID, value) \
(((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value))
#define JRI_SetFieldByte(env, obj, fieldID, value) \
(((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value))
#define JRI_SetFieldChar(env, obj, fieldID, value) \
(((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value))
#define JRI_SetFieldShort(env, obj, fieldID, value) \
(((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value))
#define JRI_SetFieldInt(env, obj, fieldID, value) \
(((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value))
#define JRI_SetFieldLong(env, obj, fieldID, value) \
(((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value))
#define JRI_SetFieldFloat(env, obj, fieldID, value) \
(((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value))
#define JRI_SetFieldDouble(env, obj, fieldID, value) \
(((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value))
#define JRI_IsSubclassOf(env, a, b) \
(((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b))
#define JRI_GetStaticMethodID(env, clazz, name, sig) \
(((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig))
#define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod)
#define JRI_CallStaticMethodV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean)
#define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte)
#define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar)
#define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort)
#define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt)
#define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong)
#define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat)
#define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args))
#define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble)
#define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args))
#define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \
(((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args))
#define JRI_GetStaticFieldID(env, clazz, name, sig) \
(((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig))
#define JRI_GetStaticField(env, clazz, fieldID) \
(((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID))
#define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \
(((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID))
#define JRI_GetStaticFieldByte(env, clazz, fieldID) \
(((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID))
#define JRI_GetStaticFieldChar(env, clazz, fieldID) \
(((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID))
#define JRI_GetStaticFieldShort(env, clazz, fieldID) \
(((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID))
#define JRI_GetStaticFieldInt(env, clazz, fieldID) \
(((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID))
#define JRI_GetStaticFieldLong(env, clazz, fieldID) \
(((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID))
#define JRI_GetStaticFieldFloat(env, clazz, fieldID) \
(((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID))
#define JRI_GetStaticFieldDouble(env, clazz, fieldID) \
(((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID))
#define JRI_SetStaticField(env, clazz, fieldID, value) \
(((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value))
#define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value))
#define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value))
#define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value))
#define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value))
#define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value))
#define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value))
#define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value))
#define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \
(((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value))
#define JRI_NewString(env, unicode, len) \
(((*(env))->NewString)(env, JRI_NewString_op, unicode, len))
#define JRI_GetStringLength(env, string) \
(((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string))
#define JRI_GetStringChars(env, string) \
(((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string))
#define JRI_NewStringUTF(env, utf, len) \
(((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len))
#define JRI_GetStringUTFLength(env, string) \
(((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string))
#define JRI_GetStringUTFChars(env, string) \
(((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string))
#define JRI_NewScalarArray(env, length, elementSig, initialElements) \
(((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements))
#define JRI_GetScalarArrayLength(env, array) \
(((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array))
#define JRI_GetScalarArrayElements(env, array) \
(((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array))
#define JRI_NewObjectArray(env, length, elementClass, initialElement) \
(((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement))
#define JRI_GetObjectArrayLength(env, array) \
(((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array))
#define JRI_GetObjectArrayElement(env, array, index) \
(((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index))
#define JRI_SetObjectArrayElement(env, array, index, value) \
(((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value))
#define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \
(((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray))
#define JRI_UnregisterNatives(env, clazz) \
(((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz))
#define JRI_NewStringPlatform(env, string, len, encoding, encodingLength) \
(((*(env))->NewStringPlatform)(env, JRI_NewStringPlatform_op, string, len, encoding, encodingLength))
#define JRI_GetStringPlatformChars(env, string, encoding, encodingLength) \
(((*(env))->GetStringPlatformChars)(env, JRI_GetStringPlatformChars_op, string, encoding, encodingLength))
/*******************************************************************************
* JRIEnv Interface
******************************************************************************/
struct java_lang_ClassLoader;
struct java_lang_Class;
struct java_lang_Throwable;
struct java_lang_Object;
struct java_lang_String;
struct JRIEnvInterface {
void* reserved0;
void* reserved1;
void* reserved2;
void* reserved3;
struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a);
void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a);
void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b);
struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op);
void (*ExceptionDescribe)(JRIEnv* env, jint op);
void (*ExceptionClear)(JRIEnv* env, jint op);
jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a);
void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a);
void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a);
void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b);
jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b);
void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a);
jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b);
jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...);
void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...);
jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...);
jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...);
jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...);
jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...);
jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...);
jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...);
jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...);
jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*GetField)(JRIEnv* env, jint op, void* a, jint b);
jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b);
jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b);
jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b);
jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b);
jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b);
jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b);
jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b);
jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b);
void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c);
void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c);
void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c);
void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c);
void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c);
void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c);
void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c);
void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c);
void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c);
jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b);
jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c);
void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c);
void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c);
void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c);
void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c);
void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c);
void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c);
void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c);
void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c);
struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b);
jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a);
const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a);
struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b);
jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a);
const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a);
void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c);
jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a);
jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a);
void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c);
jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a);
void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b);
void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c);
void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c);
void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a);
struct java_lang_Class* (*DefineClass)(JRIEnv* env, jint op, struct java_lang_ClassLoader* a, jbyte* b, jsize bLen);
struct java_lang_String* (*NewStringPlatform)(JRIEnv* env, jint op, const jbyte* a, jint b, const jbyte* c, jint d);
const jbyte* (*GetStringPlatformChars)(JRIEnv* env, jint op, struct java_lang_String* a, const jbyte* b, jint c);
};
/*
** ****************************************************************************
** JRIEnv Operation IDs
** ***************************************************************************
*/
typedef enum JRIEnvOperations {
JRI_Reserved0_op,
JRI_Reserved1_op,
JRI_Reserved2_op,
JRI_Reserved3_op,
JRI_FindClass_op,
JRI_Throw_op,
JRI_ThrowNew_op,
JRI_ExceptionOccurred_op,
JRI_ExceptionDescribe_op,
JRI_ExceptionClear_op,
JRI_NewGlobalRef_op,
JRI_DisposeGlobalRef_op,
JRI_GetGlobalRef_op,
JRI_SetGlobalRef_op,
JRI_IsSameObject_op,
JRI_NewObject_op,
JRI_NewObject_op_va_list,
JRI_NewObject_op_array,
JRI_GetObjectClass_op,
JRI_IsInstanceOf_op,
JRI_GetMethodID_op,
JRI_CallMethod_op,
JRI_CallMethod_op_va_list,
JRI_CallMethod_op_array,
JRI_CallMethodBoolean_op,
JRI_CallMethodBoolean_op_va_list,
JRI_CallMethodBoolean_op_array,
JRI_CallMethodByte_op,
JRI_CallMethodByte_op_va_list,
JRI_CallMethodByte_op_array,
JRI_CallMethodChar_op,
JRI_CallMethodChar_op_va_list,
JRI_CallMethodChar_op_array,
JRI_CallMethodShort_op,
JRI_CallMethodShort_op_va_list,
JRI_CallMethodShort_op_array,
JRI_CallMethodInt_op,
JRI_CallMethodInt_op_va_list,
JRI_CallMethodInt_op_array,
JRI_CallMethodLong_op,
JRI_CallMethodLong_op_va_list,
JRI_CallMethodLong_op_array,
JRI_CallMethodFloat_op,
JRI_CallMethodFloat_op_va_list,
JRI_CallMethodFloat_op_array,
JRI_CallMethodDouble_op,
JRI_CallMethodDouble_op_va_list,
JRI_CallMethodDouble_op_array,
JRI_GetFieldID_op,
JRI_GetField_op,
JRI_GetFieldBoolean_op,
JRI_GetFieldByte_op,
JRI_GetFieldChar_op,
JRI_GetFieldShort_op,
JRI_GetFieldInt_op,
JRI_GetFieldLong_op,
JRI_GetFieldFloat_op,
JRI_GetFieldDouble_op,
JRI_SetField_op,
JRI_SetFieldBoolean_op,
JRI_SetFieldByte_op,
JRI_SetFieldChar_op,
JRI_SetFieldShort_op,
JRI_SetFieldInt_op,
JRI_SetFieldLong_op,
JRI_SetFieldFloat_op,
JRI_SetFieldDouble_op,
JRI_IsSubclassOf_op,
JRI_GetStaticMethodID_op,
JRI_CallStaticMethod_op,
JRI_CallStaticMethod_op_va_list,
JRI_CallStaticMethod_op_array,
JRI_CallStaticMethodBoolean_op,
JRI_CallStaticMethodBoolean_op_va_list,
JRI_CallStaticMethodBoolean_op_array,
JRI_CallStaticMethodByte_op,
JRI_CallStaticMethodByte_op_va_list,
JRI_CallStaticMethodByte_op_array,
JRI_CallStaticMethodChar_op,
JRI_CallStaticMethodChar_op_va_list,
JRI_CallStaticMethodChar_op_array,
JRI_CallStaticMethodShort_op,
JRI_CallStaticMethodShort_op_va_list,
JRI_CallStaticMethodShort_op_array,
JRI_CallStaticMethodInt_op,
JRI_CallStaticMethodInt_op_va_list,
JRI_CallStaticMethodInt_op_array,
JRI_CallStaticMethodLong_op,
JRI_CallStaticMethodLong_op_va_list,
JRI_CallStaticMethodLong_op_array,
JRI_CallStaticMethodFloat_op,
JRI_CallStaticMethodFloat_op_va_list,
JRI_CallStaticMethodFloat_op_array,
JRI_CallStaticMethodDouble_op,
JRI_CallStaticMethodDouble_op_va_list,
JRI_CallStaticMethodDouble_op_array,
JRI_GetStaticFieldID_op,
JRI_GetStaticField_op,
JRI_GetStaticFieldBoolean_op,
JRI_GetStaticFieldByte_op,
JRI_GetStaticFieldChar_op,
JRI_GetStaticFieldShort_op,
JRI_GetStaticFieldInt_op,
JRI_GetStaticFieldLong_op,
JRI_GetStaticFieldFloat_op,
JRI_GetStaticFieldDouble_op,
JRI_SetStaticField_op,
JRI_SetStaticFieldBoolean_op,
JRI_SetStaticFieldByte_op,
JRI_SetStaticFieldChar_op,
JRI_SetStaticFieldShort_op,
JRI_SetStaticFieldInt_op,
JRI_SetStaticFieldLong_op,
JRI_SetStaticFieldFloat_op,
JRI_SetStaticFieldDouble_op,
JRI_NewString_op,
JRI_GetStringLength_op,
JRI_GetStringChars_op,
JRI_NewStringUTF_op,
JRI_GetStringUTFLength_op,
JRI_GetStringUTFChars_op,
JRI_NewScalarArray_op,
JRI_GetScalarArrayLength_op,
JRI_GetScalarArrayElements_op,
JRI_NewObjectArray_op,
JRI_GetObjectArrayLength_op,
JRI_GetObjectArrayElement_op,
JRI_SetObjectArrayElement_op,
JRI_RegisterNatives_op,
JRI_UnregisterNatives_op,
JRI_DefineClass_op,
JRI_NewStringPlatform_op,
JRI_GetStringPlatformChars_op
} JRIEnvOperations;
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* JRI_H */
/******************************************************************************/

View File

@@ -0,0 +1,565 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*******************************************************************************
* Java Runtime Interface - Machine Dependent Types
******************************************************************************/
#ifndef JRI_MD_H
#define JRI_MD_H
#include <assert.h>
#include "prtypes.h" /* Needed for HAS_LONG_LONG ifdefs */
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* WHAT'S UP WITH THIS FILE?
*
* This is where we define the mystical JRI_PUBLIC_API macro that works on all
* platforms. If you're running with Visual C++, Symantec C, or Borland's
* development environment on the PC, you're all set. Or if you're on the Mac
* with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
* matter.
*
* On UNIX though you probably care about a couple of other symbols though:
* IS_LITTLE_ENDIAN must be defined for little-endian systems
* HAVE_LONG_LONG must be defined on systems that have 'long long' integers
* HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned
* HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned
* IS_64 must be defined on 64-bit machines (like Dec Alpha)
******************************************************************************/
/* DLL Entry modifiers... */
/* PC */
#if defined(XP_OS2)
# ifdef XP_OS2_VACPP
# define JRI_PUBLIC_API(ResultType) ResultType _Optlink
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_CALLBACK
# else
# define JRI_PUBLIC_API(ResultType) ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_CALLBACK
# endif
#elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
# include <windows.h>
# if defined(_MSC_VER) || defined(__GNUC__)
# if defined(WIN32) || defined(_WIN32)
# define JRI_PUBLIC_API(ResultType) __declspec(dllexport) ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) __declspec(dllexport) VarType
# define JRI_PUBLIC_VAR_IMP(VarType) __declspec(dllimport) VarType
# define JRI_NATIVE_STUB(ResultType) __declspec(dllexport) ResultType
# define JRI_CALLBACK
# else /* !_WIN32 */
# if defined(_WINDLL)
# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
# define JRI_CALLBACK __loadds
# else /* !WINDLL */
# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_NATIVE_STUB(ResultType) ResultType __cdecl __export
# define JRI_CALLBACK __export
# endif /* !WINDLL */
# endif /* !_WIN32 */
# elif defined(__BORLANDC__)
# if defined(WIN32) || defined(_WIN32)
# define JRI_PUBLIC_API(ResultType) __export ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) __export VarType
# define JRI_PUBLIC_VAR_IMP(VarType) __import VarType
# define JRI_NATIVE_STUB(ResultType) __export ResultType
# define JRI_CALLBACK
# else /* !_WIN32 */
# define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) __cdecl __export VarType
# define JRI_PUBLIC_VAR_IMP(VarType) __cdecl __import VarType
# define JRI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
# define JRI_CALLBACK _loadds
# endif
# else
# error Unsupported PC development environment.
# endif
# ifndef IS_LITTLE_ENDIAN
# define IS_LITTLE_ENDIAN
# endif
/* Mac */
#elif defined (macintosh) || Macintosh || THINK_C
# if defined(__MWERKS__) /* Metrowerks */
# if !__option(enumsalwaysint)
# error You need to define 'Enums Always Int' for your project.
# endif
# if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
# if !__option(fourbyteints)
# error You need to define 'Struct Alignment: 68k' for your project.
# endif
# endif /* !GENERATINGCFM */
# define JRI_PUBLIC_API(ResultType) __declspec(export) ResultType
# define JRI_PUBLIC_VAR(VarType) JRI_PUBLIC_API(VarType)
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_API(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_API(VarType)
# define JRI_NATIVE_STUB(ResultType) JRI_PUBLIC_API(ResultType)
# elif defined(__SC__) /* Symantec */
# error What are the Symantec defines? (warren@netscape.com)
# elif macintosh && applec /* MPW */
# error Please upgrade to the latest MPW compiler (SC).
# else
# error Unsupported Mac development environment.
# endif
# define JRI_CALLBACK
/* Unix or else */
#else
# define JRI_PUBLIC_API(ResultType) ResultType
# define JRI_PUBLIC_VAR(VarType) VarType
# define JRI_PUBLIC_VAR_EXP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_PUBLIC_VAR_IMP(VarType) JRI_PUBLIC_VAR(VarType)
# define JRI_NATIVE_STUB(ResultType) ResultType
# define JRI_CALLBACK
#endif
#ifndef FAR /* for non-Win16 */
#define FAR
#endif
/******************************************************************************/
/* Java Scalar Types */
#if 0 /* now in jni.h */
typedef short jchar;
typedef short jshort;
typedef float jfloat;
typedef double jdouble;
typedef juint jsize;
#endif
/* moved from jni.h -- Sun's new jni.h doesn't have this anymore */
#ifdef __cplusplus
typedef class _jobject *jref;
#else
typedef struct _jobject *jref;
#endif
typedef unsigned char jbool;
typedef signed char jbyte;
#ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */
typedef unsigned int juint;
typedef int jint;
#else
typedef unsigned long juint;
typedef long jint;
#endif
/*******************************************************************************
* jlong : long long (64-bit signed integer type) support.
******************************************************************************/
/*
** Bit masking macros. (n must be <= 31 to be portable)
*/
#define JRI_BIT(n) ((juint)1 << (n))
#define JRI_BITMASK(n) (JRI_BIT(n) - 1)
#ifdef HAVE_LONG_LONG
#ifdef OSF1
/* long is default 64-bit on OSF1, -std1 does not allow long long */
typedef long jlong;
typedef unsigned long julong;
#define jlong_MAXINT 0x7fffffffffffffffL
#define jlong_MININT 0x8000000000000000L
#define jlong_ZERO 0x0L
#elif (defined(WIN32) || defined(_WIN32))
typedef LONGLONG jlong;
typedef DWORDLONG julong;
#define jlong_MAXINT 0x7fffffffffffffffi64
#define jlong_MININT 0x8000000000000000i64
#define jlong_ZERO 0x0i64
#else
typedef long long jlong;
typedef unsigned long long julong;
#define jlong_MAXINT 0x7fffffffffffffffLL
#define jlong_MININT 0x8000000000000000LL
#define jlong_ZERO 0x0LL
#endif
#define jlong_IS_ZERO(a) ((a) == 0)
#define jlong_EQ(a, b) ((a) == (b))
#define jlong_NE(a, b) ((a) != (b))
#define jlong_GE_ZERO(a) ((a) >= 0)
#define jlong_CMP(a, op, b) ((a) op (b))
#define jlong_AND(r, a, b) ((r) = (a) & (b))
#define jlong_OR(r, a, b) ((r) = (a) | (b))
#define jlong_XOR(r, a, b) ((r) = (a) ^ (b))
#define jlong_OR2(r, a) ((r) = (r) | (a))
#define jlong_NOT(r, a) ((r) = ~(a))
#define jlong_NEG(r, a) ((r) = -(a))
#define jlong_ADD(r, a, b) ((r) = (a) + (b))
#define jlong_SUB(r, a, b) ((r) = (a) - (b))
#define jlong_MUL(r, a, b) ((r) = (a) * (b))
#define jlong_DIV(r, a, b) ((r) = (a) / (b))
#define jlong_MOD(r, a, b) ((r) = (a) % (b))
#define jlong_SHL(r, a, b) ((r) = (a) << (b))
#define jlong_SHR(r, a, b) ((r) = (a) >> (b))
#define jlong_USHR(r, a, b) ((r) = (julong)(a) >> (b))
#define jlong_ISHL(r, a, b) ((r) = ((jlong)(a)) << (b))
#define jlong_L2I(i, l) ((i) = (int)(l))
#define jlong_L2UI(ui, l) ((ui) =(unsigned int)(l))
#define jlong_L2F(f, l) ((f) = (l))
#define jlong_L2D(d, l) ((d) = (l))
#define jlong_I2L(l, i) ((l) = (i))
#define jlong_UI2L(l, ui) ((l) = (ui))
#define jlong_F2L(l, f) ((l) = (f))
#define jlong_D2L(l, d) ((l) = (d))
#define jlong_UDIVMOD(qp, rp, a, b) \
(*(qp) = ((julong)(a) / (b)), \
*(rp) = ((julong)(a) % (b)))
#else /* !HAVE_LONG_LONG */
typedef struct {
#ifdef IS_LITTLE_ENDIAN
juint lo, hi;
#else
juint hi, lo;
#endif
} jlong;
typedef jlong julong;
extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO;
#define jlong_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0))
#define jlong_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo))
#define jlong_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo))
#define jlong_GE_ZERO(a) (((a).hi >> 31) == 0)
/*
* NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >).
*/
#define jlong_CMP(a, op, b) (((int32)(a).hi op (int32)(b).hi) || \
(((a).hi == (b).hi) && ((a).lo op (b).lo)))
#define jlong_UCMP(a, op, b) (((a).hi op (b).hi) || \
(((a).hi == (b).hi) && ((a).lo op (b).lo)))
#define jlong_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \
(r).hi = (a).hi & (b).hi)
#define jlong_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \
(r).hi = (a).hi | (b).hi)
#define jlong_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \
(r).hi = (a).hi ^ (b).hi)
#define jlong_OR2(r, a) ((r).lo = (r).lo | (a).lo, \
(r).hi = (r).hi | (a).hi)
#define jlong_NOT(r, a) ((r).lo = ~(a).lo, \
(r).hi = ~(a).hi)
#define jlong_NEG(r, a) ((r).lo = -(int32)(a).lo, \
(r).hi = -(int32)(a).hi - ((r).lo != 0))
#define jlong_ADD(r, a, b) { \
jlong _a, _b; \
_a = a; _b = b; \
(r).lo = _a.lo + _b.lo; \
(r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \
}
#define jlong_SUB(r, a, b) { \
jlong _a, _b; \
_a = a; _b = b; \
(r).lo = _a.lo - _b.lo; \
(r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \
} \
/*
* Multiply 64-bit operands a and b to get 64-bit result r.
* First multiply the low 32 bits of a and b to get a 64-bit result in r.
* Then add the outer and inner products to r.hi.
*/
#define jlong_MUL(r, a, b) { \
jlong _a, _b; \
_a = a; _b = b; \
jlong_MUL32(r, _a.lo, _b.lo); \
(r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \
}
/* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */
#define _jlong_lo16(a) ((a) & JRI_BITMASK(16))
#define _jlong_hi16(a) ((a) >> 16)
/*
* Multiply 32-bit operands a and b to get 64-bit result r.
* Use polynomial expansion based on primitive field element (1 << 16).
*/
#define jlong_MUL32(r, a, b) { \
juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \
_a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a); \
_b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b); \
_y0 = _a0 * _b0; \
_y1 = _a0 * _b1; \
_y2 = _a1 * _b0; \
_y3 = _a1 * _b1; \
_y1 += _jlong_hi16(_y0); /* can't carry */ \
_y1 += _y2; /* might carry */ \
if (_y1 < _y2) _y3 += 1 << 16; /* propagate */ \
(r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0); \
(r).hi = _y3 + _jlong_hi16(_y1); \
}
/*
* Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp
* to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder.
* Minimize effort if one of qp and rp is null.
*/
#define jlong_UDIVMOD(qp, rp, a, b) jlong_udivmod(qp, rp, a, b)
extern JRI_PUBLIC_API(void)
jlong_udivmod(julong *qp, julong *rp, julong a, julong b);
#define jlong_DIV(r, a, b) { \
jlong _a, _b; \
juint _negative = (int32)(a).hi < 0; \
if (_negative) { \
jlong_NEG(_a, a); \
} else { \
_a = a; \
} \
if ((int32)(b).hi < 0) { \
_negative ^= 1; \
jlong_NEG(_b, b); \
} else { \
_b = b; \
} \
jlong_UDIVMOD(&(r), 0, _a, _b); \
if (_negative) \
jlong_NEG(r, r); \
}
#define jlong_MOD(r, a, b) { \
jlong _a, _b; \
juint _negative = (int32)(a).hi < 0; \
if (_negative) { \
jlong_NEG(_a, a); \
} else { \
_a = a; \
} \
if ((int32)(b).hi < 0) { \
jlong_NEG(_b, b); \
} else { \
_b = b; \
} \
jlong_UDIVMOD(0, &(r), _a, _b); \
if (_negative) \
jlong_NEG(r, r); \
}
/*
* NB: b is a juint, not jlong or julong, for the shift ops.
*/
#define jlong_SHL(r, a, b) { \
if (b) { \
jlong _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = _a.lo << (b); \
(r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b))); \
} else { \
(r).lo = 0; \
(r).hi = _a.lo << ((b) & 31); \
} \
} else { \
(r) = (a); \
} \
}
/* a is an int32, b is int32, r is jlong */
#define jlong_ISHL(r, a, b) { \
if (b) { \
jlong _a; \
_a.lo = (a); \
_a.hi = 0; \
if ((b) < 32) { \
(r).lo = (a) << (b); \
(r).hi = ((a) >> (32 - (b))); \
} else { \
(r).lo = 0; \
(r).hi = (a) << ((b) & 31); \
} \
} else { \
(r).lo = (a); \
(r).hi = 0; \
} \
}
#define jlong_SHR(r, a, b) { \
if (b) { \
jlong _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \
(r).hi = (int32)_a.hi >> (b); \
} else { \
(r).lo = (int32)_a.hi >> ((b) & 31); \
(r).hi = (int32)_a.hi >> 31; \
} \
} else { \
(r) = (a); \
} \
}
#define jlong_USHR(r, a, b) { \
if (b) { \
jlong _a; \
_a = a; \
if ((b) < 32) { \
(r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \
(r).hi = _a.hi >> (b); \
} else { \
(r).lo = _a.hi >> ((b) & 31); \
(r).hi = 0; \
} \
} else { \
(r) = (a); \
} \
}
#define jlong_L2I(i, l) ((i) = (l).lo)
#define jlong_L2UI(ui, l) ((ui) = (l).lo)
#define jlong_L2F(f, l) { double _d; jlong_L2D(_d, l); (f) = (float) _d; }
#define jlong_L2D(d, l) { \
int32 _negative; \
jlong _absval; \
\
_negative = (l).hi >> 31; \
if (_negative) { \
jlong_NEG(_absval, l); \
} else { \
_absval = l; \
} \
(d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \
if (_negative) \
(d) = -(d); \
}
#define jlong_I2L(l, i) ((l).hi = (i) >> 31, (l).lo = (i))
#define jlong_UI2L(l, ui) ((l).hi = 0, (l).lo = (ui))
#define jlong_F2L(l, f) { double _d = (double) f; jlong_D2L(l, _d); }
#define jlong_D2L(l, d) { \
int _negative; \
double _absval, _d_hi; \
jlong _lo_d; \
\
_negative = ((d) < 0); \
_absval = _negative ? -(d) : (d); \
\
(l).hi = (juint)(_absval / 4.294967296e9); \
(l).lo = 0; \
jlong_L2D(_d_hi, l); \
_absval -= _d_hi; \
_lo_d.hi = 0; \
if (_absval < 0) { \
_lo_d.lo = (juint) -_absval; \
jlong_SUB(l, l, _lo_d); \
} else { \
_lo_d.lo = (juint) _absval; \
jlong_ADD(l, l, _lo_d); \
} \
\
if (_negative) \
jlong_NEG(l, l); \
}
#endif /* !HAVE_LONG_LONG */
/******************************************************************************/
#ifdef HAVE_ALIGNED_LONGLONGS
#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
((_t).x[1] = ((jint*)(_addr))[1]), \
(_t).l )
#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \
((jint*)(_addr))[0] = (_t).x[0], \
((jint*)(_addr))[1] = (_t).x[1] )
#else
#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr))
#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v))
#endif
/* If double's must be aligned on doubleword boundaries then define this */
#ifdef HAVE_ALIGNED_DOUBLES
#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
((_t).x[1] = ((jint*)(_addr))[1]), \
(_t).d )
#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \
((jint*)(_addr))[0] = (_t).x[0], \
((jint*)(_addr))[1] = (_t).x[1] )
#else
#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr))
#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v))
#endif
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* JRI_MD_H */
/******************************************************************************/

View File

@@ -0,0 +1,243 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*******************************************************************************
* Java Runtime Interface
******************************************************************************/
#ifndef JRITYPES_H
#define JRITYPES_H
#include "jri_md.h"
#include "jni.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* Types
******************************************************************************/
struct JRIEnvInterface;
typedef void* JRIRef;
typedef void* JRIGlobalRef;
typedef jint JRIFieldID;
typedef jint JRIMethodID;
/* synonyms: */
typedef JRIGlobalRef jglobal;
typedef union JRIValue {
jbool z;
jbyte b;
jchar c;
jshort s;
jint i;
jlong l;
jfloat f;
jdouble d;
jref r;
} JRIValue;
typedef enum JRIBoolean {
JRIFalse = 0,
JRITrue = 1
} JRIBoolean;
typedef enum JRIConstant {
JRIUninitialized = -1
} JRIConstant;
/* convenience types (these must be distinct struct types for c++ overloading): */
#if 0 /* now in jni.h */
typedef struct jbooleanArrayStruct* jbooleanArray;
typedef struct jbyteArrayStruct* jbyteArray;
typedef struct jcharArrayStruct* jcharArray;
typedef struct jshortArrayStruct* jshortArray;
typedef struct jintArrayStruct* jintArray;
typedef struct jlongArrayStruct* jlongArray;
typedef struct jfloatArrayStruct* jfloatArray;
typedef struct jdoubleArrayStruct* jdoubleArray;
typedef struct jobjectArrayStruct* jobjectArray;
#endif
typedef struct jstringArrayStruct* jstringArray;
typedef struct jarrayArrayStruct* jarrayArray;
#define JRIConstructorMethodName "<init>"
/*******************************************************************************
* Signature Construction Macros
******************************************************************************/
/*
** These macros can be used to construct signature strings. Hopefully their names
** are a little easier to remember than the single character they correspond to.
** For example, to specify the signature of the method:
**
** public int read(byte b[], int off, int len);
**
** you could write something like this in C:
**
** char* readSig = JRISigMethod(JRISigArray(JRISigByte)
** JRISigInt
** JRISigInt) JRISigInt;
**
** Of course, don't put commas between the types.
*/
#define JRISigArray(T) "[" T
#define JRISigByte "B"
#define JRISigChar "C"
#define JRISigClass(name) "L" name ";"
#define JRISigFloat "F"
#define JRISigDouble "D"
#define JRISigMethod(args) "(" args ")"
#define JRISigNoArgs ""
#define JRISigInt "I"
#define JRISigLong "J"
#define JRISigShort "S"
#define JRISigVoid "V"
#define JRISigBoolean "Z"
/*******************************************************************************
* Environments
******************************************************************************/
extern JRI_PUBLIC_API(const struct JRIEnvInterface**)
JRI_GetCurrentEnv(void);
/*******************************************************************************
* Specific Scalar Array Types
******************************************************************************/
/*
** The JRI Native Method Interface does not support boolean arrays. This
** is to allow Java runtime implementations to optimize boolean array
** storage. Using the ScalarArray operations on boolean arrays is bound
** to fail, so convert any boolean arrays to byte arrays in Java before
** passing them to a native method.
*/
#define JRI_NewByteArray(env, length, initialValues) \
JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues))
#define JRI_GetByteArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetByteArrayElements(env, array) \
JRI_GetScalarArrayElements(env, array)
#define JRI_NewCharArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues))
#define JRI_GetCharArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetCharArrayElements(env, array) \
((jchar*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewShortArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues))
#define JRI_GetShortArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetShortArrayElements(env, array) \
((jshort*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewIntArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues))
#define JRI_GetIntArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetIntArrayElements(env, array) \
((jint*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewLongArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues))
#define JRI_GetLongArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetLongArrayElements(env, array) \
((jlong*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewFloatArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues))
#define JRI_GetFloatArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetFloatArrayElements(env, array) \
((jfloat*)JRI_GetScalarArrayElements(env, array))
#define JRI_NewDoubleArray(env, length, initialValues) \
JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues))
#define JRI_GetDoubleArrayLength(env, array) \
JRI_GetScalarArrayLength(env, array)
#define JRI_GetDoubleArrayElements(env, array) \
((jdouble*)JRI_GetScalarArrayElements(env, array))
/******************************************************************************/
/*
** JDK Stuff -- This stuff is still needed while we're using the JDK
** dynamic linking strategy to call native methods.
*/
typedef union JRI_JDK_stack_item {
/* Non pointer items */
jint i;
jfloat f;
jint o;
/* Pointer items */
void *h;
void *p;
unsigned char *addr;
#ifdef IS_64
double d;
long l; /* == 64bits! */
#endif
} JRI_JDK_stack_item;
typedef union JRI_JDK_Java8Str {
jint x[2];
jdouble d;
jlong l;
void *p;
float f;
} JRI_JDK_Java8;
/******************************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* JRITYPES_H */
/******************************************************************************/

View File

@@ -0,0 +1,254 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_aix_defs_h___
#define nspr_aix_defs_h___
#include <sys/types.h>
#if defined(_PR_PTHREADS) || defined(PTHREADS_USER)
#include <pthread.h>
#endif
/*
* To pick up fd_set and the poll events.
*/
#include <sys/select.h>
#include <sys/poll.h>
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "aix"
#define _PR_SI_SYSNAME "AIX"
#define _PR_SI_ARCHITECTURE "rs6000"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
#define _MD_MINIMUM_STACK_SIZE (2*65536L)
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define NEED_TIME_R
#undef HAVE_STACK_GROWING_UP
#undef HAVE_WEAK_IO_SYMBOLS
#undef HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETHOSTBYNAME2
#define _PR_HAVE_GETADDRINFO
#endif
#define _PR_HAVE_SYSV_SEMAPHORES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#define _PR_ACCEPT_INHERIT_NONBLOCK
/* Timer operations */
#if defined(AIX_TIMERS)
extern PRIntervalTime _MD_AixGetInterval(void);
#define _MD_GET_INTERVAL _MD_AixGetInterval
extern PRIntervalTime _MD_AixIntervalPerSec(void);
#define _MD_INTERVAL_PER_SEC _MD_AixIntervalPerSec
#else /* defined(AIX_TIMERS) */
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#endif /* defined(AIX_TIMERS) */
#ifdef AIX_HAVE_ATOMIC_OP_H
/* The atomic operations */
#include <sys/atomic_op.h>
#define _PR_HAVE_ATOMIC_OPS
#ifndef IS_64
#define _PR_HAVE_ATOMIC_CAS
#endif
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val) ((PRInt32)fetch_and_add((atomic_p)val, 1) + 1)
#define _MD_ATOMIC_ADD(ptr, val) ((PRInt32)fetch_and_add((atomic_p)ptr, val) + val)
#define _MD_ATOMIC_DECREMENT(val) ((PRInt32)fetch_and_add((atomic_p)val, -1) - 1)
#define _MD_ATOMIC_SET(val, newval) _AIX_AtomicSet(val, newval)
#endif /* AIX_HAVE_ATOMIC_OP_H */
#define USE_SETJMP
#include <setjmp.h>
#define _MD_GET_SP(_t) (_t)->md.jb[3]
#define _MD_SET_THR_SP(_t, _sp) ((_t)->md.jb[3] = (int) (_sp - 2 * 64))
#define PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.jb)
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
#ifdef PTHREADS_USER
#include "_nspr_pthread.h"
#else
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
(*_main)(); \
} \
_MD_GET_SP(_thread) = (int) (_sp - 2 * 64); \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
jmp_buf jb;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#if !defined(_PR_PTHREADS)
#define _MD_INIT_LOCKS()
#endif
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
#endif /* PTHREADS_USER */
#ifdef AIX_RENAME_SELECT
#define _MD_SELECT select
#define _MD_POLL poll
#endif
extern void _MD_aix_map_sendfile_error(int err);
#endif /* nspr_aix_defs_h___ */

View File

@@ -0,0 +1,613 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_beos_defs_h___
#define nspr_beos_defs_h___
#include "prtypes.h"
#include "prio.h"
#include "prthread.h"
#include "prproces.h"
#include "prmem.h"
#include "obsolete/prsem.h"
#include <errno.h>
#include <support/SupportDefs.h>
#include <kernel/OS.h>
#include <dirent.h>
/*
* Internal configuration macros
*/
#ifdef BONE_VERSION
#define _PR_HAVE_SOCKADDR_LEN
#endif
#define PR_LINKER_ARCH "beos"
#define _PR_SI_SYSNAME "BEOS"
#ifdef __powerpc__
#define _PR_SI_ARCHITECTURE "ppc"
#else
#define _PR_SI_ARCHITECTURE "x86"
#endif
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define _PR_NO_CLOCK_TIMER
/*
* The Atomic operations
*/
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC _MD_AtomicInit
#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
#define _MD_ATOMIC_ADD _MD_AtomicAdd
#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
#define _MD_ATOMIC_SET _MD_AtomicSet
#define HAVE_CVAR_BUILT_ON_SEM
#define _PR_GLOBAL_THREADS_ONLY
#define _PR_BTHREADS
#define _PR_NEED_FAKE_POLL
#define _PR_HAVE_PEEK_BUFFER
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
#define _PR_CONNECT_DOES_NOT_BIND
#define _PR_HAVE_O_APPEND
/* Define threading functions and objects as native BeOS */
struct _MDThread {
thread_id tid; /* BeOS thread handle */
sem_id joinSem; /* sems used to synchronzie joining */
PRBool is_joining; /* TRUE if someone is currently waiting to
join this thread */
};
struct _MDThreadStack {
PRInt8 notused;
};
/*
* Lock and Semaphore related definitions
*/
struct _MDLock {
sem_id semaphoreID;
int32 benaphoreCount;
};
struct _MDCVar {
sem_id sem1;
sem_id sem2;
int16 count;
};
struct _MDSemaphore {
sem_id sid;
};
/*
** CPU-related definitions
*/
struct _MDCPU {
int8 unused;
};
/*
** Process-related definitions
*/
struct _MDProcess {
pid_t pid;
};
struct _MDSegment {
PRInt8 notused;
};
/*
** File- and directory-related definitions
*/
#ifndef BONE_VERSION
#define BE_SOCK_SHUTDOWN_READ 0x01
#define BE_SOCK_SHUTDOWN_WRITE 0x02
#endif
struct _MDFileDesc {
PRInt32 osfd;
PRInt32 sock_state;
PRBool accepted_socket;
PRNetAddr peer_addr;
#ifndef BONE_VERSION
PRBool connectValueValid;
int connectReturnValue;
int connectReturnError;
#endif
};
struct _MDDir {
DIR *d;
};
#define PR_DIRECTORY_SEPARATOR '/'
#define PR_DIRECTORY_SEPARATOR_STR "/"
#define PR_PATH_SEPARATOR ':'
#define PR_PATH_SEPARATOR_STR ":"
#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
/* --- Memory-mapped files stuff --- not implemented on BeOS */
struct _MDFileMap {
PRInt8 unused;
};
/*
* Network related definitions.
*/
#ifndef BONE_VERSION
#define IPPROTO_IP 0
#define AF_UNIX 2
#define TCP_NODELAY SO_NONBLOCK
#define SO_LINGER -1
#define SO_ERROR 4
#endif
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
#ifndef BONE_VERSION
/* these aren't actually used. if they are, we're screwed */
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
struct protoent* getprotobyname(const char* name);
struct protoent* getprotobynumber(int number);
#endif
/*
* malloc() related definitions.
*/
#undef _PR_OVERRIDE_MALLOC
/* Miscellaneous */
#define _MD_ERRNO() (errno)
#define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
#define _MD_EXIT _MD_exit
#define _MD_GET_ENV getenv
#define _MD_PUT_ENV putenv
#define _MD_EARLY_INIT _MD_early_init
#define _MD_FINAL_INIT _MD_final_init
/* CPU Stuff */
#define _MD_INIT_CPUS _MD_init_cpus
#define _MD_WAKEUP_CPUS _MD_wakeup_cpus
#define _MD_START_INTERRUPTS _MD_start_interrupts
#define _MD_STOP_INTERRUPTS _MD_stop_interrupts
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
#define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
#define _MD_INIT_STACK _MD_init_stack
#define _MD_CLEAR_STACK _MD_clear_stack
// #define _MD_GET_INTSOFF _MD_get_intsoff
// #define _MD_SET_INTSOFF _MD_set_intsoff
#define _MD_CURRENT_CPU _MD_current_cpu
#define _MD_SET_CURRENT_CPU _MD_set_current_cpu
#define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
#define _MD_PAUSE_CPU _MD_pause_cpu
/* Thread stuff */
#define _MD_CURRENT_THREAD() PR_GetCurrentThread()
// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
#define _MD_LAST_THREAD _MD_last_thread
#define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
#define _MD_SET_LAST_THREAD _MD_set_last_thread
#define _MD_INIT_THREAD _MD_init_thread
#define _MD_EXIT_THREAD _MD_exit_thread
#define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
#define _MD_SUSPEND_THREAD _MD_suspend_thread
#define _MD_RESUME_THREAD _MD_resume_thread
#define _MD_SUSPEND_CPU _MD_suspend_cpu
#define _MD_RESUME_CPU _MD_resume_cpu
#define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
#define _MD_END_SUSPEND_ALL _MD_end_suspend_all
#define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
#define _MD_END_RESUME_ALL _MD_end_resume_all
#define _MD_GET_SP _MD_get_sp
#define _MD_CLEAN_THREAD _MD_clean_thread
#define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
#define _MD_CREATE_USER_THREAD _MD_create_user_thread
#define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
#define _MD_CREATE_THREAD _MD_create_thread
#define _MD_YIELD _MD_yield
#define _MD_SET_PRIORITY _MD_set_priority
#define _MD_SUSPENDALL _MD_suspendall
#define _MD_RESUMEALL _MD_resumeall
#define _MD_SWITCH_CONTEXT _MD_switch_context
#define _MD_RESTORE_CONTEXT _MD_restore_context
#define _MD_WAIT _MD_wait
#define _MD_WAKEUP_WAITER _MD_wakeup_waiter
#define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
#define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
/* Thread Synchronization */
#define _MD_INIT_LOCKS _MD_init_locks
#define _MD_NEW_LOCK _MD_new_lock
#define _MD_FREE_LOCK _MD_free_lock
#define _MD_LOCK _MD_lock
#define _MD_TEST_AND_LOCK _MD_test_and_lock
#define _MD_UNLOCK _MD_unlock
#define _MD_IOQ_LOCK _MD_ioq_lock
#define _MD_IOQ_UNLOCK _MD_ioq_unlock
#define _MD_NEW_SEM _MD_new_sem
#define _MD_DESTROY_SEM _MD_destroy_sem
#define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
#define _MD_WAIT_SEM _MD_wait_sem
#define _MD_POST_SEM _MD_post_sem
// #define _MD_NEW_CV _MD_new_cv
// #define _MD_FREE_CV _MD_free_cv
// #define _MD_WAIT_CV _MD_wait_cv
// #define _MD_NOTIFY_CV _MD_notify_cv
// #define _MD_NOTIFYALL_CV _MD_notifyall_cv
/* File I/O */
/* don't need any I/O initializations */
#define _MD_INIT_IO()
#define _MD_INIT_FILEDESC(fd)
#define _MD_OPEN_DIR _MD_open_dir
#define _MD_READ_DIR _MD_read_dir
#define _MD_CLOSE_DIR _MD_close_dir
#define _MD_MAKE_NONBLOCK _MD_make_nonblock
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
#define _MD_OPEN _MD_open
#define _MD_OPEN_FILE _MD_open
#define _MD_CLOSE_FILE _MD_close_file
#define _MD_READ _MD_read
#define _MD_WRITE _MD_write
#define _MD_WRITEV _MD_writev
#define _MD_LSEEK _MD_lseek
#define _MD_LSEEK64 _MD_lseek64
#define _MD_FSYNC _MD_fsync
#define _MD_DELETE _MD_delete
#define _MD_GETFILEINFO _MD_getfileinfo
#define _MD_GETFILEINFO64 _MD_getfileinfo64
#define _MD_GETOPENFILEINFO _MD_getopenfileinfo
#define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
#define _MD_RENAME _MD_rename
#define _MD_ACCESS _MD_access
#define _MD_STAT stat
#define _MD_MKDIR _MD_mkdir
#define _MD_MAKE_DIR _MD_mkdir
#define _MD_RMDIR _MD_rmdir
#define _MD_PR_POLL _MD_pr_poll
/* Network I/O */
#define _MD_CLOSE_SOCKET _MD_close_socket
#define _MD_CONNECT _MD_connect
#define _MD_ACCEPT _MD_accept
#define _MD_BIND _MD_bind
#define _MD_LISTEN _MD_listen
#define _MD_SHUTDOWN _MD_shutdown
#define _MD_RECV _MD_recv
#define _MD_SEND _MD_send
#define _MD_ACCEPT_READ _MD_accept_read
#define _MD_GETSOCKNAME _MD_getsockname
#define _MD_GETPEERNAME _MD_getpeername
#define _MD_GETSOCKOPT _MD_getsockopt
#define _MD_SETSOCKOPT _MD_setsockopt
#define _MD_RECVFROM _MD_recvfrom
#define _MD_SENDTO _MD_sendto
#define _MD_SOCKETPAIR _MD_socketpair
#define _MD_SOCKET _MD_socket
#define _MD_SOCKETAVAILABLE _MD_socketavailable
#define _MD_PIPEAVAILABLE _MD_socketavailable
#define _MD_GET_SOCKET_ERROR() (errno)
#define _MD_GETHOSTNAME _MD_gethostname
#define _MD_SELECT select
/* Process management */
#define _MD_CREATE_PROCESS _MD_create_process
#define _MD_DETACH_PROCESS _MD_detach_process
#define _MD_WAIT_PROCESS _MD_wait_process
#define _MD_KILL_PROCESS _MD_kill_process
/* Atomic data operations */
// #define _MD_INIT_ATOMIC _MD_init_atomic
// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
// #define _MD_ATOMIC_SET _MD_atomic_set
/* memory management */
#define _MD_INIT_SEGS _MD_init_segs
#define _MD_ALLOC_SEGMENT _MD_alloc_segment
#define _MD_FREE_SEGMENT _MD_free_segment
/* Memory mapped file I/O */
#define _MD_CREATE_FILE_MAP _MD_create_file_map
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment
#define _MD_MEM_MAP _MD_mem_map
#define _MD_MEM_UNMAP _MD_mem_unmap
#define _MD_CLOSE_FILE_MAP _MD_close_file_map
/* Time related */
#define _MD_NOW _MD_now
#define _MD_INTERVAL_INIT _MD_interval_init
#define _MD_GET_INTERVAL _MD_get_interval
#define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
/* File locking */
#define _MD_LOCKFILE _MD_lockfile
#define _MD_TLOCKFILE _MD_tlockfile
#define _MD_UNLOCKFILE _MD_unlockfile
/**
* Prototypes for machine dependent function implementations. (Too bad
* NSPR's MD system blows so much that we have to reiterate every stinking
* thing we implement here in our MD header file.)
*/
/* Miscellaneous */
NSPR_API(void) _MD_cleanup_before_exit(void);
NSPR_API(void) _MD_exit(PRIntn status);
NSPR_API(char*) _MD_get_env(const char *name);
NSPR_API(PRIntn) _MD_put_env(const char *name);
NSPR_API(void) _MD_early_init(void);
NSPR_API(void) _MD_final_init(void);
/* CPU Stuff */
NSPR_API(void) _MD_init_cpus();
NSPR_API(void) _MD_wakeup_cpus();
NSPR_API(void) _MD_start_interrupts(void);
NSPR_API(void) _MD_stop_interrupts(void);
NSPR_API(void) _MD_disable_clock_interrupts(void);
NSPR_API(void) _MD_block_clock_interrupts(void);
NSPR_API(void) _MD_unblock_clock_interrupts(void);
NSPR_API(void) _MD_clock_interrupt(void);
// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
// NSPR_API(PRInt32) _MD_get_intsoff(void);
// NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
// NSPR_API(_PRCPU*) _MD_current_cpu(void);
// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
/* Thread stuff */
// NSPR_API(PRThread*) _MD_current_thread(void);
NSPR_API(PRThread*) _MD_get_attached_thread(void);
NSPR_API(PRThread*) _MD_last_thread(void);
NSPR_API(void) _MD_set_current_thread(PRThread *thread);
NSPR_API(void) _MD_set_last_thread(PRThread *thread);
NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
NSPR_API(void) _MD_exit_thread(PRThread *thread);
NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
NSPR_API(void) _MD_suspend_thread(PRThread *thread);
NSPR_API(void) _MD_resume_thread(PRThread *thread);
// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
NSPR_API(void) _MD_begin_suspend_all(void);
NSPR_API(void) _MD_end_suspend_all(void);
NSPR_API(void) _MD_begin_resume_all(void);
NSPR_API(void) _MD_end_resume_all(void);
NSPR_API(void *) _MD_get_sp(PRThread *thread);
NSPR_API(void) _MD_clean_thread(PRThread *thread);
NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
NSPR_API(void) _MD_yield(void);
NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
NSPR_API(void) _MD_suspendall(void);
NSPR_API(void) _MD_resumeall(void);
NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
NSPR_API(void) _MD_switch_context(PRThread *thread);
NSPR_API(void) _MD_restore_context(PRThread *thread);
NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
/* Thread Synchronization */
NSPR_API(void) _MD_init_locks(void);
NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
NSPR_API(void) _MD_free_lock(struct _MDLock *md);
NSPR_API(void) _MD_lock(struct _MDLock *md);
NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
NSPR_API(void) _MD_unlock(struct _MDLock *md);
NSPR_API(void) _MD_ioq_lock(void);
NSPR_API(void) _MD_ioq_unlock(void);
NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
// NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
/* File I/O */
// NSPR_API(void) _MD_init_io(void);
NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
NSPR_API(PRInt32) _MD_delete(const char *name);
NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
NSPR_API(PRInt32) _MD_rmdir(const char *name);
NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
/* Network I/O */
NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
// NSPR_API(PRInt32) _MD_fast_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
// NSPR_API(PRInt32) _MD_get_socket_error(void);
NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
/* Process management */
NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
/* Atomic data operations */
// NSPR_API(void) _MD_init_atomic(void);
// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
/* Memory management */
NSPR_API(void) _MD_init_segs(void);
NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
NSPR_API(void) _MD_free_segment(PRSegment *seg);
/* Memory mapped file I/O */
NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
/* Time related */
NSPR_API(PRTime) _MD_now(void);
NSPR_API(void) _MD_interval_init(void);
NSPR_API(PRIntervalTime) _MD_get_interval(void);
NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
/* File locking */
NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
#endif /* _nspr_beos_defs_h___*/

View File

@@ -0,0 +1,214 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_bsdi_defs_h___
#define nspr_bsdi_defs_h___
/*
* Internal configuration macros
*/
#include <sys/param.h> /* for _BSDI_VERSION */
#define PR_LINKER_ARCH "bsdi"
#define _PR_SI_SYSNAME "BSDI"
#if defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
#elif defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#else
#error "Unknown CPU architecture"
#endif
#define PR_DLL_SUFFIX ".so"
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define HAVE_BSD_FLOCK
#define NEED_TIME_R
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_NO_LARGE_FILES
#define USE_SETJMP
/* BSD/OS 4.3 and newer all have IPv6 support */
#if _BSDI_VERSION >= 200105
#define _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#endif
#ifndef _PR_PTHREADS
#include <setjmp.h>
#if defined(_PR_BSDI_JMPBUF_IS_ARRAY)
#define _MD_GET_SP(_t) (_t)->md.context[2]
#elif defined(_PR_BSDI_JMPBUF_IS_STRUCT)
#define _MD_GET_SP(_t) (_t)->md.context[0].jb_esp
#else
#error "Unknown BSDI jmp_buf type"
#endif
#define PR_NUM_GCREGS _JBLEN
#define PR_CONTEXT_TYPE jmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
_main(); \
} \
_MD_GET_SP(_thread) = (int) (_sp - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
#endif /* ! _PR_PTHREADS */
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#include <sys/syscall.h>
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#endif /* nspr_bsdi_defs_h___ */

View File

@@ -0,0 +1,276 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_darwin_defs_h___
#define nspr_darwin_defs_h___
#include "prthread.h"
#include <sys/syscall.h>
#ifdef XP_MACOSX
#include <AvailabilityMacros.h>
#endif
#define PR_LINKER_ARCH "darwin"
#define _PR_SI_SYSNAME "DARWIN"
#ifdef i386
#define _PR_SI_ARCHITECTURE "x86"
#else
#define _PR_SI_ARCHITECTURE "ppc"
#endif
#define PR_DLL_SUFFIX ".dylib"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_MACH_DYLD
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_NO_LARGE_FILES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#define _PR_INET6
/*
* I'd prefer to use getipnodebyname and getipnodebyaddr but the
* getipnodebyname(3) man page on Mac OS X 10.2 says they are not
* thread-safe. AI_V4MAPPED|AI_ADDRCONFIG doesn't work either.
*/
#define _PR_HAVE_GETHOSTBYNAME2
#define _PR_HAVE_GETADDRINFO
/*
* On Mac OS X 10.2, gethostbyaddr fails with h_errno=NO_RECOVERY
* if you pass an IPv4-mapped IPv6 address to it.
*/
#define _PR_GHBA_DISALLOW_V4MAPPED
#ifdef XP_MACOSX
#if !defined(MAC_OS_X_VERSION_10_3) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
/*
* socket(AF_INET6) fails with EPROTONOSUPPORT on Mac OS X 10.1.
* IPv6 under OS X 10.2 and below is not complete (see bug 222031).
*/
#define _PR_INET6_PROBE
#endif /* DT < 10.3 */
#if defined(MAC_OS_X_VERSION_10_2) && \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2
/* Mac OS X 10.2 has inet_ntop and inet_pton. */
#define _PR_HAVE_INET_NTOP
#endif /* DT >= 10.2 */
#endif /* XP_MACOSX */
#define _PR_IPV6_V6ONLY_PROBE
/* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */
#ifndef IPV6_V6ONLY
#define IPV6_V6ONLY 27
#endif
#if defined(__ppc__)
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
extern PRInt32 _PR_DarwinPPC_AtomicIncrement(PRInt32 *val);
#define _MD_ATOMIC_INCREMENT(val) _PR_DarwinPPC_AtomicIncrement(val)
extern PRInt32 _PR_DarwinPPC_AtomicDecrement(PRInt32 *val);
#define _MD_ATOMIC_DECREMENT(val) _PR_DarwinPPC_AtomicDecrement(val)
extern PRInt32 _PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_ATOMIC_SET(val, newval) _PR_DarwinPPC_AtomicSet(val, newval)
extern PRInt32 _PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val);
#define _MD_ATOMIC_ADD(ptr, val) _PR_DarwinPPC_AtomicAdd(ptr, val)
#endif /* __ppc__ */
#define USE_SETJMP
#if !defined(_PR_PTHREADS)
#include <setjmp.h>
#define PR_CONTEXT_TYPE jmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
#define PR_NUM_GCREGS _JBLEN
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
_main(); \
} \
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
extern PRStatus _MD_InitializeThread(PRThread *thread);
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
extern PRStatus _MD_CREATE_THREAD(
PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
extern void _MD_YIELD(void);
#endif /* ! _PR_PTHREADS */
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
extern void _MD_EarlyInit(void);
extern PRIntervalTime _PR_UNIX_GetInterval(void);
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
/* For writev() */
#include <sys/uio.h>
#endif /* nspr_darwin_defs_h___ */

View File

@@ -0,0 +1,221 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_dgux_defs_h___
#define nspr_dgux_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "dgux"
#define _PR_SI_SYSNAME "DGUX"
#define _PR_SI_ARCHITECTURE "x86"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#undef HAVE_STACK_GROWING_UP
#define HAVE_NETCONFIG
#define HAVE_DLL
#define USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define _PR_NEED_STRCASECMP
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define USE_SETJMP
#include <setjmp.h>
#define _SETJMP setjmp
#define _LONGJMP longjmp
#define _PR_CONTEXT_TYPE jmp_buf
#define _MD_GET_SP(_t) (_t)->md.context[4]
#define _PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_SETJMP(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_LONGJMP(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures.
* Don't use SVR4 native threads (yet).
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
* The following are copied from _sunos.h, _aix.h. This means
* some of them should probably be moved into _unixos.h. But
* _irix.h seems to be quite different in regard to these macros.
*/
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *execptfds, struct timeval *timeout);
#define _MD_SELECT _select
#define _MD_POLL _poll
#include <poll.h>
#include <stropts.h>
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
#endif /* nspr_dgux_defs_h___ */

View File

@@ -0,0 +1,278 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_freebsd_defs_h___
#define nspr_freebsd_defs_h___
#include "prthread.h"
#if __FreeBSD__ >= 2
#include <osreldate.h> /* for __FreeBSD_version */
#endif
#include <sys/syscall.h>
#define PR_LINKER_ARCH "freebsd"
#define _PR_SI_SYSNAME "FREEBSD"
#if defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
#elif defined(__alpha__)
#define _PR_SI_ARCHITECTURE "alpha"
#elif defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__ia64__)
#define _PR_SI_ARCHITECTURE "ia64"
#elif defined(__amd64__)
#define _PR_SI_ARCHITECTURE "amd64"
#else
#error "Unknown CPU architecture"
#endif
#if defined(__ELF__)
#define PR_DLL_SUFFIX ".so"
#else
#define PR_DLL_SUFFIX ".so.1.0"
#endif
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_NO_LARGE_FILES
#if defined(_PR_PTHREADS)
#if __FreeBSD_version >= 400008
/*
* libc_r before this version of FreeBSD doesn't have poll().
* Although libc has poll(), it is not thread-safe so we can't
* use it in the pthreads version.
*/
#define _PR_POLL_AVAILABLE
#endif
#else
#if __FreeBSD_version >= 300000
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#endif
#endif
#define _PR_HAVE_SYSV_SEMAPHORES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#if __FreeBSD_version >= 400014
#define _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETHOSTBYNAME2
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#define _PR_IPV6_V6ONLY_PROBE
#endif
#define USE_SETJMP
#ifndef _PR_PTHREADS
#include <setjmp.h>
#define PR_CONTEXT_TYPE sigjmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#define _MD_GET_SP(_th) (_th)->md.context[0]._sjb[2]
#define PR_NUM_GCREGS _JBLEN
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (sigsetjmp(CONTEXT(_thread), 1)) { \
_main(); \
} \
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
siglongjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
extern PRStatus _MD_InitializeThread(PRThread *thread);
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
extern PRStatus _MD_CREATE_THREAD(
PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
extern void _MD_YIELD(void);
#endif /* ! _PR_PTHREADS */
extern void _MD_EarlyInit(void);
extern PRIntervalTime _PR_UNIX_GetInterval(void);
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
#if defined(_PR_POLL_AVAILABLE)
#include <poll.h>
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
#endif
/* freebsd has INADDR_LOOPBACK defined, but in /usr/include/rpc/types.h, and I didn't
want to be including that.. */
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK (u_long)0x7F000001
#endif
/* For writev() */
#include <sys/uio.h>
#endif /* nspr_freebsd_defs_h___ */

View File

@@ -0,0 +1,257 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_xhppa_defs_h___
#define nspr_xhppa_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "hpux"
#define _PR_SI_SYSNAME "HPUX"
#define _PR_SI_ARCHITECTURE "hppa1.1"
#define PR_DLL_SUFFIX ".sl"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
/*
* _USE_BIG_FDS increases the size of fd_set from 256 bytes to
* about 7500 bytes. PR_Poll allocates three fd_sets on the
* stack, so it is safer to also increase the default thread
* stack size.
*/
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
#define _MD_MINIMUM_STACK_SIZE (2*65536L)
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define NEED_TIME_R
#define HAVE_STACK_GROWING_UP
#undef HAVE_WEAK_IO_SYMBOLS
#undef HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#ifdef IS_64
#define USE_DLFCN
#else
#define USE_HPSHL
#endif
#ifndef HAVE_STRERROR
#define HAVE_STRERROR
#endif
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_HAVE_POSIX_SEMAPHORES
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
#define _PR_ACCEPT_INHERIT_NONBLOCK
#undef _PR_HAVE_ATOMIC_OPS
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#endif
#if !defined(_PR_PTHREADS)
#include <syscall.h>
#include <setjmp.h>
#define USE_SETJMP
#define _MD_GET_SP(_t) (*((int *)((_t)->md.jb) + 1))
#define PR_NUM_GCREGS _JBLEN
/* Caveat: This makes jmp_buf full of doubles. */
#define CONTEXT(_th) ((_th)->md.jb)
/* Stack needs two frames (64 bytes) at the bottom */ \
#define _MD_SET_THR_SP(_t, _sp) ((_MD_GET_SP(_t)) = (int) (_sp + 64 *2))
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
#if !defined(PTHREADS_USER)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*(status) = PR_TRUE; \
if (_setjmp(CONTEXT(_thread))) (*_main)(); \
/* Stack needs two frames (64 bytes) at the bottom */ \
(_MD_GET_SP(_thread)) = (int) ((_sp) + 64*2); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures. HP-UX has no native threads. */
struct _MDThread {
jmp_buf jb;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
#else /* PTHREADS_USER */
#include "_nspr_pthread.h"
#endif /* PTHREADS_USER */
#endif /* !defined(_PR_PTHREADS) */
#if !defined(PTHREADS_USER)
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#endif
#if defined(HPUX_LW_TIMER)
extern void _PR_HPUX_LW_IntervalInit(void);
extern PRIntervalTime _PR_HPUX_LW_GetInterval(void);
#define _MD_INTERVAL_INIT _PR_HPUX_LW_IntervalInit
#define _MD_GET_INTERVAL _PR_HPUX_LW_GetInterval
#define _MD_INTERVAL_PER_SEC() 1000
#else
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#endif
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
#include <poll.h>
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
#ifdef HPUX11
extern void _MD_hpux_map_sendfile_error(int err);
#endif /* HPUX11 */
#endif /* nspr_xhppa_defs_h___ */

View File

@@ -0,0 +1,470 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_irix_defs_h___
#define nspr_irix_defs_h___
#define _PR_HAVE_ATOMIC_CAS
/*
* MipsPro assembler defines _LANGUAGE_ASSEMBLY
*/
#ifndef _LANGUAGE_ASSEMBLY
#include "prclist.h"
#include "prthread.h"
#include <sys/ucontext.h>
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "irix"
#define _PR_SI_SYSNAME "IRIX"
#define _PR_SI_ARCHITECTURE "mips"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _PR_NUM_GCREGS 9
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MIN_STACK_SIZE 16384L
#undef HAVE_STACK_GROWING_UP
#define HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_ATOMIC_OPS
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ST_ATIM
#define _PR_HAVE_OFF64_T
#define HAVE_POINTER_LOCALTIME_R
#define _PR_HAVE_POSIX_SEMAPHORES
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
#define _PR_ACCEPT_INHERIT_NONBLOCK
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#endif
/* Initialization entry points */
NSPR_API(void) _MD_EarlyInit(void);
#define _MD_EARLY_INIT _MD_EarlyInit
NSPR_API(void) _MD_IrixInit(void);
#define _MD_FINAL_INIT _MD_IrixInit
#define _MD_INIT_IO()
/* Timer operations */
NSPR_API(PRIntervalTime) _MD_IrixGetInterval(void);
#define _MD_GET_INTERVAL _MD_IrixGetInterval
NSPR_API(PRIntervalTime) _MD_IrixIntervalPerSec(void);
#define _MD_INTERVAL_PER_SEC _MD_IrixIntervalPerSec
/* GC operations */
NSPR_API(void *) _MD_GetSP(PRThread *thread);
#define _MD_GET_SP _MD_GetSP
/* The atomic operations */
#include <mutex.h>
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val) add_then_test((unsigned long*)val, 1)
#define _MD_ATOMIC_ADD(ptr, val) add_then_test((unsigned long*)ptr, (unsigned long)val)
#define _MD_ATOMIC_DECREMENT(val) add_then_test((unsigned long*)val, 0xffffffff)
#define _MD_ATOMIC_SET(val, newval) test_and_set((unsigned long*)val, newval)
#if defined(_PR_PTHREADS)
#else /* defined(_PR_PTHREADS) */
/************************************************************************/
#include <setjmp.h>
#include <errno.h>
#include <unistd.h>
#include <bstring.h>
#include <sys/time.h>
#include <ulocks.h>
#include <sys/prctl.h>
/*
* Data region private to each sproc. This region is setup by calling
* mmap(...,MAP_LOCAL,...). The private data is mapped at the same
* address in every sproc, but every sproc gets a private mapping.
*
* Just make sure that this structure fits in a page, as only one page
* is allocated for the private region.
*/
struct sproc_private_data {
struct PRThread *me;
struct _PRCPU *cpu;
struct PRThread *last;
PRUintn intsOff;
int sproc_pid;
};
extern char *_nspr_sproc_private;
#define _PR_PRDA() ((struct sproc_private_data *) _nspr_sproc_private)
#define _MD_SET_CURRENT_THREAD(_thread) _PR_PRDA()->me = (_thread)
#define _MD_THIS_THREAD() (_PR_PRDA()->me)
#define _MD_LAST_THREAD() (_PR_PRDA()->last)
#define _MD_SET_LAST_THREAD(_thread) _PR_PRDA()->last = (_thread)
#define _MD_CURRENT_CPU() (_PR_PRDA()->cpu)
#define _MD_SET_CURRENT_CPU(_cpu) _PR_PRDA()->cpu = (_cpu)
#define _MD_SET_INTSOFF(_val) (_PR_PRDA()->intsOff = _val)
#define _MD_GET_INTSOFF() (_PR_PRDA()->intsOff)
#define _MD_SET_SPROC_PID(_val) (_PR_PRDA()->sproc_pid = _val)
#define _MD_GET_SPROC_PID() (_PR_PRDA()->sproc_pid)
NSPR_API(struct PRThread*) _MD_get_attached_thread(void);
NSPR_API(struct PRThread*) _MD_get_current_thread(void);
#define _MD_GET_ATTACHED_THREAD() _MD_get_attached_thread()
#define _MD_CURRENT_THREAD() _MD_get_current_thread()
#define _MD_CHECK_FOR_EXIT() { \
if (_pr_irix_exit_now) { \
_PR_POST_SEM(_pr_irix_exit_sem); \
_MD_Wakeup_CPUs(); \
_exit(0); \
} \
}
#define _MD_ATTACH_THREAD(threadp)
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
extern struct _PRCPU *_pr_primordialCPU;
extern usema_t *_pr_irix_exit_sem;
extern PRInt32 _pr_irix_exit_now;
extern int _pr_irix_primoridal_cpu_fd[];
extern PRInt32 _pr_irix_process_exit;
extern PRInt32 _pr_irix_process_exit_code;
/* Thread operations */
#define _PR_LOCK_HEAP() { \
PRIntn _is; \
if (_pr_primordialCPU) { \
if (_MD_GET_ATTACHED_THREAD() && \
!_PR_IS_NATIVE_THREAD( \
_MD_GET_ATTACHED_THREAD())) \
_PR_INTSOFF(_is); \
_PR_LOCK(_pr_heapLock); \
}
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
_PR_UNLOCK(_pr_heapLock); \
if (_MD_GET_ATTACHED_THREAD() && \
!_PR_IS_NATIVE_THREAD( \
_MD_GET_ATTACHED_THREAD())) \
_PR_INTSON(_is); \
} \
}
#define _PR_OPEN_POLL_SEM(_sem) usopenpollsema(_sem, 0666)
#define _PR_WAIT_SEM(_sem) uspsema(_sem)
#define _PR_POST_SEM(_sem) usvsema(_sem)
#define _MD_CVAR_POST_SEM(threadp) usvsema((threadp)->md.cvar_pollsem)
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
struct _MDLock {
ulock_t lock;
usptr_t *arena;
};
/*
* disable pre-emption for the LOCAL threads when calling the arena lock
* routines
*/
#define _PR_LOCK(lock) { \
PRIntn _is; \
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
if (me && !_PR_IS_NATIVE_THREAD(me)) \
_PR_INTSOFF(_is); \
ussetlock(lock); \
if (me && !_PR_IS_NATIVE_THREAD(me)) \
_PR_FAST_INTSON(_is); \
}
#define _PR_UNLOCK(lock) { \
PRIntn _is; \
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
if (me && !_PR_IS_NATIVE_THREAD(me)) \
_PR_INTSOFF(_is); \
usunsetlock(lock); \
if (me && !_PR_IS_NATIVE_THREAD(me)) \
_PR_FAST_INTSON(_is); \
}
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
#define _MD_LOCK(_lockp) _PR_LOCK((_lockp)->lock)
#define _MD_UNLOCK(_lockp) _PR_UNLOCK((_lockp)->lock)
#define _MD_TEST_AND_LOCK(_lockp) (uscsetlock((_lockp)->lock, 1) == 0)
extern ulock_t _pr_heapLock;
struct _MDThread {
jmp_buf jb;
usptr_t *pollsem_arena;
usema_t *cvar_pollsem;
PRInt32 cvar_pollsemfd;
PRInt32 cvar_pollsem_select; /* acquire sem by calling select */
PRInt32 cvar_wait; /* if 1, thread is waiting on cvar Q */
PRInt32 id;
PRInt32 suspending_id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDSemaphore {
usema_t *sem;
};
struct _MDCVar {
ulock_t mdcvar_lock;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
PRInt32 id;
PRInt32 suspending_id;
struct _MDCPU_Unix md_unix;
};
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
int *jb = (_thread)->md.jb; \
*status = PR_TRUE; \
(void) setjmp(jb); \
(_thread)->md.jb[JB_SP] = (int) ((_sp) - 64); \
(_thread)->md.jb[JB_PC] = (int) _main; \
_thread->no_sched = 0; \
PR_END_MACRO
/*
** Switch away from the current thread context by saving its state and
** calling the thread scheduler. Reload cpu when we come back from the
** context switch because it might have changed.
*
* XXX RUNQ lock needed before clearing _PR_NO_SCHED flag, because the
* thread may be unr RUNQ?
*/
#define _MD_SWITCH_CONTEXT(_thread) \
PR_BEGIN_MACRO \
PR_ASSERT(_thread->no_sched); \
if (!setjmp(_thread->md.jb)) { \
_MD_SAVE_ERRNO(_thread) \
_MD_SET_LAST_THREAD(_thread); \
_PR_Schedule(); \
} else { \
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
_MD_LAST_THREAD()->no_sched = 0; \
} \
PR_END_MACRO
/*
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
** initialized by _MD_INIT_CONTEXT.
*/
#define _MD_RESTORE_CONTEXT(_newThread) \
PR_BEGIN_MACRO \
int *jb = (_newThread)->md.jb; \
_MD_RESTORE_ERRNO(_newThread) \
_MD_SET_CURRENT_THREAD(_newThread); \
_newThread->no_sched = 1; \
longjmp(jb, 1); \
PR_END_MACRO
NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread,
PRBool wakeup_parent);
NSPR_API(PRStatus) _MD_InitAttachedThread(struct PRThread *thread,
PRBool wakeup_parent);
#define _MD_INIT_THREAD(thread) _MD_InitThread(thread, PR_TRUE)
#define _MD_INIT_ATTACHED_THREAD(thread) \
_MD_InitAttachedThread(thread, PR_FALSE)
NSPR_API(void) _MD_ExitThread(struct PRThread *thread);
#define _MD_EXIT_THREAD _MD_ExitThread
NSPR_API(void) _MD_SuspendThread(struct PRThread *thread);
#define _MD_SUSPEND_THREAD _MD_SuspendThread
NSPR_API(void) _MD_ResumeThread(struct PRThread *thread);
#define _MD_RESUME_THREAD _MD_ResumeThread
NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread);
#define _MD_SUSPEND_CPU _MD_SuspendCPU
NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread);
#define _MD_RESUME_CPU _MD_ResumeCPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_RESUME_ALL()
NSPR_API(void) _MD_InitLocks(void);
#define _MD_INIT_LOCKS _MD_InitLocks
NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
#define _MD_CLEAN_THREAD _MD_CleanThread
#define _MD_YIELD() sginap(0)
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
* awaken a thread which is waiting on a lock or cvar.
*/
NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout);
#define _MD_WAIT _MD_wait
NSPR_API(void) _PR_MD_primordial_cpu();
NSPR_API(void) _PR_MD_WAKEUP_PRIMORDIAL_CPU();
NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
NSPR_API(void ) _MD_exit(PRIntn status);
#define _MD_EXIT _MD_exit
#include "prthread.h"
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
PRThreadPriority newPri);
#define _MD_SET_PRIORITY _MD_SetPriority
NSPR_API(PRStatus) _MD_CreateThread(
struct PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
#define _MD_CREATE_THREAD _MD_CreateThread
extern void _MD_CleanupBeforeExit(void);
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
NSPR_API(void) _PR_MD_PRE_CLEANUP(PRThread *me);
/* The following defines the unwrapped versions of select() and poll(). */
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
#define _MD_SELECT _select
#include <stropts.h>
#include <poll.h>
#define _MD_POLL _poll
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
#define HAVE_THREAD_AFFINITY 1
NSPR_API(PRInt32) _MD_GetThreadAffinityMask(PRThread *unused, PRUint32 *mask);
#define _MD_GETTHREADAFFINITYMASK _MD_GetThreadAffinityMask
NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu);
#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU
#endif /* defined(_PR_PTHREADS) */
#endif /* _LANGUAGE_ASSEMBLY */
#endif /* nspr_irix_defs_h___ */

View File

@@ -0,0 +1,559 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_linux_defs_h___
#define nspr_linux_defs_h___
#include "prthread.h"
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "linux"
#define _PR_SI_SYSNAME "LINUX"
#ifdef __powerpc64__
#define _PR_SI_ARCHITECTURE "ppc64"
#elif defined(__powerpc__)
#define _PR_SI_ARCHITECTURE "ppc"
#elif defined(__alpha)
#define _PR_SI_ARCHITECTURE "alpha"
#elif defined(__ia64__)
#define _PR_SI_ARCHITECTURE "ia64"
#elif defined(__x86_64__)
#define _PR_SI_ARCHITECTURE "x86-64"
#elif defined(__mc68000__)
#define _PR_SI_ARCHITECTURE "m68k"
#elif defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
#elif defined(__mips__)
#define _PR_SI_ARCHITECTURE "mips"
#elif defined(__arm__)
#define _PR_SI_ARCHITECTURE "arm"
#elif defined(__hppa__)
#define _PR_SI_ARCHITECTURE "hppa"
#elif defined(__s390x__)
#define _PR_SI_ARCHITECTURE "s390x"
#elif defined(__s390__)
#define _PR_SI_ARCHITECTURE "s390"
#else
#error "Unknown CPU architecture"
#endif
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
/*
* Elf linux supports dl* functions
*/
#define HAVE_DLL
#define USE_DLFCN
#if defined(__i386__)
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val);
#define _MD_ATOMIC_INCREMENT _PR_x86_AtomicIncrement
extern PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val);
#define _MD_ATOMIC_DECREMENT _PR_x86_AtomicDecrement
extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
#define _MD_ATOMIC_ADD _PR_x86_AtomicAdd
extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_ATOMIC_SET _PR_x86_AtomicSet
#endif
#if defined(__ia64__)
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
extern PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val);
#define _MD_ATOMIC_INCREMENT _PR_ia64_AtomicIncrement
extern PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val);
#define _MD_ATOMIC_DECREMENT _PR_ia64_AtomicDecrement
extern PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
#define _MD_ATOMIC_ADD _PR_ia64_AtomicAdd
extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_ATOMIC_SET _PR_ia64_AtomicSet
#endif
#if defined(__x86_64__)
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val);
#define _MD_ATOMIC_INCREMENT _PR_x86_64_AtomicIncrement
extern PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val);
#define _MD_ATOMIC_DECREMENT _PR_x86_64_AtomicDecrement
extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
#define _MD_ATOMIC_ADD _PR_x86_64_AtomicAdd
extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
#endif
#if defined(__alpha)
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_ADD(ptr, i) ({ \
PRInt32 __atomic_tmp, __atomic_ret; \
__asm__ __volatile__( \
"1: ldl_l %[ret], %[val] \n" \
" addl %[ret], %[inc], %[tmp] \n" \
" addl %[ret], %[inc], %[ret] \n" \
" stl_c %[tmp], %[val] \n" \
" beq %[tmp], 2f \n" \
".subsection 2 \n" \
"2: br 1b \n" \
".previous" \
: [ret] "=&r" (__atomic_ret), \
[tmp] "=&r" (__atomic_tmp), \
[val] "=m" (*ptr) \
: [inc] "Ir" (i), "m" (*ptr)); \
__atomic_ret; \
})
#define _MD_ATOMIC_INCREMENT(ptr) _MD_ATOMIC_ADD(ptr, 1)
#define _MD_ATOMIC_DECREMENT(ptr) ({ \
PRInt32 __atomic_tmp, __atomic_ret; \
__asm__ __volatile__( \
"1: ldl_l %[ret], %[val] \n" \
" subl %[ret], 1, %[tmp] \n" \
" subl %[ret], 1, %[ret] \n" \
" stl_c %[tmp], %[val] \n" \
" beq %[tmp], 2f \n" \
".subsection 2 \n" \
"2: br 1b \n" \
".previous" \
: [ret] "=&r" (__atomic_ret), \
[tmp] "=&r" (__atomic_tmp), \
[val] "=m" (*ptr) \
: "m" (*ptr)); \
__atomic_ret; \
})
#define _MD_ATOMIC_SET(ptr, n) ({ \
PRInt32 __atomic_tmp, __atomic_ret; \
__asm__ __volatile__( \
"1: ldl_l %[ret], %[val] \n" \
" mov %[newval], %[tmp] \n" \
" stl_c %[tmp], %[val] \n" \
" beq %[tmp], 2f \n" \
".subsection 2 \n" \
"2: br 1b \n" \
".previous" \
: [ret] "=&r" (__atomic_ret), \
[tmp] "=&r"(__atomic_tmp), \
[val] "=m" (*ptr) \
: [newval] "Ir" (n), "m" (*ptr)); \
__atomic_ret; \
})
#endif
#define USE_SETJMP
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _PR_POLL_AVAILABLE
#endif
#undef _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#if defined(__alpha) || defined(__ia64__)
#define _PR_HAVE_LARGE_OFF_T
#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
#define _PR_HAVE_OFF64_T
#else
#define _PR_NO_LARGE_FILES
#endif
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
#define _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETHOSTBYNAME2
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#endif
#define _PR_HAVE_SYSV_SEMAPHORES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#if (__GLIBC__ >= 2) && defined(_PR_PTHREADS)
#define _PR_HAVE_GETHOST_R
#define _PR_HAVE_GETHOST_R_INT
#endif
#ifdef _PR_PTHREADS
extern void _MD_CleanupBeforeExit(void);
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
#else /* ! _PR_PTHREADS */
#include <setjmp.h>
#define PR_CONTEXT_TYPE sigjmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#ifdef __powerpc__
/*
* PowerPC based MkLinux
*
* On the PowerPC, the new style jmp_buf isn't used until glibc
* 2.1.
*/
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_GPR1]
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0]
#endif /* glibc 2.1 or later */
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
/* aix = 64, macos = 70 */
#define PR_NUM_GCREGS 64
#elif defined(__alpha)
/* Alpha based Linux */
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
#define _MD_SP_TYPE long int
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
#define _MD_SP_TYPE __ptr_t
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
/* XXX not sure if this is correct, or maybe it should be 17? */
#define PR_NUM_GCREGS 9
#elif defined(__ia64__)
#define _MD_GET_SP(_t) ((long *)((_t)->md.context[0].__jmpbuf)[0])
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
#define _MD_SP_TYPE long int
#define PR_NUM_GCREGS _JBLEN
#elif defined(__mc68000__)
/* m68k based Linux */
/*
* On the m68k, glibc still uses the old style sigjmp_buf, even
* in glibc 2.0.7.
*/
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
#define _MD_SP_TYPE int
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
#define _MD_SP_TYPE __ptr_t
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
/* XXX not sure if this is correct, or maybe it should be 17? */
#define PR_NUM_GCREGS 9
#elif defined(__sparc__)
/* Sparc */
#if defined(__GLIBC__) && __GLIBC__ >= 2
/*
* You need glibc2-2.0.7-25 or later. The libraries that came with
* Red Hat 5.1 are not new enough, but they are in 5.2.
*/
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_FP] = val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_FP])
#define _MD_SP_TYPE int
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__fp
#define _MD_SET_FP(_t, val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) ((void *) 0)
#define _MD_SP_TYPE __ptr_t
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#elif defined(__i386__)
/* Intel based Linux */
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_BP] = val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_BP])
#define _MD_SP_TYPE int
#else
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__bp = val)
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) &((_t)->md.context[0].__jmpbuf[0].__bp)
#define _MD_SP_TYPE __ptr_t
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#define PR_NUM_GCREGS 6
#elif defined(__mips__)
/* Linux/MIPS */
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__fp = (val))
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__fp)
#define _MD_SP_TYPE __ptr_t
#else
#error "Linux/MIPS pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#elif defined(__arm__)
/* ARM/Linux */
#if defined(__GLIBC__) && __GLIBC__ >= 2
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[19] = (val))
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[19])
#define _MD_SP_TYPE __ptr_t
#else
#error "ARM/Linux pre-glibc2 not supported yet"
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
#else
#error "Unknown CPU architecture"
#endif /*__powerpc__*/
/*
** Initialize a thread context to run "_main()" when started
*/
#ifdef __powerpc__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (sigsetjmp(CONTEXT(_thread), 1)) { \
_main(); \
} \
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
_thread->md.sp = _MD_GET_SP_PTR(_thread); \
_thread->md.fp = _MD_GET_FP_PTR(_thread); \
_MD_SET_FP(_thread, 0); \
}
#elif defined(__mips__)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
(void) sigsetjmp(CONTEXT(_thread), 1); \
_thread->md.context[0].__jmpbuf[0].__pc = (__ptr_t) _main; \
_MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
_thread->md.sp = _MD_GET_SP_PTR(_thread); \
_thread->md.fp = _MD_GET_FP_PTR(_thread); \
_MD_SET_FP(_thread, 0); \
}
#else
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (sigsetjmp(CONTEXT(_thread), 1)) { \
_main(); \
} \
_MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
_thread->md.sp = _MD_GET_SP_PTR(_thread); \
_thread->md.fp = _MD_GET_FP_PTR(_thread); \
_MD_SET_FP(_thread, 0); \
}
#endif /*__powerpc__*/
#define _MD_SWITCH_CONTEXT(_thread) \
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
siglongjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
void *sp;
void *fp;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#include <sys/time.h> /* for FD_SETSIZE */
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
extern PRStatus _MD_InitializeThread(PRThread *thread);
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
extern PRStatus _MD_CREATE_THREAD(
PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
extern void _MD_YIELD(void);
#endif /* ! _PR_PTHREADS */
extern void _MD_EarlyInit(void);
extern PRIntervalTime _PR_UNIX_GetInterval(void);
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT __select
#ifdef _PR_POLL_AVAILABLE
#include <sys/poll.h>
extern int __syscall_poll(struct pollfd *ufds, unsigned long int nfds,
int timeout);
#define _MD_POLL __syscall_poll
#endif
/* For writev() */
#include <sys/uio.h>
extern void _MD_linux_map_sendfile_error(int err);
#endif /* nspr_linux_defs_h___ */

View File

@@ -0,0 +1,725 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef prmacos_h___
#define prmacos_h___
//
// This file contains all changes and additions which need to be made to the NSPR runtime
// for the Macintosh platform (specifically the Metrowerks environment). This file should
// only be incluced in Macintosh builds.
//
#define PR_DLL_SUFFIX ""
#define _PR_LOCAL_THREADS_ONLY
#define _PR_NO_PREEMPT 1
#define _PR_HAVE_ATOMIC_OPS 1
#include "prinit.h"
#include "prio.h"
#include "prlong.h"
#include "prlock.h"
#include "prcvar.h"
#include "prsem.h"
#include "prthread.h"
#include "prtime.h"
#include "prproces.h"
#if !defined(MAC_NSPR_STANDALONE)
#include "macstdlibextras.h"
#endif
#include <stddef.h>
#include <setjmp.h>
#include <Errors.h>
#include <OpenTransport.h>
#include <DriverServices.h>
#define _PR_HAVE_PEEK_BUFFER
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
struct _MDProcess {
PRInt8 notused;
};
struct _MDThread {
jmp_buf jb;
int osErrCode;
PRLock * asyncIOLock;
PRCondVar * asyncIOCVar;
PRBool missedIONotify;
PRBool missedAsyncNotify;
PRBool asyncNotifyPending;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
struct _MDCPU {
AbsoluteTime lastThreadSwitch;
AbsoluteTime lastWakeUpProcess;
PRBool trackScheduling;
};
typedef struct _MDSocketCallerInfo {
PRThread * thread;
void * cookie;
} _MDSocketCallerInfo;
struct _MDFileDesc {
PRInt32 osfd;
PRPackedBool orderlyDisconnect;
PRPackedBool readReady;
PRPackedBool writeReady;
PRPackedBool exceptReady;
PRLock * miscLock;
/* Server sockets: listen bit tells the notifier func what to do */
PRBool doListen;
/* stored error for non-blocking connects, as a Unix-style error code */
OTReason disconnectError;
_MDSocketCallerInfo misc;
_MDSocketCallerInfo read;
_MDSocketCallerInfo write;
};
/*
** Iinitialization Related definitions
*/
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _MD_FinalInit
/*
** Interrupts Related definitions
*/
#define _MD_GET_INTSOFF() (_pr_intsOff)
#define _MD_INTSOFF(_is) \
PR_BEGIN_MACRO \
ENTER_CRITICAL_REGION(); \
(_is) = _PR_MD_GET_INTSOFF(); \
_PR_MD_SET_INTSOFF(1); \
LEAVE_CRITICAL_REGION(); \
PR_END_MACRO
#if TARGET_CARBON
extern void _MD_SetIntsOff(PRInt32 ints);
#define _MD_SET_INTSOFF(_val) _MD_SetIntsOff(_val)
#else /* not TARGET_CARBON */
#define _MD_SET_INTSOFF(_val) (_pr_intsOff = _val)
#endif /* TARGET_CARBON */
#define _MD_START_INTERRUPTS _MD_StartInterrupts
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
/*
** CPU Related definitions
*/
#define _MD_PAUSE_CPU _MD_PauseCPU
#define _MD_CLEANUP_BEFORE_EXIT()
#define _MD_EXIT(status) exit(status)
#define _MD_INIT_CPUS()
#define _MD_INIT_RUNNING_CPU(cpu) _MD_InitRunningCPU(cpu)
/*
** Process Related definitions
*/
extern struct PRProcess * _MD_CreateProcess(
const char *path,
char *const *argv,
char *const *envp,
const PRProcessAttr *attr);
#define _MD_CREATE_PROCESS _MD_CreateProcess
extern PRStatus _MD_DetachProcess(PRProcess *process);
#define _MD_DETACH_PROCESS _MD_DetachProcess
extern PRStatus _MD_WaitProcess(PRProcess *process, PRInt32 *exitCode);
#define _MD_WAIT_PROCESS _MD_WaitProcess
extern PRStatus _MD_KillProcess(PRProcess *process);
#define _MD_KILL_PROCESS _MD_KillProcess
/*
** Memory Segments Related definitions
*/
#define _MD_INIT_SEGS()
/*
** Thread Stacks Debugging Related definitions
*/
#define _MD_INIT_STACK _MD_InitStack
#define _MD_CLEAR_STACK _MD_ClearStack
/*
** Locks Related definitions
*/
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) (PR_SUCCESS)
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
/*
** Thread Related definitions
*/
NSPR_API(PRThread *) PR_GetPrimaryThread();
#if defined(powerc) || defined(__powerc)
#define _MD_GET_PC(_t) (*((PRUint32 *)((_t)->md.jb)))
#define _MD_GET_SP(_t) (*((PRUint32 *)((_t)->md.jb) + 2))
#define _MD_GET_TOC(_t) (*((PRUint32 *)((_t)->md.jb) + 3))
#define INIT_STACKPTR(stackTop) ((unsigned char*)stackTop - 128)
#define PR_NUM_GCREGS 70
#else
#define _MD_GET_PC(_t) (*((PRUint32 *)((_t)->md.jb) + 6))
#define _MD_GET_SP(_t) (*((PRUint32 *)((_t)->md.jb) + 12))
#define INIT_STACKPTR(stackTop) ((unsigned char*)stackTop - 4)
#define PR_NUM_GCREGS 13
#endif
#define _MD_DEFAULT_STACK_SIZE (58 * 1024)
#define _MD_MINIMUM_STACK_SIZE (58 * 1024)
/*
** Initialize the thread machine dependent data structure
*/
extern PRStatus _MD_InitThread(PRThread *thread);
#define _MD_INIT_THREAD _MD_InitThread
/*
** Clean-up the thread machine dependent data structure
*/
#define _MD_CLEAN_THREAD(_thread) \
PR_BEGIN_MACRO \
PR_DestroyCondVar(_thread->md.asyncIOCVar); \
PR_DestroyLock(_thread->md.asyncIOLock); \
PR_END_MACRO
/*
** Initialize the thread context preparing it to execute _main.
** *sp = 0 zeros out the sp for the first stack frame so that
** stack walking code can find the top of the stack.
*/
#if defined(powerc) || defined(__powerc)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, _status) \
PR_BEGIN_MACRO \
unsigned char *sp; \
unsigned long *tvect; \
long **jb = (_thread)->md.jb; \
*((PRBool *)_status) = PR_TRUE; \
(void) setjmp(jb); \
sp = INIT_STACKPTR(_sp); \
*sp = 0; \
(_MD_GET_SP(_thread)) = (long) sp; \
tvect = (unsigned long *)_main; \
(_MD_GET_PC(_thread)) = (int) *tvect; \
(_MD_GET_TOC(_thread)) = (int) *(tvect+1); \
_thread->no_sched = 0; \
PR_END_MACRO
#else
#define _MD_INIT_CONTEXT(_thread, _sp, _main, _status) \
PR_BEGIN_MACRO \
unsigned char *sp; \
long **jb = (_thread)->md.jb; \
*((PRBool *)_status) = PR_TRUE; \
(void) setjmp(jb); \
sp = INIT_STACKPTR(_sp); \
(_MD_GET_SP(_thread)) = (long) sp; \
(_MD_GET_PC(_thread)) = (int) _main; \
_thread->no_sched = 0; \
PR_END_MACRO
#endif
/*
** Switch away from the current thread context by saving its state and
** calling the thread scheduler. Reload cpu when we come back from the
** context switch because it might have changed.
*/
/* ResetTimer(); before _PR_Schedule() */
#define _MD_SWITCH_CONTEXT(_thread) \
PR_BEGIN_MACRO \
PR_ASSERT(_thread->no_sched); \
if (!setjmp(_thread->md.jb)) { \
_MD_SET_LAST_THREAD(_thread); \
if (_PR_MD_CURRENT_CPU()->md.trackScheduling) \
_PR_MD_CURRENT_CPU()->md.lastThreadSwitch = UpTime(); \
_PR_Schedule(); \
} else { \
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
_MD_LAST_THREAD()->no_sched = 0; \
} \
PR_END_MACRO
/*
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
** initialized by _MD_INIT_CONTEXT.
*/
#define _MD_RESTORE_CONTEXT(_newThread) \
PR_BEGIN_MACRO \
long **jb = (_newThread)->md.jb; \
_MD_SET_CURRENT_THREAD(_newThread); \
_newThread->no_sched = 1; \
longjmp(jb, 1); \
PR_END_MACRO
#define _MD_ERRNO() _MD_CURRENT_THREAD()->md.osErrCode
extern PRStatus _MD_wait(PRThread *thread, PRIntervalTime timeout);
#define _MD_WAIT _MD_wait
/*
** Combined thread model related definitions
*/
#define _MD_CREATE_THREAD(a,b,c,d,e,f) (PR_SUCCESS)
#define _MD_WAKEUP_WAITER(a)
#define _MD_SET_PRIORITY(a,b)
/*
** File I/O Related definitions
*/
extern PRInt32 _PR_MD_WRITE_SYNC(PRFileDesc *fd, void *buf, PRInt32 amount);
#define _PR_MD_WRITE_SYNC _MD_WRITE_SYNC
struct _MDDir {
short ioVRefNum;
long ioDirID;
short ioFDirIndex;
char *currentEntryName;
};
#define PR_DIRECTORY_SEPARATOR '/'
#define PR_DIRECTORY_SEPARATOR_STR "/"
#define PR_PATH_SEPARATOR ':'
#define PR_PATH_SEPARATOR_STR ":"
typedef enum IOOperation {
READ_ASYNC,
WRITE_ASYNC
} IOOperation;
#define _MD_INIT_IO()
#define _MD_OPEN _MD_Open
#define _MD_OPEN_FILE _MD_Open
#define _MD_CLOSE_FILE FSClose
#define _MD_READ(fd,buf,amount) ReadWriteProc(fd,buf,amount,READ_ASYNC)
#define _MD_WRITE(fd,buf,amount) ReadWriteProc(fd,buf,amount,WRITE_ASYNC)
#define _MD_WRITE_SYNC(fd,buf,amount) WriteSyncProc(fd,buf,amount)
#define _MD_GET_FILE_ERROR() _PR_MD_CURRENT_THREAD()->md.osErrCode
#define _MD_LSEEK _MD_LSeek
#define _MD_FSYNC _MD_FSync
/* to be implemented */
#define _MD_LSEEK64(a,b,c) LL_ZERO
#define _MD_GETOPENFILEINFO64(fd,info) -1
#define _MD_GETFILEINFO64(fd,info) -1
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
** File Manipulation definitions
*/
#define _MD_RENAME _MD_Rename
#define _MD_ACCESS _MD_Access
#define _MD_GETFILEINFO _MD_GetFileInfo
#define _MD_GETOPENFILEINFO _MD_GetOpenFileInfo
#define _MD_STAT _MD_Stat
#define _MD_DELETE _MD_Delete
extern PRStatus _MD_LockFile(PRInt32 osfd);
#define _MD_LOCKFILE _MD_LockFile
extern PRStatus _MD_TLockFile(PRInt32 osfd);
#define _MD_TLOCKFILE _MD_TLockFile
extern PRStatus _MD_UnlockFile(PRInt32 osfd);
#define _MD_UNLOCKFILE _MD_UnlockFile
/*
** Directory enumeration related definitions
*/
extern PRStatus _MD_OpenDir(struct _MDDir *md,const char *name);
#define _MD_OPEN_DIR _MD_OpenDir
extern char* _MD_ReadDir(struct _MDDir *md,PRIntn flags);
#define _MD_READ_DIR _MD_ReadDir
#define _MD_CLOSE_DIR _MD_CloseDir
#define _MD_MKDIR _MD_MkDir
#define _MD_MAKE_DIR _MD_MkDir
#define _MD_RMDIR _MD_Delete
/*
** Pipe I/O Related definitions (not implemented)
*/
#define _MD_PIPEAVAILABLE(fd) -1
/*
** Socket I/O Related definitions
*/
#if UNIVERSAL_INTERFACES_VERSION >= 0x0330
/* In Universal Interfaces 3.3 and later, these are enums. */
#define IP_TTL IP_TTL
#define IP_TOS IP_TOS
#define IP_ADD_MEMBERSHIP IP_ADD_MEMBERSHIP
#define IP_DROP_MEMBERSHIP IP_DROP_MEMBERSHIP
#define IP_MULTICAST_IF IP_MULTICAST_IF
#define IP_MULTICAST_TTL IP_MULTICAST_TTL
#define IP_MULTICAST_LOOP IP_MULTICAST_LOOP
#define TCP_NODELAY TCP_NODELAY
#define TCP_MAXSEG TCP_MAXSEG
#endif
#define _MD_SOCKET _MD_socket
#define _MD_BIND _MD_bind
#define _MD_LISTEN _MD_listen
#define _MD_GETSOCKNAME _MD_getsockname
extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
#define _MD_GETSOCKOPT _MD_getsockopt
extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
#define _MD_SETSOCKOPT _MD_setsockopt
#define _MD_SOCKETAVAILABLE _MD_socketavailable
#define _MD_ACCEPT _MD_accept
#define _MD_CONNECT _MD_connect
#define _MD_SEND _MD_send
#define _MD_RECV _MD_recv
#define _MD_CLOSE_SOCKET _MD_closesocket
#define _MD_SENDTO _MD_sendto
#define _MD_RECVFROM _MD_recvfrom
#define _MD_PR_POLL _MD_poll
#define _MD_INIT_FILEDESC _MD_initfiledesc
#define _MD_FREE_FILEDESC _MD_freefiledesc
#define _MD_MAKE_NONBLOCK _MD_makenonblock
#define _MD_INIT_FD_INHERITABLE _MD_initfdinheritable
#define _MD_QUERY_FD_INHERITABLE _MD_queryfdinheritable
#define _MD_GET_SOCKET_ERROR() _PR_MD_CURRENT_THREAD()->md.osErrCode
#define _PR_MD_MAP_SELECT_ERROR(x) (x)
/*
** Netdb Related definitions
*/
extern PRStatus _MD_gethostname(char *name, int namelen);
#define _MD_GETHOSTNAME _MD_gethostname
#define _PR_GET_HOST_ADDR_AS_NAME
/*
XXX _MD_WRITEV, _MD_SHUTDOWN & _MD_GETPEERNAME not done yet!!!
*/
#define _MD_WRITEV _MD_writev
#define _MD_SHUTDOWN _MD_shutdown
#define _MD_GETPEERNAME _MD_getpeername
#ifdef OLD_MACSOCK_LIBRARY
#define _MD_SOCKET macsock_socket
#define _MD_LISTEN macsock_listen
#define _MD_SEND(fd,buf,amount,flags,timeout) macsock_send(fd->secret->md.osfd,buf,amount,flags)
#define _MD_SENDTO(fd,buf,amount,flags,addr,addrlen,timeout) macsock_sendto(fd->secret->md.osfd,buf,amount,flags,(struct sockaddr *)addr,addrlen)
#define _MD_RECV(fd,buf,amount,flags,timeout) macsock_recv(fd->secret->md.osfd,buf,amount,flags)
#define _MD_RECVFROM(fd,buf,amount,flags,addr,addrlen,timeout) macsock_recvfrom(fd->secret->md.osfd,buf,amount,flags,(struct sockaddr *)addr,addrlen)
#define _MD_CLOSE_SOCKET macsock_close
#define _MD_SHUTDOWN(a,b) (0)
#define _MD_ACCEPT(fd,addr,addrlen,timeout) macsock_accept(fd->secret->md.osfd,(struct sockaddr *)addr,addrlen)
#define _MD_CONNECT(fd,name,namelen,timeout) macsock_connect(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
#define _MD_BIND(fd,name,namelen) macsock_bind(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
#define _MD_GETSOCKNAME(fd,name,namelen) macsock_getsockname(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
#define _MD_GETPEERNAME(fd,name,namelen) macsock_getpeername(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
#define _MD_GETSOCKOPT(fd,level,optname,optval,optlen) macsock_getsockopt(fd->secret->md.osfd,level,optname,optval,optlen)
#define _MD_SETSOCKOPT(fd,level,optname,optval,optlen) macsock_setsockopt(fd->secret->md.osfd,level,optname,optval,optlen)
#define _MD_SOCKETAVAILABLE(fd,bytes) macsock_socketavailable(fd->secret->md.osfd,bytes)
#endif
/*
** Memory Segements Related definitions
*/
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
#define _MD_FREE_SEGMENT _MD_FreeSegment
/*
** Time Related definitions
*/
#define _MD_GET_INTERVAL _MD_GetInterval
#define _MD_INTERVAL_PER_SEC() PR_MSEC_PER_SEC
#define _MD_INTERVAL_INIT()
/*
** Environemnt Related definitions
*/
extern char *_MD_GetEnv(const char *name);
#define _MD_GET_ENV _MD_GetEnv
extern int _MD_PutEnv(const char *variableCopy);
#define _MD_PUT_ENV _MD_PutEnv
/*
** Following is old stuff to be looked at.
*/
#define GCPTR
#define CALLBACK
typedef int (*FARPROC)();
#define MAX_NON_PRIMARY_TIME_SLICES 6
extern long gTimeSlicesOnNonPrimaryThread;
extern struct PRThread *gPrimaryThread;
// Errors not found in the Mac StdCLib
#define EACCES 13 // Permission denied
#define ENOENT -43 // No such file or directory
#define _OS_INVALID_FD_VALUE -1
#define STDERR_FILENO 2
#if !defined(MAC_NSPR_STANDALONE)
#define PATH_SEPARATOR ':'
#define PATH_SEPARATOR_STR ":"
#define DIRECTORY_SEPARATOR '/'
#define DIRECTORY_SEPARATOR_STR "/"
#endif
#define UNIX_THIS_DIRECTORY_STR "./"
#define UNIX_PARENT_DIRECTORY_STR "../"
// Alias a few names
#define getenv PR_GetEnv
#define putenv _MD_PutEnv
#if defined(MAC_NSPR_STANDALONE)
typedef unsigned char (*MemoryCacheFlusherProc)(size_t size);
typedef void (*PreAllocationHookProc)(void);
extern char *strdup(const char *source);
extern void InstallPreAllocationHook(PreAllocationHookProc newHook);
extern void InstallMemoryCacheFlusher(MemoryCacheFlusherProc newFlusher);
#endif
extern char *PR_GetDLLSearchPath(void);
#if defined(MAC_NSPR_STANDALONE)
extern int strcmp(const char *str1, const char *str2);
extern int strcasecmp(const char *str1, const char *str2);
#endif
extern void MapFullToPartialMacFile(char *);
extern char *MapPartialToFullMacFile(const char *);
extern void ResetTimer(void);
extern void PR_PeriodicIdle(void);
extern void ActivateTimer(void);
extern void DeactivateTimer(void);
extern void PR_InitMemory(void);
extern struct hostent *gethostbyaddr(const void *addr, int addrlen, int type);
extern short GetVolumeRefNumFromName(const char *);
#include <stdio.h> // Needed to get FILE typedef
extern FILE *_OS_FOPEN(const char *filename, const char *mode);
//
// Macintosh only private parts.
//
#define dprintTrace ";dprintf;doTrace"
#define dprintNoTrace ";dprintf"
extern void dprintf(const char *format, ...);
// Entry into the memory system's cache flushing
#if defined(MAC_NSPR_STANDALONE)
extern PRUint8 CallCacheFlushers(size_t blockSize);
#endif
#if defined(MAC_NSPR_STANDALONE)
extern void* reallocSmaller(void* block, size_t newSize);
#endif
/*
** PR_GetSystemInfo related definitions
*/
#define _PR_SI_SYSNAME "MacOS"
#define _PR_SI_ARCHITECTURE "PowerPC"
/*
* Memory-mapped files
*/
struct _MDFileMap {
PRInt8 unused;
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
extern PRInt32 _MD_GetMemMapAlignment(void);
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
extern void SetLogFileTypeCreator(const char *logFile);
extern int _MD_mac_get_nonblocking_connect_error(PRFileDesc* fd);
/*
* Critical section support
*/
#define MAC_CRITICAL_REGIONS TARGET_CARBON
#if MAC_CRITICAL_REGIONS
extern void InitCriticalRegion();
extern void TermCriticalRegion();
extern void EnterCritialRegion();
extern void LeaveCritialRegion();
#define INIT_CRITICAL_REGION() InitCriticalRegion()
#define TERM_CRITICAL_REGION() TermCriticalRegion()
#define ENTER_CRITICAL_REGION() EnterCritialRegion()
#define LEAVE_CRITICAL_REGION() LeaveCritialRegion()
#else
#define INIT_CRITICAL_REGION()
#define TERM_CRITICAL_REGION()
#define ENTER_CRITICAL_REGION()
#define LEAVE_CRITICAL_REGION()
#endif
/*
* CPU Idle support
*/
extern void InitIdleSemaphore();
extern void TermIdleSemaphore();
extern void WaitOnIdleSemaphore();
extern void SignalIdleSemaphore();
/*
* Atomic operations
*/
#ifdef _PR_HAVE_ATOMIC_OPS
extern PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val) OTAtomicAdd32(1, (SInt32 *)val)
#define _MD_ATOMIC_ADD(ptr, val) OTAtomicAdd32(val, (SInt32 *)ptr)
#define _MD_ATOMIC_DECREMENT(val) OTAtomicAdd32(-1, (SInt32 *)val)
#define _MD_ATOMIC_SET(val, newval) _MD_AtomicSet(val, newval)
#endif /* _PR_HAVE_ATOMIC_OPS */
#endif /* prmacos_h___ */

View File

@@ -0,0 +1,230 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_unixware_defs_h___
#define nspr_unixware_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "ncr"
#define _PR_SI_SYSNAME "NCR"
#define _PR_SI_ARCHITECTURE "x86"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define HAVE_DLL
#define USE_DLFCN
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
#if !defined (HAVE_STRERROR)
#define HAVE_STRERROR
#endif
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_NO_LARGE_FILES
#undef HAVE_STACK_GROWING_UP
#define HAVE_NETCONFIG
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define NEED_LOCALTIME_R
#define NEED_GMTIME_R
#define NEED_ASCTIME_R
#define NEED_STRTOK_R
#define NEED_CTIME_R
#define _PR_NEED_STRCASECMP
#define USE_SETJMP
#include <setjmp.h>
#define _SETJMP setjmp
#define _LONGJMP longjmp
#define _PR_CONTEXT_TYPE jmp_buf
#define _MD_GET_SP(_t) (_t)->md.context[4]
#define _PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_SETJMP(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_LONGJMP(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures.
* Don't use SVR4 native threads (yet).
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
* The following are copied from _sunos.h, _aix.h. This means
* some of them should probably be moved into _unixos.h. But
* _irix.h seems to be quite different in regard to these macros.
*/
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *execptfds, struct timeval *timeout);
#define _MD_SELECT _select
#define _MD_POLL _poll
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
#endif /* nspr_ncr_defs_h */

View File

@@ -0,0 +1,196 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_nec_defs_h___
#define nspr_nec_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "nec"
#define _PR_SI_SYSNAME "NEC"
#define _PR_SI_ARCHITECTURE "mips"
#define PR_DLL_SUFFIX ".so"
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define NEED_TIME_R
#define NEED_STRFTIME_LOCK
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ST_ATIM_UNION
#include <ucontext.h>
#include <sys/regset.h>
#define PR_NUM_GCREGS NGREG
#define PR_CONTEXT_TYPE ucontext_t
#define CONTEXT(_thread) (&(_thread)->md.context)
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[CXT_SP]
/*
** Initialize the thread context preparing it to execute "e(o,a)"
*/
#define _MD_INIT_CONTEXT(thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
getcontext(CONTEXT(thread)); \
CONTEXT(thread)->uc_stack.ss_sp = (char*) (thread)->stack->stackBottom; \
CONTEXT(thread)->uc_stack.ss_size = (thread)->stack->stackSize; \
_MD_GET_SP(thread) = (greg_t) _sp - 64; \
makecontext(CONTEXT(thread), _main, 0); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!getcontext(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
ucontext_t *uc = CONTEXT(_thread); \
uc->uc_mcontext.gregs[CXT_V0] = 1; \
uc->uc_mcontext.gregs[CXT_A3] = 0; \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
setcontext(uc); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
#define _MD_SELECT _select
#define _MD_POLL _poll
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#endif /* nspr_nec_defs_h___ */

View File

@@ -0,0 +1,322 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your
* version of this file only under the terms of the GPL and not to
* allow others to use your version of this file under the MPL,
* indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient
* may use your version of this file under either the MPL or the
* GPL.
*/
#ifndef nspr_netbsd_defs_h___
#define nspr_netbsd_defs_h___
#include <sys/syscall.h>
#include <sys/param.h> /* for __NetBSD_Version__ */
#define PR_LINKER_ARCH "netbsd"
#define _PR_SI_SYSNAME "NetBSD"
#if defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
#elif defined(__alpha__)
#define _PR_SI_ARCHITECTURE "alpha"
#elif defined(__m68k__)
#define _PR_SI_ARCHITECTURE "m68k"
#elif defined(__powerpc__)
#define _PR_SI_ARCHITECTURE "powerpc"
#elif defined(__sparc_v9__)
#define _PR_SI_ARCHITECTURE "sparc64"
#elif defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__mips__)
#define _PR_SI_ARCHITECTURE "mips"
#elif defined(__arm32__) || defined(__arm__) || defined(__armel__) \
|| defined(__armeb__)
#define _PR_SI_ARCHITECTURE "arm"
#endif
#if defined(__ELF__)
#define PR_DLL_SUFFIX ".so"
#else
#define PR_DLL_SUFFIX ".so.1.0"
#endif
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_HAVE_SYSV_SEMAPHORES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#if __NetBSD_Version__ >= 105000000
#define _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETHOSTBYNAME2
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#endif
#if __NetBSD_Version__ >= 106370000
/* NetBSD 1.6ZK */
#define _PR_HAVE_GETPROTO_R
#define _PR_HAVE_GETPROTO_R_INT
#endif
#define USE_SETJMP
#ifndef _PR_PTHREADS
#include <setjmp.h>
#define PR_CONTEXT_TYPE sigjmp_buf
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize a thread context to run "_main()" when started
*/
#ifdef __i386__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[0] = (int) _main; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
#endif
#ifdef __sparc_v9__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[1] = (unsigned char*) ((_sp) - 176 - 0x7ff); \
CONTEXT(_thread)[2] = (long) _main; \
CONTEXT(_thread)[3] = (long) _main + 4; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) (CONTEXT(_thread)[2]+0x7ff)
#elif defined(__sparc__)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[3] = (int) _main; \
CONTEXT(_thread)[4] = (int) _main + 4; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
#endif
#ifdef __powerpc__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[3] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[4] = (int) _main; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[3]
#endif
#ifdef __m68k__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[5] = (int) _main; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
#endif
#ifdef __mips__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[32] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[2] = (int) _main; \
CONTEXT(_thread)[28] = (int) _main; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[32]
#endif
#if defined(__arm32__) || defined(__arm__) || defined(__armel__) \
|| defined(__armeb__)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[23] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[24] = (int) _main; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[23]
#endif
#ifdef __alpha__
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
sigsetjmp(CONTEXT(_thread), 1); \
CONTEXT(_thread)[34] = (unsigned char*) ((_sp) - 128); \
CONTEXT(_thread)[2] = (long) _main; \
CONTEXT(_thread)[30] = (long) _main; \
CONTEXT(_thread)[31] = (long) _main; \
*status = PR_TRUE; \
}
#define _MD_GET_SP(_thread) CONTEXT(_thread)[34]
#endif
#ifndef _MD_INIT_CONTEXT
#error "Need to define _MD_INIT_CONTEXT for this platform"
#endif
#define PR_NUM_GCREGS _JBLEN
#define _MD_SWITCH_CONTEXT(_thread) \
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
siglongjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
#endif /* ! _PR_PTHREADS */
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
#if defined(_PR_POLL_AVAILABLE)
#include <poll.h>
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
#endif
#if NetBSD1_3 == 1L
typedef unsigned int nfds_t;
#endif
#endif /* nspr_netbsd_defs_h___ */

View File

@@ -0,0 +1,299 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_nextstep_defs_h___
#define nspr_nextstep_defs_h___
#include "prthread.h"
#include <bsd/libc.h>
#include <bsd/syscall.h>
/* syscall() is not declared in NEXTSTEP's syscall.h ...
*/
extern int syscall(int number, ...);
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "nextstep"
#define _PR_SI_SYSNAME "NEXTSTEP"
#if defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__m68k__)
#define _PR_SI_ARCHITECTURE "m68k"
#elif defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
#else
error Unknown NEXTSTEP architecture
#endif
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define USE_MACH_DYLD
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_NO_LARGE_FILES
#define USE_SETJMP
#ifndef _PR_PTHREADS
#include <setjmp.h>
#define PR_CONTEXT_TYPE jmp_buf
#define CONTEXT(_th) ((_th)->md.context)
/* balazs.pataki@sztaki.hu:
** __sparc__ is checked
** __m68k__ is checked
** __i386__ is a guess (one of the two defines should work)
*/
#if defined(__sparc__)
#define _MD_GET_SP(_th) (_th)->md.context[2]
#elif defined(__m68k__)
#define _MD_GET_SP(_th) (_th)->md.context[2]
#elif defined(__i386__)
/* One of this two must be OK ... try using sc_onstack
*/
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
//#define _MD_GET_SP(_th) (_th)->md.context[0].sc_esp
#else
error Unknown NEXTSTEP architecture
#endif
#define PR_NUM_GCREGS _JBLEN
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
_main(); \
} \
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
extern PRStatus _MD_InitializeThread(PRThread *thread);
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
extern PRStatus _MD_CREATE_THREAD(
PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
extern void _MD_YIELD(void);
#endif /* ! _PR_PTHREADS */
extern void _MD_EarlyInit(void);
extern PRIntervalTime _PR_UNIX_GetInterval(void);
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
/* For writev() */
#include <sys/uio.h>
/* signal.h */
/* balazs.pataki@sztaki.hu: this is stolen from sunos4.h. The things is that
** NEXTSTEP doesn't support these flags for `struct sigaction's sa_flags, so
** I have to fake them ...
*/
#define SA_RESTART 0
/* mmap */
/* balazs.pataki@sztaki.hu: NEXTSTEP doesn't have mmap, at least not
** publically. We have sys/mman.h, but it doesn't declare mmap(), and
** PROT_NONE is also missing. syscall.h has entries for mmap, munmap, and
** mprotect so I wrap these in nextstep.c as mmap(), munmap() and mprotect()
** and pray for it to work.
**
*/
caddr_t mmap(caddr_t addr, size_t len, int prot, int flags,
int fildes, off_t off);
int munmap(caddr_t addr, size_t len);
int mprotect(caddr_t addr, size_t len, int prot);
/* my_mmap() is implemented in nextstep.c and is based on map_fd() of mach.
*/
caddr_t my_mmap(caddr_t addr, size_t len, int prot, int flags,
int fildes, off_t off);
int my_munmap(caddr_t addr, size_t len);
/* string.h
*/
/* balazs.pataki@sztaki.hu: this is missing so implemenetd in nextstep.c ...
*/
char *strdup(const char *s1);
/* unistd.h
*/
/* balazs.pataki@sztaki.hu: these functions are hidden, though correctly
** implemented in NEXTSTEP. Here I give the declaration for them to be used
** by prmalloc.c, and I have a wrapped syscall() version of them in nextstep.c
*/
int brk(void *endds);
void *sbrk(int incr);
#endif /* nspr_nextstep_defs_h___ */

View File

@@ -0,0 +1,283 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_pthread_defs_h___
#define nspr_pthread_defs_h___
#include <pthread.h>
#include "prthread.h"
#if defined(PTHREADS_USER)
/*
** Thread Local Storage
*/
extern pthread_key_t current_thread_key;
extern pthread_key_t current_cpu_key;
extern pthread_key_t last_thread_key;
extern pthread_key_t intsoff_key;
#define _MD_CURRENT_THREAD() \
((struct PRThread *) pthread_getspecific(current_thread_key))
#define _MD_CURRENT_CPU() \
((struct _PRCPU *) pthread_getspecific(current_cpu_key))
#define _MD_LAST_THREAD() \
((struct PRThread *) pthread_getspecific(last_thread_key))
#define _MD_SET_CURRENT_THREAD(newval) \
pthread_setspecific(current_thread_key, (void *)newval)
#define _MD_SET_CURRENT_CPU(newval) \
pthread_setspecific(current_cpu_key, (void *)newval)
#define _MD_SET_LAST_THREAD(newval) \
pthread_setspecific(last_thread_key, (void *)newval)
#define _MD_SET_INTSOFF(_val)
#define _MD_GET_INTSOFF() 1
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
if (SAVE_CONTEXT(_thread)) { \
(*_main)(); \
} \
_MD_SET_THR_SP(_thread, _sp); \
_thread->no_sched = 0; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread) \
PR_BEGIN_MACRO \
PR_ASSERT(_thread->no_sched); \
if (!SAVE_CONTEXT(_thread)) { \
(_thread)->md.errcode = errno; \
_MD_SET_LAST_THREAD(_thread); \
_PR_Schedule(); \
} else { \
(_MD_LAST_THREAD())->no_sched = 0; \
} \
PR_END_MACRO
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
PR_BEGIN_MACRO \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_thread->no_sched = 1; \
GOTO_CONTEXT(_thread); \
PR_END_MACRO
/* Machine-dependent (MD) data structures */
struct _MDThread {
jmp_buf jb;
int id;
int errcode;
pthread_t pthread;
pthread_mutex_t pthread_mutex;
pthread_cond_t pthread_cond;
int wait;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
pthread_mutex_t mutex;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
pthread_mutex_t mutex;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
jmp_buf jb;
pthread_t pthread;
struct _MDCPU_Unix md_unix;
};
/*
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
*/
extern pthread_mutex_t _pr_heapLock;
#define _PR_LOCK(lock) pthread_mutex_lock(lock)
#define _PR_UNLOCK(lock) pthread_mutex_unlock(lock)
#define _PR_LOCK_HEAP() { \
if (_pr_primordialCPU) { \
_PR_LOCK(_pr_heapLock); \
}
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
_PR_UNLOCK(_pr_heapLock); \
} \
}
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
#define _MD_LOCK(_lockp) _PR_LOCK(&(_lockp)->mutex)
#define _MD_UNLOCK(_lockp) _PR_UNLOCK(&(_lockp)->mutex)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_CHECK_FOR_EXIT()
NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread);
#define _MD_INIT_THREAD _MD_InitThread
#define _MD_INIT_ATTACHED_THREAD _MD_InitThread
NSPR_API(void) _MD_ExitThread(struct PRThread *thread);
#define _MD_EXIT_THREAD _MD_ExitThread
NSPR_API(void) _MD_SuspendThread(struct PRThread *thread);
#define _MD_SUSPEND_THREAD _MD_SuspendThread
NSPR_API(void) _MD_ResumeThread(struct PRThread *thread);
#define _MD_RESUME_THREAD _MD_ResumeThread
NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread);
#define _MD_SUSPEND_CPU _MD_SuspendCPU
NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread);
#define _MD_RESUME_CPU _MD_ResumeCPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_RESUME_ALL()
NSPR_API(void) _MD_EarlyInit(void);
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
NSPR_API(void) _MD_InitLocks(void);
#define _MD_INIT_LOCKS _MD_InitLocks
NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
#define _MD_CLEAN_THREAD _MD_CleanThread
NSPR_API(PRStatus) _MD_CreateThread(
struct PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
#define _MD_CREATE_THREAD _MD_CreateThread
extern void _MD_CleanupBeforeExit(void);
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu);
#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
* awaken a thread which is waiting on a lock or cvar.
*/
NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout);
#define _MD_WAIT _MD_wait
NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
PRThreadPriority newPri);
#define _MD_SET_PRIORITY _MD_SetPriority
#endif /* PTHREADS_USER */
#endif /* nspr_pthread_defs_h___ */

View File

@@ -0,0 +1,221 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1999-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_nto_defs_h___
#define nspr_nto_defs_h___
/*
** Internal configuration macros
*/
#define PR_LINKER_ARCH "nto"
#define _PR_SI_SYSNAME "NTO"
#define _PR_SI_ARCHITECTURE "x86"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MINIMUM_STACK_SIZE 131072L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#undef _PR_POLL_AVAILABLE
#undef _PR_USE_POLL
#define _PR_HAVE_SOCKADDR_LEN
#undef HAVE_BSD_FLOCK
#define HAVE_FCNTL_FILE_LOCKING
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
#define _PR_HAVE_POSIX_SEMAPHORES
#undef FD_SETSIZE
#define FD_SETSIZE 4096
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define _PR_NEED_STRCASECMP
#ifndef HAVE_STRERROR
#define HAVE_STRERROR
#endif
#define USE_SETJMP
#include <setjmp.h>
#define _SETJMP setjmp
#define _LONGJMP longjmp
#define _PR_CONTEXT_TYPE jmp_buf
#define _PR_NUM_GCREGS _JBLEN
#define _MD_GET_SP(_t) (_t)->md.context[7]
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_SETJMP(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_LONGJMP(CONTEXT(_thread), 1); \
}
/*
** Machine-dependent (MD) data structures.
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
** md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
** We wrapped the select() call. _MD_SELECT refers to the built-in,
** unwrapped version.
*/
#define _MD_SELECT select
#define SA_RESTART 0
#endif /* nspr_nto_defs_h___ */

View File

@@ -0,0 +1,238 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_openbsd_defs_h___
#define nspr_openbsd_defs_h___
#include <sys/syscall.h>
#define PR_LINKER_ARCH "openbsd"
#define _PR_SI_SYSNAME "OPENBSD"
#if defined(__i386__)
#define _PR_SI_ARCHITECTURE "x86"
#elif defined(__alpha__)
#define _PR_SI_ARCHITECTURE "alpha"
#elif defined(__amd64__)
#define _PR_SI_ARCHITECTURE "amd64"
#elif defined(__m68k__)
#define _PR_SI_ARCHITECTURE "m68k"
#elif defined(__powerpc__)
#define _PR_SI_ARCHITECTURE "powerpc"
#elif defined(__sparc__)
#define _PR_SI_ARCHITECTURE "sparc"
#endif
#define PR_DLL_SUFFIX ".so.1.0"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_HAVE_SYSV_SEMAPHORES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#define _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETHOSTBYNAME2
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#define USE_SETJMP
#ifndef _PR_PTHREADS
#include <setjmp.h>
#define PR_CONTEXT_TYPE sigjmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#if defined(__i386__) || defined(__sparc__) || defined(__m68k__)
#define JB_SP_INDEX 2
#elif defined(__powerpc__)
#define JB_SP_INDEX 1
#elif defined(__alpha__)
#define JB_SP_INDEX 34
#elif defined(__amd64__)
#define JB_SP_INDEX 6
#else
#error "Need to define SP index in jmp_buf here"
#endif
#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX]
#define PR_NUM_GCREGS _JBLEN
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (sigsetjmp(CONTEXT(_thread), 1)) { \
_main(); \
} \
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
siglongjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
#endif /* ! _PR_PTHREADS */
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
#include <poll.h>
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
#if OpenBSD1_3 == 1L
typedef unsigned int nfds_t;
#endif
#endif /* nspr_openbsd_defs_h___ */

View File

@@ -0,0 +1,332 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
** This is the OpenVMS machine dependant configuration file. It is based
** on the OSF/1 machine dependant file.
*/
#ifndef nspr_openvms_defs_h___
#define nspr_openvms_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "OpenVMS"
#define _PR_SI_SYSNAME "OpenVMS"
#ifdef __alpha
#define _PR_SI_ARCHITECTURE "alpha"
#else
#define _PR_SI_ARCHITECTURE "vax"
#endif
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 131072L
#define _MD_MINIMUM_STACK_SIZE 131072L
/*
** This is not defined on OpenVMS. I believe its only used in GC code, and
** isn't that only used in Java? Anyway, for now, let's keep the compiler
** happy.
*/
#define SA_RESTART 0
/*
** OpenVMS doesn't have these in socket.h.
** Does in later versions!
*/
#if 0
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
#endif
/*
* OSF1 needs the MAP_FIXED flag to ensure that mmap returns a pointer
* with the upper 32 bits zero. This is because Java sticks a pointer
* into an int.
*/
#define _MD_MMAP_FLAGS MAP_PRIVATE|MAP_FIXED
#undef HAVE_STACK_GROWING_UP
#undef HAVE_WEAK_IO_SYMBOLS
#undef HAVE_WEAK_MALLOC_SYMBOLS
#undef HAVE_BSD_FLOCK
#define NEED_TIME_R
#define HAVE_DLL
#define USE_DLFCN
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_NO_LARGE_FILES
#define _PR_STRICT_ADDR_LEN
/* IPv6 support */
#ifdef _SOCKADDR_LEN
#define _PR_HAVE_SOCKADDR_LEN
#endif
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#else
#define AF_INET6 26
#ifndef AI_CANONNAME
#define AI_CANONNAME 0x00000002
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#define AI_V4MAPPED 0x00000010
#define AI_ALL 0x00000008
#define AI_ADDRCONFIG 0x00000020
#endif
#define _PR_HAVE_MD_SOCKADDR_IN6
/* if we have a quadword field defined in the structure, then its length */
/* will be a multiple of 8, and connect() won't accept 32 (it wants 28) */
struct _md_in6_addr {
union {
PRUint8 _S6_u8[16];
PRUint16 _S6_u16[8];
PRUint32 _S6_u32[4];
} _S6_un;
};
struct _md_sockaddr_in6 {
PRUint16 sin6_family;
PRUint16 sin6_port;
PRUint32 sin6_flowinfo;
struct _md_in6_addr sin6_addr;
PRUint32 sin6_scope_id;
};
#undef USE_SETJMP
#include <setjmp.h>
/*
* A jmp_buf is actually a struct sigcontext. The sc_sp field of
* struct sigcontext is the stack pointer.
*/
#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
#define PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.context)
/*
** I am ifdef'ing these out because that's the way they are in FT.
*/
#ifndef __VMS
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
(*_main)(); \
} \
_MD_GET_SP(_thread) = (long) ((_sp) - 64); \
_MD_GET_SP(_thread) &= ~15; \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
#endif /* __VMS */
/* Machine-dependent (MD) data structures */
struct _MDThread {
jmp_buf context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#ifndef _PR_PTHREADS
#define _MD_INIT_LOCKS()
#endif
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
* The following are copied from _sunos.h, _aix.h. This means
* some of them should probably be moved into _unixos.h. But
* _irix.h seems to be quite different in regard to these macros.
*/
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
extern PRIntervalTime _PR_UNIX_GetInterval(void);
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
#define _MD_EARLY_INIT _MD_EarlyInit
void _MD_EarlyInit(void);
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#ifdef _VMS_NOT_YET
NSPR_API(void) _PR_InitThreads(
PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs);
#endif
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/* The following defines unwrapped versions of select() and poll(). */
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
#define _MD_SELECT __select
#ifndef __VMS
#define _MD_POLL __poll
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
#endif
#ifdef __VMS
NSPR_API(void) _PR_InitCPUs(void);
NSPR_API(void) _PR_MD_START_INTERRUPTS(void);
#endif
/*
* Atomic operations
*/
#include <machine/builtins.h>
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_ADD(ptr,val) (__ATOMIC_ADD_LONG(ptr,val) + val)
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
extern int thread_suspend(PRThread *thr_id);
extern int thread_resume(PRThread *thr_id);
#endif /* nspr_openvms_defs_h___ */

View File

@@ -0,0 +1,594 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_os2_defs_h___
#define nspr_os2_defs_h___
#ifndef NO_LONG_LONG
#define INCL_LONGLONG
#endif
#define INCL_DOS
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#define INCL_WIN
#define INCL_WPS
#include <os2.h>
#include <sys/select.h>
#include "prio.h"
#include <errno.h>
#ifdef XP_OS2_VACPP
/* TODO RAMSEMs need to be written for GCC/EMX */
#define USE_RAMSEM
#endif
#ifdef USE_RAMSEM
#pragma pack(4)
#pragma pack(2)
typedef struct _RAMSEM
{
ULONG ulTIDPID;
ULONG hevSem;
ULONG cLocks;
USHORT cWaiting;
USHORT cPosts;
} RAMSEM, *PRAMSEM;
typedef struct _CRITICAL_SECTION
{
ULONG ulReserved[4]; /* Same size as RAMSEM */
} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION;
#pragma pack(4)
APIRET _Optlink SemRequest486(PRAMSEM, ULONG);
APIRET _Optlink SemReleasex86(PRAMSEM, ULONG);
#endif
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "os2"
#define _PR_SI_SYSNAME "OS2"
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
#define HAVE_DLL
#define _PR_GLOBAL_THREADS_ONLY
#undef HAVE_THREAD_AFFINITY
#define _PR_HAVE_THREADSAFE_GETHOST
#define _PR_HAVE_ATOMIC_OPS
#define HANDLE unsigned long
#define HINSTANCE HMODULE
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
/* --- Globals --- */
extern struct PRLock *_pr_schedLock;
/* --- Typedefs --- */
typedef void (*FiberFunc)(void *);
#define PR_NUM_GCREGS 8
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
#define GC_VMBASE 0x40000000
#define GC_VMLIMIT 0x00FFFFFF
typedef int (*FARPROC)();
#define _MD_MAGIC_THREAD 0x22222222
#define _MD_MAGIC_THREADSTACK 0x33333333
#define _MD_MAGIC_SEGMENT 0x44444444
#define _MD_MAGIC_DIR 0x55555555
#define _MD_MAGIC_CV 0x66666666
struct _MDSemaphore {
HEV sem;
};
struct _MDCPU {
int unused;
};
struct _MDThread {
HEV blocked_sema; /* Threads block on this when waiting
* for IO or CondVar.
*/
PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
* wait queue of some cond var.
* PR_FALSE otherwise. */
TID handle; /* OS/2 thread handle */
void *sp; /* only valid when suspended */
PRUint32 magic; /* for debugging */
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
struct PRThread *prev, *next; /* used by the cvar wait queue to
* chain the PRThread structures
* together */
};
struct _MDThreadStack {
PRUint32 magic; /* for debugging */
};
struct _MDSegment {
PRUint32 magic; /* for debugging */
};
#undef PROFILE_LOCKS
struct _MDDir {
HDIR d_hdl;
union {
FILEFINDBUF3 small;
FILEFINDBUF3L large;
} d_entry;
PRBool firstEntry; /* Is this the entry returned
* by FindFirstFile()? */
PRUint32 magic; /* for debugging */
};
struct _MDCVar {
PRUint32 magic;
struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly-
* linked list of threads
* waiting on this condition
* variable */
PRIntn nwait; /* number of threads in the
* wait queue */
};
#define _MD_CV_NOTIFIED_LENGTH 6
typedef struct _MDNotified _MDNotified;
struct _MDNotified {
PRIntn length; /* # of used entries in this
* structure */
struct {
struct _MDCVar *cv; /* the condition variable notified */
PRIntn times; /* and the number of times notified */
struct PRThread *notifyHead; /* list of threads to wake up */
} cv[_MD_CV_NOTIFIED_LENGTH];
_MDNotified *link; /* link to another of these, or NULL */
};
struct _MDLock {
#ifdef USE_RAMSEM
CRITICAL_SECTION mutex; /* this is recursive on NT */
#else
HMTX mutex; /* this is recursive on NT */
#endif
/*
* When notifying cvars, there is no point in actually
* waking up the threads waiting on the cvars until we've
* released the lock. So, we temporarily record the cvars.
* When doing an unlock, we'll then wake up the waiting threads.
*/
struct _MDNotified notified; /* array of conditions notified */
#ifdef PROFILE_LOCKS
PRInt32 hitcount;
PRInt32 misscount;
#endif
};
struct _MDFileDesc {
PRInt32 osfd; /* The osfd can come from one of three spaces:
* - For stdin, stdout, and stderr, we are using
* the libc file handle (0, 1, 2), which is an int.
* - For files and pipes, we are using OS/2 handles,
* which is a void*.
* - For sockets, we are using int
*/
};
struct _MDProcess {
PID pid;
};
/* --- Misc stuff --- */
#define _MD_GET_SP(thread) (thread)->md.gcContext[6]
/* --- IO stuff --- */
#define _MD_OPEN (_PR_MD_OPEN)
#define _MD_OPEN_FILE (_PR_MD_OPEN)
#define _MD_READ (_PR_MD_READ)
#define _MD_WRITE (_PR_MD_WRITE)
#define _MD_WRITEV (_PR_MD_WRITEV)
#define _MD_LSEEK (_PR_MD_LSEEK)
#define _MD_LSEEK64 (_PR_MD_LSEEK64)
extern PRInt32 _MD_CloseFile(PRInt32 osfd);
#define _MD_CLOSE_FILE _MD_CloseFile
#define _MD_GETFILEINFO (_PR_MD_GETFILEINFO)
#define _MD_GETFILEINFO64 (_PR_MD_GETFILEINFO64)
#define _MD_GETOPENFILEINFO (_PR_MD_GETOPENFILEINFO)
#define _MD_GETOPENFILEINFO64 (_PR_MD_GETOPENFILEINFO64)
#define _MD_STAT (_PR_MD_STAT)
#define _MD_RENAME (_PR_MD_RENAME)
#define _MD_ACCESS (_PR_MD_ACCESS)
#define _MD_DELETE (_PR_MD_DELETE)
#define _MD_MKDIR (_PR_MD_MKDIR)
#define _MD_MAKE_DIR (_PR_MD_MKDIR)
#define _MD_RMDIR (_PR_MD_RMDIR)
#define _MD_LOCKFILE (_PR_MD_LOCKFILE)
#define _MD_TLOCKFILE (_PR_MD_TLOCKFILE)
#define _MD_UNLOCKFILE (_PR_MD_UNLOCKFILE)
/* --- Socket IO stuff --- */
/* The ones that don't map directly may need to be re-visited... */
#ifdef XP_OS2_VACPP
#define EPIPE EBADF
#define EIO ECONNREFUSED
#endif
#define _MD_EACCES EACCES
#define _MD_EADDRINUSE EADDRINUSE
#define _MD_EADDRNOTAVAIL EADDRNOTAVAIL
#define _MD_EAFNOSUPPORT EAFNOSUPPORT
#define _MD_EAGAIN EWOULDBLOCK
#define _MD_EALREADY EALREADY
#define _MD_EBADF EBADF
#define _MD_ECONNREFUSED ECONNREFUSED
#define _MD_ECONNRESET ECONNRESET
#define _MD_EFAULT SOCEFAULT
#define _MD_EINPROGRESS EINPROGRESS
#define _MD_EINTR EINTR
#define _MD_EINVAL EINVAL
#define _MD_EISCONN EISCONN
#define _MD_ENETUNREACH ENETUNREACH
#define _MD_ENOENT ENOENT
#define _MD_ENOTCONN ENOTCONN
#define _MD_ENOTSOCK ENOTSOCK
#define _MD_EOPNOTSUPP EOPNOTSUPP
#define _MD_EWOULDBLOCK EWOULDBLOCK
#define _MD_GET_SOCKET_ERROR() sock_errno()
#ifndef INADDR_LOOPBACK /* For some reason this is not defined in OS2 tcpip */
/* #define INADDR_LOOPBACK INADDR_ANY */
#endif
#define _MD_INIT_FILEDESC(fd)
extern void _MD_MakeNonblock(PRFileDesc *f);
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
#define _MD_INIT_FD_INHERITABLE (_PR_MD_INIT_FD_INHERITABLE)
#define _MD_QUERY_FD_INHERITABLE (_PR_MD_QUERY_FD_INHERITABLE)
#define _MD_SHUTDOWN (_PR_MD_SHUTDOWN)
#define _MD_LISTEN _PR_MD_LISTEN
extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
#define _MD_CLOSE_SOCKET _MD_CloseSocket
#define _MD_SENDTO (_PR_MD_SENDTO)
#define _MD_RECVFROM (_PR_MD_RECVFROM)
#ifdef XP_OS2_VACPP
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
#else
#define _MD_SOCKETPAIR (_PR_MD_SOCKETPAIR)
#endif
#define _MD_GETSOCKNAME (_PR_MD_GETSOCKNAME)
#define _MD_GETPEERNAME (_PR_MD_GETPEERNAME)
#define _MD_GETSOCKOPT (_PR_MD_GETSOCKOPT)
#define _MD_SETSOCKOPT (_PR_MD_SETSOCKOPT)
#define _MD_FSYNC _PR_MD_FSYNC
#define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE)
#ifdef _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
#define _MD_ATOMIC_SET _PR_MD_ATOMIC_SET
#endif
#define _MD_INIT_IO (_PR_MD_INIT_IO)
#define _MD_PR_POLL (_PR_MD_PR_POLL)
#define _MD_SOCKET (_PR_MD_SOCKET)
extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
#define _MD_SOCKETAVAILABLE _MD_SocketAvailable
#define _MD_PIPEAVAILABLE _MD_SocketAvailable
#define _MD_CONNECT (_PR_MD_CONNECT)
extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
PRIntervalTime timeout);
#define _MD_ACCEPT _MD_Accept
#define _MD_BIND (_PR_MD_BIND)
#define _MD_RECV (_PR_MD_RECV)
#define _MD_SEND (_PR_MD_SEND)
/* --- Scheduler stuff --- */
/* #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU */
#define _MD_PAUSE_CPU
/* --- DIR stuff --- */
#define PR_DIRECTORY_SEPARATOR '\\'
#define PR_DIRECTORY_SEPARATOR_STR "\\"
#define PR_PATH_SEPARATOR ';'
#define PR_PATH_SEPARATOR_STR ";"
#define _MD_ERRNO() errno
#define _MD_OPEN_DIR (_PR_MD_OPEN_DIR)
#define _MD_CLOSE_DIR (_PR_MD_CLOSE_DIR)
#define _MD_READ_DIR (_PR_MD_READ_DIR)
/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
#define _MD_FREE_SEGMENT(seg)
/* --- Environment Stuff --- */
#define _MD_GET_ENV (_PR_MD_GET_ENV)
#define _MD_PUT_ENV (_PR_MD_PUT_ENV)
/* --- Threading Stuff --- */
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_INIT_THREAD (_PR_MD_INIT_THREAD)
#define _MD_INIT_ATTACHED_THREAD (_PR_MD_INIT_THREAD)
#define _MD_CREATE_THREAD (_PR_MD_CREATE_THREAD)
#define _MD_YIELD (_PR_MD_YIELD)
#define _MD_SET_PRIORITY (_PR_MD_SET_PRIORITY)
#define _MD_CLEAN_THREAD (_PR_MD_CLEAN_THREAD)
#define _MD_SETTHREADAFFINITYMASK (_PR_MD_SETTHREADAFFINITYMASK)
#define _MD_GETTHREADAFFINITYMASK (_PR_MD_GETTHREADAFFINITYMASK)
#define _MD_EXIT_THREAD (_PR_MD_EXIT_THREAD)
#define _MD_SUSPEND_THREAD (_PR_MD_SUSPEND_THREAD)
#define _MD_RESUME_THREAD (_PR_MD_RESUME_THREAD)
#define _MD_SUSPEND_CPU (_PR_MD_SUSPEND_CPU)
#define _MD_RESUME_CPU (_PR_MD_RESUME_CPU)
#define _MD_WAKEUP_CPUS (_PR_MD_WAKEUP_CPUS)
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_END_RESUME_ALL()
/* --- Lock stuff --- */
#define _PR_LOCK _MD_LOCK
#define _PR_UNLOCK _MD_UNLOCK
#ifdef USE_RAMSEM
#define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
#define _MD_FREE_LOCK(lock) (DosCloseEventSem(((PRAMSEM)(&((lock)->mutex)))->hevSem))
#define _MD_LOCK(lock) (SemRequest486(&((lock)->mutex), -1))
#define _MD_TEST_AND_LOCK(lock) (SemRequest486(&((lock)->mutex), -1),0)
#define _MD_UNLOCK(lock) \
PR_BEGIN_MACRO \
if (0 != (lock)->notified.length) { \
md_UnlockAndPostNotifies((lock), NULL, NULL); \
} else { \
SemReleasex86( &(lock)->mutex, 0 ); \
} \
PR_END_MACRO
#else
#define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
#define _MD_FREE_LOCK(lock) (DosCloseMutexSem((lock)->mutex))
#define _MD_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT))
#define _MD_TEST_AND_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT),0)
#define _MD_UNLOCK(lock) \
PR_BEGIN_MACRO \
if (0 != (lock)->notified.length) { \
md_UnlockAndPostNotifies((lock), NULL, NULL); \
} else { \
DosReleaseMutexSem((lock)->mutex); \
} \
PR_END_MACRO
#endif
/* --- lock and cv waiting --- */
#define _MD_WAIT (_PR_MD_WAIT)
#define _MD_WAKEUP_WAITER (_PR_MD_WAKEUP_WAITER)
/* --- CVar ------------------- */
#define _MD_WAIT_CV (_PR_MD_WAIT_CV)
#define _MD_NEW_CV (_PR_MD_NEW_CV)
#define _MD_FREE_CV (_PR_MD_FREE_CV)
#define _MD_NOTIFY_CV (_PR_MD_NOTIFY_CV )
#define _MD_NOTIFYALL_CV (_PR_MD_NOTIFYALL_CV)
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
/* extern struct _MDLock _pr_ioq_lock; */
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/* --- Initialization stuff --- */
#define _MD_START_INTERRUPTS()
#define _MD_STOP_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_EARLY_INIT (_PR_MD_EARLY_INIT)
#define _MD_FINAL_INIT()
#define _MD_INIT_CPUS()
#define _MD_INIT_RUNNING_CPU(cpu)
struct PRProcess;
struct PRProcessAttr;
#define _MD_CREATE_PROCESS _PR_CreateOS2Process
extern struct PRProcess * _PR_CreateOS2Process(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr
);
#define _MD_DETACH_PROCESS _PR_DetachOS2Process
extern PRStatus _PR_DetachOS2Process(struct PRProcess *process);
/* --- Wait for a child process to terminate --- */
#define _MD_WAIT_PROCESS _PR_WaitOS2Process
extern PRStatus _PR_WaitOS2Process(struct PRProcess *process,
PRInt32 *exitCode);
#define _MD_KILL_PROCESS _PR_KillOS2Process
extern PRStatus _PR_KillOS2Process(struct PRProcess *process);
#define _MD_CLEANUP_BEFORE_EXIT()
#define _MD_EXIT (_PR_MD_EXIT)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT
#define _MD_RESTORE_CONTEXT
/* --- Intervals --- */
#define _MD_INTERVAL_INIT (_PR_MD_INTERVAL_INIT)
#define _MD_GET_INTERVAL (_PR_MD_GET_INTERVAL)
#define _MD_INTERVAL_PER_SEC (_PR_MD_INTERVAL_PER_SEC)
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
/* --- Native-Thread Specific Definitions ------------------------------- */
typedef struct __NSPR_TLS
{
struct PRThread *_pr_thread_last_run;
struct PRThread *_pr_currentThread;
struct _PRCPU *_pr_currentCPU;
} _NSPR_TLS;
extern _NSPR_TLS* pThreadLocalStorage;
NSPR_API(void) _PR_MD_ENSURE_TLS(void);
#define _MD_GET_ATTACHED_THREAD() pThreadLocalStorage->_pr_currentThread
extern struct PRThread * _MD_CURRENT_THREAD(void);
#define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread)
#define _MD_LAST_THREAD() pThreadLocalStorage->_pr_thread_last_run
#define _MD_SET_LAST_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_thread_last_run = (_thread)
#define _MD_CURRENT_CPU() pThreadLocalStorage->_pr_currentCPU
#define _MD_SET_CURRENT_CPU(_cpu) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentCPU = (_cpu)
/* lth. #define _MD_SET_INTSOFF(_val) (_pr_ints_off = (_val)) */
/* lth. #define _MD_GET_INTSOFF() _pr_ints_off */
/* lth. #define _MD_INCREMENT_INTSOFF() (_pr_ints_off++) */
/* lth. #define _MD_DECREMENT_INTSOFF() (_pr_ints_off--) */
/* --- Scheduler stuff --- */
#define LOCK_SCHEDULER() 0
#define UNLOCK_SCHEDULER() 0
#define _PR_LockSched() 0
#define _PR_UnlockSched() 0
/* --- Initialization stuff --- */
#define _MD_INIT_LOCKS()
/* --- Stack stuff --- */
#define _MD_INIT_STACK(stack, redzone)
#define _MD_CLEAR_STACK(stack)
/* --- Memory-mapped files stuff --- not implemented on OS/2 */
struct _MDFileMap {
PRInt8 unused;
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
extern PRInt32 _MD_GetMemMapAlignment(void);
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
/* Some stuff for setting up thread contexts */
typedef ULONG DWORD, *PDWORD;
/* The following definitions and two structures are new in OS/2 Warp 4.0.
*/
#ifndef CONTEXT_CONTROL
#define CONTEXT_CONTROL 0x00000001
#define CONTEXT_INTEGER 0x00000002
#define CONTEXT_SEGMENTS 0x00000004
#define CONTEXT_FLOATING_POINT 0x00000008
#define CONTEXT_FULL 0x0000000F
#pragma pack(2)
typedef struct _FPREG {
ULONG losig; /* Low 32-bits of the significand. */
ULONG hisig; /* High 32-bits of the significand. */
USHORT signexp; /* Sign and exponent. */
} FPREG;
typedef struct _CONTEXTRECORD {
ULONG ContextFlags;
ULONG ctx_env[7];
FPREG ctx_stack[8];
ULONG ctx_SegGs; /* GS register. */
ULONG ctx_SegFs; /* FS register. */
ULONG ctx_SegEs; /* ES register. */
ULONG ctx_SegDs; /* DS register. */
ULONG ctx_RegEdi; /* EDI register. */
ULONG ctx_RegEsi; /* ESI register. */
ULONG ctx_RegEax; /* EAX register. */
ULONG ctx_RegEbx; /* EBX register. */
ULONG ctx_RegEcx; /* ECX register. */
ULONG ctx_RegEdx; /* EDX register. */
ULONG ctx_RegEbp; /* EBP register. */
ULONG ctx_RegEip; /* EIP register. */
ULONG ctx_SegCs; /* CS register. */
ULONG ctx_EFlags; /* EFLAGS register. */
ULONG ctx_RegEsp; /* ESP register. */
ULONG ctx_SegSs; /* SS register. */
} CONTEXTRECORD, *PCONTEXTRECORD;
#pragma pack()
#endif
extern APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
/*
#define _pr_tid (((PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)))->tib2_ultid)
#define _pr_current_Thread (_system_tls[_pr_tid-1].__pr_current_thread)
*/
/* Some simple mappings of Windows API's to OS/2 API's to make our lives a
* little bit easier. Only add one here if it is a DIRECT mapping. We are
* not emulating anything. Just mapping.
*/
#define FreeLibrary(x) DosFreeModule((HMODULE)x)
#define OutputDebugString(x)
extern int _MD_os2_get_nonblocking_connect_error(int osfd);
#endif /* nspr_os2_defs_h___ */

View File

@@ -0,0 +1,162 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_os2_errors_h___
#define nspr_os2_errors_h___
#include "md/_os2.h"
#ifndef assert
#include <assert.h>
#endif
NSPR_API(void) _MD_os2_map_default_error(PRInt32 err);
#define _PR_MD_MAP_DEFAULT_ERROR _MD_os2_map_default_error
NSPR_API(void) _MD_os2_map_opendir_error(PRInt32 err);
#define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error
NSPR_API(void) _MD_os2_map_closedir_error(PRInt32 err);
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_os2_map_closedir_error
NSPR_API(void) _MD_os2_readdir_error(PRInt32 err);
#define _PR_MD_MAP_READDIR_ERROR _MD_os2_readdir_error
NSPR_API(void) _MD_os2_map_delete_error(PRInt32 err);
#define _PR_MD_MAP_DELETE_ERROR _MD_os2_map_delete_error
NSPR_API(void) _MD_os2_map_stat_error(PRInt32 err);
#define _PR_MD_MAP_STAT_ERROR _MD_os2_map_stat_error
NSPR_API(void) _MD_os2_map_fstat_error(PRInt32 err);
#define _PR_MD_MAP_FSTAT_ERROR _MD_os2_map_fstat_error
NSPR_API(void) _MD_os2_map_rename_error(PRInt32 err);
#define _PR_MD_MAP_RENAME_ERROR _MD_os2_map_rename_error
NSPR_API(void) _MD_os2_map_access_error(PRInt32 err);
#define _PR_MD_MAP_ACCESS_ERROR _MD_os2_map_access_error
NSPR_API(void) _MD_os2_map_mkdir_error(PRInt32 err);
#define _PR_MD_MAP_MKDIR_ERROR _MD_os2_map_mkdir_error
NSPR_API(void) _MD_os2_map_rmdir_error(PRInt32 err);
#define _PR_MD_MAP_RMDIR_ERROR _MD_os2_map_rmdir_error
NSPR_API(void) _MD_os2_map_read_error(PRInt32 err);
#define _PR_MD_MAP_READ_ERROR _MD_os2_map_read_error
NSPR_API(void) _MD_os2_map_transmitfile_error(PRInt32 err);
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_os2_map_transmitfile_error
NSPR_API(void) _MD_os2_map_write_error(PRInt32 err);
#define _PR_MD_MAP_WRITE_ERROR _MD_os2_map_write_error
NSPR_API(void) _MD_os2_map_lseek_error(PRInt32 err);
#define _PR_MD_MAP_LSEEK_ERROR _MD_os2_map_lseek_error
NSPR_API(void) _MD_os2_map_fsync_error(PRInt32 err);
#define _PR_MD_MAP_FSYNC_ERROR _MD_os2_map_fsync_error
NSPR_API(void) _MD_os2_map_close_error(PRInt32 err);
#define _PR_MD_MAP_CLOSE_ERROR _MD_os2_map_close_error
NSPR_API(void) _MD_os2_map_socket_error(PRInt32 err);
#define _PR_MD_MAP_SOCKET_ERROR _MD_os2_map_socket_error
NSPR_API(void) _MD_os2_map_recv_error(PRInt32 err);
#define _PR_MD_MAP_RECV_ERROR _MD_os2_map_recv_error
NSPR_API(void) _MD_os2_map_recvfrom_error(PRInt32 err);
#define _PR_MD_MAP_RECVFROM_ERROR _MD_os2_map_recvfrom_error
NSPR_API(void) _MD_os2_map_send_error(PRInt32 err);
#define _PR_MD_MAP_SEND_ERROR _MD_os2_map_send_error
NSPR_API(void) _MD_os2_map_sendto_error(PRInt32 err);
#define _PR_MD_MAP_SENDTO_ERROR _MD_os2_map_sendto_error
NSPR_API(void) _MD_os2_map_writev_error(int err);
#define _PR_MD_MAP_WRITEV_ERROR _MD_os2_map_writev_error
NSPR_API(void) _MD_os2_map_accept_error(PRInt32 err);
#define _PR_MD_MAP_ACCEPT_ERROR _MD_os2_map_accept_error
NSPR_API(void) _MD_os2_map_acceptex_error(PRInt32 err);
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_os2_map_acceptex_error
NSPR_API(void) _MD_os2_map_connect_error(PRInt32 err);
#define _PR_MD_MAP_CONNECT_ERROR _MD_os2_map_connect_error
NSPR_API(void) _MD_os2_map_bind_error(PRInt32 err);
#define _PR_MD_MAP_BIND_ERROR _MD_os2_map_bind_error
NSPR_API(void) _MD_os2_map_listen_error(PRInt32 err);
#define _PR_MD_MAP_LISTEN_ERROR _MD_os2_map_listen_error
NSPR_API(void) _MD_os2_map_shutdown_error(PRInt32 err);
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_os2_map_shutdown_error
#ifndef XP_OS2_VACPP
NSPR_API(void) _MD_os2_map_socketpair_error(int err);
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_os2_map_socketpair_error
#endif
NSPR_API(void) _MD_os2_map_getsockname_error(PRInt32 err);
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_os2_map_getsockname_error
NSPR_API(void) _MD_os2_map_getpeername_error(PRInt32 err);
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_os2_map_getpeername_error
NSPR_API(void) _MD_os2_map_getsockopt_error(PRInt32 err);
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_os2_map_getsockopt_error
NSPR_API(void) _MD_os2_map_setsockopt_error(PRInt32 err);
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_os2_map_setsockopt_error
NSPR_API(void) _MD_os2_map_open_error(PRInt32 err);
#define _PR_MD_MAP_OPEN_ERROR _MD_os2_map_open_error
NSPR_API(void) _MD_os2_map_gethostname_error(PRInt32 err);
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_os2_map_gethostname_error
NSPR_API(void) _MD_os2_map_select_error(PRInt32 err);
#define _PR_MD_MAP_SELECT_ERROR _MD_os2_map_select_error
NSPR_API(void) _MD_os2_map_lockf_error(int err);
#define _PR_MD_MAP_LOCKF_ERROR _MD_os2_map_lockf_error
#endif /* nspr_os2_errors_h___ */

View File

@@ -0,0 +1,255 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_osf1_defs_h___
#define nspr_osf1_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "osf"
#define _PR_SI_SYSNAME "OSF"
#define _PR_SI_ARCHITECTURE "alpha"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 131072L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#undef HAVE_WEAK_IO_SYMBOLS
#undef HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define HAVE_BSD_FLOCK
#define NEED_TIME_R
#define USE_DLFCN
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_HAVE_LARGE_OFF_T
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#else
#define AF_INET6 26
#ifndef AI_CANONNAME
#define AI_CANONNAME 0x00000002
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#define AI_V4MAPPED 0x00000010
#define AI_ALL 0x00000008
#define AI_ADDRCONFIG 0x00000020
#endif
#define _PR_HAVE_POSIX_SEMAPHORES
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
#define USE_SETJMP
#include <setjmp.h>
/*
* A jmp_buf is actually a struct sigcontext. The sc_sp field of
* struct sigcontext is the stack pointer.
*/
#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
#define PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
(*_main)(); \
} \
_MD_GET_SP(_thread) = (long) ((_sp) - 64); \
_MD_GET_SP(_thread) &= ~15; \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
jmp_buf context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#ifndef _PR_PTHREADS
#define _MD_INIT_LOCKS()
#endif
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
* The following are copied from _sunos.h, _aix.h. This means
* some of them should probably be moved into _unixos.h. But
* _irix.h seems to be quite different in regard to these macros.
*/
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/* The following defines unwrapped versions of select() and poll(). */
#include <sys/time.h>
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
#define _MD_SELECT __select
#include <sys/poll.h>
#define _MD_POLL __poll
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
/*
* Atomic operations
*/
#ifdef OSF1_HAVE_MACHINE_BUILTINS_H
#include <machine/builtins.h>
#define _PR_HAVE_ATOMIC_OPS
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
#define _MD_ATOMIC_ADD(ptr, val) (__ATOMIC_ADD_LONG(ptr, val) + val)
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
#endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
#endif /* nspr_osf1_defs_h___ */

View File

@@ -0,0 +1,89 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef prpcos_h___
#define prpcos_h___
#define PR_DLL_SUFFIX ".dll"
#include <stdlib.h>
#define DIRECTORY_SEPARATOR '\\'
#define DIRECTORY_SEPARATOR_STR "\\"
#define PATH_SEPARATOR ';'
#ifdef WIN16
#define GCPTR __far
#else
#define GCPTR
#endif
/*
** Routines for processing command line arguments
*/
PR_BEGIN_EXTERN_C
#ifndef XP_OS2_EMX
extern char *optarg;
extern int optind;
extern int getopt(int argc, char **argv, char *spec);
#endif
PR_END_EXTERN_C
/*
** Definitions of directory structures amd functions
** These definitions are from:
** <dirent.h>
*/
#ifdef XP_OS2_EMX
#include <sys/types.h>
#endif
#include <sys/stat.h>
#include <io.h>
#include <fcntl.h> /* O_BINARY */
#ifdef OS2
extern PRStatus _MD_OS2GetHostName(char *name, PRUint32 namelen);
#define _MD_GETHOSTNAME _MD_OS2GetHostName
#else
extern PRStatus _MD_WindowsGetHostName(char *name, PRUint32 namelen);
#define _MD_GETHOSTNAME _MD_WindowsGetHostName
extern PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen);
#define _MD_GETSYSINFO _MD_WindowsGetSysInfo
#endif
#endif /* prpcos_h___ */

View File

@@ -0,0 +1,303 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_pth_defs_h_
#define nspr_pth_defs_h_
/*
** Appropriate definitions of entry points not used in a pthreads world
*/
#define _PR_MD_BLOCK_CLOCK_INTERRUPTS()
#define _PR_MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _PR_MD_DISABLE_CLOCK_INTERRUPTS()
#define _PR_MD_ENABLE_CLOCK_INTERRUPTS()
/* In good standards fashion, the DCE threads (based on posix-4) are not
* quite the same as newer posix implementations. These are mostly name
* changes and small differences, so macros usually do the trick
*/
#ifdef _PR_DCETHREADS
#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_create
#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_delete
#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), a)
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (0 == pthread_mutex_trylock(&(m)))
#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_create
#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), a)
#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_delete
/* Notes about differences between DCE threads and pthreads 10:
* 1. pthread_mutex_trylock returns 1 when it locks the mutex
* 0 when it does not. The latest pthreads has a set of errno-like
* return values.
* 2. return values from pthread_cond_timedwait are different.
*
*
*
*/
#elif defined(BSDI)
/*
* Mutex and condition attributes are not supported. The attr
* argument to pthread_mutex_init() and pthread_cond_init() must
* be passed as NULL.
*
* The memset calls in _PT_PTHREAD_MUTEX_INIT and _PT_PTHREAD_COND_INIT
* are to work around BSDI's using a single bit to indicate a mutex
* or condition variable is initialized. This entire BSDI section
* will go away when BSDI releases updated threads libraries for
* BSD/OS 3.1 and 4.0.
*/
#define _PT_PTHREAD_MUTEXATTR_INIT(x) 0
#define _PT_PTHREAD_MUTEXATTR_DESTROY(x) /* */
#define _PT_PTHREAD_MUTEX_INIT(m, a) (memset(&(m), 0, sizeof(m)), \
pthread_mutex_init(&(m), NULL))
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m)))
#define _PT_PTHREAD_CONDATTR_INIT(x) 0
#define _PT_PTHREAD_CONDATTR_DESTROY(x) /* */
#define _PT_PTHREAD_COND_INIT(m, a) (memset(&(m), 0, sizeof(m)), \
pthread_cond_init(&(m), NULL))
#else
#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_init
#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy
#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), &(a))
#if defined(FREEBSD)
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) pt_pthread_mutex_is_locked(&(m))
#else
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m)))
#endif
#if defined(DARWIN)
#define _PT_PTHREAD_CONDATTR_INIT(x) 0
#else
#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init
#endif
#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy
#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a))
#endif
/* The pthreads standard does not specify an invalid value for the
* pthread_t handle. (0 is usually an invalid pthread identifier
* but there are exceptions, for example, DG/UX.) These macros
* define a way to set the handle to or compare the handle with an
* invalid identifier. These macros are not portable and may be
* more of a problem as we adapt to more pthreads implementations.
* They are only used in the PRMonitor functions. Do not use them
* in new code.
*
* Unfortunately some of our clients depend on certain properties
* of our PRMonitor implementation, preventing us from replacing
* it by a portable implementation.
* - High-performance servers like the fact that PR_EnterMonitor
* only calls PR_Lock and PR_ExitMonitor only calls PR_Unlock.
* (A portable implementation would use a PRLock and a PRCondVar
* to implement the recursive lock in a monitor and call both
* PR_Lock and PR_Unlock in PR_EnterMonitor and PR_ExitMonitor.)
* Unfortunately this forces us to read the monitor owner field
* without holding a lock.
* - One way to make it safe to read the monitor owner field
* without holding a lock is to make that field a PRThread*
* (one should be able to read a pointer with a single machine
* instruction). However, PR_GetCurrentThread calls calloc if
* it is called by a thread that was not created by NSPR. The
* malloc tracing tools in the Mozilla client use PRMonitor for
* locking in their malloc, calloc, and free functions. If
* PR_EnterMonitor calls any of these functions, infinite
* recursion ensues.
*/
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) \
memset(&(t), 0, sizeof(pthread_t))
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \
(!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|| defined(HPUX) || defined(LINUX) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|| defined(VMS) || defined(NTO) || defined(DARWIN) \
|| defined(UNIXWARE) || defined(RISCOS)
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
#else
#error "pthreads is not supported for this architecture"
#endif
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_ATTR_INIT pthread_attr_create
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_delete
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, a, f, r)
#define _PT_PTHREAD_KEY_CREATE pthread_keycreate
#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setsched
#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) \
(*(s) = pthread_attr_getstacksize(*(a)), 0)
#define _PT_PTHREAD_GETSPECIFIC(k, r) \
pthread_getspecific((k), (pthread_addr_t *) &(r))
#elif defined(_PR_PTHREADS)
#define _PT_PTHREAD_ATTR_INIT pthread_attr_init
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_destroy
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r)
#define _PT_PTHREAD_KEY_CREATE pthread_key_create
#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setschedpolicy
#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) pthread_attr_getstacksize(a, s)
#define _PT_PTHREAD_GETSPECIFIC(k, r) (r) = pthread_getspecific(k)
#else
#error "Cannot determine pthread strategy"
#endif
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_EXPLICIT_SCHED _PT_PTHREAD_DEFAULT_SCHED
#endif
/*
* pthread_mutex_trylock returns different values in DCE threads and
* pthreads.
*/
#if defined(_PR_DCETHREADS)
#define PT_TRYLOCK_SUCCESS 1
#define PT_TRYLOCK_BUSY 0
#else
#define PT_TRYLOCK_SUCCESS 0
#define PT_TRYLOCK_BUSY EBUSY
#endif
/*
* These platforms don't have sigtimedwait()
*/
#if (defined(AIX) && !defined(AIX4_3_PLUS)) || defined(LINUX) \
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|| defined(BSDI) || defined(VMS) || defined(UNIXWARE) \
|| defined(DARWIN)
#define PT_NO_SIGTIMEDWAIT
#endif
/*
* These platforms don't have pthread_kill()
*/
#if defined(DARWIN)
#define pthread_kill(thread, sig) ENOSYS
#endif
#if defined(OSF1) || defined(VMS)
#define PT_PRIO_MIN PRI_OTHER_MIN
#define PT_PRIO_MAX PRI_OTHER_MAX
#elif defined(IRIX)
#include <sys/sched.h>
#define PT_PRIO_MIN PX_PRIO_MIN
#define PT_PRIO_MAX PX_PRIO_MAX
#elif defined(AIX)
#include <sys/priv.h>
#include <sys/sched.h>
#ifndef PTHREAD_CREATE_JOINABLE
#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED
#endif
#define PT_PRIO_MIN DEFAULT_PRIO
#define PT_PRIO_MAX DEFAULT_PRIO
#elif defined(HPUX)
#if defined(_PR_DCETHREADS)
#define PT_PRIO_MIN PRI_OTHER_MIN
#define PT_PRIO_MAX PRI_OTHER_MAX
#else /* defined(_PR_DCETHREADS) */
#include <sys/sched.h>
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
#endif /* defined(_PR_DCETHREADS) */
#elif defined(LINUX) || defined(FREEBSD)
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
#elif defined(NTO)
/*
* Neutrino has functions that return the priority range but
* they return invalid numbers, so I just hard coded these here
* for now. Jerry.Kirk@Nexarecorp.com
*/
#define PT_PRIO_MIN 0
#define PT_PRIO_MAX 30
#elif defined(SOLARIS)
/*
* Solaris doesn't seem to have macros for the min/max priorities.
* The range of 0-127 is mentioned in the pthread_setschedparam(3T)
* man pages, and pthread_setschedparam indeed allows 0-127. However,
* pthread_attr_setschedparam does not allow 0; it allows 1-127.
*/
#define PT_PRIO_MIN 1
#define PT_PRIO_MAX 127
#elif defined(OPENBSD)
#define PT_PRIO_MIN 0
#define PT_PRIO_MAX 31
#elif defined(NETBSD) \
|| defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) \
|| defined(RISCOS) /* XXX */
#define PT_PRIO_MIN 0
#define PT_PRIO_MAX 126
#else
#error "pthreads is not supported for this architecture"
#endif
/*
* The _PT_PTHREAD_YIELD function is called from a signal handler.
* Needed for garbage collection -- Look at PR_Suspend/PR_Resume
* implementation.
*/
#if defined(_PR_DCETHREADS)
#define _PT_PTHREAD_YIELD() pthread_yield()
#elif defined(OSF1) || defined(VMS)
/*
* sched_yield can't be called from a signal handler. Must use
* the _np version.
*/
#define _PT_PTHREAD_YIELD() pthread_yield_np()
#elif defined(AIX)
extern int (*_PT_aix_yield_fcn)();
#define _PT_PTHREAD_YIELD() (*_PT_aix_yield_fcn)()
#elif defined(IRIX)
#include <time.h>
#define _PT_PTHREAD_YIELD() \
PR_BEGIN_MACRO \
struct timespec onemillisec = {0}; \
onemillisec.tv_nsec = 1000000L; \
nanosleep(&onemillisec,NULL); \
PR_END_MACRO
#elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|| defined(UNIXWARE) || defined(RISCOS)
#define _PT_PTHREAD_YIELD() sched_yield()
#else
#error "Need to define _PT_PTHREAD_YIELD for this platform"
#endif
#endif /* nspr_pth_defs_h_ */

View File

@@ -0,0 +1,215 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_qnx_defs_h___
#define nspr_qnx_defs_h___
/*
** Internal configuration macros
*/
#define PR_LINKER_ARCH "qnx"
#define _PR_SI_SYSNAME "QNX"
#define _PR_SI_ARCHITECTURE "x86"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#undef _PR_POLL_AVAILABLE
#undef _PR_USE_POLL
#define _PR_HAVE_SOCKADDR_LEN
#define HAVE_BSD_FLOCK
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ONLY_ST_ATIME
#include <sys/select.h>
#undef HAVE_STACK_GROWING_UP
#undef HAVE_DLL
#undef USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define _PR_NEED_STRCASECMP
#ifndef HAVE_STRERROR
#define HAVE_STRERROR
#endif
#define USE_SETJMP
#include <setjmp.h>
#define _SETJMP setjmp
#define _LONGJMP longjmp
#define _PR_CONTEXT_TYPE jmp_buf
#define _PR_NUM_GCREGS _JBLEN
#define _MD_GET_SP(_t) (_t)->md.context[7]
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_SETJMP(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_LONGJMP(CONTEXT(_thread), 1); \
}
/*
** Machine-dependent (MD) data structures.
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
** md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
** We wrapped the select() call. _MD_SELECT refers to the built-in,
** unwrapped version.
*/
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
#define _MD_SELECT select
#define SA_RESTART 0
#endif /* nspr_qnx_defs_h___ */

View File

@@ -0,0 +1,270 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* reliantunix.h
* 5/18/96 Taken from nec.h -- chrisk@netscape.com
* 3/14/97 Modified for nspr20 -- chrisk@netscape.com
*/
#ifndef nspr_reliantunix_defs_h___
#define nspr_reliantunix_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "sinix"
#define _PR_SI_SYSNAME "SINIX"
#define _PR_SI_ARCHITECTURE "mips"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
#define _MD_MMAP_FLAGS MAP_PRIVATE|MAP_FIXED
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define HAVE_NETCONFIG
#define HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_MALLOC_SYMBOLS
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ST_ATIM
#define _PR_NO_LARGE_FILES
/*
* Mike Patnode indicated that it is possibly safe now to use context-switching
* calls that do not change the signal mask, like setjmp vs. sigsetjmp.
* So we'll use our homegrown, getcontext/setcontext-compatible stuff which
* will save us the getcontext/setcontext system calls at each context switch.
* It already works in FastTrack 2.01, so it should do it here :-)
* - chrisk 040497
*/
#define USE_SETCXT /* temporarily disabled... */
#include <ucontext.h>
#ifdef USE_SETCXT
/* use non-syscall machine language replacement */
#define _GETCONTEXT getcxt
#define _SETCONTEXT setcxt
/* defined in os_ReliantUNIX.s */
extern int getcxt(ucontext_t *);
extern int setcxt(ucontext_t *);
#else
#define _GETCONTEXT getcontext
#define _SETCONTEXT setcontext
#endif
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gpregs[CXT_SP]
#define _PR_CONTEXT_TYPE ucontext_t
#define _PR_NUM_GCREGS NGREG
#define CONTEXT(_thread) (&(_thread)->md.context)
#define _PR_IS_NATIVE_THREAD_SUPPORTED() 0
/*
** Machine-dependent (MD) data structures.
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
** Initialize the thread context preparing it to execute "_main()"
** - get a nice, fresh context
** - set its SP to the stack we allcoated for it
** - set it to start things at "e"
*/
#define _MD_INIT_CONTEXT(thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
_GETCONTEXT(CONTEXT(thread)); \
/* this is supposed to point to the stack BASE, not to SP */ \
CONTEXT(thread)->uc_stack.ss_sp = thread->stack->stackBottom; \
CONTEXT(thread)->uc_stack.ss_size = thread->stack->stackSize; \
CONTEXT(thread)->uc_mcontext.gpregs[CXT_SP] = ((unsigned long)_sp - 128) & 0xfffffff8; \
CONTEXT(thread)->uc_mcontext.gpregs[CXT_T9] = _main; \
CONTEXT(thread)->uc_mcontext.gpregs[CXT_EPC] = _main; \
CONTEXT(thread)->uc_mcontext.gpregs[CXT_RA] = 0; \
thread->no_sched = 0; \
PR_END_MACRO
/*
** Save current context as it is scheduled away
*/
#define _MD_SWITCH_CONTEXT(_thread) \
PR_BEGIN_MACRO \
if (!_GETCONTEXT(CONTEXT(_thread))) { \
_MD_SAVE_ERRNO(_thread); \
_MD_SET_LAST_THREAD(_thread); \
_PR_Schedule(); \
} \
PR_END_MACRO
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT or set up
** by _MD_INIT_CONTEXT
** CXT_V0 is the register that holds the return value.
** We must set it to 1 so that we can see if the return from
** getcontext() is the result of calling getcontext() or
** setcontext()...
** setting a context got with getcontext() appears to
** return from getcontext(), too!
** CXT_A3 is the register that holds status when returning
** from a syscall. It is set to 0 to indicate success,
** because we want getcontext() on the other side of the magic
** door to be ok.
*/
#define _MD_RESTORE_CONTEXT(_thread) \
PR_BEGIN_MACRO \
ucontext_t *uc = CONTEXT(_thread); \
uc->uc_mcontext.gpregs[CXT_V0] = 1;\
uc->uc_mcontext.gpregs[CXT_A3] = 0;\
_MD_RESTORE_ERRNO(_thread); \
_MD_SET_CURRENT_THREAD(_thread); \
_SETCONTEXT(uc); \
PR_END_MACRO
#define _MD_SAVE_ERRNO(t) (t)->md.errcode = errno;
#define _MD_RESTORE_ERRNO(t) errno = (t)->md.errcode;
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
#define S_ISSOCK(mode) ((mode&0xF000) == 0xC000)
#endif
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(mode) ((mode&0xA000) == 0xC000)
#endif
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *execptfds, struct timeval *timeout);
#define _MD_SELECT(nfds,r,w,e,tv) _select(nfds,r,w,e,tv)
#define _MD_POLL _poll
#endif /* nspr_reliantunix_defs_h___ */

View File

@@ -0,0 +1,225 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_rhapsody_defs_h___
#define nspr_rhapsody_defs_h___
#include "prthread.h"
#include <sys/syscall.h>
#define PR_LINKER_ARCH "rhapsody"
#define _PR_SI_SYSNAME "RHAPSODY"
#ifdef i386
#define _PR_SI_ARCHITECTURE "x86"
#else
#define _PR_SI_ARCHITECTURE "ppc"
#endif
#define PR_DLL_SUFFIX ".dylib"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_MACH_DYLD
#define _PR_HAVE_SOCKADDR_LEN
#define _PR_STAT_HAS_ST_ATIMESPEC
#define _PR_NO_LARGE_FILES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#define USE_SETJMP
#if !defined(_PR_PTHREADS)
#include <setjmp.h>
#define PR_CONTEXT_TYPE jmp_buf
#define CONTEXT(_th) ((_th)->md.context)
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
#define PR_NUM_GCREGS _JBLEN
/*
** Initialize a thread context to run "_main()" when started
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) { \
_main(); \
} \
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
extern PRStatus _MD_InitializeThread(PRThread *thread);
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
#define _MD_CLEAN_THREAD(_thread)
extern PRStatus _MD_CREATE_THREAD(
PRThread *thread,
void (*start) (void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
extern void _MD_YIELD(void);
#endif /* ! _PR_PTHREADS */
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
extern void _MD_EarlyInit(void);
extern PRIntervalTime _PR_UNIX_GetInterval(void);
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
/* For writev() */
#include <sys/uio.h>
#endif /* nspr_rhapsody_defs_h___ */

View File

@@ -0,0 +1,209 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Peter Naulls <peter@chocky.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_riscos_defs_h___
#define nspr_riscos_defs_h___
/*
** Internal configuration macros
*/
#define PR_LINKER_ARCH "riscos"
#define _PR_SI_SYSNAME "RISCOS"
#define _PR_SI_ARCHITECTURE "arm"
#define PR_DLL_SUFFIX ".a"
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_HAVE_SOCKADDR_LEN
#undef HAVE_BSD_FLOCK
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _PR_HAVE_POSIX_SEMAPHORES
#include <sys/select.h>
#include <sys/poll.h>
#include <kernel.h>
#undef HAVE_STACK_GROWING_UP
#undef HAVE_DLL
#undef USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define PT_NO_SIGTIMEDWAIT
#ifndef HAVE_STRERROR
#define HAVE_STRERROR
#endif
#define USE_SETJMP
#include <setjmp.h>
#define _SETJMP setjmp
#define _LONGJMP longjmp
#define _PR_CONTEXT_TYPE jmp_buf
#define _PR_NUM_GCREGS _JBLEN
#define _MD_GET_SP(_t) (_t)->md.context[7]
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_SETJMP(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_LONGJMP(CONTEXT(_thread), 1); \
}
/*
** Machine-dependent (MD) data structures.
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
** md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif
};
#define _PR_IOQ(_cpu) /* */ ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
** We wrapped the select() call. _MD_SELECT refers to the built-in,
** unwrapped version.
*/
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
#define _MD_SELECT select
#endif /* nspr_riscos_defs_h___ */

View File

@@ -0,0 +1,204 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_scoos5_defs_h___
#define nspr_scoos5_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "scoos5"
#define PR_DLL_SUFFIX ".so"
#define _PR_SI_SYSNAME "SCO"
#define _PR_SI_ARCHITECTURE "x86"
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#if !defined (HAVE_STRERROR)
#define HAVE_STRERROR
#endif
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
#define USE_SETJMP
#ifdef _PR_LOCAL_THREADS_ONLY
#include <setjmp.h>
#define _MD_GET_SP(_t) (_t)->md.jb[4]
#define PR_NUM_GCREGS _SIGJBLEN
#define PR_CONTEXT_TYPE sigjmp_buf
#define CONTEXT(_th) ((_th)->md.jb)
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if (sigsetjmp(CONTEXT(_thread),1)) { \
(*_main)(); \
} \
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->osErrorCode; \
_MD_SET_CURRENT_THREAD(_thread); \
siglongjmp(CONTEXT(_thread), 1); \
}
#endif /* _PR_LOCAL_THREADS_ONLY */
struct _MDThread {
jmp_buf jb;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_SELECT _select
#define _MD_POLL _poll
#endif /* nspr_scoos5_defs_h___ */

View File

@@ -0,0 +1,806 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_solaris_defs_h___
#define nspr_solaris_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "solaris"
#define _PR_SI_SYSNAME "SOLARIS"
#ifdef sparc
#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__x86_64)
#define _PR_SI_ARCHITECTURE "x86-64"
#elif defined(i386)
#define _PR_SI_ARCHITECTURE "x86"
#else
#error unknown processor
#endif
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
#define _MD_MMAP_FLAGS MAP_SHARED
#undef HAVE_STACK_GROWING_UP
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#undef HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define USE_DLFCN
#define NEED_STRFTIME_LOCK
/*
* Intel x86 has atomic instructions.
*
* Sparc v8 does not have instructions to efficiently implement
* atomic increment/decrement operations. In the local threads
* only and pthreads versions, we use the default atomic routine
* implementation in pratom.c. The obsolete global threads only
* version uses a global mutex_t to implement the atomic routines
* in solaris.c, which is actually equivalent to the default
* implementation.
*
* 64-bit Solaris requires sparc v9, which has atomic instructions.
*/
#if defined(i386) || defined(_PR_GLOBAL_THREADS_ONLY) || defined(IS_64)
#define _PR_HAVE_ATOMIC_OPS
#endif
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ST_ATIM
#ifdef SOLARIS2_5
#define _PR_HAVE_SYSV_SEMAPHORES
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
#else
#define _PR_HAVE_POSIX_SEMAPHORES
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
#endif
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#define _PR_ACCEPT_INHERIT_NONBLOCK
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#else
#define AF_INET6 26
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#define AI_CANONNAME 0x0010
#define AI_V4MAPPED 0x0001
#define AI_ALL 0x0002
#define AI_ADDRCONFIG 0x0004
#define _PR_HAVE_MD_SOCKADDR_IN6
/* isomorphic to struct in6_addr on Solaris 8 */
struct _md_in6_addr {
union {
PRUint8 _S6_u8[16];
PRUint32 _S6_u32[4];
PRUint32 __S6_align;
} _S6_un;
};
/* isomorphic to struct sockaddr_in6 on Solaris 8 */
struct _md_sockaddr_in6 {
PRUint16 sin6_family;
PRUint16 sin6_port;
PRUint32 sin6_flowinfo;
struct _md_in6_addr sin6_addr;
PRUint32 sin6_scope_id;
PRUint32 __sin6_src_id;
};
#endif
#if defined(_PR_GLOBAL_THREADS_ONLY) || defined(_PR_PTHREADS)
#define _PR_HAVE_GETHOST_R
#define _PR_HAVE_GETHOST_R_POINTER
#endif
#include "prinrval.h"
NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
#define _MD_GET_INTERVAL _MD_Solaris_GetInterval
NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
#define _MD_INTERVAL_PER_SEC _MD_Solaris_TicksPerSecond
#if defined(_PR_HAVE_ATOMIC_OPS)
/*
** Atomic Operations
*/
#define _MD_INIT_ATOMIC()
NSPR_API(PRInt32) _MD_AtomicIncrement(PRInt32 *val);
#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
NSPR_API(PRInt32) _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val);
#define _MD_ATOMIC_ADD _MD_AtomicAdd
NSPR_API(PRInt32) _MD_AtomicDecrement(PRInt32 *val);
#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
NSPR_API(PRInt32) _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
#define _MD_ATOMIC_SET _MD_AtomicSet
#endif /* _PR_HAVE_ATOMIC_OPS */
#if defined(_PR_PTHREADS)
NSPR_API(void) _MD_EarlyInit(void);
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#elif defined(_PR_GLOBAL_THREADS_ONLY)
#include "prthread.h"
#include <ucontext.h>
/*
** Iinitialization Related definitions
*/
NSPR_API(void) _MD_EarlyInit(void);
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_GET_SP(threadp) threadp->md.sp
/*
** Clean-up the thread machine dependent data structure
*/
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_INIT_ATTACHED_THREAD _MD_InitializeThread
NSPR_API(PRStatus) _MD_CreateThread(PRThread *thread,
void (*start)(void *),
PRThreadPriority priority,
PRThreadScope scope,
PRThreadState state,
PRUint32 stackSize);
#define _MD_CREATE_THREAD _MD_CreateThread
#define _PR_CONTEXT_TYPE ucontext_t
#define CONTEXT(_thread) (&(_thread)->md.context)
#include <thread.h>
#include <sys/lwp.h>
#include <synch.h>
extern struct PRLock *_pr_schedLock;
/*
** Thread Local Storage
*/
#define THREAD_KEY_T thread_key_t
extern struct PRThread *_pr_attached_thread_tls();
extern struct PRThread *_pr_current_thread_tls();
extern struct _PRCPU *_pr_current_cpu_tls();
extern struct PRThread *_pr_last_thread_tls();
extern THREAD_KEY_T threadid_key;
extern THREAD_KEY_T cpuid_key;
extern THREAD_KEY_T last_thread_key;
#define _MD_GET_ATTACHED_THREAD() _pr_attached_thread_tls()
#define _MD_CURRENT_THREAD() _pr_current_thread_tls()
#define _MD_CURRENT_CPU() _pr_current_cpu_tls()
#define _MD_LAST_THREAD() _pr_last_thread_tls()
#define _MD_SET_CURRENT_THREAD(newval) \
PR_BEGIN_MACRO \
thr_setspecific(threadid_key, (void *)newval); \
PR_END_MACRO
#define _MD_SET_CURRENT_CPU(newval) \
PR_BEGIN_MACRO \
thr_setspecific(cpuid_key, (void *)newval); \
PR_END_MACRO
#define _MD_SET_LAST_THREAD(newval) \
PR_BEGIN_MACRO \
thr_setspecific(last_thread_key, (void *)newval); \
PR_END_MACRO
#define _MD_CLEAN_THREAD(_thread) _MD_cleanup_thread(_thread)
extern void _MD_exit_thread(PRThread *thread);
#define _MD_EXIT_THREAD(thread) _MD_exit_thread(thread)
#define _MD_SUSPEND_THREAD(thread) _MD_Suspend(thread)
#define _MD_RESUME_THREAD(thread) thr_continue((thread)->md.handle)
/* XXXX Needs to be defined - Prashant */
#define _MD_SUSPEND_CPU(cpu)
#define _MD_RESUME_CPU(cpu)
extern void _MD_Begin_SuspendAll(void);
extern void _MD_End_SuspendAll(void);
extern void _MD_End_ResumeAll(void);
#define _MD_BEGIN_SUSPEND_ALL() _MD_Begin_SuspendAll()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL() _MD_End_SuspendAll()
#define _MD_END_RESUME_ALL() _MD_End_ResumeAll()
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(md_lockp) (mutex_init(&((md_lockp)->lock),USYNC_THREAD,NULL) ? PR_FAILURE : PR_SUCCESS)
#define _MD_FREE_LOCK(md_lockp) mutex_destroy(&((md_lockp)->lock))
#define _MD_UNLOCK(md_lockp) mutex_unlock(&((md_lockp)->lock))
#define _MD_TEST_AND_LOCK(md_lockp) mutex_trylock(&((md_lockp)->lock))
struct _MDLock;
NSPR_API(void) _MD_lock(struct _MDLock *md_lock);
#undef PROFILE_LOCKS
#ifndef PROFILE_LOCKS
#define _MD_LOCK(md_lockp) _MD_lock(md_lockp)
#else
#define _MD_LOCK(md_lockp) \
PR_BEGIN_MACRO \
int rv = _MD_TEST_AND_LOCK(md_lockp); \
if (rv == 0) { \
(md_lockp)->hitcount++; \
} else { \
(md_lockp)->misscount++; \
_MD_lock(md_lockp); \
} \
PR_END_MACRO
#endif
#define _PR_LOCK_HEAP() if (_pr_heapLock) _MD_LOCK(&_pr_heapLock->md)
#define _PR_UNLOCK_HEAP() if (_pr_heapLock) _MD_UNLOCK(&_pr_heapLock->md)
#define _MD_ATTACH_THREAD(threadp)
#define THR_KEYCREATE thr_keycreate
#define THR_SELF thr_self
#define _MD_NEW_CV(condp) cond_init(&((condp)->cv), USYNC_THREAD, 0)
#define COND_WAIT(condp, mutexp) cond_wait(condp, mutexp)
#define COND_TIMEDWAIT(condp, mutexp, tspec) \
cond_timedwait(condp, mutexp, tspec)
#define _MD_NOTIFY_CV(condp, lockp) cond_signal(&((condp)->cv))
#define _MD_NOTIFYALL_CV(condp,unused) cond_broadcast(&((condp)->cv))
#define _MD_FREE_CV(condp) cond_destroy(&((condp)->cv))
#define _MD_YIELD() thr_yield()
#include <time.h>
/*
* Because clock_gettime() on Solaris/x86 2.4 always generates a
* segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
* which is implemented using gettimeofday().
*/
#if defined(i386) && defined(SOLARIS2_4)
extern int _pr_solx86_clock_gettime(clockid_t clock_id, struct timespec *tp);
#define GETTIME(tt) _pr_solx86_clock_gettime(CLOCK_REALTIME, (tt))
#else
#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
#endif /* i386 && SOLARIS2_4 */
#define MUTEX_T mutex_t
#define COND_T cond_t
#define _MD_NEW_SEM(md_semp,_val) sema_init(&((md_semp)->sem),_val,USYNC_THREAD,NULL)
#define _MD_DESTROY_SEM(md_semp) sema_destroy(&((md_semp)->sem))
#define _MD_WAIT_SEM(md_semp) sema_wait(&((md_semp)->sem))
#define _MD_POST_SEM(md_semp) sema_post(&((md_semp)->sem))
#define _MD_SAVE_ERRNO(_thread)
#define _MD_RESTORE_ERRNO(_thread)
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
extern struct _MDLock _pr_ioq_lock;
#define _MD_IOQ_LOCK() _MD_LOCK(&_pr_ioq_lock)
#define _MD_IOQ_UNLOCK() _MD_UNLOCK(&_pr_ioq_lock)
extern PRStatus _MD_wait(struct PRThread *, PRIntervalTime timeout);
#define _MD_WAIT _MD_wait
extern PRStatus _MD_WakeupWaiter(struct PRThread *);
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
NSPR_API(void) _MD_InitIO(void);
#define _MD_INIT_IO _MD_InitIO
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread)
#define _MD_RESTORE_CONTEXT(_newThread)
struct _MDLock {
MUTEX_T lock;
#ifdef PROFILE_LOCKS
PRInt32 hitcount;
PRInt32 misscount;
#endif
};
struct _MDCVar {
COND_T cv;
};
struct _MDSemaphore {
sema_t sem;
};
struct _MDThread {
_PR_CONTEXT_TYPE context;
thread_t handle;
lwpid_t lwpid;
uint_t sp; /* stack pointer */
uint_t threadID; /* ptr to solaris-internal thread id structures */
struct _MDSemaphore waiter_sem;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field, common to all Unix platforms
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
/* The following defines the unwrapped versions of select() and poll(). */
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
#define _MD_SELECT _select
#include <poll.h>
#define _MD_POLL _poll
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
PR_BEGIN_EXTERN_C
/*
** Missing function prototypes
*/
extern int gethostname (char *name, int namelen);
PR_END_EXTERN_C
#else /* _PR_GLOBAL_THREADS_ONLY */
/*
* LOCAL_THREADS_ONLY implementation on Solaris
*/
#include "prthread.h"
#include <errno.h>
#include <ucontext.h>
#include <sys/stack.h>
#include <synch.h>
/*
** Iinitialization Related definitions
*/
NSPR_API(void) _MD_EarlyInit(void);
NSPR_API(void) _MD_SolarisInit();
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _MD_SolarisInit
#define _MD_INIT_THREAD _MD_InitializeThread
#ifdef USE_SETJMP
#include <setjmp.h>
#define _PR_CONTEXT_TYPE jmp_buf
#ifdef sparc
#define _MD_GET_SP(_t) (_t)->md.context[2]
#else
#define _MD_GET_SP(_t) (_t)->md.context[4]
#endif
#define PR_NUM_GCREGS _JBLEN
#define CONTEXT(_thread) (_thread)->md.context
#else /* ! USE_SETJMP */
#ifdef sparc
#define _PR_CONTEXT_TYPE ucontext_t
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[REG_SP]
/*
** Sparc's use register windows. the _MD_GetRegisters for the sparc's
** doesn't actually store anything into the argument buffer; instead the
** register windows are homed to the stack. I assume that the stack
** always has room for the registers to spill to...
*/
#define PR_NUM_GCREGS 0
#else
#define _PR_CONTEXT_TYPE unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[USP]
#define PR_NUM_GCREGS _JBLEN
#endif
#define CONTEXT(_thread) (&(_thread)->md.context)
#endif /* ! USE_SETJMP */
#include <time.h>
/*
* Because clock_gettime() on Solaris/x86 always generates a
* segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
* which is implemented using gettimeofday().
*/
#ifdef i386
#define GETTIME(tt) _pr_solx86_clock_gettime(CLOCK_REALTIME, (tt))
#else
#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
#endif /* i386 */
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
#ifdef sparc
#ifdef USE_SETJMP
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
int *context = (_thread)->md.context; \
*status = PR_TRUE; \
(void) setjmp(context); \
(_thread)->md.context[1] = (int) ((_sp) - 64); \
(_thread)->md.context[2] = (int) _main; \
(_thread)->md.context[3] = (int) _main + 4; \
_thread->no_sched = 0; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
_MD_SAVE_ERRNO(_thread) \
_MD_SET_LAST_THREAD(_thread); \
_MD_SET_CURRENT_THREAD(_thread); \
_PR_Schedule(); \
}
#define _MD_RESTORE_CONTEXT(_newThread) \
{ \
_MD_RESTORE_ERRNO(_newThread) \
_MD_SET_CURRENT_THREAD(_newThread); \
longjmp(CONTEXT(_newThread), 1); \
}
#else
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
ucontext_t *uc = CONTEXT(_thread); \
*status = PR_TRUE; \
getcontext(uc); \
uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
uc->uc_stack.ss_size = _thread->stack->stackSize; \
uc->uc_stack.ss_flags = 0; /* ? */ \
uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp; \
uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main; \
uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4; \
uc->uc_flags = UC_ALL; \
_thread->no_sched = 0; \
PR_END_MACRO
/*
** Switch away from the current thread context by saving its state and
** calling the thread scheduler. Reload cpu when we come back from the
** context switch because it might have changed.
*/
#define _MD_SWITCH_CONTEXT(_thread) \
PR_BEGIN_MACRO \
if (!getcontext(CONTEXT(_thread))) { \
_MD_SAVE_ERRNO(_thread); \
_MD_SET_LAST_THREAD(_thread); \
_PR_Schedule(); \
} \
PR_END_MACRO
/*
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
** initialized by _MD_INIT_CONTEXT.
*/
#define _MD_RESTORE_CONTEXT(_newThread) \
PR_BEGIN_MACRO \
ucontext_t *uc = CONTEXT(_newThread); \
uc->uc_mcontext.gregs[11] = 1; \
_MD_RESTORE_ERRNO(_newThread); \
_MD_SET_CURRENT_THREAD(_newThread); \
setcontext(uc); \
PR_END_MACRO
#endif
#else /* x86 solaris */
#ifdef USE_SETJMP
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
if (setjmp(CONTEXT(_thread))) _main(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
_MD_SAVE_ERRNO(_thread) \
_PR_Schedule(); \
}
#define _MD_RESTORE_CONTEXT(_newThread) \
{ \
_MD_RESTORE_ERRNO(_newThread) \
_MD_SET_CURRENT_THREAD(_newThread); \
longjmp(CONTEXT(_newThread), 1); \
}
#else /* USE_SETJMP */
#define WINDOWSIZE 0
int getedi(void);
void setedi(int);
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
ucontext_t *uc = CONTEXT(_thread); \
*status = PR_TRUE; \
getcontext(uc); \
/* Force sp to be double aligned! */ \
uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
uc->uc_mcontext.gregs[PC] = (int) _main; \
(_thread)->no_sched = 0; \
PR_END_MACRO
/* getcontext() may return 1, contrary to what the man page says */
#define _MD_SWITCH_CONTEXT(_thread) \
PR_BEGIN_MACRO \
ucontext_t *uc = CONTEXT(_thread); \
PR_ASSERT(_thread->no_sched); \
sigfillset(&((_thread)->md.blockMask)); \
sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask), \
&((_thread)->md.oldMask)); \
(_thread)->md.edi = getedi(); \
if (! getcontext(uc)) { \
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi; \
_MD_SAVE_ERRNO(_thread) \
_MD_SET_LAST_THREAD(_thread); \
_PR_Schedule(); \
} else { \
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
setedi((_thread)->md.edi); \
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
_MD_LAST_THREAD()->no_sched = 0; \
} \
PR_END_MACRO
/*
** Restore a thread context, saved by _PR_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_newthread) \
PR_BEGIN_MACRO \
ucontext_t *uc = CONTEXT(_newthread); \
uc->uc_mcontext.gregs[EAX] = 1; \
_MD_RESTORE_ERRNO(_newthread) \
_MD_SET_CURRENT_THREAD(_newthread); \
(_newthread)->no_sched = 1; \
setcontext(uc); \
PR_END_MACRO
#endif /* USE_SETJMP */
#endif /* sparc */
struct _MDLock {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDThread {
_PR_CONTEXT_TYPE context;
int errcode;
int id;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#ifndef _PR_PTHREADS
#define _MD_INIT_LOCKS()
#endif
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
extern PRStatus _MD_WAIT(struct PRThread *, PRIntervalTime timeout);
extern PRStatus _MD_WAKEUP_WAITER(struct PRThread *);
extern void _MD_YIELD(void);
extern PRStatus _MD_InitializeThread(PRThread *thread);
extern void _MD_SET_PRIORITY(struct _MDThread *thread,
PRThreadPriority newPri);
extern PRStatus _MD_CREATE_THREAD(PRThread *thread, void (*start) (void *),
PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
PRUint32 stackSize);
NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
#define _MD_GET_INTERVAL _MD_Solaris_GetInterval
NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
#define _MD_INTERVAL_PER_SEC _MD_Solaris_TicksPerSecond
/* The following defines the unwrapped versions of select() and poll(). */
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
#define _MD_SELECT _select
#include <stropts.h>
#include <poll.h>
#define _MD_POLL _poll
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
PR_BEGIN_EXTERN_C
/*
** Missing function prototypes
*/
extern int gethostname (char *name, int namelen);
PR_END_EXTERN_C
#endif /* _PR_GLOBAL_THREADS_ONLY */
extern void _MD_solaris_map_sendfile_error(int err);
#endif /* nspr_solaris_defs_h___ */

View File

@@ -0,0 +1,204 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_sony_defs_h___
#define nspr_sony_defs_h___
#define PR_LINKER_ARCH "sony"
#define _PR_SI_SYSNAME "SONY"
#define _PR_SI_ARCHITECTURE "mips"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#if defined(_PR_LOCAL_THREADS_ONLY)
#include <ucontext.h>
#include <sys/regset.h>
#define PR_NUM_GCREGS NGREG
#define PR_CONTEXT_TYPE ucontext_t
#define CONTEXT(_thread) (&(_thread)->md.context)
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[CXT_SP]
/*
** Initialize the thread context preparing it to execute _main()
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
getcontext(CONTEXT(_thread)); \
CONTEXT(_thread)->uc_stack.ss_sp = (char*) (_thread)->stack->stackBottom; \
CONTEXT(_thread)->uc_stack.ss_size = (_thread)->stack->stackSize; \
_MD_GET_SP(_thread) = (greg_t) (_sp) - 64; \
makecontext(CONTEXT(_thread), _main, 0); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!getcontext(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
ucontext_t *uc = CONTEXT(_thread); \
uc->uc_mcontext.gregs[CXT_V0] = 1; \
uc->uc_mcontext.gregs[CXT_A3] = 0; \
_MD_SET_CURRENT_THREAD(_thread); \
errno = (_thread)->md.errcode; \
setcontext(uc); \
}
/* Machine-dependent (MD) data structures */
struct _MDThread {
PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/* The following defines unwrapped versions of select() and poll(). */
extern int _select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
#define _MD_SELECT _select
#include <sys/poll.h>
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
#define _MD_POLL _poll
#endif /* _PR_LOCAL_THREADS_ONLY */
#undef HAVE_STACK_GROWING_UP
#define HAVE_DLL
#define USE_DLFCN
#define NEED_TIME_R
#define NEED_STRFTIME_LOCK
/*
** Missing function prototypes
*/
extern int gethostname(char *name, int namelen);
#endif /* nspr_sony_defs_h___ */

View File

@@ -0,0 +1,236 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_sunos_defs_h___
#define nspr_sunos_defs_h___
#include "md/sunos4.h"
/* On SunOS 4, memset is declared in memory.h */
#include <memory.h>
#include <errno.h>
#include <sys/syscall.h>
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "sunos"
#define _PR_SI_SYSNAME "SUNOS"
#define _PR_SI_ARCHITECTURE "sparc"
#define PR_DLL_SUFFIX ".so.1.0"
/*
** For sunos type machines, don't specify an address because the
** NetBSD/SPARC O.S. does the wrong thing.
*/
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#undef HAVE_STACK_GROWING_UP
#undef HAVE_WEAK_IO_SYMBOLS
#undef HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define USE_DLFCN
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define HAVE_BSD_FLOCK
#define _PR_NO_LARGE_FILES
#define _PR_STAT_HAS_ONLY_ST_ATIME
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define USE_SETJMP
#include <setjmp.h>
#define _MD_GET_SP(_t) (_t)->md.context[2]
#define PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
int *context = (_thread)->md.context; \
*status = PR_TRUE; \
asm("ta 3"); \
(void) setjmp(context); \
(_thread)->md.context[2] = (int) ((_sp) - 64); \
(_thread)->md.context[2] &= ~7; \
(_thread)->md.context[3] = (int) _main; \
(_thread)->md.context[4] = (int) _main + 4; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread) \
asm("ta 3"); \
if (!setjmp(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
longjmp(CONTEXT(_thread), 1); \
}
#pragma unknown_control_flow(longjmp)
#pragma unknown_control_flow(setjmp)
#pragma unknown_control_flow(_PR_Schedule)
/*
** Missing function prototypes
*/
extern int socket (int domain, int type, int protocol);
extern int getsockname (int s, struct sockaddr *name, int *namelen);
extern int getpeername (int s, struct sockaddr *name, int *namelen);
extern int getsockopt (int s, int level, int optname, char* optval, int* optlen);
extern int setsockopt (int s, int level, int optname, const char* optval, int optlen);
extern int accept (int s, struct sockaddr *addr, int *addrlen);
extern int listen (int s, int backlog);
extern int brk(void *);
extern void *sbrk(int);
/* Machine-dependent (MD) data structures. SunOS 4 has no native threads. */
struct _MDThread {
jmp_buf context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/* These are copied from _solaris.h */
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
#endif /* nspr_sparc_defs_h___ */

View File

@@ -0,0 +1,171 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef prunixerrors_h___
#define prunixerrors_h___
#include <unistd.h>
#include <stddef.h>
PR_BEGIN_EXTERN_C
extern void _MD_unix_map_default_error(int err);
#define _PR_MD_MAP_DEFAULT_ERROR _MD_unix_map_default_error
extern void _MD_unix_map_opendir_error(int err);
#define _PR_MD_MAP_OPENDIR_ERROR _MD_unix_map_opendir_error
extern void _MD_unix_map_closedir_error(int err);
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_unix_map_closedir_error
extern void _MD_unix_readdir_error(int err);
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
extern void _MD_unix_map_unlink_error(int err);
#define _PR_MD_MAP_UNLINK_ERROR _MD_unix_map_unlink_error
extern void _MD_unix_map_stat_error(int err);
#define _PR_MD_MAP_STAT_ERROR _MD_unix_map_stat_error
extern void _MD_unix_map_fstat_error(int err);
#define _PR_MD_MAP_FSTAT_ERROR _MD_unix_map_fstat_error
extern void _MD_unix_map_rename_error(int err);
#define _PR_MD_MAP_RENAME_ERROR _MD_unix_map_rename_error
extern void _MD_unix_map_access_error(int err);
#define _PR_MD_MAP_ACCESS_ERROR _MD_unix_map_access_error
extern void _MD_unix_map_mkdir_error(int err);
#define _PR_MD_MAP_MKDIR_ERROR _MD_unix_map_mkdir_error
extern void _MD_unix_map_rmdir_error(int err);
#define _PR_MD_MAP_RMDIR_ERROR _MD_unix_map_rmdir_error
extern void _MD_unix_map_read_error(int err);
#define _PR_MD_MAP_READ_ERROR _MD_unix_map_read_error
extern void _MD_unix_map_write_error(int err);
#define _PR_MD_MAP_WRITE_ERROR _MD_unix_map_write_error
extern void _MD_unix_map_lseek_error(int err);
#define _PR_MD_MAP_LSEEK_ERROR _MD_unix_map_lseek_error
extern void _MD_unix_map_fsync_error(int err);
#define _PR_MD_MAP_FSYNC_ERROR _MD_unix_map_fsync_error
extern void _MD_unix_map_close_error(int err);
#define _PR_MD_MAP_CLOSE_ERROR _MD_unix_map_close_error
extern void _MD_unix_map_socket_error(int err);
#define _PR_MD_MAP_SOCKET_ERROR _MD_unix_map_socket_error
extern void _MD_unix_map_socketavailable_error(int err);
#define _PR_MD_MAP_SOCKETAVAILABLE_ERROR _MD_unix_map_socketavailable_error
extern void _MD_unix_map_recv_error(int err);
#define _PR_MD_MAP_RECV_ERROR _MD_unix_map_recv_error
extern void _MD_unix_map_recvfrom_error(int err);
#define _PR_MD_MAP_RECVFROM_ERROR _MD_unix_map_recvfrom_error
extern void _MD_unix_map_send_error(int err);
#define _PR_MD_MAP_SEND_ERROR _MD_unix_map_send_error
extern void _MD_unix_map_sendto_error(int err);
#define _PR_MD_MAP_SENDTO_ERROR _MD_unix_map_sendto_error
extern void _MD_unix_map_writev_error(int err);
#define _PR_MD_MAP_WRITEV_ERROR _MD_unix_map_writev_error
extern void _MD_unix_map_accept_error(int err);
#define _PR_MD_MAP_ACCEPT_ERROR _MD_unix_map_accept_error
extern void _MD_unix_map_connect_error(int err);
#define _PR_MD_MAP_CONNECT_ERROR _MD_unix_map_connect_error
extern void _MD_unix_map_bind_error(int err);
#define _PR_MD_MAP_BIND_ERROR _MD_unix_map_bind_error
extern void _MD_unix_map_listen_error(int err);
#define _PR_MD_MAP_LISTEN_ERROR _MD_unix_map_listen_error
extern void _MD_unix_map_shutdown_error(int err);
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_unix_map_shutdown_error
extern void _MD_unix_map_socketpair_error(int err);
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_unix_map_socketpair_error
extern void _MD_unix_map_getsockname_error(int err);
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_unix_map_getsockname_error
extern void _MD_unix_map_getpeername_error(int err);
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_unix_map_getpeername_error
extern void _MD_unix_map_getsockopt_error(int err);
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_unix_map_getsockopt_error
extern void _MD_unix_map_setsockopt_error(int err);
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_unix_map_setsockopt_error
extern void _MD_unix_map_open_error(int err);
#define _PR_MD_MAP_OPEN_ERROR _MD_unix_map_open_error
extern void _MD_unix_map_mmap_error(int err);
#define _PR_MD_MAP_MMAP_ERROR _MD_unix_map_mmap_error
extern void _MD_unix_map_gethostname_error(int err);
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_unix_map_gethostname_error
extern void _MD_unix_map_select_error(int err);
#define _PR_MD_MAP_SELECT_ERROR _MD_unix_map_select_error
extern void _MD_unix_map_poll_error(int err);
#define _PR_MD_MAP_POLL_ERROR _MD_unix_map_poll_error
extern void _MD_unix_map_poll_revents_error(int err);
#define _PR_MD_MAP_POLL_REVENTS_ERROR _MD_unix_map_poll_revents_error
extern void _MD_unix_map_flock_error(int err);
#define _PR_MD_MAP_FLOCK_ERROR _MD_unix_map_flock_error
extern void _MD_unix_map_lockf_error(int err);
#define _PR_MD_MAP_LOCKF_ERROR _MD_unix_map_lockf_error
PR_END_EXTERN_C
#endif /* prunixerrors_h___ */

View File

@@ -0,0 +1,632 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef prunixos_h___
#define prunixos_h___
/*
* If FD_SETSIZE is not defined on the command line, set the default value
* before include select.h
*/
/*
* Linux: FD_SETSIZE is defined in /usr/include/sys/select.h and should
* not be redefined.
*/
#if !defined(LINUX) && !defined(DARWIN) && !defined(NEXTSTEP)
#ifndef FD_SETSIZE
#define FD_SETSIZE 4096
#endif
#endif
#include <unistd.h>
#include <stddef.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include "prio.h"
#include "prmem.h"
#include "prclist.h"
/*
* For select(), fd_set, and struct timeval.
*
* In The Single UNIX(R) Specification, Version 2,
* the header file for select() is <sys/time.h>.
*
* fd_set is defined in <sys/types.h>. Usually
* <sys/time.h> includes <sys/types.h>, but on some
* older systems <sys/time.h> does not include
* <sys/types.h>, so we include it explicitly.
*/
#include <sys/time.h>
#include <sys/types.h>
#if defined(AIX) /* Only pre-4.2 AIX needs it, but for simplicity... */
#include <sys/select.h>
#endif
#define _PR_HAVE_O_APPEND
#define PR_DIRECTORY_SEPARATOR '/'
#define PR_DIRECTORY_SEPARATOR_STR "/"
#define PR_PATH_SEPARATOR ':'
#define PR_PATH_SEPARATOR_STR ":"
#define GCPTR
typedef int (*FARPROC)();
/*
* intervals at which GLOBAL threads wakeup to check for pending interrupt
*/
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
extern PRIntervalTime intr_timeout_ticks;
/*
* The bit flags for the in_flags and out_flags fields
* of _PR_UnixPollDesc
*/
#ifdef _PR_USE_POLL
#define _PR_UNIX_POLL_READ POLLIN
#define _PR_UNIX_POLL_WRITE POLLOUT
#define _PR_UNIX_POLL_EXCEPT POLLPRI
#define _PR_UNIX_POLL_ERR POLLERR
#define _PR_UNIX_POLL_NVAL POLLNVAL
#define _PR_UNIX_POLL_HUP POLLHUP
#else /* _PR_USE_POLL */
#define _PR_UNIX_POLL_READ 0x1
#define _PR_UNIX_POLL_WRITE 0x2
#define _PR_UNIX_POLL_EXCEPT 0x4
#define _PR_UNIX_POLL_ERR 0x8
#define _PR_UNIX_POLL_NVAL 0x10
#define _PR_UNIX_POLL_HUP 0x20
#endif /* _PR_USE_POLL */
typedef struct _PRUnixPollDesc {
PRInt32 osfd;
PRInt16 in_flags;
PRInt16 out_flags;
} _PRUnixPollDesc;
typedef struct PRPollQueue {
PRCList links; /* for linking PRPollQueue's together */
_PRUnixPollDesc *pds; /* array of poll descriptors */
PRUintn npds; /* length of the array */
PRPackedBool on_ioq; /* is this on the async i/o work q? */
PRIntervalTime timeout; /* timeout, in ticks */
struct PRThread *thr;
} PRPollQueue;
#define _PR_POLLQUEUE_PTR(_qp) \
((PRPollQueue*) ((char*) (_qp) - offsetof(PRPollQueue,links)))
extern PRInt32 _PR_WaitForMultipleFDs(
_PRUnixPollDesc *unixpds,
PRInt32 pdcnt,
PRIntervalTime timeout);
extern void _PR_Unblock_IO_Wait(struct PRThread *thr);
#if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
#define _MD_CHECK_FOR_EXIT()
#endif
extern fd_set _pr_md_read_set, _pr_md_write_set, _pr_md_exception_set;
extern PRInt16 _pr_md_read_cnt[], _pr_md_write_cnt[], _pr_md_exception_cnt[];
extern PRInt32 _pr_md_ioq_max_osfd;
extern PRUint32 _pr_md_ioq_timeout;
struct _MDFileDesc {
int osfd;
#if defined(LINUX) && defined(_PR_PTHREADS)
int tcp_nodelay; /* used by pt_LinuxSendFile */
#endif
};
struct _MDDir {
DIR *d;
};
struct _PRCPU;
extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);
/*
** Make a redzone at both ends of the stack segment. Disallow access
** to those pages of memory. It's ok if the mprotect call's don't
** work - it just means that we don't really have a functional
** redzone.
*/
#include <sys/mman.h>
#ifndef PROT_NONE
#define PROT_NONE 0x0
#endif
#if defined(DEBUG) && !defined(DARWIN) && !defined(NEXTSTEP)
#if !defined(SOLARIS)
#include <string.h> /* for memset() */
#define _MD_INIT_STACK(ts,REDZONE) \
PR_BEGIN_MACRO \
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
REDZONE, PROT_NONE); \
/* \
** Fill stack memory with something that turns into an illegal \
** pointer value. This will sometimes find runtime references to \
** uninitialized pointers. We don't do this for solaris because we \
** can use purify instead. \
*/ \
if (_pr_debugStacks) { \
memset(ts->allocBase + REDZONE, 0xf7, ts->stackSize); \
} \
PR_END_MACRO
#else /* !SOLARIS */
#define _MD_INIT_STACK(ts,REDZONE) \
PR_BEGIN_MACRO \
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
REDZONE, PROT_NONE); \
PR_END_MACRO
#endif /* !SOLARIS */
/*
* _MD_CLEAR_STACK
* Allow access to the redzone pages; the access was turned off in
* _MD_INIT_STACK.
*/
#define _MD_CLEAR_STACK(ts) \
PR_BEGIN_MACRO \
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_READ|PROT_WRITE);\
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
REDZONE, PROT_READ|PROT_WRITE); \
PR_END_MACRO
#else /* DEBUG */
#define _MD_INIT_STACK(ts,REDZONE)
#define _MD_CLEAR_STACK(ts)
#endif /* DEBUG */
#if !defined(SOLARIS)
#define PR_SET_INTSOFF(newval)
#endif
/************************************************************************/
extern void _PR_UnixInit(void);
/************************************************************************/
struct _MDProcess {
pid_t pid;
};
struct PRProcess;
struct PRProcessAttr;
/* Create a new process (fork() + exec()) */
#define _MD_CREATE_PROCESS _MD_CreateUnixProcess
extern struct PRProcess * _MD_CreateUnixProcess(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr
);
#define _MD_DETACH_PROCESS _MD_DetachUnixProcess
extern PRStatus _MD_DetachUnixProcess(struct PRProcess *process);
/* Wait for a child process to terminate */
#define _MD_WAIT_PROCESS _MD_WaitUnixProcess
extern PRStatus _MD_WaitUnixProcess(struct PRProcess *process,
PRInt32 *exitCode);
#define _MD_KILL_PROCESS _MD_KillUnixProcess
extern PRStatus _MD_KillUnixProcess(struct PRProcess *process);
/************************************************************************/
extern void _MD_EnableClockInterrupts(void);
extern void _MD_DisableClockInterrupts(void);
#define _MD_START_INTERRUPTS _MD_StartInterrupts
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_DisableClockInterrupts
#define _MD_ENABLE_CLOCK_INTERRUPTS _MD_EnableClockInterrupts
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_BlockClockInterrupts
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_UnblockClockInterrupts
/************************************************************************/
extern void _MD_InitCPUS(void);
#define _MD_INIT_CPUS _MD_InitCPUS
extern void _MD_Wakeup_CPUs(void);
#define _MD_WAKEUP_CPUS _MD_Wakeup_CPUs
#define _MD_PAUSE_CPU _MD_PauseCPU
#if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
#define _MD_CLEANUP_BEFORE_EXIT()
#endif
#ifndef IRIX
#define _MD_EXIT(status) _exit(status)
#endif
/************************************************************************/
#define _MD_GET_ENV getenv
#define _MD_PUT_ENV putenv
/************************************************************************/
#define _MD_INIT_FILEDESC(fd)
extern void _MD_MakeNonblock(PRFileDesc *fd);
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
/************************************************************************/
#if !defined(_PR_PTHREADS)
extern void _MD_InitSegs(void);
extern PRStatus _MD_AllocSegment(PRSegment *seg, PRUint32 size,
void *vaddr);
extern void _MD_FreeSegment(PRSegment *seg);
#define _MD_INIT_SEGS _MD_InitSegs
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
#define _MD_FREE_SEGMENT _MD_FreeSegment
#endif /* !defined(_PR_PTHREADS) */
/************************************************************************/
#if !defined(HPUX_LW_TIMER)
#define _MD_INTERVAL_INIT()
#endif
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
/************************************************************************/
#define _MD_ERRNO() (errno)
#define _MD_GET_SOCKET_ERROR() (errno)
/************************************************************************/
extern PRInt32 _MD_AvailableSocket(PRInt32 osfd);
extern void _MD_StartInterrupts(void);
extern void _MD_StopInterrupts(void);
extern void _MD_DisableClockInterrupts(void);
extern void _MD_BlockClockInterrupts(void);
extern void _MD_UnblockClockInterrupts(void);
extern void _MD_PauseCPU(PRIntervalTime timeout);
extern PRStatus _MD_open_dir(struct _MDDir *, const char *);
extern PRInt32 _MD_close_dir(struct _MDDir *);
extern char * _MD_read_dir(struct _MDDir *, PRIntn);
extern PRInt32 _MD_open(const char *name, PRIntn osflags, PRIntn mode);
extern PRInt32 _MD_delete(const char *name);
extern PRInt32 _MD_getfileinfo(const char *fn, PRFileInfo *info);
extern PRInt32 _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
extern PRInt32 _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
extern PRInt32 _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
extern PRInt32 _MD_rename(const char *from, const char *to);
extern PRInt32 _MD_access(const char *name, PRAccessHow how);
extern PRInt32 _MD_mkdir(const char *name, PRIntn mode);
extern PRInt32 _MD_rmdir(const char *name);
extern PRInt32 _MD_accept_read(PRInt32 sock, PRInt32 *newSock,
PRNetAddr **raddr, void *buf, PRInt32 amount);
extern PRInt32 _PR_UnixSendFile(PRFileDesc *sd, PRSendFileData *sfd,
PRTransmitFileFlags flags, PRIntervalTime timeout);
extern PRStatus _MD_LockFile(PRInt32 osfd);
extern PRStatus _MD_TLockFile(PRInt32 osfd);
extern PRStatus _MD_UnlockFile(PRInt32 osfd);
#define _MD_OPEN_DIR(dir, name) _MD_open_dir(dir, name)
#define _MD_CLOSE_DIR(dir) _MD_close_dir(dir)
#define _MD_READ_DIR(dir, flags) _MD_read_dir(dir, flags)
#define _MD_OPEN(name, osflags, mode) _MD_open(name, osflags, mode)
#define _MD_OPEN_FILE(name, osflags, mode) _MD_open(name, osflags, mode)
extern PRInt32 _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
#define _MD_READ(fd,buf,amount) _MD_read(fd,buf,amount)
extern PRInt32 _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
#define _MD_WRITE(fd,buf,amount) _MD_write(fd,buf,amount)
#define _MD_DELETE(name) _MD_delete(name)
#define _MD_GETFILEINFO(fn, info) _MD_getfileinfo(fn, info)
#define _MD_GETFILEINFO64(fn, info) _MD_getfileinfo64(fn, info)
#define _MD_GETOPENFILEINFO(fd, info) _MD_getopenfileinfo(fd, info)
#define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)
#define _MD_RENAME(from, to) _MD_rename(from, to)
#define _MD_ACCESS(name, how) _MD_access(name, how)
#define _MD_MKDIR(name, mode) _MD_mkdir(name, mode)
#define _MD_MAKE_DIR(name, mode) _MD_mkdir(name, mode)
#define _MD_RMDIR(name) _MD_rmdir(name)
#define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount) _MD_accept_read(sock, newSock, raddr, buf, amount)
#define _MD_LOCKFILE _MD_LockFile
#define _MD_TLOCKFILE _MD_TLockFile
#define _MD_UNLOCKFILE _MD_UnlockFile
extern PRInt32 _MD_socket(int af, int type, int flags);
#define _MD_SOCKET _MD_socket
extern PRInt32 _MD_connect(PRFileDesc *fd, const PRNetAddr *addr,
PRUint32 addrlen, PRIntervalTime timeout);
#define _MD_CONNECT _MD_connect
extern PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
PRIntervalTime timeout);
#define _MD_ACCEPT _MD_accept
extern PRInt32 _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
#define _MD_BIND _MD_bind
extern PRInt32 _MD_listen(PRFileDesc *fd, PRIntn backlog);
#define _MD_LISTEN _MD_listen
extern PRInt32 _MD_shutdown(PRFileDesc *fd, PRIntn how);
#define _MD_SHUTDOWN _MD_shutdown
extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
PRIntn flags, PRIntervalTime timeout);
#define _MD_RECV _MD_recv
extern PRInt32 _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,
PRIntn flags, PRIntervalTime timeout);
#define _MD_SEND _MD_send
extern PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen,
PRIntervalTime timeout);
#define _MD_RECVFROM _MD_recvfrom
extern PRInt32 _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount,
PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen,
PRIntervalTime timeout);
#define _MD_SENDTO _MD_sendto
extern PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,
PRInt32 iov_size, PRIntervalTime timeout);
#define _MD_WRITEV _MD_writev
extern PRInt32 _MD_socketavailable(PRFileDesc *fd);
#define _MD_SOCKETAVAILABLE _MD_socketavailable
extern PRInt64 _MD_socketavailable64(PRFileDesc *fd);
#define _MD_SOCKETAVAILABLE64 _MD_socketavailable64
#define _MD_PIPEAVAILABLE _MD_socketavailable
extern PRInt32 _MD_pr_poll(PRPollDesc *pds, PRIntn npds,
PRIntervalTime timeout);
#define _MD_PR_POLL _MD_pr_poll
extern PRInt32 _MD_close(PRInt32 osfd);
#define _MD_CLOSE_FILE _MD_close
extern PRInt32 _MD_lseek(PRFileDesc*, PRInt32, PRSeekWhence);
#define _MD_LSEEK _MD_lseek
extern PRInt64 _MD_lseek64(PRFileDesc*, PRInt64, PRSeekWhence);
#define _MD_LSEEK64 _MD_lseek64
extern PRInt32 _MD_fsync(PRFileDesc *fd);
#define _MD_FSYNC _MD_fsync
extern PRInt32 _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
#define _MD_SOCKETPAIR _MD_socketpair
#define _MD_CLOSE_SOCKET _MD_close
#ifndef NO_NSPR_10_SUPPORT
#define _MD_STAT stat
#endif
extern PRStatus _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr,
PRUint32 *addrlen);
#define _MD_GETPEERNAME _MD_getpeername
extern PRStatus _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr,
PRUint32 *addrlen);
#define _MD_GETSOCKNAME _MD_getsockname
extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level,
PRInt32 optname, char* optval, PRInt32* optlen);
#define _MD_GETSOCKOPT _MD_getsockopt
extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level,
PRInt32 optname, const char* optval, PRInt32 optlen);
#define _MD_SETSOCKOPT _MD_setsockopt
extern PRStatus _MD_set_fd_inheritable(PRFileDesc *fd, PRBool inheritable);
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
extern void _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
extern void _MD_query_fd_inheritable(PRFileDesc *fd);
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
extern PRStatus _MD_gethostname(char *name, PRUint32 namelen);
#define _MD_GETHOSTNAME _MD_gethostname
extern PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen);
#define _MD_GETSYSINFO _MD_getsysinfo
extern int _MD_unix_get_nonblocking_connect_error(int osfd);
/* Memory-mapped files */
struct _MDFileMap {
PRIntn prot;
PRIntn flags;
PRBool isAnonFM; /* when true, PR_CloseFileMap() must close the related fd */
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
#define _MD_GET_MEM_MAP_ALIGNMENT() PR_GetPageSize()
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
/*
* The standard (XPG4) gettimeofday() (from BSD) takes two arguments.
* On some SVR4 derivatives, gettimeofday() takes only one argument.
* The GETTIMEOFDAY macro is intended to hide this difference.
*/
#ifdef HAVE_SVID_GETTOD
#define GETTIMEOFDAY(tp) gettimeofday(tp)
#else
#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
#endif
#if defined(_PR_PTHREADS) && !defined(_PR_POLL_AVAILABLE)
#define _PR_NEED_FAKE_POLL
#endif
#if defined(_PR_NEED_FAKE_POLL)
/*
* Some platforms don't have poll(), but our pthreads code calls poll().
* As a temporary measure, I implemented a fake poll() using select().
* Here are the struct and macro definitions copied from sys/poll.h
* on Solaris 2.5.
*/
struct pollfd {
int fd;
short events;
short revents;
};
/* poll events */
#define POLLIN 0x0001 /* fd is readable */
#define POLLPRI 0x0002 /* high priority info at fd */
#define POLLOUT 0x0004 /* fd is writeable (won't block) */
#define POLLRDNORM 0x0040 /* normal data is readable */
#define POLLWRNORM POLLOUT
#define POLLRDBAND 0x0080 /* out-of-band data is readable */
#define POLLWRBAND 0x0100 /* out-of-band data is writeable */
#define POLLNORM POLLRDNORM
#define POLLERR 0x0008 /* fd has error condition */
#define POLLHUP 0x0010 /* fd has been hung up on */
#define POLLNVAL 0x0020 /* invalid pollfd entry */
extern int poll(struct pollfd *, unsigned long, int);
#endif /* _PR_NEED_FAKE_POLL */
/*
** A vector of the UNIX I/O calls we use. These are here to smooth over
** the rough edges needed for large files. All of NSPR's implmentaions
** go through this vector using syntax of the form
** result = _md_iovector.xxx64(args);
*/
#if defined(SOLARIS2_5)
/*
** Special case: Solaris 2.5.1
** Solaris starts to have 64-bit file I/O in 2.6. We build on Solaris
** 2.5.1 so that we can use the same binaries on both Solaris 2.5.1 and
** 2.6. At run time, we detect whether 64-bit file I/O is available by
** looking up the 64-bit file function symbols in libc. At build time,
** we need to define the 64-bit file I/O datatypes that are compatible
** with their definitions on Solaris 2.6.
*/
typedef PRInt64 off64_t;
typedef PRUint64 ino64_t;
typedef PRInt64 blkcnt64_t;
struct stat64 {
dev_t st_dev;
long st_pad1[3];
ino64_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
long t_pad2[2];
off64_t st_size;
timestruc_t st_atim;
timestruc_t st_mtim;
timestruc_t st_ctim;
long st_blksize;
blkcnt64_t st_blocks;
char st_fstype[_ST_FSTYPSZ];
long st_pad4[8];
};
typedef struct stat64 _MDStat64;
typedef off64_t _MDOff64_t;
#elif defined(_PR_HAVE_OFF64_T)
typedef struct stat64 _MDStat64;
typedef off64_t _MDOff64_t;
#elif defined(_PR_HAVE_LARGE_OFF_T)
typedef struct stat _MDStat64;
typedef off_t _MDOff64_t;
#elif defined(_PR_NO_LARGE_FILES)
typedef struct stat _MDStat64;
typedef PRInt64 _MDOff64_t;
#else
#error "I don't know yet"
#endif
typedef PRIntn (*_MD_Fstat64)(PRIntn osfd, _MDStat64 *buf);
typedef PRIntn (*_MD_Open64)(const char *path, int oflag, ...);
#if defined(VMS)
typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf, ...);
#else
typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf);
#endif
typedef _MDOff64_t (*_MD_Lseek64)(PRIntn osfd, _MDOff64_t, PRIntn whence);
typedef void* (*_MD_Mmap64)(
void *addr, PRSize len, PRIntn prot, PRIntn flags,
PRIntn fildes, _MDOff64_t offset);
struct _MD_IOVector
{
_MD_Open64 _open64;
_MD_Mmap64 _mmap64;
_MD_Stat64 _stat64;
_MD_Fstat64 _fstat64;
_MD_Lseek64 _lseek64;
};
extern struct _MD_IOVector _md_iovector;
#endif /* prunixos_h___ */

View File

@@ -0,0 +1,219 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_unixware_defs_h___
#define nspr_unixware_defs_h___
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "unixware"
#define _PR_SI_SYSNAME "UnixWare"
#define _PR_SI_ARCHITECTURE "x86"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MMAP_FLAGS MAP_PRIVATE
#ifndef HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_IO_SYMBOLS
#endif
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ST_ATIM_UNION
#undef HAVE_STACK_GROWING_UP
#define HAVE_NETCONFIG
#define HAVE_DLL
#define USE_DLFCN
#define HAVE_STRERROR
#define NEED_STRFTIME_LOCK
#define NEED_TIME_R
#define _PR_NEED_STRCASECMP
#define USE_SETJMP
#include <setjmp.h>
#define _SETJMP setjmp
#define _LONGJMP longjmp
#define _PR_CONTEXT_TYPE jmp_buf
#define _MD_GET_SP(_t) (_t)->md.context[4]
#define _PR_NUM_GCREGS _JBLEN
#define CONTEXT(_th) ((_th)->md.context)
/*
** Initialize the thread context preparing it to execute _main.
*/
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
{ \
*status = PR_TRUE; \
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
}
#define _MD_SWITCH_CONTEXT(_thread) \
if (!_SETJMP(CONTEXT(_thread))) { \
(_thread)->md.errcode = errno; \
_PR_Schedule(); \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _MD_RESTORE_CONTEXT(_thread) \
{ \
errno = (_thread)->md.errcode; \
_MD_SET_CURRENT_THREAD(_thread); \
_LONGJMP(CONTEXT(_thread), 1); \
}
/* Machine-dependent (MD) data structures.
* Don't use SVR4 native threads (yet).
*/
struct _MDThread {
_PR_CONTEXT_TYPE context;
int id;
int errcode;
};
struct _MDThreadStack {
PRInt8 notused;
};
struct _MDLock {
PRInt8 notused;
};
struct _MDSemaphore {
PRInt8 notused;
};
struct _MDCVar {
PRInt8 notused;
};
struct _MDSegment {
PRInt8 notused;
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
PRCList ioQ;
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
PRInt32 ioq_osfd_cnt;
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
#define _MD_INIT_IO()
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/*
* The following are copied from _sunos.h, _aix.h. This means
* some of them should probably be moved into _unixos.h. But
* _irix.h seems to be quite different in regard to these macros.
*/
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
#define _MD_EARLY_INIT _MD_EarlyInit
#define _MD_FINAL_INIT _PR_UnixInit
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
#define _MD_CLEAN_THREAD(_thread)
/*
* We wrapped the select() call. _MD_SELECT refers to the built-in,
* unwrapped version.
*/
#include <sys/time.h>
#include <sys/types.h>
#include <sys/select.h>
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *execptfds, struct timeval *timeout);
#define _MD_SELECT _select
#define _MD_POLL _poll
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
#endif /* nspr_unixware_defs_h___ */

View File

@@ -0,0 +1,568 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_win16_defs_h___
#define nspr_win16_defs_h___
#include <windows.h>
#include <winsock.h>
#include <errno.h>
#include <direct.h>
#include "nspr.h"
/* $$ fix this */
#define Remind(x)
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "win16"
#define _PR_SI_SYSNAME "WIN16"
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
#define HAVE_DLL
#define _PR_NO_PREEMPT
#define _PR_LOCAL_THREADS_ONLY
#undef _PR_GLOBAL_THREADS_ONLY
#undef HAVE_THREAD_AFFINITY
#define _PR_HAVE_ATOMIC_OPS
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
extern struct PRLock *_pr_schedLock;
extern char * _pr_top_of_task_stack;
/* --- Typedefs --- */
#define PR_NUM_GCREGS 9
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
#define _MD_MAGIC_THREAD 0x22222222
#define _MD_MAGIC_THREADSTACK 0x33333333
#define _MD_MAGIC_SEGMENT 0x44444444
#define _MD_MAGIC_DIR 0x55555555
#define _MD_MAGIC_CV 0x66666666
typedef struct _PRWin16PollDesc
{
PRInt32 osfd;
PRInt16 in_flags;
PRInt16 out_flags;
} _PRWin16PollDesc;
typedef struct PRPollQueue
{
PRCList links; /* for linking PRPollQueue's together */
_PRWin16PollDesc *pds; /* array of poll descriptors */
PRUintn npds; /* length of the array */
PRPackedBool on_ioq; /* is this on the async i/o work q? */
PRIntervalTime timeout; /* timeout, in ticks */
struct PRThread *thr;
} PRPollQueue;
#define _PR_POLLQUEUE_PTR(_qp) \
((PRPollQueue *) ((char*) (_qp) - offsetof(PRPollQueue,links)))
NSPR_API(PRInt32) _PR_WaitForFD(PRInt32 osfd, PRUintn how,
PRIntervalTime timeout);
NSPR_API(void) _PR_Unblock_IO_Wait(struct PRThread *thr);
#define _PR_MD_MAX_OSFD FD_SETSIZE
#define _PR_IOQ(_cpu) ((_cpu)->md.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.fd_read_set)
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.fd_read_cnt)
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.fd_write_set)
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.fd_write_cnt)
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.fd_exception_set)
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.fd_exception_cnt)
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.ioq_timeout)
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.ioq_max_osfd)
struct _MDCPU {
PRCList ioQ;
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
fd_exception_cnt[_PR_MD_MAX_OSFD];
PRUint32 ioq_timeout;
PRInt32 ioq_max_osfd;
};
struct _MDThread {
/* The overlapped structure must be first! */
HANDLE blocked_sema; /* Threads block on this when waiting
* for IO or CondVar.
*/
PRInt32 errcode; /* preserved errno for this thread */
CATCHBUF context; /* thread context for Throw() */
void *SP; /* Stack pointer, used only by GarbColl */
int threadNumber; /* instrumentation: order of creation */
_PRWin16PollDesc thr_pd; /* poll descriptor for i/o */
PRPollQueue thr_pq; /* i/o parameters */
void *exceptionContext; /* mfc exception context */
char guardBand[24]; /* don't overwrite this */
PRUint32 magic; /* self identifier, for debug */
};
struct _MDThreadStack {
PRUint32 magic; /* for debugging */
PRIntn cxByteCount; /* number of stack bytes to move */
char * stackTop; /* high address on stack */
};
struct _MDSegment {
PRUint32 magic; /* for debugging */
};
struct _MDLock {
PRUint32 magic; /* for debugging */
PRUint32 mutex;
};
struct _MDDir {
PRUint32 magic; /* for debugging */
struct dirent *dir;
};
struct _MDCVar {
PRUint32 magic;
};
struct _MDSemaphore {
PRInt32 unused;
};
struct _MDFileDesc {
PRInt32 osfd;
};
struct _MDProcess {
HANDLE handle;
DWORD id;
};
/*
** Microsoft 'struct _stat'
** ... taken directly from msvc 1.52c's header file sys/stat.h
** see PR_Stat() implemented in w16io.c
** See BugSplat: 98516
*/
#pragma pack(push)
#pragma pack(2)
typedef unsigned short _ino_t;
typedef short _dev_t;
typedef long _off_t;
typedef struct _MDMSStat {
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
_off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
} _MDMSStat;
#pragma pack(pop)
/* --- Errors --- */
/* These are NSPR generated error codes which need to be unique from
* OS error codes.
*/
#define _MD_UNIQUEBASE 50000
#define _MD_EINTERRUPTED _MD_UNIQUEBASE + 1
#define _MD_ETIMEDOUT _MD_UNIQUEBASE + 2
#define _MD_EIO _MD_UNIQUEBASE + 3
struct PRProcess;
struct PRProcessAttr;
/* --- Create a new process --- */
#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
extern struct PRProcess * _PR_CreateWindowsProcess(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr
);
#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
/* --- Wait for a child process to terminate --- */
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
PRInt32 *exitCode);
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
/* --- Misc stuff --- */
#define MD_ASSERTINT( x ) PR_ASSERT( (x) < 65535 )
/* --- IO stuff --- */
#define MAX_PATH 256
#define _MD_ERRNO() errno
#define GetLastError() errno
#define _MD_GET_FILE_ERROR() errno
#define _MD_SET_FILE_ERROR(_err) errno = (_err)
#define _MD_OPEN _PR_MD_OPEN
#define _MD_READ _PR_MD_READ
#define _MD_WRITE _PR_MD_WRITE
#define _MD_WRITEV _PR_MD_WRITEV
#define _MD_LSEEK _PR_MD_LSEEK
#define _MD_LSEEK64 _PR_MD_LSEEK64
#define _MD_CLOSE_FILE _PR_MD_CLOSE_FILE
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
#define _MD_STAT _PR_MD_STAT
#define _MD_RENAME _PR_MD_RENAME
#define _MD_ACCESS _PR_MD_ACCESS
#define _MD_DELETE _PR_MD_DELETE
#define _MD_MKDIR _PR_MD_MKDIR
#define _MD_RMDIR _PR_MD_RMDIR
#define _MD_LOCKFILE _PR_MD_LOCKFILE
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
/* --- Socket IO stuff --- */
#define _MD_EACCES WSAEACCES
#define _MD_EADDRINUSE WSAEADDRINUSE
#define _MD_EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define _MD_EAFNOSUPPORT WSAEAFNOSUPPORT
#define _MD_EAGAIN WSAEWOULDBLOCK
#define _MD_EALREADY WSAEALREADY
#define _MD_EBADF WSAEBADF
#define _MD_ECONNREFUSED WSAECONNREFUSED
#define _MD_ECONNRESET WSAECONNRESET
#define _MD_EFAULT WSAEFAULT
#define _MD_EINPROGRESS WSAEINPROGRESS
#define _MD_EINTR WSAEINTR
#define _MD_EINVAL EINVAL
#define _MD_EISCONN WSAEISCONN
#define _MD_ENETUNREACH WSAENETUNREACH
#define _MD_ENOENT ENOENT
#define _MD_ENOTCONN WSAENOTCONN
#define _MD_ENOTSOCK WSAENOTSOCK
#define _MD_EOPNOTSUPP WSAEOPNOTSUPP
#define _MD_EWOULDBLOCK WSAEWOULDBLOCK
#define _MD_GET_SOCKET_ERROR() WSAGetLastError()
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
#define _MD_INIT_FILEDESC(fd)
#define _MD_MAKE_NONBLOCK _PR_MD_MAKE_NONBLOCK
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
#define _MD_LISTEN _PR_MD_LISTEN
#define _MD_CLOSE_SOCKET _PR_MD_CLOSE_SOCKET
#define _MD_SENDTO _PR_MD_SENDTO
#define _MD_RECVFROM _PR_MD_RECVFROM
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
#define _MD_SELECT select
#define _MD_FSYNC _PR_MD_FSYNC
#define _MD_SOCKETAVAILABLE _PR_MD_SOCKETAVAILABLE
#define _MD_INIT_ATOMIC()
#define _MD_ATOMIC_INCREMENT(x) (*x++)
#define _MD_ATOMIC_ADD(ptr, val) ((*x) += val)
#define _MD_ATOMIC_DECREMENT(x) (*x--)
#define _MD_ATOMIC_SET(x,y) (*x, y)
#define _MD_INIT_IO _PR_MD_INIT_IO
/* win95 doesn't have async IO */
#define _MD_SOCKET _PR_MD_SOCKET
#define _MD_CONNECT _PR_MD_CONNECT
#define _MD_ACCEPT _PR_MD_ACCEPT
#define _MD_BIND _PR_MD_BIND
#define _MD_RECV _PR_MD_RECV
#define _MD_SEND _PR_MD_SEND
#define _MD_CHECK_FOR_EXIT()
/* --- Scheduler stuff --- */
#define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
/* --- DIR stuff --- */
#define PR_DIRECTORY_SEPARATOR '\\'
#define PR_DIRECTORY_SEPARATOR_STR "\\"
#define PR_PATH_SEPARATOR ';'
#define PR_PATH_SEPARATOR_STR ";"
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
#define _MD_READ_DIR _PR_MD_READ_DIR
/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
#define _MD_FREE_SEGMENT _MD_FreeSegment
/* --- Environment Stuff --- */
#define _MD_GET_ENV _PR_MD_GET_ENV
#define _MD_PUT_ENV _PR_MD_PUT_ENV
/* --- Threading Stuff --- */
#define _MD_DEFAULT_STACK_SIZE 32767L
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
#define _MD_CREATE_THREAD(t,f,p,sc,st,stsiz) (PR_SUCCESS)
#define _MD_YIELD _PR_MD_YIELD
#define _MD_SET_PRIORITY(t,p)
#define _MD_CLEAN_THREAD(t)
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
#define _MD_EXIT_THREAD
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_END_RESUME_ALL()
/* --- Lock stuff --- */
/*
** Win16 does not need MD locks.
*/
#define _PR_LOCK _MD_LOCK
#define _PR_UNLOCK _MD_UNLOCK
#define _MD_NEW_LOCK(l) (PR_SUCCESS)
#define _MD_FREE_LOCK(l)
#define _MD_LOCK(l)
#define _MD_TEST_AND_LOCK(l) (-1)
#define _MD_UNLOCK(l)
/* --- lock and cv waiting --- */
#define _MD_WAIT _PR_MD_WAIT
#define _MD_WAKEUP_WAITER(a)
#define _MD_WAKEUP_CPUS _PR_MD_WAKEUP_CPUS
/* --- CVar ------------------- */
#define _MD_WAIT_CV _PR_MD_WAIT_CV
#define _MD_NEW_CV _PR_MD_NEW_CV
#define _MD_FREE_CV _PR_MD_FREE_CV
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/* --- Initialization stuff --- */
NSPR_API(void) _MD_INIT_RUNNING_CPU(struct _PRCPU *cpu );
#define _MD_START_INTERRUPTS()
#define _MD_STOP_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
#define _MD_FINAL_INIT _PR_MD_FINAL_INIT
#define _MD_INIT_CPUS()
/* --- User Threading stuff --- */
#define _MD_EXIT
#define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
/* --- Intervals --- */
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
/* --- Scheduler stuff --- */
#define LOCK_SCHEDULER() 0
#define UNLOCK_SCHEDULER() 0
#define _PR_LockSched() 0
#define _PR_UnlockSched() 0
/* --- Initialization stuff --- */
#define _MD_INIT_LOCKS()
/* --- Stack stuff --- */
#define _MD_INIT_STACK _PR_MD_INIT_STACK
#define _MD_CLEAR_STACK(stack)
/*
** Watcom needs to see this to make the linker work.
**
*/
NSPR_API(void) _PR_NativeDestroyThread(PRThread *thread);
NSPR_API(void) _PR_UserDestroyThread(PRThread *thread);
/*
** If thread emulation is used, then setjmp/longjmp stores the register
** state of each thread.
**
** CatchBuf layout:
** context[0] - IP
** context[1] - CS
** context[2] - SP
** context[3] - BP
** context[4] - SI
** context[5] - DI
** context[6] - DS
** context[7] - ?? (maybe flags)
** context[8] - SS
*/
#define PR_CONTEXT_TYPE CATCHBUF
#define PR_NUM_GCREGS 9
#define _MD_GET_SP(thread) ((thread)->md.SP)
#define CONTEXT(_t) ((_t)->md.context)
/*
** Initialize a thread context to run "e(o,a)" when started
*/
#define _MD_INIT_CONTEXT(_t, sp, epa, stat ) \
{ \
*(stat) = PR_TRUE; \
Catch((_t)->md.context ); \
(_t)->md.context[0] = OFFSETOF(epa); \
(_t)->md.context[1] = SELECTOROF(epa); \
(_t)->md.context[2] = OFFSETOF(_pr_top_of_task_stack - 64); \
(_t)->md.context[3] = 0; \
}
#define _MD_SWITCH_CONTEXT(_t) \
if (!Catch((_t)->md.context)) { \
int garbCollPlaceHolder; \
(_t)->md.errcode = errno; \
(_t)->md.SP = &garbCollPlaceHolder; \
_PR_Schedule(); \
}
#define _MD_SAVE_CONTEXT(_t) \
{ \
int garbCollPlaceHolder; \
Catch((_t)->md.context); \
(_t)->md.errcode = errno; \
(_t)->md.SP = &garbCollPlaceHolder; \
}
/*
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
*/
#define _PR_MD_RESTORE_CONTEXT _MD_RESTORE_CONTEXT
/*
* Memory-mapped files
*/
struct _MDFileMap {
PRInt8 unused;
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
extern PRInt32 _MD_GetMemMapAlignment(void);
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
/* --- Error mapping ----------------------------------- */
extern void _PR_MD_map_error( int err );
#define _PR_MD_MAP_OPENDIR_ERROR _PR_MD_map_error
#define _PR_MD_MAP_CLOSEDIR_ERROR _PR_MD_map_error
#define _PR_MD_MAP_READDIR_ERROR _PR_MD_map_error
#define _PR_MD_MAP_DELETE_ERROR _PR_MD_map_error
#define _PR_MD_MAP_STAT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_FSTAT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_RENAME_ERROR _PR_MD_map_error
#define _PR_MD_MAP_ACCESS_ERROR _PR_MD_map_error
#define _PR_MD_MAP_MKDIR_ERROR _PR_MD_map_error
#define _PR_MD_MAP_RMDIR_ERROR _PR_MD_map_error
#define _PR_MD_MAP_READ_ERROR _PR_MD_map_error
#define _PR_MD_MAP_TRANSMITFILE_ERROR _PR_MD_map_error
#define _PR_MD_MAP_WRITE_ERROR _PR_MD_map_error
#define _PR_MD_MAP_LSEEK_ERROR _PR_MD_map_error
#define _PR_MD_MAP_FSYNC_ERROR _PR_MD_map_error
#define _PR_MD_MAP_CLOSE_ERROR _PR_MD_map_error
#define _PR_MD_MAP_SOCKET_ERROR _PR_MD_map_error
#define _PR_MD_MAP_RECV_ERROR _PR_MD_map_error
#define _PR_MD_MAP_RECVFROM_ERROR _PR_MD_map_error
#define _PR_MD_MAP_SEND_ERROR _PR_MD_map_error
#define _PR_MD_MAP_SENDTO_ERROR _PR_MD_map_error
#define _PR_MD_MAP_ACCEPT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_ACCEPTEX_ERROR _PR_MD_map_error
#define _PR_MD_MAP_CONNECT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_BIND_ERROR _PR_MD_map_error
#define _PR_MD_MAP_LISTEN_ERROR _PR_MD_map_error
#define _PR_MD_MAP_SHUTDOWN_ERROR _PR_MD_map_error
#define _PR_MD_MAP_GETSOCKNAME_ERROR _PR_MD_map_error
#define _PR_MD_MAP_GETPEERNAME_ERROR _PR_MD_map_error
#define _PR_MD_MAP_GETSOCKOPT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_SETSOCKOPT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_OPEN_ERROR _PR_MD_map_error
#define _PR_MD_MAP_GETHOSTNAME_ERROR _PR_MD_map_error
#define _PR_MD_MAP_SELECT_ERROR _PR_MD_map_error
#define _PR_MD_MAP_LOCKF_ERROR _PR_MD_map_error
#define _PR_MD_MAP_WSASTARTUP_ERROR _PR_MD_map_error
#endif /* nspr_win16_defs_h___ */

View File

@@ -0,0 +1,154 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_win32_errors_h___
#define nspr_win32_errors_h___
#include <windows.h>
#include <winsock.h>
#include <errno.h>
extern void _MD_win32_map_default_error(PRInt32 err);
#define _PR_MD_MAP_DEFAULT_ERROR _MD_win32_map_default_error
extern void _MD_win32_map_opendir_error(PRInt32 err);
#define _PR_MD_MAP_OPENDIR_ERROR _MD_win32_map_opendir_error
extern void _MD_win32_map_closedir_error(PRInt32 err);
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_win32_map_closedir_error
extern void _MD_unix_readdir_error(PRInt32 err);
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
extern void _MD_win32_map_delete_error(PRInt32 err);
#define _PR_MD_MAP_DELETE_ERROR _MD_win32_map_delete_error
extern void _MD_win32_map_stat_error(PRInt32 err);
#define _PR_MD_MAP_STAT_ERROR _MD_win32_map_stat_error
extern void _MD_win32_map_fstat_error(PRInt32 err);
#define _PR_MD_MAP_FSTAT_ERROR _MD_win32_map_fstat_error
extern void _MD_win32_map_rename_error(PRInt32 err);
#define _PR_MD_MAP_RENAME_ERROR _MD_win32_map_rename_error
extern void _MD_win32_map_access_error(PRInt32 err);
#define _PR_MD_MAP_ACCESS_ERROR _MD_win32_map_access_error
extern void _MD_win32_map_mkdir_error(PRInt32 err);
#define _PR_MD_MAP_MKDIR_ERROR _MD_win32_map_mkdir_error
extern void _MD_win32_map_rmdir_error(PRInt32 err);
#define _PR_MD_MAP_RMDIR_ERROR _MD_win32_map_rmdir_error
extern void _MD_win32_map_read_error(PRInt32 err);
#define _PR_MD_MAP_READ_ERROR _MD_win32_map_read_error
extern void _MD_win32_map_transmitfile_error(PRInt32 err);
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_win32_map_transmitfile_error
extern void _MD_win32_map_write_error(PRInt32 err);
#define _PR_MD_MAP_WRITE_ERROR _MD_win32_map_write_error
extern void _MD_win32_map_lseek_error(PRInt32 err);
#define _PR_MD_MAP_LSEEK_ERROR _MD_win32_map_lseek_error
extern void _MD_win32_map_fsync_error(PRInt32 err);
#define _PR_MD_MAP_FSYNC_ERROR _MD_win32_map_fsync_error
extern void _MD_win32_map_close_error(PRInt32 err);
#define _PR_MD_MAP_CLOSE_ERROR _MD_win32_map_close_error
extern void _MD_win32_map_socket_error(PRInt32 err);
#define _PR_MD_MAP_SOCKET_ERROR _MD_win32_map_socket_error
extern void _MD_win32_map_recv_error(PRInt32 err);
#define _PR_MD_MAP_RECV_ERROR _MD_win32_map_recv_error
extern void _MD_win32_map_recvfrom_error(PRInt32 err);
#define _PR_MD_MAP_RECVFROM_ERROR _MD_win32_map_recvfrom_error
extern void _MD_win32_map_send_error(PRInt32 err);
#define _PR_MD_MAP_SEND_ERROR _MD_win32_map_send_error
extern void _MD_win32_map_sendto_error(PRInt32 err);
#define _PR_MD_MAP_SENDTO_ERROR _MD_win32_map_sendto_error
extern void _MD_win32_map_accept_error(PRInt32 err);
#define _PR_MD_MAP_ACCEPT_ERROR _MD_win32_map_accept_error
extern void _MD_win32_map_acceptex_error(PRInt32 err);
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_win32_map_acceptex_error
extern PRInt32 _MD_win32_map_connect_error(PRInt32 err);
#define _PR_MD_MAP_CONNECT_ERROR _MD_win32_map_connect_error
extern void _MD_win32_map_bind_error(PRInt32 err);
#define _PR_MD_MAP_BIND_ERROR _MD_win32_map_bind_error
extern void _MD_win32_map_listen_error(PRInt32 err);
#define _PR_MD_MAP_LISTEN_ERROR _MD_win32_map_listen_error
extern void _MD_win32_map_shutdown_error(PRInt32 err);
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_win32_map_shutdown_error
extern void _MD_win32_map_getsockname_error(PRInt32 err);
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_win32_map_getsockname_error
extern void _MD_win32_map_getpeername_error(PRInt32 err);
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_win32_map_getpeername_error
extern void _MD_win32_map_getsockopt_error(PRInt32 err);
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_win32_map_getsockopt_error
extern void _MD_win32_map_setsockopt_error(PRInt32 err);
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_win32_map_setsockopt_error
extern void _MD_win32_map_open_error(PRInt32 err);
#define _PR_MD_MAP_OPEN_ERROR _MD_win32_map_open_error
extern void _MD_win32_map_gethostname_error(PRInt32 err);
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_win32_map_gethostname_error
extern void _MD_win32_map_select_error(PRInt32 err);
#define _PR_MD_MAP_SELECT_ERROR _MD_win32_map_select_error
extern void _MD_win32_map_lockf_error(int err);
#define _PR_MD_MAP_LOCKF_ERROR _MD_win32_map_lockf_error
#endif /* nspr_win32_errors_h___ */

View File

@@ -0,0 +1,549 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_win95_defs_h___
#define nspr_win95_defs_h___
#include "prio.h"
#include <windows.h>
#include <winsock.h>
#include <errno.h>
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "win32"
#define _PR_SI_SYSNAME "WIN95"
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
#define HAVE_DLL
#undef HAVE_THREAD_AFFINITY
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#ifndef _PR_INET6
#define AF_INET6 23
/* newer ws2tcpip.h provides these */
#ifndef AI_CANONNAME
#define AI_CANONNAME 0x2
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#define _PR_HAVE_MD_SOCKADDR_IN6
/* isomorphic to struct in6_addr on Windows */
struct _md_in6_addr {
union {
PRUint8 _S6_u8[16];
PRUint16 _S6_u16[8];
} _S6_un;
};
/* isomorphic to struct sockaddr_in6 on Windows */
struct _md_sockaddr_in6 {
PRInt16 sin6_family;
PRUint16 sin6_port;
PRUint32 sin6_flowinfo;
struct _md_in6_addr sin6_addr;
PRUint32 sin6_scope_id;
};
#endif
#define _PR_HAVE_THREADSAFE_GETHOST
#define _PR_HAVE_ATOMIC_OPS
#define PR_HAVE_WIN32_NAMED_SHARED_MEMORY
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
/* --- Globals --- */
extern struct PRLock *_pr_schedLock;
/* --- Typedefs --- */
typedef void (*FiberFunc)(void *);
#define PR_NUM_GCREGS 8
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
#define GC_VMBASE 0x40000000
#define GC_VMLIMIT 0x00FFFFFF
#define _MD_MAGIC_THREAD 0x22222222
#define _MD_MAGIC_THREADSTACK 0x33333333
#define _MD_MAGIC_SEGMENT 0x44444444
#define _MD_MAGIC_DIR 0x55555555
#define _MD_MAGIC_CV 0x66666666
struct _MDCPU {
int unused;
};
struct _MDThread {
HANDLE blocked_sema; /* Threads block on this when waiting
* for IO or CondVar.
*/
PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
* wait queue of some cond var.
* PR_FALSE otherwise. */
HANDLE handle; /* Win32 thread handle */
PRUint32 id;
void *sp; /* only valid when suspended */
PRUint32 magic; /* for debugging */
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
struct PRThread *prev, *next; /* used by the cvar wait queue to
* chain the PRThread structures
* together */
void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
* pass its 'start' argument to
* pr_root. */
};
struct _MDThreadStack {
PRUint32 magic; /* for debugging */
};
struct _MDSegment {
PRUint32 magic; /* for debugging */
};
#undef PROFILE_LOCKS
struct _MDDir {
HANDLE d_hdl;
WIN32_FIND_DATA d_entry;
PRBool firstEntry; /* Is this the entry returned
* by FindFirstFile()? */
PRUint32 magic; /* for debugging */
};
#ifdef MOZ_UNICODE
struct _MDDirUTF16 {
HANDLE d_hdl;
WIN32_FIND_DATAW d_entry;
PRBool firstEntry; /* Is this the entry returned
* by FindFirstFileW()? */
PRUint32 magic; /* for debugging */
};
#endif /* MOZ_UNICODE */
struct _MDCVar {
PRUint32 magic;
struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly-
* linked list of threads
* waiting on this condition
* variable */
PRIntn nwait; /* number of threads in the
* wait queue */
};
#define _MD_CV_NOTIFIED_LENGTH 6
typedef struct _MDNotified _MDNotified;
struct _MDNotified {
PRIntn length; /* # of used entries in this
* structure */
struct {
struct _MDCVar *cv; /* the condition variable notified */
PRIntn times; /* and the number of times notified */
struct PRThread *notifyHead; /* list of threads to wake up */
} cv[_MD_CV_NOTIFIED_LENGTH];
_MDNotified *link; /* link to another of these, or NULL */
};
struct _MDLock {
CRITICAL_SECTION mutex; /* this is recursive on NT */
/*
* When notifying cvars, there is no point in actually
* waking up the threads waiting on the cvars until we've
* released the lock. So, we temporarily record the cvars.
* When doing an unlock, we'll then wake up the waiting threads.
*/
struct _MDNotified notified; /* array of conditions notified */
#ifdef PROFILE_LOCKS
PRInt32 hitcount;
PRInt32 misscount;
#endif
};
struct _MDSemaphore {
HANDLE sem;
};
struct _MDFileDesc {
PRInt32 osfd; /* The osfd can come from one of three spaces:
* - For stdin, stdout, and stderr, we are using
* the libc file handle (0, 1, 2), which is an int.
* - For files and pipes, we are using Win32 HANDLE,
* which is a void*.
* - For sockets, we are using Winsock SOCKET, which
* is a u_int.
*/
};
struct _MDProcess {
HANDLE handle;
DWORD id;
};
/* --- Misc stuff --- */
#define _MD_GET_SP(thread) (thread)->md.gcContext[6]
/* --- NT security stuff --- */
extern void _PR_NT_InitSids(void);
extern void _PR_NT_FreeSids(void);
extern PRStatus _PR_NT_MakeSecurityDescriptorACL(
PRIntn mode,
DWORD accessTable[],
PSECURITY_DESCRIPTOR *resultSD,
PACL *resultACL
);
extern void _PR_NT_FreeSecurityDescriptorACL(
PSECURITY_DESCRIPTOR pSD, PACL pACL);
/* --- IO stuff --- */
#define _MD_OPEN _PR_MD_OPEN
#define _MD_OPEN_FILE _PR_MD_OPEN_FILE
#define _MD_READ _PR_MD_READ
#define _MD_WRITE _PR_MD_WRITE
#define _MD_WRITEV _PR_MD_WRITEV
#define _MD_LSEEK _PR_MD_LSEEK
#define _MD_LSEEK64 _PR_MD_LSEEK64
extern PRInt32 _MD_CloseFile(PRInt32 osfd);
#define _MD_CLOSE_FILE _MD_CloseFile
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
#define _MD_GETFILEINFO64 _PR_MD_GETFILEINFO64
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
#define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
#define _MD_STAT _PR_MD_STAT
#define _MD_RENAME _PR_MD_RENAME
#define _MD_ACCESS _PR_MD_ACCESS
#define _MD_DELETE _PR_MD_DELETE
#define _MD_MKDIR _PR_MD_MKDIR
#define _MD_MAKE_DIR _PR_MD_MAKE_DIR
#define _MD_RMDIR _PR_MD_RMDIR
#define _MD_LOCKFILE _PR_MD_LOCKFILE
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
#ifdef MOZ_UNICODE
/* --- UTF16 IO stuff --- */
#define _MD_OPEN_FILE_UTF16 _PR_MD_OPEN_FILE_UTF16
#define _MD_OPEN_DIR_UTF16 _PR_MD_OPEN_DIR_UTF16
#define _MD_READ_DIR_UTF16 _PR_MD_READ_DIR_UTF16
#define _MD_CLOSE_DIR_UTF16 _PR_MD_CLOSE_DIR_UTF16
#define _MD_GETFILEINFO64_UTF16 _PR_MD_GETFILEINFO64_UTF16
#endif /* MOZ_UNICODE */
/* --- Socket IO stuff --- */
#define _MD_EACCES WSAEACCES
#define _MD_EADDRINUSE WSAEADDRINUSE
#define _MD_EADDRNOTAVAIL WSAEADDRNOTAVAIL
#define _MD_EAFNOSUPPORT WSAEAFNOSUPPORT
#define _MD_EAGAIN WSAEWOULDBLOCK
#define _MD_EALREADY WSAEALREADY
#define _MD_EBADF WSAEBADF
#define _MD_ECONNREFUSED WSAECONNREFUSED
#define _MD_ECONNRESET WSAECONNRESET
#define _MD_EFAULT WSAEFAULT
#define _MD_EINPROGRESS WSAEINPROGRESS
#define _MD_EINTR WSAEINTR
#define _MD_EINVAL EINVAL
#define _MD_EISCONN WSAEISCONN
#define _MD_ENETUNREACH WSAENETUNREACH
#define _MD_ENOENT ENOENT
#define _MD_ENOTCONN WSAENOTCONN
#define _MD_ENOTSOCK WSAENOTSOCK
#define _MD_EOPNOTSUPP WSAEOPNOTSUPP
#define _MD_EWOULDBLOCK WSAEWOULDBLOCK
#define _MD_GET_SOCKET_ERROR() WSAGetLastError()
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
#define _MD_INIT_FILEDESC(fd)
extern void _MD_MakeNonblock(PRFileDesc *f);
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
#define _MD_INIT_FD_INHERITABLE _PR_MD_INIT_FD_INHERITABLE
#define _MD_QUERY_FD_INHERITABLE _PR_MD_QUERY_FD_INHERITABLE
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
#define _MD_LISTEN _PR_MD_LISTEN
extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
#define _MD_CLOSE_SOCKET _MD_CloseSocket
#define _MD_SENDTO _PR_MD_SENDTO
#define _MD_RECVFROM _PR_MD_RECVFROM
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
#define _MD_SET_FD_INHERITABLE _PR_MD_SET_FD_INHERITABLE
#define _MD_SELECT select
#define _MD_FSYNC _PR_MD_FSYNC
#define READ_FD 1
#define WRITE_FD 2
#define _MD_INIT_ATOMIC()
#if defined(_M_IX86) || defined(_X86_)
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
#else /* non-x86 processors */
#define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
#define _MD_ATOMIC_ADD(ptr,val) (InterlockedExchangeAdd((PLONG)ptr, (LONG)val) + val)
#define _MD_ATOMIC_DECREMENT(x) InterlockedDecrement((PLONG)x)
#endif /* x86 */
#define _MD_ATOMIC_SET(x,y) InterlockedExchange((PLONG)x, (LONG)y)
#define _MD_INIT_IO _PR_MD_INIT_IO
/* win95 doesn't have async IO */
#define _MD_SOCKET _PR_MD_SOCKET
extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
#define _MD_SOCKETAVAILABLE _MD_SocketAvailable
#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
#define _MD_CONNECT _PR_MD_CONNECT
extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
PRIntervalTime timeout);
#define _MD_ACCEPT _MD_Accept
#define _MD_BIND _PR_MD_BIND
#define _MD_RECV _PR_MD_RECV
#define _MD_SEND _PR_MD_SEND
#define _MD_PR_POLL _PR_MD_PR_POLL
/* --- Scheduler stuff --- */
// #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
#define _MD_PAUSE_CPU
/* --- DIR stuff --- */
#define PR_DIRECTORY_SEPARATOR '\\'
#define PR_DIRECTORY_SEPARATOR_STR "\\"
#define PR_PATH_SEPARATOR ';'
#define PR_PATH_SEPARATOR_STR ";"
#define _MD_ERRNO() GetLastError()
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
#define _MD_READ_DIR _PR_MD_READ_DIR
/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
#define _MD_FREE_SEGMENT(seg)
/* --- Environment Stuff --- */
#define _MD_GET_ENV _PR_MD_GET_ENV
#define _MD_PUT_ENV _PR_MD_PUT_ENV
/* --- Threading Stuff --- */
#define _MD_DEFAULT_STACK_SIZE 0
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
#define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD
#define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD
#define _MD_YIELD _PR_MD_YIELD
#define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY
#define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
#define _MD_EXIT_THREAD _PR_MD_EXIT_THREAD
#define _MD_EXIT _PR_MD_EXIT
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_END_RESUME_ALL()
/* --- Lock stuff --- */
#define _PR_LOCK _MD_LOCK
#define _PR_UNLOCK _MD_UNLOCK
#define _MD_NEW_LOCK(lock) (InitializeCriticalSection(&((lock)->mutex)),(lock)->notified.length=0,(lock)->notified.link=NULL,PR_SUCCESS)
#define _MD_FREE_LOCK(lock) DeleteCriticalSection(&((lock)->mutex))
#define _MD_LOCK(lock) EnterCriticalSection(&((lock)->mutex))
#define _MD_TEST_AND_LOCK(lock) (EnterCriticalSection(&((lock)->mutex)),0)
#define _MD_UNLOCK _PR_MD_UNLOCK
/* --- lock and cv waiting --- */
#define _MD_WAIT _PR_MD_WAIT
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
/* --- CVar ------------------- */
#define _MD_WAIT_CV _PR_MD_WAIT_CV
#define _MD_NEW_CV _PR_MD_NEW_CV
#define _MD_FREE_CV _PR_MD_FREE_CV
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
// extern struct _MDLock _pr_ioq_lock;
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
/* --- Initialization stuff --- */
#define _MD_START_INTERRUPTS()
#define _MD_STOP_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
#define _MD_FINAL_INIT()
#define _MD_INIT_CPUS()
#define _MD_INIT_RUNNING_CPU(cpu)
struct PRProcess;
struct PRProcessAttr;
#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
extern struct PRProcess * _PR_CreateWindowsProcess(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr
);
#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
/* --- Wait for a child process to terminate --- */
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
PRInt32 *exitCode);
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
#define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
PR_BEGIN_MACRO \
*status = PR_TRUE; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT
#define _MD_RESTORE_CONTEXT
/* --- Intervals --- */
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
/* --- Time --- */
extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);
/* --- Native-Thread Specific Definitions ------------------------------- */
extern struct PRThread * _MD_CURRENT_THREAD(void);
#ifdef _PR_USE_STATIC_TLS
extern __declspec(thread) struct PRThread *_pr_currentThread;
#define _MD_GET_ATTACHED_THREAD() _pr_currentThread
#define _MD_SET_CURRENT_THREAD(_thread) (_pr_currentThread = (_thread))
extern __declspec(thread) struct PRThread *_pr_thread_last_run;
#define _MD_LAST_THREAD() _pr_thread_last_run
#define _MD_SET_LAST_THREAD(_thread) (_pr_thread_last_run = 0)
extern __declspec(thread) struct _PRCPU *_pr_currentCPU;
#define _MD_CURRENT_CPU() _pr_currentCPU
#define _MD_SET_CURRENT_CPU(_cpu) (_pr_currentCPU = 0)
#else /* _PR_USE_STATIC_TLS */
extern DWORD _pr_currentThreadIndex;
#define _MD_GET_ATTACHED_THREAD() ((PRThread *) TlsGetValue(_pr_currentThreadIndex))
#define _MD_SET_CURRENT_THREAD(_thread) TlsSetValue(_pr_currentThreadIndex, (_thread))
extern DWORD _pr_lastThreadIndex;
#define _MD_LAST_THREAD() ((PRThread *) TlsGetValue(_pr_lastThreadIndex))
#define _MD_SET_LAST_THREAD(_thread) TlsSetValue(_pr_lastThreadIndex, 0)
extern DWORD _pr_currentCPUIndex;
#define _MD_CURRENT_CPU() ((struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
#define _MD_SET_CURRENT_CPU(_cpu) TlsSetValue(_pr_currentCPUIndex, 0)
#endif /* _PR_USE_STATIC_TLS */
/* --- Scheduler stuff --- */
#define LOCK_SCHEDULER() 0
#define UNLOCK_SCHEDULER() 0
#define _PR_LockSched() 0
#define _PR_UnlockSched() 0
/* --- Initialization stuff --- */
#define _MD_INIT_LOCKS()
/* --- Stack stuff --- */
#define _MD_INIT_STACK(stack, redzone)
#define _MD_CLEAR_STACK(stack)
/* --- Memory-mapped files stuff --- */
struct _MDFileMap {
HANDLE hFileMap;
DWORD dwAccess;
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
extern PRInt32 _MD_GetMemMapAlignment(void);
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
/* --- Named semaphores stuff --- */
#define _PR_HAVE_NAMED_SEMAPHORES
#define _MD_OPEN_SEMAPHORE _PR_MD_OPEN_SEMAPHORE
#define _MD_WAIT_SEMAPHORE _PR_MD_WAIT_SEMAPHORE
#define _MD_POST_SEMAPHORE _PR_MD_POST_SEMAPHORE
#define _MD_CLOSE_SEMAPHORE _PR_MD_CLOSE_SEMAPHORE
#define _MD_DELETE_SEMAPHORE(name) PR_SUCCESS /* no op */
#endif /* nspr_win32_defs_h___ */

View File

@@ -0,0 +1,610 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_win32_defs_h___
#define nspr_win32_defs_h___
/* Need to force service-pack 3 extensions to be defined by
** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h.
*/
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#elif (_WIN32_WINNT < 0x0400)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif /* _WIN32_WINNT */
#include <windows.h>
#include <winsock.h>
#ifdef __MINGW32__
#include <mswsock.h>
#endif
#include <errno.h>
#include "prio.h"
#include "prclist.h"
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "win32"
#define _PR_SI_SYSNAME "WINNT"
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
#define HAVE_DLL
#define HAVE_CUSTOM_USER_THREADS
#define HAVE_THREAD_AFFINITY
#define _PR_HAVE_GETADDRINFO
#define _PR_INET6_PROBE
#ifndef _PR_INET6
#define AF_INET6 23
/* newer ws2tcpip.h provides these */
#ifndef AI_CANONNAME
#define AI_CANONNAME 0x2
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#define _PR_HAVE_MD_SOCKADDR_IN6
/* isomorphic to struct in6_addr on Windows */
struct _md_in6_addr {
union {
PRUint8 _S6_u8[16];
PRUint16 _S6_u16[8];
} _S6_un;
};
/* isomorphic to struct sockaddr_in6 on Windows */
struct _md_sockaddr_in6 {
PRInt16 sin6_family;
PRUint16 sin6_port;
PRUint32 sin6_flowinfo;
struct _md_in6_addr sin6_addr;
PRUint32 sin6_scope_id;
};
#endif
#define _PR_HAVE_THREADSAFE_GETHOST
#define _PR_HAVE_ATOMIC_OPS
#define _PR_HAVE_ATOMIC_CAS
#define PR_HAVE_WIN32_NAMED_SHARED_MEMORY
#define _PR_HAVE_PEEK_BUFFER
#define _PR_PEEK_BUFFER_MAX (32 * 1024)
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) \
(!(fd)->secret->nonblocking && (fd)->secret->inheritable != _PR_TRI_TRUE)
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
/* --- Globals --- */
extern struct PRLock *_pr_schedLock;
/* --- Typedefs --- */
typedef void (*FiberFunc)(void *);
#define PR_NUM_GCREGS 8
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
#define GC_VMBASE 0x40000000
#define GC_VMLIMIT 0x00FFFFFF
#define _MD_MAGIC_THREAD 0x22222222
#define _MD_MAGIC_THREADSTACK 0x33333333
#define _MD_MAGIC_SEGMENT 0x44444444
#define _MD_MAGIC_DIR 0x55555555
struct _MDCPU {
int unused;
};
enum _MDIOModel {
_MD_BlockingIO = 0x38,
_MD_MultiWaitIO = 0x49
};
typedef struct _MDOverlapped {
OVERLAPPED overlapped; /* Used for async I/O */
enum _MDIOModel ioModel; /* The I/O model to implement
* using overlapped I/O.
*/
union {
struct _MDThread *mdThread; /* For blocking I/O, this structure
* is embedded in the _MDThread
* structure.
*/
struct {
PRCList links; /* for group->io_ready list */
struct PRRecvWait *desc; /* For multiwait I/O, this structure
* is associated with a PRRecvWait
* structure.
*/
struct PRWaitGroup *group;
struct TimerEvent *timer;
DWORD error;
} mw;
} data;
} _MDOverlapped;
struct _MDThread {
/* The overlapped structure must be first! */
struct _MDOverlapped overlapped; /* Used for async IO for this thread */
void *acceptex_buf; /* Used for AcceptEx() */
TRANSMIT_FILE_BUFFERS *xmit_bufs; /* Used for TransmitFile() */
HANDLE blocked_sema; /* Threads block on this when waiting
* for IO or CondVar.
*/
PRInt32 blocked_io_status; /* Status of the completed IO */
PRInt32 blocked_io_bytes; /* Bytes transferred for completed IO */
PRInt32 blocked_io_error; /* Save error if status is FALSE */
HANDLE handle;
PRUint32 id;
void *sp; /* only valid when suspended */
PRUint32 magic; /* for debugging */
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
struct _PRCPU *thr_bound_cpu; /* thread bound to cpu */
PRBool interrupt_disabled;/* thread cannot be interrupted */
HANDLE thr_event; /* For native-threads-only support,
thread blocks on this event */
/* The following are used only if this is a fiber */
void *fiber_id; /* flag whether or not this is a fiber*/
FiberFunc fiber_fn; /* main fiber routine */
void *fiber_arg; /* arg to main fiber routine */
PRUint32 fiber_stacksize; /* stacksize for fiber */
PRInt32 fiber_last_error; /* last error for the fiber */
void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
* pass its 'start' argument to
* pr_root. */
};
struct _MDThreadStack {
PRUint32 magic; /* for debugging */
};
struct _MDSegment {
PRUint32 magic; /* for debugging */
};
#undef PROFILE_LOCKS
struct _MDLock {
CRITICAL_SECTION mutex; /* this is recursive on NT */
#ifdef PROFILE_LOCKS
PRInt32 hitcount;
PRInt32 misscount;
#endif
};
struct _MDDir {
HANDLE d_hdl;
WIN32_FIND_DATA d_entry;
PRBool firstEntry; /* Is this the entry returned
* by FindFirstFile()? */
PRUint32 magic; /* for debugging */
};
struct _MDCVar {
PRUint32 unused;
};
struct _MDSemaphore {
HANDLE sem;
};
struct _MDFileDesc {
PRInt32 osfd; /* The osfd can come from one of three spaces:
* - For stdin, stdout, and stderr, we are using
* the libc file handle (0, 1, 2), which is an int.
* - For files and pipes, we are using Win32 HANDLE,
* which is a void*.
* - For sockets, we are using Winsock SOCKET, which
* is a u_int.
*/
PRBool io_model_committed; /* The io model (blocking or nonblocking)
* for this osfd has been committed and
* cannot be changed. The osfd has been
* either associated with the io
* completion port or made nonblocking. */
PRBool sync_file_io; /* Use synchronous file I/O on the osfd
* (a file handle) */
PRBool accepted_socket; /* Is this an accepted socket (on the
* server side)? */
PRNetAddr peer_addr; /* If this is an accepted socket, cache
* the peer's address returned by
* AcceptEx(). This is to work around
* the bug that getpeername() on an
* socket accepted by AcceptEx() returns
* an all-zero net address. */
};
struct _MDProcess {
HANDLE handle;
DWORD id;
};
/* --- Misc stuff --- */
#define _MD_GET_SP(thread) (thread)->md.gcContext[6]
/* --- NT security stuff --- */
extern void _PR_NT_InitSids(void);
extern void _PR_NT_FreeSids(void);
extern PRStatus _PR_NT_MakeSecurityDescriptorACL(
PRIntn mode,
DWORD accessTable[],
PSECURITY_DESCRIPTOR *resultSD,
PACL *resultACL
);
extern void _PR_NT_FreeSecurityDescriptorACL(
PSECURITY_DESCRIPTOR pSD, PACL pACL);
/* --- IO stuff --- */
extern PRInt32 _md_Associate(HANDLE);
extern PRInt32 _PR_MD_CLOSE(PRInt32 osfd, PRBool socket);
#define _MD_OPEN _PR_MD_OPEN
#define _MD_OPEN_FILE _PR_MD_OPEN_FILE
#define _MD_READ _PR_MD_READ
#define _MD_WRITE _PR_MD_WRITE
#define _MD_WRITEV _PR_MD_WRITEV
#define _MD_LSEEK _PR_MD_LSEEK
#define _MD_LSEEK64 _PR_MD_LSEEK64
#define _MD_CLOSE_FILE(f) _PR_MD_CLOSE(f, PR_FALSE)
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
#define _MD_GETFILEINFO64 _PR_MD_GETFILEINFO64
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
#define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
#define _MD_STAT _PR_MD_STAT
#define _MD_RENAME _PR_MD_RENAME
#define _MD_ACCESS _PR_MD_ACCESS
#define _MD_DELETE _PR_MD_DELETE
#define _MD_MKDIR _PR_MD_MKDIR
#define _MD_MAKE_DIR _PR_MD_MAKE_DIR
#define _MD_RMDIR _PR_MD_RMDIR
#define _MD_LOCKFILE _PR_MD_LOCKFILE
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
/* --- Socket IO stuff --- */
#define _MD_GET_SOCKET_ERROR() WSAGetLastError()
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
#define _MD_INIT_FILEDESC(fd)
#define _MD_MAKE_NONBLOCK _PR_MD_MAKE_NONBLOCK
#define _MD_INIT_FD_INHERITABLE _PR_MD_INIT_FD_INHERITABLE
#define _MD_QUERY_FD_INHERITABLE _PR_MD_QUERY_FD_INHERITABLE
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
#define _MD_LISTEN _PR_MD_LISTEN
#define _MD_CLOSE_SOCKET(s) _PR_MD_CLOSE(s, PR_TRUE)
#define _MD_SENDTO _PR_MD_SENDTO
#define _MD_RECVFROM _PR_MD_RECVFROM
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
#define _MD_SELECT select
extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
const struct timeval *);
#define _MD_FSYNC _PR_MD_FSYNC
#define _MD_SOCKETAVAILABLE _PR_MD_SOCKETAVAILABLE
#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
#define _MD_SET_FD_INHERITABLE _PR_MD_SET_FD_INHERITABLE
#define _MD_INIT_ATOMIC()
#if defined(_M_IX86) || defined(_X86_)
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
#else /* non-x86 processors */
#define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
#define _MD_ATOMIC_ADD(ptr,val) (InterlockedExchangeAdd((PLONG)ptr, (LONG)val) + val)
#define _MD_ATOMIC_DECREMENT(x) InterlockedDecrement((PLONG)x)
#endif /* x86 */
#define _MD_ATOMIC_SET(x,y) InterlockedExchange((PLONG)x, (LONG)y)
#define _MD_INIT_IO _PR_MD_INIT_IO
#define _MD_SOCKET _PR_MD_SOCKET
#define _MD_CONNECT _PR_MD_CONNECT
#define _MD_ACCEPT(s, a, l, to) \
_MD_FAST_ACCEPT(s, a, l, to, PR_FALSE, NULL, NULL)
#define _MD_FAST_ACCEPT(s, a, l, to, fast, cb, cba) \
_PR_MD_FAST_ACCEPT(s, a, l, to, fast, cb, cba)
#define _MD_ACCEPT_READ(s, ns, ra, buf, l, t) \
_MD_FAST_ACCEPT_READ(s, ns, ra, buf, l, t, PR_FALSE, NULL, NULL)
#define _MD_FAST_ACCEPT_READ(s, ns, ra, buf, l, t, fast, cb, cba) \
_PR_MD_FAST_ACCEPT_READ(s, ns, ra, buf, l, t, fast, cb, cba)
#define _MD_UPDATE_ACCEPT_CONTEXT _PR_MD_UPDATE_ACCEPT_CONTEXT
#define _MD_BIND _PR_MD_BIND
#define _MD_RECV _PR_MD_RECV
#define _MD_SEND _PR_MD_SEND
#define _MD_SENDFILE _PR_MD_SENDFILE
#define _MD_PR_POLL _PR_MD_PR_POLL
/* --- Scheduler stuff --- */
#define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
/* --- DIR stuff --- */
#define PR_DIRECTORY_SEPARATOR '\\'
#define PR_DIRECTORY_SEPARATOR_STR "\\"
#define PR_PATH_SEPARATOR ';'
#define PR_PATH_SEPARATOR_STR ";"
#define _MD_ERRNO() GetLastError()
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
#define _MD_READ_DIR _PR_MD_READ_DIR
/* --- Segment stuff --- */
#define _MD_INIT_SEGS()
#define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
#define _MD_FREE_SEGMENT(seg)
/* --- Environment Stuff --- */
#define _MD_GET_ENV _PR_MD_GET_ENV
#define _MD_PUT_ENV _PR_MD_PUT_ENV
/* --- Threading Stuff --- */
#define _MD_DEFAULT_STACK_SIZE 0
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
#define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD
#define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD
#define _MD_JOIN_THREAD _PR_MD_JOIN_THREAD
#define _MD_END_THREAD _PR_MD_END_THREAD
#define _MD_YIELD _PR_MD_YIELD
#define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY
#define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
#define _MD_EXIT_THREAD _PR_MD_EXIT_THREAD
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_END_RESUME_ALL()
extern void _PR_Unblock_IO_Wait(PRThread *thr);
/* --- Lock stuff --- */
#define _MD_NEW_LOCK(lock) (InitializeCriticalSection(&((lock)->mutex)),PR_SUCCESS)
#define _MD_FREE_LOCK(lock) DeleteCriticalSection(&((lock)->mutex))
#ifndef PROFILE_LOCKS
#define _MD_LOCK(lock) EnterCriticalSection(&((lock)->mutex))
#define _MD_TEST_AND_LOCK(lock) (TryEnterCriticalSection(&((lock)->mutex))== FALSE)
#define _MD_UNLOCK(lock) LeaveCriticalSection(&((lock)->mutex))
#else
#define _MD_LOCK(lock) \
PR_BEGIN_MACRO \
BOOL rv = TryEnterCriticalSection(&((lock)->mutex)); \
if (rv == TRUE) { \
InterlockedIncrement(&((lock)->hitcount)); \
} else { \
InterlockedIncrement(&((lock)->misscount)); \
EnterCriticalSection(&((lock)->mutex)); \
} \
PR_END_MACRO
#define _MD_TEST_AND_LOCK(lock) 0 /* XXXMB */
#define _MD_UNLOCK(lock) LeaveCriticalSection(&((lock)->mutex))
#endif
#define _PR_LOCK _MD_LOCK
#define _PR_UNLOCK _MD_UNLOCK
/* --- lock and cv waiting --- */
#define _MD_WAIT _PR_MD_WAIT
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
extern struct _MDLock _pr_ioq_lock;
#define _MD_IOQ_LOCK() _MD_LOCK(&_pr_ioq_lock)
#define _MD_IOQ_UNLOCK() _MD_UNLOCK(&_pr_ioq_lock)
/* --- Initialization stuff --- */
#define _MD_START_INTERRUPTS()
#define _MD_STOP_INTERRUPTS()
#define _MD_DISABLE_CLOCK_INTERRUPTS()
#define _MD_ENABLE_CLOCK_INTERRUPTS()
#define _MD_BLOCK_CLOCK_INTERRUPTS()
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
#define _MD_FINAL_INIT()
#define _MD_INIT_CPUS()
#define _MD_INIT_RUNNING_CPU(cpu)
struct PRProcess;
struct PRProcessAttr;
/* --- Create a new process --- */
#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
extern struct PRProcess * _PR_CreateWindowsProcess(
const char *path,
char *const *argv,
char *const *envp,
const struct PRProcessAttr *attr
);
#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
/* --- Wait for a child process to terminate --- */
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
PRInt32 *exitCode);
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
/* --- User Threading stuff --- */
#define HAVE_FIBERS
#define _MD_CREATE_USER_THREAD _PR_MD_CREATE_USER_THREAD
#define _MD_CREATE_PRIMORDIAL_USER_THREAD _PR_MD_CREATE_PRIMORDIAL_USER_THREAD
#define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
#define _MD_EXIT _PR_MD_EXIT
#define _MD_INIT_CONTEXT _PR_MD_INIT_CONTEXT
#define _MD_SWITCH_CONTEXT _PR_MD_SWITCH_CONTEXT
#define _MD_RESTORE_CONTEXT _PR_MD_RESTORE_CONTEXT
/* --- Intervals --- */
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
/* --- Time --- */
extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);
/* --- Native-Thread Specific Definitions ------------------------------- */
extern BOOL _pr_use_static_tls;
extern __declspec(thread) struct PRThread *_pr_current_fiber;
extern DWORD _pr_currentFiberIndex;
#define _MD_GET_ATTACHED_THREAD() \
(_pr_use_static_tls ? _pr_current_fiber \
: (PRThread *) TlsGetValue(_pr_currentFiberIndex))
extern struct PRThread * _MD_CURRENT_THREAD(void);
#define _MD_SET_CURRENT_THREAD(_thread) \
PR_BEGIN_MACRO \
if (_pr_use_static_tls) { \
_pr_current_fiber = (_thread); \
} else { \
TlsSetValue(_pr_currentFiberIndex, (_thread)); \
} \
PR_END_MACRO
extern __declspec(thread) struct PRThread *_pr_fiber_last_run;
extern DWORD _pr_lastFiberIndex;
#define _MD_LAST_THREAD() \
(_pr_use_static_tls ? _pr_fiber_last_run \
: (PRThread *) TlsGetValue(_pr_lastFiberIndex))
#define _MD_SET_LAST_THREAD(_thread) \
PR_BEGIN_MACRO \
if (_pr_use_static_tls) { \
_pr_fiber_last_run = (_thread); \
} else { \
TlsSetValue(_pr_lastFiberIndex, (_thread)); \
} \
PR_END_MACRO
extern __declspec(thread) struct _PRCPU *_pr_current_cpu;
extern DWORD _pr_currentCPUIndex;
#define _MD_CURRENT_CPU() \
(_pr_use_static_tls ? _pr_current_cpu \
: (struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
#define _MD_SET_CURRENT_CPU(_cpu) \
PR_BEGIN_MACRO \
if (_pr_use_static_tls) { \
_pr_current_cpu = (_cpu); \
} else { \
TlsSetValue(_pr_currentCPUIndex, (_cpu)); \
} \
PR_END_MACRO
extern __declspec(thread) PRUintn _pr_ints_off;
extern DWORD _pr_intsOffIndex;
#define _MD_GET_INTSOFF() \
(_pr_use_static_tls ? _pr_ints_off \
: (PRUintn) TlsGetValue(_pr_intsOffIndex))
#define _MD_SET_INTSOFF(_val) \
PR_BEGIN_MACRO \
if (_pr_use_static_tls) { \
_pr_ints_off = (_val); \
} else { \
TlsSetValue(_pr_intsOffIndex, (LPVOID) (_val)); \
} \
PR_END_MACRO
/* --- Initialization stuff --- */
#define _MD_INIT_LOCKS()
/* --- Stack stuff --- */
#define _MD_INIT_STACK(stack, redzone)
#define _MD_CLEAR_STACK(stack)
/* --- Memory-mapped files stuff --- */
struct _MDFileMap {
HANDLE hFileMap;
DWORD dwAccess;
};
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
extern PRInt32 _MD_GetMemMapAlignment(void);
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
PRUint32 len);
#define _MD_MEM_MAP _MD_MemMap
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
#define _MD_MEM_UNMAP _MD_MemUnmap
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
/* --- Named semaphores stuff --- */
#define _PR_HAVE_NAMED_SEMAPHORES
#define _MD_OPEN_SEMAPHORE _PR_MD_OPEN_SEMAPHORE
#define _MD_WAIT_SEMAPHORE _PR_MD_WAIT_SEMAPHORE
#define _MD_POST_SEMAPHORE _PR_MD_POST_SEMAPHORE
#define _MD_CLOSE_SEMAPHORE _PR_MD_CLOSE_SEMAPHORE
#define _MD_DELETE_SEMAPHORE(name) PR_SUCCESS /* no op */
#endif /* nspr_win32_defs_h___ */

View File

@@ -0,0 +1,169 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef prosdep_h___
#define prosdep_h___
/*
** Get OS specific header information
*/
#include "prtypes.h"
PR_BEGIN_EXTERN_C
#ifdef XP_PC
#include "md/_pcos.h"
#ifdef WINNT
#include "md/_winnt.h"
#include "md/_win32_errors.h"
#elif defined(WIN95)
#include "md/_win95.h"
#include "md/_win32_errors.h"
#elif defined(WIN16)
#include "md/_win16.h"
#elif defined(OS2)
#include "md/_os2.h"
#include "md/_os2_errors.h"
#else
#error unknown Windows platform
#endif
#elif defined XP_MAC
#include "_macos.h"
#elif defined(XP_UNIX)
#if defined(AIX)
#include "md/_aix.h"
#elif defined(FREEBSD)
#include "md/_freebsd.h"
#elif defined(NETBSD)
#include "md/_netbsd.h"
#elif defined(OPENBSD)
#include "md/_openbsd.h"
#elif defined(BSDI)
#include "md/_bsdi.h"
#elif defined(HPUX)
#include "md/_hpux.h"
#elif defined(IRIX)
#include "md/_irix.h"
#elif defined(LINUX)
#include "md/_linux.h"
#elif defined(OSF1)
#include "md/_osf1.h"
#elif defined(DARWIN)
#include "md/_darwin.h"
#elif defined(NEXTSTEP)
#include "md/_nextstep.h"
#elif defined(SOLARIS)
#include "md/_solaris.h"
#elif defined(SUNOS4)
#include "md/_sunos4.h"
#elif defined(SNI)
#include "md/_reliantunix.h"
#elif defined(SONY)
#include "md/_sony.h"
#elif defined(NEC)
#include "md/_nec.h"
#elif defined(SCO)
#include "md/_scoos.h"
#elif defined(UNIXWARE)
#include "md/_unixware.h"
#elif defined(NCR)
#include "md/_ncr.h"
#elif defined(DGUX)
#include "md/_dgux.h"
#elif defined(QNX)
#include "md/_qnx.h"
#elif defined(VMS)
#include "md/_openvms.h"
#elif defined(NTO)
#include "md/_nto.h"
#elif defined(RISCOS)
#include "md/_riscos.h"
#else
#error unknown Unix flavor
#endif
#include "md/_unixos.h"
#include "md/_unix_errors.h"
#elif defined(XP_BEOS)
#include "md/_beos.h"
#include "md/_unix_errors.h"
#else
#error "The platform is not BeOS, Unix, Windows, or Mac"
#endif
#ifdef _PR_PTHREADS
#include "md/_pth.h"
#endif
PR_END_EXTERN_C
#endif /* prosdep_h___ */

View File

@@ -0,0 +1,164 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef pr_sunos4_h___
#define pr_sunos4_h___
#ifndef SVR4
/*
** Hodge podge of random missing prototypes for the Sunos4 system
*/
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include <limits.h>
#include <sys/types.h>
#define PATH_MAX _POSIX_PATH_MAX
struct timeval;
struct timezone;
struct itimerval;
struct sockaddr;
struct stat;
struct tm;
/* ctype.h */
extern int tolower(int);
extern int toupper(int);
/* errno.h */
extern char *sys_errlist[];
extern int sys_nerr;
#define strerror(e) sys_errlist[((unsigned)(e) < sys_nerr) ? e : 0]
extern void perror(const char *);
/* getopt */
extern char *optarg;
extern int optind;
extern int getopt(int argc, char **argv, char *spec);
/* math.h */
extern int srandom(long val);
extern long random(void);
/* memory.h */
#define memmove(to,from,len) bcopy((char*)(from),(char*)(to),len)
extern void bcopy(const char *, char *, int);
/* signal.h */
/*
** SunOS4 sigaction hides interrupts by default, so we can safely define
** SA_RESTART to 0.
*/
#define SA_RESTART 0
/* stdio.h */
extern int printf(const char *, ...);
extern int fprintf(FILE *, const char *, ...);
extern int vprintf(const char *, va_list);
extern int vfprintf(FILE *, const char *, va_list);
extern char *vsprintf(char *, const char *, va_list);
extern int scanf(const char *, ...);
extern int sscanf(const char *, const char *, ...);
extern int fscanf(FILE *, const char *, ...);
extern int fgetc(FILE *);
extern int fputc(int, FILE *);
extern int fputs(const char *, FILE *);
extern int puts(const char *);
extern int fread(void *, size_t, size_t, FILE *);
extern int fwrite(const char *, int, int, FILE *);
extern int fseek(FILE *, long, int);
extern long ftell(FILE *);
extern int rewind(FILE *);
extern int fflush(FILE *);
extern int _flsbuf(unsigned char, FILE *);
extern int fclose(FILE *);
extern int remove(const char *);
extern int setvbuf(FILE *, char *, int, size_t);
extern int system(const char *);
extern FILE *popen(const char *, const char *);
extern int pclose(FILE *);
/* stdlib.h */
#define strtoul strtol
extern int isatty(int fildes);
extern long strtol(const char *, char **, int);
extern int putenv(const char *);
extern void srand48(long);
extern long lrand48(void);
extern double drand48(void);
/* string.h */
extern int strcasecmp(const char *, const char *);
extern int strncasecmp(const char *, const char *, size_t);
extern int strcoll(const char *, const char *);
/* time.h */
extern time_t mktime(struct tm *);
extern size_t strftime(char *, size_t, const char *, const struct tm *);
extern int gettimeofday(struct timeval *, struct timezone *);
extern int setitimer(int, struct itimerval *, struct itimerval *);
extern time_t time(time_t *);
extern time_t timegm(struct tm *);
extern struct tm *localtime(const time_t *);
extern struct tm *gmtime(const time_t *);
/* unistd.h */
extern int rename(const char *, const char *);
extern int ioctl(int, int, int *arg);
extern int connect(int, struct sockaddr *, int);
extern int readlink(const char *, char *, int);
extern int symlink(const char *, const char *);
extern int ftruncate(int, off_t);
extern int fchmod(int, mode_t);
extern int fchown(int, uid_t, gid_t);
extern int lstat(const char *, struct stat *);
extern int fstat(int, struct stat *);
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
extern int gethostname(char *, int);
extern char *getwd(char *);
extern int getpagesize(void);
#endif /* SVR4 */
#endif /* pr_sunos4_h___ */

View File

@@ -0,0 +1,99 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/js/src/xpconnect/idl/mozIJSSubScriptLoader.idl
*/
#ifndef __gen_mozIJSSubScriptLoader_h__
#define __gen_mozIJSSubScriptLoader_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: mozIJSSubScriptLoader */
#define MOZIJSSUBSCRIPTLOADER_IID_STR "8792d77e-1dd2-11b2-ac7f-9bc9be4f2916"
#define MOZIJSSUBSCRIPTLOADER_IID \
{0x8792d77e, 0x1dd2, 0x11b2, \
{ 0xac, 0x7f, 0x9b, 0xc9, 0xbe, 0x4f, 0x29, 0x16 }}
class NS_NO_VTABLE mozIJSSubScriptLoader : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(MOZIJSSUBSCRIPTLOADER_IID)
/**
* This method should only be called from JS!
* In JS, the signature looks like:
* rv loadSubScript (url [, obj]);
* @param url the url if the sub-script, it MUST be either a file:,
* resource:, or chrome: url, and MUST be local.
* @param obj an optional object to evaluate the script onto, it
* defaults to the global object of the caller.
* @retval rv the value returned by the sub-script
*/
/* void loadSubScript (in wstring url); */
NS_IMETHOD LoadSubScript(const PRUnichar *url) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_MOZIJSSUBSCRIPTLOADER \
NS_IMETHOD LoadSubScript(const PRUnichar *url);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_MOZIJSSUBSCRIPTLOADER(_to) \
NS_IMETHOD LoadSubScript(const PRUnichar *url) { return _to LoadSubScript(url); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_MOZIJSSUBSCRIPTLOADER(_to) \
NS_IMETHOD LoadSubScript(const PRUnichar *url) { return !_to ? NS_ERROR_NULL_POINTER : _to->LoadSubScript(url); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class _MYCLASS_ : public mozIJSSubScriptLoader
{
public:
NS_DECL_ISUPPORTS
NS_DECL_MOZIJSSUBSCRIPTLOADER
_MYCLASS_();
private:
~_MYCLASS_();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(_MYCLASS_, mozIJSSubScriptLoader)
_MYCLASS_::_MYCLASS_()
{
/* member initializers and constructor code */
}
_MYCLASS_::~_MYCLASS_()
{
/* destructor code */
}
/* void loadSubScript (in wstring url); */
NS_IMETHODIMP _MYCLASS_::LoadSubScript(const PRUnichar *url)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_mozIJSSubScriptLoader_h__ */

View File

@@ -0,0 +1,52 @@
/* List of defines generated by configure. Included with preprocessor flag,
* -include, to avoid long list of -D defines on the compile command-line.
* Do not edit.
*/
#ifndef _MOZILLA_CONFIG_H_
#define _MOZILLA_CONFIG_H_
#define ACCESSIBILITY 1
#define D_INO d_ino
#define HAVE_SNPRINTF 1
#define HW_THREADS 1
#define IBMBIDI 1
#define JS_THREADSAFE 1
#define MOZILLA_LOCALE_VERSION "1.8b5"
#define MOZILLA_REGION_VERSION "1.8b5"
#define MOZILLA_SKIN_VERSION "1.8"
#define MOZILLA_VERSION "1.8"
#define MOZILLA_VERSION_U 1.8
#define MOZ_BUILD_APP browser
#define MOZ_DEFAULT_TOOLKIT "windows"
#define MOZ_DISTRIBUTION_ID "org.mozilla"
#define MOZ_DLL_SUFFIX ".dll"
#define MOZ_JSLOADER 1
#define MOZ_LOGGING 1
#define MOZ_MATHML 1
#define MOZ_PHOENIX 1
#define MOZ_PROFILELOCKING 1
#define MOZ_UPDATE_CHANNEL default
#define MOZ_USER_DIR "Mozilla"
#define MOZ_VIEW_SOURCE 1
#define MOZ_XPINSTALL 1
#define MOZ_XTF 1
#define MOZ_XUL 1
#define MOZ_XUL_APP 1
#define NO_X11 1
#define NS_PRINTING 1
#define NS_PRINT_PREVIEW 1
#define OJI 1
#define STDC_HEADERS 1
#define WIN32 1
#define WIN32_LEAN_AND_MEAN 1
#define WINVER 0x400
#define XP_WIN 1
#define XP_WIN32 1
#define _WIN32 1
#define _WIN32_WINNT 0x400
#define _WINDOWS 1
#define _X86_ 1
#endif /* _MOZILLA_CONFIG_H_ */

View File

@@ -0,0 +1,726 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* npapi.h $Revision: 1.1 $
* Netscape client plug-in API spec
*/
#ifndef _NPAPI_H_
#define _NPAPI_H_
#ifdef __OS2__
#pragma pack(1)
#endif
#include "prtypes.h"
/* Copied from xp_core.h */
/* removed #ifdef for hpux defined in /usr/include/model.h */
#ifndef XP_MAC
#ifndef _INT16
#define _INT16
#endif
#ifndef _INT32
#define _INT32
#endif
#ifndef _UINT16
#define _UINT16
#endif
#ifndef _UINT32
#define _UINT32
#endif
#endif
/*
* NO_NSPR_10_SUPPORT disables the inclusion
* of obsolete/protypes.h, whose int16, uint16,
* int32, and uint32 typedefs conflict with those
* in this file.
*/
#ifndef NO_NSPR_10_SUPPORT
#define NO_NSPR_10_SUPPORT
#endif
#ifdef OJI
#include "jri.h" /* Java Runtime Interface */
#endif
#if defined (__OS2__ ) || defined (OS2)
# ifndef XP_OS2
# define XP_OS2 1
# endif /* XP_OS2 */
#endif /* __OS2__ */
#ifdef _WINDOWS
# include <windef.h>
# ifndef XP_WIN
# define XP_WIN 1
# endif /* XP_WIN */
#endif /* _WINDOWS */
#ifdef __MWERKS__
# define _declspec __declspec
# ifdef macintosh
# ifndef XP_MAC
# define XP_MAC 1
# endif /* XP_MAC */
# endif /* macintosh */
# ifdef __INTEL__
# undef NULL
# ifndef XP_WIN
# define XP_WIN 1
# endif /* XP_WIN */
# endif /* __INTEL__ */
#endif /* __MWERKS__ */
#if defined(XP_MAC) || defined(XP_MACOSX)
#include <Quickdraw.h>
#include <Events.h>
#endif
#if defined(XP_UNIX)
# include <stdio.h>
# if defined(MOZ_X11)
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
#endif
/*----------------------------------------------------------------------*/
/* Plugin Version Constants */
/*----------------------------------------------------------------------*/
#define NP_VERSION_MAJOR 0
#define NP_VERSION_MINOR 16
/* The OS/2 version of Netscape uses RC_DATA to define the
mime types, file extensions, etc that are required.
Use a vertical bar to separate types, end types with \0.
FileVersion and ProductVersion are 32bit ints, all other
entries are strings the MUST be terminated wwith a \0.
AN EXAMPLE:
RCDATA NP_INFO_ProductVersion { 1,0,0,1,}
RCDATA NP_INFO_MIMEType { "video/x-video|",
"video/x-flick\0" }
RCDATA NP_INFO_FileExtents { "avi|",
"flc\0" }
RCDATA NP_INFO_FileOpenName{ "MMOS2 video player(*.avi)|",
"MMOS2 Flc/Fli player(*.flc)\0" }
RCDATA NP_INFO_FileVersion { 1,0,0,1 }
RCDATA NP_INFO_CompanyName { "Netscape Communications\0" }
RCDATA NP_INFO_FileDescription { "NPAVI32 Extension DLL\0"
RCDATA NP_INFO_InternalName { "NPAVI32\0" )
RCDATA NP_INFO_LegalCopyright { "Copyright Netscape Communications \251 1996\0"
RCDATA NP_INFO_OriginalFilename { "NVAPI32.DLL" }
RCDATA NP_INFO_ProductName { "NPAVI32 Dynamic Link Library\0" }
*/
/* RC_DATA types for version info - required */
#define NP_INFO_ProductVersion 1
#define NP_INFO_MIMEType 2
#define NP_INFO_FileOpenName 3
#define NP_INFO_FileExtents 4
/* RC_DATA types for version info - used if found */
#define NP_INFO_FileDescription 5
#define NP_INFO_ProductName 6
/* RC_DATA types for version info - optional */
#define NP_INFO_CompanyName 7
#define NP_INFO_FileVersion 8
#define NP_INFO_InternalName 9
#define NP_INFO_LegalCopyright 10
#define NP_INFO_OriginalFilename 11
#ifndef RC_INVOKED
/*----------------------------------------------------------------------*/
/* Definition of Basic Types */
/*----------------------------------------------------------------------*/
#ifndef _UINT16
typedef unsigned short uint16;
#endif
#ifndef _UINT32
# if defined(__alpha) || defined(__amd64__) || defined(__x86_64__)
typedef unsigned int uint32;
# else /* __alpha */
typedef unsigned long uint32;
# endif /* __alpha */
#endif
/*
* AIX defines these in sys/inttypes.h included from sys/types.h
*/
#ifndef AIX
#ifndef _INT16
typedef short int16;
#endif
#ifndef _INT32
# if defined(__alpha) || defined(__amd64__) || defined(__x86_64__)
typedef int int32;
# else /* __alpha */
typedef long int32;
# endif /* __alpha */
#endif
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef NULL
#define NULL (0L)
#endif
typedef unsigned char NPBool;
typedef int16 NPError;
typedef int16 NPReason;
typedef char* NPMIMEType;
/*----------------------------------------------------------------------*/
/* Structures and definitions */
/*----------------------------------------------------------------------*/
#ifdef XP_MAC
#pragma options align=mac68k
#endif
/*
* NPP is a plug-in's opaque instance handle
*/
typedef struct _NPP
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
} NPP_t;
typedef NPP_t* NPP;
typedef struct _NPStream
{
void* pdata; /* plug-in private data */
void* ndata; /* netscape private data */
const char* url;
uint32 end;
uint32 lastmodified;
void* notifyData;
} NPStream;
typedef struct _NPByteRange
{
int32 offset; /* negative offset means from the end */
uint32 length;
struct _NPByteRange* next;
} NPByteRange;
typedef struct _NPSavedData
{
int32 len;
void* buf;
} NPSavedData;
typedef struct _NPRect
{
uint16 top;
uint16 left;
uint16 bottom;
uint16 right;
} NPRect;
typedef struct _NPSize
{
int32 width;
int32 height;
} NPSize;
#ifdef XP_UNIX
/*
* Unix specific structures and definitions
*/
/*
* Callback Structures.
*
* These are used to pass additional platform specific information.
*/
enum {
NP_SETWINDOW = 1,
NP_PRINT
};
typedef struct
{
int32 type;
} NPAnyCallbackStruct;
typedef struct
{
int32 type;
#ifdef MOZ_X11
Display* display;
Visual* visual;
Colormap colormap;
unsigned int depth;
#endif
} NPSetWindowCallbackStruct;
typedef struct
{
int32 type;
FILE* fp;
} NPPrintCallbackStruct;
#endif /* XP_UNIX */
/*
* The following masks are applied on certain platforms to NPNV and
* NPPV selectors that pass around pointers to COM interfaces. Newer
* compilers on some platforms may generate vtables that are not
* compatible with older compilers. To prevent older plugins from
* not understanding a new browser's ABI, these masks change the
* values of those selectors on those platforms. To remain backwards
* compatible with differenet versions of the browser, plugins can
* use these masks to dynamically determine and use the correct C++
* ABI that the browser is expecting. This does not apply to Windows
* as Microsoft's COM ABI will likely not change.
*/
#define NP_ABI_GCC3_MASK 0x10000000
/*
* gcc 3.x generated vtables on UNIX and OSX are incompatible with
* previous compilers.
*/
#if (defined (XP_UNIX) && defined(__GNUC__) && (__GNUC__ >= 3))
#define _NP_ABI_MIXIN_FOR_GCC3 NP_ABI_GCC3_MASK
#else
#define _NP_ABI_MIXIN_FOR_GCC3 0
#endif
#define NP_ABI_MACHO_MASK 0x01000000
/*
* On OSX, the Mach-O executable format is significantly
* different than CFM. In addition to having a different
* C++ ABI, it also has has different C calling convention.
* You must use glue code when calling between CFM and
* Mach-O C functions.
*/
#if (defined(TARGET_RT_MAC_MACHO))
#define _NP_ABI_MIXIN_FOR_MACHO NP_ABI_MACHO_MASK
#else
#define _NP_ABI_MIXIN_FOR_MACHO 0
#endif
#define NP_ABI_MASK (_NP_ABI_MIXIN_FOR_GCC3 | _NP_ABI_MIXIN_FOR_MACHO)
/*
* List of variable names for which NPP_GetValue shall be implemented
*/
typedef enum {
NPPVpluginNameString = 1,
NPPVpluginDescriptionString,
NPPVpluginWindowBool,
NPPVpluginTransparentBool,
NPPVjavaClass, /* Not implemented in Mozilla 1.0 */
NPPVpluginWindowSize,
NPPVpluginTimerInterval,
NPPVpluginScriptableInstance = (10 | NP_ABI_MASK),
NPPVpluginScriptableIID = 11,
/* Introduced in Mozilla 0.9.9 */
NPPVjavascriptPushCallerBool = 12,
/* Introduced in Mozilla 1.0 */
NPPVpluginKeepLibraryInMemory = 13,
NPPVpluginNeedsXEmbed = 14,
/* Get the NPObject for scripting the plugin. Introduced in Firefox
* 1.0 (NPAPI minor version 14).
*/
NPPVpluginScriptableNPObject = 15,
/* Get the plugin value (as \0-terminated UTF-8 string data) for
* form submission if the plugin is part of a form. Use
* NPN_MemAlloc() to allocate memory for the string data. Introduced
* in Mozilla 1.8b2 (NPAPI minor version 15).
*/
NPPVformValue = 16
} NPPVariable;
/*
* List of variable names for which NPN_GetValue is implemented by Mozilla
*/
typedef enum {
NPNVxDisplay = 1,
NPNVxtAppContext,
NPNVnetscapeWindow,
NPNVjavascriptEnabledBool,
NPNVasdEnabledBool,
NPNVisOfflineBool,
/* 10 and over are available on Mozilla builds starting with 0.9.4 */
NPNVserviceManager = (10 | NP_ABI_MASK),
NPNVDOMElement = (11 | NP_ABI_MASK), /* available in Mozilla 1.2 */
NPNVDOMWindow = (12 | NP_ABI_MASK),
NPNVToolkit = (13 | NP_ABI_MASK),
NPNVSupportsXEmbedBool = 14,
/* Get the NPObject wrapper for the browser window. */
NPNVWindowNPObject = 15,
/* Get the NPObject wrapper for the plugins DOM element. */
NPNVPluginElementNPObject = 16
} NPNVariable;
/*
* The type of Tookkit the widgets use
*/
typedef enum {
NPNVGtk12 = 1,
NPNVGtk2
} NPNToolkitType;
/*
* The type of a NPWindow - it specifies the type of the data structure
* returned in the window field.
*/
typedef enum {
NPWindowTypeWindow = 1,
NPWindowTypeDrawable
} NPWindowType;
typedef struct _NPWindow
{
void* window; /* Platform specific window handle */
/* OS/2: x - Position of bottom left corner */
/* OS/2: y - relative to visible netscape window */
int32 x; /* Position of top left corner relative */
int32 y; /* to a netscape page. */
uint32 width; /* Maximum window size */
uint32 height;
NPRect clipRect; /* Clipping rectangle in port coordinates */
/* Used by MAC only. */
#if defined(XP_UNIX) && !defined(XP_MACOSX)
void * ws_info; /* Platform-dependent additonal data */
#endif /* XP_UNIX */
NPWindowType type; /* Is this a window or a drawable? */
} NPWindow;
typedef struct _NPFullPrint
{
NPBool pluginPrinted;/* Set TRUE if plugin handled fullscreen printing */
NPBool printOne; /* TRUE if plugin should print one copy to default printer */
void* platformPrint; /* Platform-specific printing info */
} NPFullPrint;
typedef struct _NPEmbedPrint
{
NPWindow window;
void* platformPrint; /* Platform-specific printing info */
} NPEmbedPrint;
typedef struct _NPPrint
{
uint16 mode; /* NP_FULL or NP_EMBED */
union
{
NPFullPrint fullPrint; /* if mode is NP_FULL */
NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
} print;
} NPPrint;
#if defined(XP_MAC) || defined(XP_MACOSX)
typedef EventRecord NPEvent;
#elif defined(XP_WIN)
typedef struct _NPEvent
{
uint16 event;
uint32 wParam;
uint32 lParam;
} NPEvent;
#elif defined(XP_OS2)
typedef struct _NPEvent
{
uint32 event;
uint32 wParam;
uint32 lParam;
} NPEvent;
#elif defined (XP_UNIX) && defined(MOZ_X11)
typedef XEvent NPEvent;
#else
typedef void* NPEvent;
#endif /* XP_MAC */
#if defined(XP_MAC) || defined(XP_MACOSX)
typedef RgnHandle NPRegion;
#elif defined(XP_WIN)
typedef HRGN NPRegion;
#elif defined(XP_UNIX) && defined(MOZ_X11)
typedef Region NPRegion;
#else
typedef void *NPRegion;
#endif /* XP_MAC */
#if defined(XP_MAC) || defined(XP_MACOSX)
/*
* Mac-specific structures and definitions.
*/
typedef struct NP_Port
{
CGrafPtr port; /* Grafport */
int32 portx; /* position inside the topmost window */
int32 porty;
} NP_Port;
/*
* Non-standard event types that can be passed to HandleEvent
*/
enum NPEventType {
NPEventType_GetFocusEvent = (osEvt + 16),
NPEventType_LoseFocusEvent,
NPEventType_AdjustCursorEvent,
NPEventType_MenuCommandEvent,
NPEventType_ClippingChangedEvent,
NPEventType_ScrollingBeginsEvent = 1000,
NPEventType_ScrollingEndsEvent
};
#ifdef OBSOLETE
#define getFocusEvent (osEvt + 16)
#define loseFocusEvent (osEvt + 17)
#define adjustCursorEvent (osEvt + 18)
#endif
#endif /* XP_MAC */
/*
* Values for mode passed to NPP_New:
*/
#define NP_EMBED 1
#define NP_FULL 2
/*
* Values for stream type passed to NPP_NewStream:
*/
#define NP_NORMAL 1
#define NP_SEEK 2
#define NP_ASFILE 3
#define NP_ASFILEONLY 4
#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
#ifdef XP_MAC
#pragma options align=reset
#endif
/*----------------------------------------------------------------------*/
/* Error and Reason Code definitions */
/*----------------------------------------------------------------------*/
/*
* Values of type NPError:
*/
#define NPERR_BASE 0
#define NPERR_NO_ERROR (NPERR_BASE + 0)
#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
#define NPERR_INVALID_URL (NPERR_BASE + 10)
#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
#define NPERR_NO_DATA (NPERR_BASE + 12)
#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
/*
* Values of type NPReason:
*/
#define NPRES_BASE 0
#define NPRES_DONE (NPRES_BASE + 0)
#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
#define NPRES_USER_BREAK (NPRES_BASE + 2)
/*
* Don't use these obsolete error codes any more.
*/
#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
/*
* Version feature information
*/
#define NPVERS_HAS_STREAMOUTPUT 8
#define NPVERS_HAS_NOTIFICATION 9
#define NPVERS_HAS_LIVECONNECT 9
#define NPVERS_WIN16_HAS_LIVECONNECT 9
#define NPVERS_68K_HAS_LIVECONNECT 11
#define NPVERS_HAS_WINDOWLESS 11
#define NPVERS_HAS_XPCONNECT_SCRIPTING 13
/*----------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------*/
#if defined(_WINDOWS) && !defined(WIN32)
#define NP_LOADDS _loadds
#else
#if defined(__OS2__)
#define NP_LOADDS _System
#else
#define NP_LOADDS
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* NPP_* functions are provided by the plugin and called by the navigator.
*/
#ifdef XP_UNIX
char* NPP_GetMIMEDescription(void);
#endif /* XP_UNIX */
NPError NP_LOADDS NPP_Initialize(void);
void NP_LOADDS NPP_Shutdown(void);
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
uint16 mode, int16 argc, char* argn[],
char* argv[], NPSavedData* saved);
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
NPStream* stream, NPBool seekable,
uint16* stype);
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
NPReason reason);
int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
int32 len, void* buffer);
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
const char* fname);
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
NPReason reason, void* notifyData);
#ifdef OJI
jref NP_LOADDS NPP_GetJavaClass(void);
#endif
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
/*
* NPN_* functions are provided by the navigator and called by the plugin.
*/
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
int* netscape_major, int* netscape_minor);
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
const char* target, void* notifyData);
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
const char* target);
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
const char* target, uint32 len,
const char* buf, NPBool file,
void* notifyData);
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
const char* target, uint32 len,
const char* buf, NPBool file);
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
const char* target, NPStream** stream);
int32 NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
void NP_LOADDS NPN_Status(NPP instance, const char* message);
const char* NP_LOADDS NPN_UserAgent(NPP instance);
void* NP_LOADDS NPN_MemAlloc(uint32 size);
void NP_LOADDS NPN_MemFree(void* ptr);
uint32 NP_LOADDS NPN_MemFlush(uint32 size);
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
#ifdef OJI
JRIEnv* NP_LOADDS NPN_GetJavaEnv(void);
jref NP_LOADDS NPN_GetJavaPeer(NPP instance);
#endif
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable, void *value);
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable, void *value);
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
void NP_LOADDS NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion);
void NP_LOADDS NPN_ForceRedraw(NPP instance);
void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* RC_INVOKED */
#ifdef __OS2__
#pragma pack()
#endif
#endif /* _NPAPI_H_ */

View File

@@ -0,0 +1,397 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Copyright © 2004, Apple Computer, Inc. and The Mozilla Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of Apple Computer, Inc. ("Apple") or The Mozilla
* Foundation ("Mozilla") nor the names of their contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE, MOZILLA AND THEIR CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE, MOZILLA OR
* THEIR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Revision 1 (March 4, 2004):
* Initial proposal.
*
* Revision 2 (March 10, 2004):
* All calls into script were made asynchronous. Results are
* provided via the NPScriptResultFunctionPtr callback.
*
* Revision 3 (March 10, 2004):
* Corrected comments to not refer to class retain/release FunctionPtrs.
*
* Revision 4 (March 11, 2004):
* Added additional convenience NPN_SetExceptionWithUTF8().
* Changed NPHasPropertyFunctionPtr and NPHasMethodFunctionPtr to take NPClass
* pointers instead of NPObject pointers.
* Added NPIsValidIdentifier().
*
* Revision 5 (March 17, 2004):
* Added context parameter to result callbacks from ScriptObject functions.
*
* Revision 6 (March 29, 2004):
* Renamed functions implemented by user agent to NPN_*. Removed _ from
* type names.
* Renamed "JavaScript" types to "Script".
*
* Revision 7 (April 21, 2004):
* NPIdentifier becomes a void*, was int32_t
* Remove NP_IsValidIdentifier, renamed NP_IdentifierFromUTF8 to NP_GetIdentifier
* Added NPVariant and modified functions to use this new type.
*
* Revision 8 (July 9, 2004):
* Updated to joint Apple-Mozilla license.
*
*/
#ifndef _NP_RUNTIME_H_
#define _NP_RUNTIME_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "nptypes.h"
/*
This API is used to facilitate binding code written in C to script
objects. The API in this header does not assume the presence of a
user agent. That is, it can be used to bind C code to scripting
environments outside of the context of a user agent.
However, the normal use of the this API is in the context of a
scripting environment running in a browser or other user agent.
In particular it is used to support the extended Netscape
script-ability API for plugins (NP-SAP). NP-SAP is an extension
of the Netscape plugin API. As such we have adopted the use of
the "NP" prefix for this API.
The following NP{N|P}Variables were added to the Netscape plugin
API (in npapi.h):
NPNVWindowNPObject
NPNVPluginElementNPObject
NPPVpluginScriptableNPObject
These variables are exposed through NPN_GetValue() and
NPP_GetValue() (respectively) and are used to establish the
initial binding between the user agent and native code. The DOM
objects in the user agent can be examined and manipulated using
the NPN_ functions that operate on NPObjects described in this
header.
To the extent possible the assumptions about the scripting
language used by the scripting environment have been minimized.
*/
#define NP_BEGIN_MACRO do {
#define NP_END_MACRO } while (0)
/*
Objects (non-primitive data) passed between 'C' and script is
always wrapped in an NPObject. The 'interface' of an NPObject is
described by an NPClass.
*/
typedef struct NPObject NPObject;
typedef struct NPClass NPClass;
typedef char NPUTF8;
typedef struct _NPString {
const NPUTF8 *utf8characters;
uint32_t utf8length;
} NPString;
typedef enum {
NPVariantType_Void,
NPVariantType_Null,
NPVariantType_Bool,
NPVariantType_Int32,
NPVariantType_Double,
NPVariantType_String,
NPVariantType_Object
} NPVariantType;
typedef struct _NPVariant {
NPVariantType type;
union {
bool boolValue;
uint32_t intValue;
double doubleValue;
NPString stringValue;
NPObject *objectValue;
} value;
} NPVariant;
/*
NPN_ReleaseVariantValue is called on all 'out' parameters
references. Specifically it is to be called on variants that own
their value, as is the case with all non-const NPVariant*
arguments after a successful call to any methods (except this one)
in this API.
After calling NPN_ReleaseVariantValue, the type of the variant
will be NPVariantType_Void.
*/
void NPN_ReleaseVariantValue(NPVariant *variant);
#define NPVARIANT_IS_VOID(_v) ((_v).type == NPVariantType_Void)
#define NPVARIANT_IS_NULL(_v) ((_v).type == NPVariantType_Null)
#define NPVARIANT_IS_BOOLEAN(_v) ((_v).type == NPVariantType_Bool)
#define NPVARIANT_IS_INT32(_v) ((_v).type == NPVariantType_Int32)
#define NPVARIANT_IS_DOUBLE(_v) ((_v).type == NPVariantType_Double)
#define NPVARIANT_IS_STRING(_v) ((_v).type == NPVariantType_String)
#define NPVARIANT_IS_OBJECT(_v) ((_v).type == NPVariantType_Object)
#define NPVARIANT_TO_BOOLEAN(_v) ((_v).value.boolValue)
#define NPVARIANT_TO_INT32(_v) ((_v).value.intValue)
#define NPVARIANT_TO_DOUBLE(_v) ((_v).value.doubleValue)
#define NPVARIANT_TO_STRING(_v) ((_v).value.stringValue)
#define NPVARIANT_TO_OBJECT(_v) ((_v).value.objectValue)
#define VOID_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Void; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define NULL_TO_NPVARIANT(_v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Null; \
(_v).value.objectValue = NULL; \
NP_END_MACRO
#define BOOLEAN_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Bool; \
(_v).value.boolValue = !!(_val); \
NP_END_MACRO
#define INT32_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Int32; \
(_v).value.intValue = _val; \
NP_END_MACRO
#define DOUBLE_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Double; \
(_v).value.doubleValue = _val; \
NP_END_MACRO
#define STRINGZ_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, strlen(_val) }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define STRINGN_TO_NPVARIANT(_val, _len, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_String; \
NPString str = { _val, _len }; \
(_v).value.stringValue = str; \
NP_END_MACRO
#define OBJECT_TO_NPVARIANT(_val, _v) \
NP_BEGIN_MACRO \
(_v).type = NPVariantType_Object; \
(_v).value.objectValue = _val; \
NP_END_MACRO
/*
Type mappings (JavaScript types have been used for illustration
purposes):
JavaScript to C (NPVariant with type:)
undefined NPVariantType_Void
null NPVariantType_Null
Boolean NPVariantType_Bool
Number NPVariantType_Double or NPVariantType_Int32
String NPVariantType_String
Object NPVariantType_Object
C (NPVariant with type:) to JavaScript
NPVariantType_Void undefined
NPVariantType_Null null
NPVariantType_Bool Boolean
NPVariantType_Int32 Number
NPVariantType_Double Number
NPVariantType_String String
NPVariantType_Object Object
*/
typedef void *NPIdentifier;
/*
NPObjects have methods and properties. Methods and properties are
identified with NPIdentifiers. These identifiers may be reflected
in script. NPIdentifiers can be either strings or integers, IOW,
methods and properties can be identified by either strings or
integers (i.e. foo["bar"] vs foo[1]). NPIdentifiers can be
compared using ==. In case of any errors, the requested
NPIdentifier(s) will be NULL.
*/
NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name);
void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
NPIdentifier *identifiers);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
bool NPN_IdentifierIsString(NPIdentifier identifier);
/*
The NPUTF8 returned from NPN_UTF8FromIdentifier SHOULD be freed.
*/
NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier);
/*
Get the integer represented by identifier. If identifier is not an
integer identifier, the behaviour is undefined.
*/
int32_t NPN_IntFromIdentifier(NPIdentifier identifier);
/*
NPObject behavior is implemented using the following set of
callback functions.
The NPVariant *result argument of these functions (where
applicable) should be released using NPN_ReleaseVariantValue().
*/
typedef NPObject *(*NPAllocateFunctionPtr)(NPP npp, NPClass *aClass);
typedef void (*NPDeallocateFunctionPtr)(NPObject *npobj);
typedef void (*NPInvalidateFunctionPtr)(NPObject *npobj);
typedef bool (*NPHasMethodFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPInvokeFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *args, uint32_t argCount,
NPVariant *result);
typedef bool (*NPInvokeDefaultFunctionPtr)(NPObject *npobj,
const NPVariant *args,
uint32_t argCount,
NPVariant *result);
typedef bool (*NPHasPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name);
typedef bool (*NPGetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
NPVariant *result);
typedef bool (*NPSetPropertyFunctionPtr)(NPObject *npobj, NPIdentifier name,
const NPVariant *value);
typedef bool (*NPRemovePropertyFunctionPtr)(NPObject *npobj,
NPIdentifier name);
/*
NPObjects returned by create, retain, invoke, and getProperty pass
a reference count to the caller. That is, the callee adds a
reference count which passes to the caller. It is the caller's
responsibility to release the returned object.
NPInvokeFunctionPtr function may return 0 to indicate a void
result.
NPInvalidateFunctionPtr is called by the scripting environment
when the native code is shutdown. Any attempt to message a
NPObject instance after the invalidate callback has been
called will result in undefined behavior, even if the native code
is still retaining those NPObject instances. (The runtime
will typically return immediately, with 0 or NULL, from an attempt
to dispatch to a NPObject, but this behavior should not be
depended upon.)
*/
struct NPClass
{
uint32_t structVersion;
NPAllocateFunctionPtr allocate;
NPDeallocateFunctionPtr deallocate;
NPInvalidateFunctionPtr invalidate;
NPHasMethodFunctionPtr hasMethod;
NPInvokeFunctionPtr invoke;
NPInvokeDefaultFunctionPtr invokeDefault;
NPHasPropertyFunctionPtr hasProperty;
NPGetPropertyFunctionPtr getProperty;
NPSetPropertyFunctionPtr setProperty;
NPRemovePropertyFunctionPtr removeProperty;
};
#define NP_CLASS_STRUCT_VERSION 1
struct NPObject {
NPClass *_class;
uint32_t referenceCount;
/*
* Additional space may be allocated here by types of NPObjects
*/
};
/*
If the class has an allocate function, NPN_CreateObject invokes
that function, otherwise a NPObject is allocated and
returned. This method will initialize the referenceCount member of
the NPObject to 1.
*/
NPObject *NPN_CreateObject(NPP npp, NPClass *aClass);
/*
Increment the NPObject's reference count.
*/
NPObject *NPN_RetainObject(NPObject *npobj);
/*
Decremented the NPObject's reference count. If the reference
count goes to zero, the class's destroy function is invoke if
specified, otherwise the object is freed directly.
*/
void NPN_ReleaseObject(NPObject *npobj);
/*
Functions to access script objects represented by NPObject.
Calls to script objects are synchronous. If a function returns a
value, it will be supplied via the result NPVariant
argument. Successful calls will return true, false will be
returned in case of an error.
Calls made from plugin code to script must be made from the thread
on which the plugin was initialized.
*/
bool NPN_Invoke(NPP npp, NPObject *npobj, NPIdentifier methodName,
const NPVariant *args, uint32_t argCount, NPVariant *result);
bool NPN_InvokeDefault(NPP npp, NPObject *npobj, const NPVariant *args,
uint32_t argCount, NPVariant *result);
bool NPN_Evaluate(NPP npp, NPObject *npobj, NPString *script,
NPVariant *result);
bool NPN_GetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
NPVariant *result);
bool NPN_SetProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName,
const NPVariant *value);
bool NPN_RemoveProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasProperty(NPP npp, NPObject *npobj, NPIdentifier propertyName);
bool NPN_HasMethod(NPP npp, NPObject *npobj, NPIdentifier methodName);
/*
NPN_SetException may be called to trigger a script exception upon
return from entry points into NPObjects. Typical usage:
NPN_SetException (npobj, message);
*/
void NPN_SetException(NPObject *npobj, const NPUTF8 *message);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,105 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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
* mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Johnny Stenback <jst@mozilla.org> (Original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*
* Header file for ensuring that C99 types ([u]int32_t and bool) are
* available.
*/
#if defined(WIN32) || defined(OS2)
/*
* Win32 and OS/2 don't know C99, so define [u]int_32 here. The bool
* is predefined tho, both in C and C++.
*/
typedef int int32_t;
typedef unsigned int uint32_t;
#elif defined(_AIX) || defined(__sun) || defined(__osf__) || defined(IRIX) || defined(HPUX)
/*
* AIX and SunOS ship a inttypes.h header that defines [u]int32_t,
* but not bool for C.
*/
#include <inttypes.h>
#ifndef __cplusplus
typedef int bool;
#endif
#elif defined(bsdi) || defined(FREEBSD) || defined(OPENBSD)
/*
* BSD/OS, FreeBSD, and OpenBSD ship sys/types.h that define int32_t and
* u_int32_t.
*/
#include <sys/types.h>
/*
* BSD/OS ships no header that defines uint32_t, nor bool (for C)
* OpenBSD ships no header that defines uint32_t and using its bool macro is
* unsafe.
*/
#if defined(bsdi) || defined(OPENBSD)
typedef u_int32_t uint32_t;
#if !defined(__cplusplus)
typedef int bool;
#endif
#else
/*
* FreeBSD defines uint32_t and bool.
*/
#include <inttypes.h>
#include <stdbool.h>
#endif
#elif defined(BEOS)
#include <inttypes.h>
#else
/*
* For those that ship a standard C99 stdint.h header file, include
* it. Can't do the same for stdbool.h tho, since some systems ship
* with a stdbool.h file that doesn't compile!
*/
#include <stdint.h>
#if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
#include <stdbool.h>
#else
/*
* GCC 2.91 can't deal with a typedef for bool, but a #define
* works.
*/
#define bool int
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
#ifndef _NSBUILDID_H_
#define _NSBUILDID_H_
/* Build ID file.
*
* If building MOZILLLA_OFFICIAL (release build) NS_BUILD_ID will be updated
* to a current build id. This will be used to determine if we need to
* re-register components.
*
*/
#define NS_BUILD_ID 0000000000
/* GRE_BUILD_ID - GRE build version identifier
*
* If creating a release build (eg, MOZILLA_OFFICIAL is set), then
* GRE_BUILD_ID will be updated to contain <milestone>_<build id>.
* If building a milestone build (eg, MOZ_MILESTONE_RELEASE is set), then
* GRE_BUILD_ID will just contain <milestone>.
*
*/
#define GRE_BUILD_ID "1.8_0000000000"
#endif /* _NSBUILDID_H_ */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,336 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsComponentManagerUtils_h__
#define nsComponentManagerUtils_h__
#ifndef nscore_h__
#include "nscore.h"
#endif
#ifndef nsCOMPtr_h__
#include "nsCOMPtr.h"
#endif
#include "nsIFactory.h"
NS_COM_GLUE nsresult
CallCreateInstance
(const nsCID &aClass, nsISupports *aDelegate, const nsIID &aIID,
void **aResult);
NS_COM_GLUE nsresult
CallCreateInstance
(const char *aContractID, nsISupports *aDelegate, const nsIID &aIID,
void **aResult);
NS_COM_GLUE nsresult
CallGetClassObject
(const nsCID &aClass, const nsIID &aIID, void **aResult);
NS_COM_GLUE nsresult
CallGetClassObject
(const char *aContractID, const nsIID &aIID, void **aResult);
class NS_COM_GLUE nsCreateInstanceByCID : public nsCOMPtr_helper
{
public:
nsCreateInstanceByCID( const nsCID& aCID, nsISupports* aOuter, nsresult* aErrorPtr )
: mCID(aCID),
mOuter(aOuter),
mErrorPtr(aErrorPtr)
{
// nothing else to do here
}
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
private:
const nsCID& mCID;
nsISupports* mOuter;
nsresult* mErrorPtr;
};
class NS_COM_GLUE nsCreateInstanceByContractID : public nsCOMPtr_helper
{
public:
nsCreateInstanceByContractID( const char* aContractID, nsISupports* aOuter, nsresult* aErrorPtr )
: mContractID(aContractID),
mOuter(aOuter),
mErrorPtr(aErrorPtr)
{
// nothing else to do here
}
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
private:
const char* mContractID;
nsISupports* mOuter;
nsresult* mErrorPtr;
};
class NS_COM_GLUE nsCreateInstanceFromFactory : public nsCOMPtr_helper
{
public:
nsCreateInstanceFromFactory( nsIFactory* aFactory, nsISupports* aOuter, nsresult* aErrorPtr )
: mFactory(aFactory),
mOuter(aOuter),
mErrorPtr(aErrorPtr)
{
// nothing else to do here
}
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
private:
nsIFactory* mFactory;
nsISupports* mOuter;
nsresult* mErrorPtr;
};
inline
const nsCreateInstanceByCID
do_CreateInstance( const nsCID& aCID, nsresult* error = 0 )
{
return nsCreateInstanceByCID(aCID, 0, error);
}
inline
const nsCreateInstanceByCID
do_CreateInstance( const nsCID& aCID, nsISupports* aOuter, nsresult* error = 0 )
{
return nsCreateInstanceByCID(aCID, aOuter, error);
}
inline
const nsCreateInstanceByContractID
do_CreateInstance( const char* aContractID, nsresult* error = 0 )
{
return nsCreateInstanceByContractID(aContractID, 0, error);
}
inline
const nsCreateInstanceByContractID
do_CreateInstance( const char* aContractID, nsISupports* aOuter, nsresult* error = 0 )
{
return nsCreateInstanceByContractID(aContractID, aOuter, error);
}
inline
const nsCreateInstanceFromFactory
do_CreateInstance( nsIFactory* aFactory, nsresult* error = 0 )
{
return nsCreateInstanceFromFactory(aFactory, 0, error);
}
inline
const nsCreateInstanceFromFactory
do_CreateInstance( nsIFactory* aFactory, nsISupports* aOuter, nsresult* error = 0 )
{
return nsCreateInstanceFromFactory(aFactory, aOuter, error);
}
class NS_COM_GLUE nsGetClassObjectByCID : public nsCOMPtr_helper
{
public:
nsGetClassObjectByCID( const nsCID& aCID, nsresult* aErrorPtr )
: mCID(aCID),
mErrorPtr(aErrorPtr)
{
// nothing else to do here
}
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
private:
const nsCID& mCID;
nsresult* mErrorPtr;
};
class NS_COM_GLUE nsGetClassObjectByContractID : public nsCOMPtr_helper
{
public:
nsGetClassObjectByContractID( const char* aContractID, nsresult* aErrorPtr )
: mContractID(aContractID),
mErrorPtr(aErrorPtr)
{
// nothing else to do here
}
virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
private:
const char* mContractID;
nsresult* mErrorPtr;
};
/**
* do_GetClassObject can be used to improve performance of callers
* that call |CreateInstance| many times. They can cache the factory
* and call do_CreateInstance or CallCreateInstance with the cached
* factory rather than having the component manager retrieve it every
* time.
*/
inline const nsGetClassObjectByCID
do_GetClassObject( const nsCID& aCID, nsresult* error = 0 )
{
return nsGetClassObjectByCID(aCID, error);
}
inline const nsGetClassObjectByContractID
do_GetClassObject( const char* aContractID, nsresult* error = 0 )
{
return nsGetClassObjectByContractID(aContractID, error);
}
// type-safe shortcuts for calling |CreateInstance|
template <class DestinationType>
inline
nsresult
CallCreateInstance( const nsCID &aClass,
nsISupports *aDelegate,
DestinationType** aDestination )
{
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aClass, aDelegate,
NS_GET_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallCreateInstance( const nsCID &aClass,
DestinationType** aDestination )
{
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aClass, nsnull,
NS_GET_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallCreateInstance( const char *aContractID,
nsISupports *aDelegate,
DestinationType** aDestination )
{
NS_PRECONDITION(aContractID, "null parameter");
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aContractID,
aDelegate,
NS_GET_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallCreateInstance( const char *aContractID,
DestinationType** aDestination )
{
NS_PRECONDITION(aContractID, "null parameter");
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aContractID, nsnull,
NS_GET_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallCreateInstance( nsIFactory *aFactory,
nsISupports *aDelegate,
DestinationType** aDestination )
{
NS_PRECONDITION(aFactory, "null parameter");
NS_PRECONDITION(aDestination, "null parameter");
return aFactory->CreateInstance(aDelegate,
NS_GET_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallCreateInstance( nsIFactory *aFactory,
DestinationType** aDestination )
{
NS_PRECONDITION(aFactory, "null parameter");
NS_PRECONDITION(aDestination, "null parameter");
return aFactory->CreateInstance(nsnull,
NS_GET_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallGetClassObject( const nsCID &aClass,
DestinationType** aDestination )
{
NS_PRECONDITION(aDestination, "null parameter");
return CallGetClassObject(aClass,
NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
inline
nsresult
CallGetClassObject( const char* aContractID,
DestinationType** aDestination )
{
NS_PRECONDITION(aDestination, "null parameter");
return CallGetClassObject(aContractID,
NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}
#endif /* nsComponentManagerUtils_h__ */

View File

@@ -0,0 +1,279 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDebug_h___
#define nsDebug_h___
#ifndef nscore_h___
#include "nscore.h"
#endif
#ifndef nsError_h__
#include "nsError.h"
#endif
#ifdef DEBUG
#define NS_DEBUG
#endif
/**
* Namespace for debugging methods. Note that your code must use the
* macros defined later in this file so that the debug code can be
* conditionally compiled out.
*/
PR_BEGIN_EXTERN_C
/**
* Log a warning message to the debug log.
*/
NS_COM_GLUE void NS_FASTCALL
NSGlue_Warning(const char *aMessage, const char *aFile, PRIntn aLine);
/**
* Abort the executing program. This works on all architectures.
*/
NS_COM_GLUE void NS_FASTCALL
NSGlue_Abort(const char *aFile, PRIntn aLine);
/**
* Break the executing program into the debugger.
*/
NS_COM_GLUE void NS_FASTCALL
NSGlue_Break(const char* aFile, PRIntn aLine);
/**
* Log an assertion message to the debug log
*/
NS_COM_GLUE void NS_FASTCALL
NSGlue_Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine);
PR_END_EXTERN_C
#ifdef DEBUG
/**
* Abort the execution of the program if the expression evaluates to
* false.
*
* There is no status value returned from the macro.
*
* Note that the non-debug version of this macro does <b>not</b>
* evaluate the expression argument. Hence side effect statements
* as arguments to the macro will yield improper execution in a
* non-debug build. For example:
*
* NS_ABORT_IF_FALSE(0 == foo++, "yikes foo should be zero");
*
* Note also that the non-debug version of this macro does <b>not</b>
* evaluate the message argument.
*/
#define NS_ABORT_IF_FALSE(_expr, _msg) \
PR_BEGIN_MACRO \
if (!(_expr)) { \
NSGlue_Assertion(_msg, #_expr, __FILE__, __LINE__); \
} \
PR_END_MACRO
/**
* Warn if a given condition is false.
*
* Program execution continues past the usage of this macro.
*
* Note also that the non-debug version of this macro does <b>not</b>
* evaluate the message argument.
*/
#define NS_WARN_IF_FALSE(_expr,_msg) \
PR_BEGIN_MACRO \
if (!(_expr)) { \
NSGlue_Assertion(_msg, #_expr, __FILE__, __LINE__); \
} \
PR_END_MACRO
/**
* Test a precondition for truth. If the expression is not true then
* trigger a program failure.
*/
#define NS_PRECONDITION(expr, str) \
PR_BEGIN_MACRO \
if (!(expr)) { \
NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} \
PR_END_MACRO
/**
* Test an assertion for truth. If the expression is not true then
* trigger a program failure.
*/
#define NS_ASSERTION(expr, str) \
PR_BEGIN_MACRO \
if (!(expr)) { \
NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} \
PR_END_MACRO
/**
* Test a post-condition for truth. If the expression is not true then
* trigger a program failure.
*/
#define NS_POSTCONDITION(expr, str) \
PR_BEGIN_MACRO \
if (!(expr)) { \
NSGlue_Assertion(str, #expr, __FILE__, __LINE__); \
} \
PR_END_MACRO
/**
* This macros triggers a program failure if executed. It indicates that
* an attempt was made to execute some unimplemented functionality.
*/
#define NS_NOTYETIMPLEMENTED(str) \
NSGlue_Assertion(str, "NotYetImplemented", __FILE__, __LINE__)
/**
* This macros triggers a program failure if executed. It indicates that
* an attempt was made to execute some unimplemented functionality.
*/
#define NS_NOTREACHED(str) \
NSGlue_Assertion(str, "Not Reached", __FILE__, __LINE__)
/**
* Log an error message.
*/
#define NS_ERROR(str) \
NSGlue_Assertion(str, "Error", __FILE__, __LINE__)
/**
* Log a warning message.
*/
#define NS_WARNING(str) \
NSGlue_Warning(str, __FILE__, __LINE__)
/**
* Trigger an abort
*/
#define NS_ABORT() \
NSGlue_Abort(__FILE__, __LINE__)
/**
* Cause a break
*/
#define NS_BREAK() \
NSGlue_Break(__FILE__, __LINE__)
#else /* NS_DEBUG */
/**
* The non-debug version of these macros do not evaluate the
* expression or the message arguments to the macro.
*/
#define NS_ABORT_IF_FALSE(_expr, _msg) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_WARN_IF_FALSE(_expr, _msg) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_PRECONDITION(expr, str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ASSERTION(expr, str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_POSTCONDITION(expr, str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTYETIMPLEMENTED(str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_NOTREACHED(str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ERROR(str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_WARNING(str) PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_ABORT() PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#define NS_BREAK() PR_BEGIN_MACRO /* nothing */ PR_END_MACRO
#endif /* ! NS_DEBUG */
/* Macros for checking the trueness of an expression passed in within an
* interface implementation. These need to be compiled regardless of the */
/* NS_DEBUG flag
******************************************************************************/
#define NS_ENSURE_TRUE(x, ret) \
PR_BEGIN_MACRO \
if (NS_UNLIKELY(!(x))) { \
NS_WARNING("NS_ENSURE_TRUE(" #x ") failed"); \
return ret; \
} \
PR_END_MACRO
#define NS_ENSURE_FALSE(x, ret) \
NS_ENSURE_TRUE(!(x), ret)
/******************************************************************************
** Macros for checking results
******************************************************************************/
#define NS_ENSURE_SUCCESS(res, ret) \
NS_ENSURE_TRUE(NS_SUCCEEDED(res), ret)
/******************************************************************************
** Macros for checking state and arguments upon entering interface boundaries
******************************************************************************/
#define NS_ENSURE_ARG(arg) \
NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_POINTER(arg) \
NS_ENSURE_TRUE(arg, NS_ERROR_INVALID_POINTER)
#define NS_ENSURE_ARG_MIN(arg, min) \
NS_ENSURE_TRUE((arg) >= min, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_MAX(arg, max) \
NS_ENSURE_TRUE((arg) <= max, NS_ERROR_INVALID_ARG)
#define NS_ENSURE_ARG_RANGE(arg, min, max) \
NS_ENSURE_TRUE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG)
#define NS_ENSURE_STATE(state) \
NS_ENSURE_TRUE(state, NS_ERROR_UNEXPECTED)
#define NS_ENSURE_NO_AGGREGATION(outer) \
NS_ENSURE_FALSE(outer, NS_ERROR_NO_AGGREGATION)
#define NS_ENSURE_PROPER_AGGREGATION(outer, iid) \
NS_ENSURE_FALSE(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG)
/*****************************************************************************/
#ifdef XPCOM_GLUE
#define NS_CheckThreadSafe
#else
#define NS_CheckThreadSafe(owningThread, msg) \
NS_ASSERTION(owningThread == PR_GetCurrentThread(), msg)
#endif
#endif /* nsDebug_h___ */

View File

@@ -0,0 +1,204 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Conrad Carlen conrad@ingress.com
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Defines the property names for directories available from
* nsIDirectoryService. These dirs are always available even if no
* nsIDirectoryServiceProviders have been registered with the service.
* Application level keys are defined in nsAppDirectoryServiceDefs.h.
*
* Keys whose definition ends in "DIR" or "FILE" return a single nsIFile (or
* subclass). Keys whose definition ends in "LIST" return an nsISimpleEnumerator
* which enumerates a list of file objects.
*
* Defines listed in this file are FROZEN. This list may grow.
*/
#ifndef nsDirectoryServiceDefs_h___
#define nsDirectoryServiceDefs_h___
/* General OS specific locations */
#define NS_OS_HOME_DIR "Home"
#define NS_OS_TEMP_DIR "TmpD"
#define NS_OS_CURRENT_WORKING_DIR "CurWorkD"
/* Files stored in this directory will appear on the user's desktop,
* if there is one, otherwise it's just the same as "Home"
*/
#define NS_OS_DESKTOP_DIR "Desk"
/* Property returns the directory in which the procces was started from.
* On Unix this will be the path in the MOZILLA_FIVE_HOME env var and if
* unset will be the current working directory.
*/
#define NS_OS_CURRENT_PROCESS_DIR "CurProcD"
/* This location is similar to NS_OS_CURRENT_PROCESS_DIR, however,
* NS_XPCOM_CURRENT_PROCESS_DIR can be overriden by passing a "bin
* directory" to NS_InitXPCOM2().
*/
#define NS_XPCOM_CURRENT_PROCESS_DIR "XCurProcD"
/* Property will return the location of the application components
* directory. By default, this directory will be contained in the
* NS_XPCOM_CURRENT_PROCESS_DIR.
*/
#define NS_XPCOM_COMPONENT_DIR "ComsD"
/* Property will return a list of components directories that will
* will be registered after the application components directory.
*/
#define NS_XPCOM_COMPONENT_DIR_LIST "ComsDL"
/* Property will return the location of the application components
* registry file.
*/
#define NS_XPCOM_COMPONENT_REGISTRY_FILE "ComRegF"
/* Property will return the location of the application XPTI
* registry file.
*/
#define NS_XPCOM_XPTI_REGISTRY_FILE "XptiRegF"
/* Property will return the location of the the XPCOM Shared Library.
*/
#define NS_XPCOM_LIBRARY_FILE "XpcomLib"
/* Property will return the current location of the the GRE directory.
* If no GRE is used, this propery will behave like
* NS_XPCOM_CURRENT_PROCESS_DIR.
*/
#define NS_GRE_DIR "GreD"
/* Property will return the current location of the the GRE component
* directory. If no GRE is used, this propery will behave like
* NS_XPCOM_COMPONENT_DIR.
*/
#define NS_GRE_COMPONENT_DIR "GreComsD"
/* Platform Specific Locations */
#if !defined (XP_UNIX) || defined(XP_MACOSX)
#define NS_OS_SYSTEM_DIR "SysD"
#endif
#if defined (XP_MACOSX)
#define NS_MAC_DESKTOP_DIR NS_OS_DESKTOP_DIR
#define NS_MAC_TRASH_DIR "Trsh"
#define NS_MAC_STARTUP_DIR "Strt"
#define NS_MAC_SHUTDOWN_DIR "Shdwn"
#define NS_MAC_APPLE_MENU_DIR "ApplMenu"
#define NS_MAC_CONTROL_PANELS_DIR "CntlPnl"
#define NS_MAC_EXTENSIONS_DIR "Exts"
#define NS_MAC_FONTS_DIR "Fnts"
#define NS_MAC_PREFS_DIR "Prfs"
#define NS_MAC_DOCUMENTS_DIR "Docs"
#define NS_MAC_INTERNET_SEARCH_DIR "ISrch"
#define NS_OSX_HOME_DIR NS_OS_HOME_DIR
#define NS_MAC_HOME_DIR NS_OS_HOME_DIR
#define NS_MAC_DEFAULT_DOWNLOAD_DIR "DfltDwnld"
#define NS_MAC_USER_LIB_DIR "ULibDir" // Only available under OS X
#define NS_OSX_DEFAULT_DOWNLOAD_DIR NS_MAC_DEFAULT_DOWNLOAD_DIR
#define NS_OSX_USER_DESKTOP_DIR "UsrDsk"
#define NS_OSX_LOCAL_DESKTOP_DIR "LocDsk"
#define NS_OSX_USER_APPLICATIONS_DIR "UsrApp"
#define NS_OSX_LOCAL_APPLICATIONS_DIR "LocApp"
#define NS_OSX_USER_DOCUMENTS_DIR "UsrDocs"
#define NS_OSX_LOCAL_DOCUMENTS_DIR "LocDocs"
#define NS_OSX_USER_INTERNET_PLUGIN_DIR "UsrIntrntPlgn"
#define NS_OSX_LOCAL_INTERNET_PLUGIN_DIR "LoclIntrntPlgn"
#define NS_OSX_USER_FRAMEWORKS_DIR "UsrFrmwrks"
#define NS_OSX_LOCAL_FRAMEWORKS_DIR "LocFrmwrks"
#define NS_OSX_USER_PREFERENCES_DIR "UsrPrfs"
#define NS_OSX_LOCAL_PREFERENCES_DIR "LocPrfs"
#define NS_OSX_PICTURE_DOCUMENTS_DIR "Pct"
#define NS_OSX_MOVIE_DOCUMENTS_DIR "Mov"
#define NS_OSX_MUSIC_DOCUMENTS_DIR "Music"
#define NS_OSX_INTERNET_SITES_DIR "IntrntSts"
#elif defined (XP_WIN)
#define NS_WIN_WINDOWS_DIR "WinD"
#define NS_WIN_PROGRAM_FILES_DIR "ProgF"
#define NS_WIN_HOME_DIR NS_OS_HOME_DIR
#define NS_WIN_DESKTOP_DIR "DeskV" // virtual folder at the root of the namespace
#define NS_WIN_PROGRAMS_DIR "Progs" // User start menu programs directory!
#define NS_WIN_CONTROLS_DIR "Cntls"
#define NS_WIN_PRINTERS_DIR "Prnts"
#define NS_WIN_PERSONAL_DIR "Pers"
#define NS_WIN_FAVORITES_DIR "Favs"
#define NS_WIN_STARTUP_DIR "Strt"
#define NS_WIN_RECENT_DIR "Rcnt"
#define NS_WIN_SEND_TO_DIR "SndTo"
#define NS_WIN_BITBUCKET_DIR "Buckt"
#define NS_WIN_STARTMENU_DIR "Strt"
// This gives the same thing as NS_OS_DESKTOP_DIR
#define NS_WIN_DESKTOP_DIRECTORY "DeskP" // file sys dir which physically stores objects on desktop
#define NS_WIN_DRIVES_DIR "Drivs"
#define NS_WIN_NETWORK_DIR "NetW"
#define NS_WIN_NETHOOD_DIR "netH"
#define NS_WIN_FONTS_DIR "Fnts"
#define NS_WIN_TEMPLATES_DIR "Tmpls"
#define NS_WIN_COMMON_STARTMENU_DIR "CmStrt"
#define NS_WIN_COMMON_PROGRAMS_DIR "CmPrgs"
#define NS_WIN_COMMON_STARTUP_DIR "CmStrt"
#define NS_WIN_COMMON_DESKTOP_DIRECTORY "CmDeskP"
#define NS_WIN_APPDATA_DIR "AppData"
#define NS_WIN_LOCAL_APPDATA_DIR "LocalAppData"
#define NS_WIN_PRINTHOOD "PrntHd"
#define NS_WIN_COOKIES_DIR "CookD"
#elif defined (XP_UNIX)
#define NS_UNIX_LOCAL_DIR "Locl"
#define NS_UNIX_LIB_DIR "LibD"
#define NS_UNIX_HOME_DIR NS_OS_HOME_DIR
#elif defined (XP_OS2)
#define NS_OS2_DIR "OS2Dir"
#define NS_OS2_HOME_DIR NS_OS_HOME_DIR
#define NS_OS2_DESKTOP_DIR NS_OS_DESKTOP_DIR
#elif defined (XP_BEOS)
#define NS_BEOS_SETTINGS_DIR "Setngs"
#define NS_BEOS_HOME_DIR NS_OS_HOME_DIR
#define NS_BEOS_DESKTOP_DIR NS_OS_DESKTOP_DIR
#endif
/* Deprecated */
#define NS_OS_DRIVE_DIR "DrvD"
#endif

View File

@@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsDirectoryServiceUtils_h___
#define nsDirectoryServiceUtils_h___
#include "nsIServiceManager.h"
#include "nsIProperties.h"
#include "nsServiceManagerUtils.h"
#include "nsCOMPtr.h"
#include "nsXPCOMCID.h"
inline nsresult
NS_GetSpecialDirectory(const char* specialDirName, nsIFile* *result)
{
nsresult rv;
nsCOMPtr<nsIProperties> serv(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
return serv->Get(specialDirName, NS_GET_IID(nsIFile),
NS_REINTERPRET_CAST(void**, result));
}
#endif

View File

@@ -0,0 +1,172 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications, Inc.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Adam Lock <adamlock@netscape.com>
* Benjamin Smedberg <benjamin@smedbergs.us>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef NSEMBEDAPI_H
#define NSEMBEDAPI_H
#include "nscore.h"
#include "nsXPCOM.h"
#include "nsILocalFile.h"
#include "nsIDirectoryService.h"
/**
* @file
* @brief The Gecko embedding API functions, structures and definitions.
*/
/**
* Initialises the Gecko embedding layer. You <I>must</I>
* call this method before proceeding to use Gecko. This function ensures
* XPCOM is started, creates the component registry if necessary and
* starts global services.
*
* @status FROZEN
*
* @note Use <CODE>NS_NewLocalFile</CODE> to create the file object you
* supply as the bin directory path in this call. The function
* may be safely called before the rest of XPCOM or embedding has
* been initialised.
*
* @param aMozBinDirectory The Gecko directory containing the component
* registry and runtime libraries;
* or use <CODE>nsnull</CODE> to use the working
* directory.
* @param aAppFileLocProvider The object to be used by Gecko that specifies
* to Gecko where to find profiles, the component
* registry preferences and so on; or use
* <CODE>nsnull</CODE> for the default behaviour.
* @param aStaticComponents An array of static components (see NS_InitXPCOM3).
* may be null.
* @param aStaticComponentCount Number of static components in the
* aStaticComponents array.
*
* @see NS_NewLocalFile
* @see nsILocalFile
* @see nsIDirectoryServiceProvider
*
* @return NS_OK for success;
* other error codes indicate a failure during initialisation.
*
*/
extern "C" NS_HIDDEN NS_METHOD
NS_InitEmbedding(nsILocalFile *aMozBinDirectory,
nsIDirectoryServiceProvider *aAppFileLocProvider,
nsStaticModuleInfo const *aStaticComponents = nsnull,
PRUint32 aStaticComponentCount = 0);
/**
* Terminates the Gecko embedding layer. Call this function during shutdown to
* ensure that global services are unloaded, files are closed and
* XPCOM is shutdown.
*
* @status FROZEN
*
* @note Release any XPCOM objects within Gecko that you may be holding a
* reference to before calling this function.
*
* @return NS_OK
*/
extern "C" NS_HIDDEN NS_METHOD
NS_TermEmbedding();
/*---------------------------------------------------------------------------*/
/* Event processing APIs. The native OS dependencies mean you must be */
/* building on a supported platform to get the functions below. */
/*---------------------------------------------------------------------------*/
#undef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
/* Win32 specific stuff */
#if defined (WIN32) || defined (WINCE)
#include "windows.h"
/**
* @var typedef MSG nsEmbedNativeEvent
*
* Embedding events are native <CODE>MSG</CODE> structs on Win32.
*/
typedef MSG nsEmbedNativeEvent;
#define MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
#endif
/* OS/2 specific stuff */
#ifdef XP_OS2
#include "os2.h"
/**
* @var typedef MSG nsEmbedNativeEvent
*
* Embedding events are native <CODE>QMSG</CODE> structs on OS/2.
*/
typedef QMSG nsEmbedNativeEvent;
#define MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
#endif
/* Mac specific stuff */
/* TODO implementation left as an exercise for the reader */
/* GTK specific stuff */
/* TODO implementation left as an exercise for the reader */
#ifdef MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING
/**
* @fn nsresult NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled)
*
* This function gives Gecko the chance to process a native window events.
* Call this function from your message processing loop.
*
* @status UNDER_REVIEW
*
* @param aEvent The native UI event
* @param aWasHandled Returns with <CODE>PR_TRUE</CODE> if the end was
* handled; in which case it should not be handled by your
* application.
*
* @return NS_OK
*/
extern "C" NS_HIDDEN NS_METHOD
NS_HandleEmbeddingEvent(nsEmbedNativeEvent &aEvent, PRBool &aWasHandled);
#endif /* MOZ_SUPPORTS_EMBEDDING_EVENT_PROCESSING */
#endif /* NSEMBEDAPI_H */

View File

@@ -0,0 +1,78 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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
* Boris Zbarsky <bzbarsky@mit.edu>.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef NSEMBEDCID_H
#define NSEMBEDCID_H
/**
* @file
* @brief List of, and documentation for, frozen Gecko embedding contracts.
*/
/**
* Web Browser ContractID
* Creating an instance of this ContractID (via createInstanceByContractID)
* is the basic way to instantiate a Gecko browser.
*
* This contract implements the following interfaces:
* nsIWebBrowser
* nsIWebBrowserSetup
* nsIInterfaceRequestor
*
* @note This contract does not guarantee implementation of any other
* interfaces and does not guarantee ability to get any particular
* interfaces via the nsIInterfaceRequestor implementation.
*/
#define NS_WEBBROWSER_CONTRACTID \
"@mozilla.org/embedding/browser/nsWebBrowser;1"
/**
* Prompt Service ContractID
* The prompt service (which can be gotten by calling getServiceByContractID
* on this ContractID) is the way to pose various prompts, alerts,
* and confirmation dialogs to the user.
*
* This contract implements the following interfaces:
* nsIPromptService
*
* Embedders may override this ContractID with their own implementation if they
* want more control over the way prompts, alerts, and confirmation dialogs are
* presented to the user.
*/
#define NS_PROMPTSERVICE_CONTRACTID \
"@mozilla.org/embedcomp/prompt-service;1"
#endif // NSEMBEDCID_H

View File

@@ -0,0 +1,51 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 a small implementation of the nsAString and nsACString.
*
* The Initial Developer of the Original Code is
* Peter Annema <jaggernaut@netscape.com>.
*
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Darin Fisher <darin@meer.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsEmbedString_h___
#define nsEmbedString_h___
#include "nsStringAPI.h"
/**
* compatibility
*/
typedef nsString nsEmbedString;
typedef nsCString nsEmbedCString;
#endif

View File

@@ -0,0 +1,317 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsError_h__
#define nsError_h__
#ifndef nscore_h___
#include "nscore.h" /* needed for nsresult */
#endif
/*
* To add error code to your module, you need to do the following:
*
* 1) Add a module offset code. Add yours to the bottom of the list
* right below this comment, adding 1.
*
* 2) In your module, define a header file which uses one of the
* NE_ERROR_GENERATExxxxxx macros. Some examples below:
*
* #define NS_ERROR_MYMODULE_MYERROR1 NS_ERROR_GENERATE(NS_ERROR_SEVERITY_ERROR,NS_ERROR_MODULE_MYMODULE,1)
* #define NS_ERROR_MYMODULE_MYERROR2 NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_MYMODULE,2)
* #define NS_ERROR_MYMODULE_MYERROR3 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MYMODULE,3)
*
*/
/**
* @name Standard Module Offset Code. Each Module should identify a unique number
* and then all errors associated with that module become offsets from the
* base associated with that module id. There are 16 bits of code bits for
* each module.
*/
#define NS_ERROR_MODULE_XPCOM 1
#define NS_ERROR_MODULE_BASE 2
#define NS_ERROR_MODULE_GFX 3
#define NS_ERROR_MODULE_WIDGET 4
#define NS_ERROR_MODULE_CALENDAR 5
#define NS_ERROR_MODULE_NETWORK 6
#define NS_ERROR_MODULE_PLUGINS 7
#define NS_ERROR_MODULE_LAYOUT 8
#define NS_ERROR_MODULE_HTMLPARSER 9
#define NS_ERROR_MODULE_RDF 10
#define NS_ERROR_MODULE_UCONV 11
#define NS_ERROR_MODULE_REG 12
#define NS_ERROR_MODULE_FILES 13
#define NS_ERROR_MODULE_DOM 14
#define NS_ERROR_MODULE_IMGLIB 15
#define NS_ERROR_MODULE_MAILNEWS 16
#define NS_ERROR_MODULE_EDITOR 17
#define NS_ERROR_MODULE_XPCONNECT 18
#define NS_ERROR_MODULE_PROFILE 19
#define NS_ERROR_MODULE_LDAP 20
#define NS_ERROR_MODULE_SECURITY 21
#define NS_ERROR_MODULE_DOM_XPATH 22
#define NS_ERROR_MODULE_DOM_RANGE 23
#define NS_ERROR_MODULE_URILOADER 24
#define NS_ERROR_MODULE_CONTENT 25
#define NS_ERROR_MODULE_PYXPCOM 26
#define NS_ERROR_MODULE_XSLT 27
#define NS_ERROR_MODULE_IPC 28
#define NS_ERROR_MODULE_SVG 29
#define NS_ERROR_MODULE_STORAGE 30
#define NS_ERROR_MODULE_SCHEMA 31
/* NS_ERROR_MODULE_GENERAL should be used by modules that do not
* care if return code values overlap. Callers of methods that
* return such codes should be aware that they are not
* globally unique. Implementors should be careful about blindly
* returning codes from other modules that might also use
* the generic base.
*/
#define NS_ERROR_MODULE_GENERAL 51
/**
* @name Standard Error Handling Macros
*/
#define NS_FAILED(_nsresult) (NS_UNLIKELY((_nsresult) & 0x80000000))
#define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) & 0x80000000)))
/**
* @name Severity Code. This flag identifies the level of warning
*/
#define NS_ERROR_SEVERITY_SUCCESS 0
#define NS_ERROR_SEVERITY_ERROR 1
/**
* @name Mozilla Code. This flag separates consumers of mozilla code
* from the native platform
*/
#define NS_ERROR_MODULE_BASE_OFFSET 0x45
/**
* @name Standard Error Generating Macros
*/
#define NS_ERROR_GENERATE(sev,module,code) \
((nsresult) (((PRUint32)(sev)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) )
#define NS_ERROR_GENERATE_SUCCESS(module,code) \
((nsresult) (((PRUint32)(NS_ERROR_SEVERITY_SUCCESS)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) )
#define NS_ERROR_GENERATE_FAILURE(module,code) \
((nsresult) (((PRUint32)(NS_ERROR_SEVERITY_ERROR)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) )
/**
* @name Standard Macros for retrieving error bits
*/
#define NS_ERROR_GET_CODE(err) ((err) & 0xffff)
#define NS_ERROR_GET_MODULE(err) (((((err) >> 16) - NS_ERROR_MODULE_BASE_OFFSET) & 0x1fff))
#define NS_ERROR_GET_SEVERITY(err) (((err) >> 31) & 0x1)
/**
* @name Standard return values
*/
/*@{*/
/* Standard "it worked" return value */
#define NS_OK 0
#define NS_ERROR_BASE ((nsresult) 0xC1F30000)
/* Returned when an instance is not initialized */
#define NS_ERROR_NOT_INITIALIZED (NS_ERROR_BASE + 1)
/* Returned when an instance is already initialized */
#define NS_ERROR_ALREADY_INITIALIZED (NS_ERROR_BASE + 2)
/* Returned by a not implemented function */
#define NS_ERROR_NOT_IMPLEMENTED ((nsresult) 0x80004001L)
/* Returned when a given interface is not supported. */
#define NS_NOINTERFACE ((nsresult) 0x80004002L)
#define NS_ERROR_NO_INTERFACE NS_NOINTERFACE
#define NS_ERROR_INVALID_POINTER ((nsresult) 0x80004003L)
#define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER
/* Returned when a function aborts */
#define NS_ERROR_ABORT ((nsresult) 0x80004004L)
/* Returned when a function fails */
#define NS_ERROR_FAILURE ((nsresult) 0x80004005L)
/* Returned when an unexpected error occurs */
#define NS_ERROR_UNEXPECTED ((nsresult) 0x8000ffffL)
/* Returned when a memory allocation fails */
#define NS_ERROR_OUT_OF_MEMORY ((nsresult) 0x8007000eL)
/* Returned when an illegal value is passed */
#define NS_ERROR_ILLEGAL_VALUE ((nsresult) 0x80070057L)
#define NS_ERROR_INVALID_ARG NS_ERROR_ILLEGAL_VALUE
/* Returned when a class doesn't allow aggregation */
#define NS_ERROR_NO_AGGREGATION ((nsresult) 0x80040110L)
/* Returned when an operation can't complete due to an unavailable resource */
#define NS_ERROR_NOT_AVAILABLE ((nsresult) 0x80040111L)
/* Returned when a class is not registered */
#define NS_ERROR_FACTORY_NOT_REGISTERED ((nsresult) 0x80040154L)
/* Returned when a class cannot be registered, but may be tried again later */
#define NS_ERROR_FACTORY_REGISTER_AGAIN ((nsresult) 0x80040155L)
/* Returned when a dynamically loaded factory couldn't be found */
#define NS_ERROR_FACTORY_NOT_LOADED ((nsresult) 0x800401f8L)
/* Returned when a factory doesn't support signatures */
#define NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT \
(NS_ERROR_BASE + 0x101)
/* Returned when a factory already is registered */
#define NS_ERROR_FACTORY_EXISTS (NS_ERROR_BASE + 0x100)
/* For COM compatibility reasons, we want to use exact error code numbers
for NS_ERROR_PROXY_INVALID_IN_PARAMETER and NS_ERROR_PROXY_INVALID_OUT_PARAMETER.
The first matches:
#define RPC_E_INVALID_PARAMETER _HRESULT_TYPEDEF_(0x80010010L)
Errors returning this mean that the xpcom proxy code could not create a proxy for
one of the in paramaters.
Because of this, we are ignoring the convention if using a base and offset for
error numbers.
*/
/* Returned when a proxy could not be create a proxy for one of the IN parameters
This is returned only when the "real" meathod has NOT been invoked.
*/
#define NS_ERROR_PROXY_INVALID_IN_PARAMETER ((nsresult) 0x80010010L)
/* Returned when a proxy could not be create a proxy for one of the OUT parameters
This is returned only when the "real" meathod has ALREADY been invoked.
*/
#define NS_ERROR_PROXY_INVALID_OUT_PARAMETER ((nsresult) 0x80010011L)
/*@}*/
/* I/O Errors */
/* Stream closed */
#define NS_BASE_STREAM_CLOSED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 2)
/* Error from the operating system */
#define NS_BASE_STREAM_OSERROR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 3)
/* Illegal arguments */
#define NS_BASE_STREAM_ILLEGAL_ARGS NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 4)
/* For unichar streams */
#define NS_BASE_STREAM_NO_CONVERTER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 5)
/* For unichar streams */
#define NS_BASE_STREAM_BAD_CONVERSION NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 6)
#define NS_BASE_STREAM_WOULD_BLOCK NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_BASE, 7)
#define NS_ERROR_FILE_UNRECOGNIZED_PATH NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 1)
#define NS_ERROR_FILE_UNRESOLVABLE_SYMLINK NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 2)
#define NS_ERROR_FILE_EXECUTION_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 3)
#define NS_ERROR_FILE_UNKNOWN_TYPE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 4)
#define NS_ERROR_FILE_DESTINATION_NOT_DIR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 5)
#define NS_ERROR_FILE_TARGET_DOES_NOT_EXIST NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 6)
#define NS_ERROR_FILE_COPY_OR_MOVE_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 7)
#define NS_ERROR_FILE_ALREADY_EXISTS NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 8)
#define NS_ERROR_FILE_INVALID_PATH NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 9)
#define NS_ERROR_FILE_DISK_FULL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 10)
#define NS_ERROR_FILE_CORRUPTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 11)
#define NS_ERROR_FILE_NOT_DIRECTORY NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 12)
#define NS_ERROR_FILE_IS_DIRECTORY NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 13)
#define NS_ERROR_FILE_IS_LOCKED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 14)
#define NS_ERROR_FILE_TOO_BIG NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 15)
#define NS_ERROR_FILE_NO_DEVICE_SPACE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 16)
#define NS_ERROR_FILE_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 17)
#define NS_ERROR_FILE_NOT_FOUND NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 18)
#define NS_ERROR_FILE_READ_ONLY NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 19)
#define NS_ERROR_FILE_DIR_NOT_EMPTY NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 20)
#define NS_ERROR_FILE_ACCESS_DENIED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 21)
#define NS_SUCCESS_FILE_DIRECTORY_EMPTY NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_FILES, 1)
/* Result codes used by nsIDirectoryServiceProvider2 */
#define NS_SUCCESS_AGGREGATE_RESULT NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_FILES, 2)
/* Result codes used by nsIVariant */
#define NS_ERROR_CANNOT_CONVERT_DATA NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 1)
#define NS_ERROR_OBJECT_IS_IMMUTABLE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 2)
#define NS_ERROR_LOSS_OF_SIGNIFICANT_DATA NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 3)
#define NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 1)
/*
* This will return the nsresult corresponding to the most recent NSPR failure
* returned by PR_GetError.
*
***********************************************************************
* Do not depend on this function. It will be going away!
***********************************************************************
*/
extern NS_COM nsresult
NS_ErrorAccordingToNSPR();
#ifdef _MSC_VER
#pragma warning(disable: 4251) /* 'nsCOMPtr<class nsIInputStream>' needs to have dll-interface to be used by clients of class 'nsInputStream' */
#pragma warning(disable: 4275) /* non dll-interface class 'nsISupports' used as base for dll-interface class 'nsIRDFNode' */
#endif
#endif

View File

@@ -0,0 +1,127 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsGenericFactory_h___
#define nsGenericFactory_h___
#include "nsCOMPtr.h"
#include "nsIGenericFactory.h"
#include "nsIClassInfo.h"
/**
* Most factories follow this simple pattern, so why not just use a function
* pointer for most creation operations?
*/
class nsGenericFactory : public nsIGenericFactory, public nsIClassInfo {
public:
NS_DEFINE_STATIC_CID_ACCESSOR(NS_GENERICFACTORY_CID);
nsGenericFactory(const nsModuleComponentInfo *info = NULL);
NS_DECL_ISUPPORTS
NS_DECL_NSICLASSINFO
/* nsIGenericFactory methods */
NS_IMETHOD SetComponentInfo(const nsModuleComponentInfo *info);
NS_IMETHOD GetComponentInfo(const nsModuleComponentInfo **infop);
NS_IMETHOD CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
private:
~nsGenericFactory();
const nsModuleComponentInfo *mInfo;
};
////////////////////////////////////////////////////////////////////////////////
#include "nsIModule.h"
#include "plhash.h"
class nsGenericModule : public nsIModule
{
public:
nsGenericModule(const char* moduleName,
PRUint32 componentCount,
const nsModuleComponentInfo* components,
nsModuleConstructorProc ctor,
nsModuleDestructorProc dtor);
private:
~nsGenericModule();
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMODULE
struct FactoryNode
{
FactoryNode(nsIGenericFactory* fact, FactoryNode* next)
{
mFactory = fact;
mNext = next;
}
~FactoryNode(){}
nsCOMPtr<nsIGenericFactory> mFactory;
FactoryNode* mNext;
};
protected:
nsresult Initialize(nsIComponentManager* compMgr);
void Shutdown();
nsresult AddFactoryNode(nsIGenericFactory* fact);
PRBool mInitialized;
const char* mModuleName;
PRUint32 mComponentCount;
const nsModuleComponentInfo* mComponents;
FactoryNode* mFactoriesNotToBeRegistered;
nsModuleConstructorProc mCtor;
nsModuleDestructorProc mDtor;
};
#endif /* nsGenericFactory_h___ */

View File

@@ -0,0 +1,230 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/security/manager/ssl/public/nsIASN1Object.idl
*/
#ifndef __gen_nsIASN1Object_h__
#define __gen_nsIASN1Object_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIASN1Object */
#define NS_IASN1OBJECT_IID_STR "ba8bf582-1dd1-11b2-898c-f40246bc9a63"
#define NS_IASN1OBJECT_IID \
{0xba8bf582, 0x1dd1, 0x11b2, \
{ 0x89, 0x8c, 0xf4, 0x02, 0x46, 0xbc, 0x9a, 0x63 }}
/**
* This represents an ASN.1 object,
* where ASN.1 is "Abstract Syntax Notation number One".
*
* The additional state information carried in this interface
* makes it fit for being used as the data structure
* when working with visual reprenstation of ASN.1 objects
* in a human user interface, like in a tree widget
* where open/close state of nodes must be remembered.
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIASN1Object : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IASN1OBJECT_IID)
/**
* Identifiers for the possible types of object.
*/
enum { ASN1_END_CONTENTS = 0U };
enum { ASN1_BOOLEAN = 1U };
enum { ASN1_INTEGER = 2U };
enum { ASN1_BIT_STRING = 3U };
enum { ASN1_OCTET_STRING = 4U };
enum { ASN1_NULL = 5U };
enum { ASN1_OBJECT_ID = 6U };
enum { ASN1_ENUMERATED = 10U };
enum { ASN1_UTF8_STRING = 12U };
enum { ASN1_SEQUENCE = 16U };
enum { ASN1_SET = 17U };
enum { ASN1_PRINTABLE_STRING = 19U };
enum { ASN1_T61_STRING = 20U };
enum { ASN1_IA5_STRING = 22U };
enum { ASN1_UTC_TIME = 23U };
enum { ASN1_GEN_TIME = 24U };
enum { ASN1_VISIBLE_STRING = 26U };
enum { ASN1_UNIVERSAL_STRING = 28U };
enum { ASN1_BMP_STRING = 30U };
enum { ASN1_HIGH_TAG_NUMBER = 31U };
enum { ASN1_CONTEXT_SPECIFIC = 32U };
enum { ASN1_APPLICATION = 33U };
enum { ASN1_PRIVATE = 34U };
/**
* "type" will be equal to one of the defined object identifiers.
*/
/* attribute unsigned long type; */
NS_IMETHOD GetType(PRUint32 *aType) = 0;
NS_IMETHOD SetType(PRUint32 aType) = 0;
/**
* This contains a tag as explained in ASN.1 standards documents.
*/
/* attribute unsigned long tag; */
NS_IMETHOD GetTag(PRUint32 *aTag) = 0;
NS_IMETHOD SetTag(PRUint32 aTag) = 0;
/**
* "displayName" contains a human readable explanatory label.
*/
/* attribute AString displayName; */
NS_IMETHOD GetDisplayName(nsAString & aDisplayName) = 0;
NS_IMETHOD SetDisplayName(const nsAString & aDisplayName) = 0;
/**
* "displayValue" contains the human readable value.
*/
/* attribute AString displayValue; */
NS_IMETHOD GetDisplayValue(nsAString & aDisplayValue) = 0;
NS_IMETHOD SetDisplayValue(const nsAString & aDisplayValue) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIASN1OBJECT \
NS_IMETHOD GetType(PRUint32 *aType); \
NS_IMETHOD SetType(PRUint32 aType); \
NS_IMETHOD GetTag(PRUint32 *aTag); \
NS_IMETHOD SetTag(PRUint32 aTag); \
NS_IMETHOD GetDisplayName(nsAString & aDisplayName); \
NS_IMETHOD SetDisplayName(const nsAString & aDisplayName); \
NS_IMETHOD GetDisplayValue(nsAString & aDisplayValue); \
NS_IMETHOD SetDisplayValue(const nsAString & aDisplayValue);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIASN1OBJECT(_to) \
NS_IMETHOD GetType(PRUint32 *aType) { return _to GetType(aType); } \
NS_IMETHOD SetType(PRUint32 aType) { return _to SetType(aType); } \
NS_IMETHOD GetTag(PRUint32 *aTag) { return _to GetTag(aTag); } \
NS_IMETHOD SetTag(PRUint32 aTag) { return _to SetTag(aTag); } \
NS_IMETHOD GetDisplayName(nsAString & aDisplayName) { return _to GetDisplayName(aDisplayName); } \
NS_IMETHOD SetDisplayName(const nsAString & aDisplayName) { return _to SetDisplayName(aDisplayName); } \
NS_IMETHOD GetDisplayValue(nsAString & aDisplayValue) { return _to GetDisplayValue(aDisplayValue); } \
NS_IMETHOD SetDisplayValue(const nsAString & aDisplayValue) { return _to SetDisplayValue(aDisplayValue); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIASN1OBJECT(_to) \
NS_IMETHOD GetType(PRUint32 *aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
NS_IMETHOD SetType(PRUint32 aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetType(aType); } \
NS_IMETHOD GetTag(PRUint32 *aTag) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetTag(aTag); } \
NS_IMETHOD SetTag(PRUint32 aTag) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetTag(aTag); } \
NS_IMETHOD GetDisplayName(nsAString & aDisplayName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDisplayName(aDisplayName); } \
NS_IMETHOD SetDisplayName(const nsAString & aDisplayName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDisplayName(aDisplayName); } \
NS_IMETHOD GetDisplayValue(nsAString & aDisplayValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDisplayValue(aDisplayValue); } \
NS_IMETHOD SetDisplayValue(const nsAString & aDisplayValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetDisplayValue(aDisplayValue); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsASN1Object : public nsIASN1Object
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIASN1OBJECT
nsASN1Object();
private:
~nsASN1Object();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsASN1Object, nsIASN1Object)
nsASN1Object::nsASN1Object()
{
/* member initializers and constructor code */
}
nsASN1Object::~nsASN1Object()
{
/* destructor code */
}
/* attribute unsigned long type; */
NS_IMETHODIMP nsASN1Object::GetType(PRUint32 *aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Object::SetType(PRUint32 aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute unsigned long tag; */
NS_IMETHODIMP nsASN1Object::GetTag(PRUint32 *aTag)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Object::SetTag(PRUint32 aTag)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute AString displayName; */
NS_IMETHODIMP nsASN1Object::GetDisplayName(nsAString & aDisplayName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Object::SetDisplayName(const nsAString & aDisplayName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute AString displayValue; */
NS_IMETHODIMP nsASN1Object::GetDisplayValue(nsAString & aDisplayValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Object::SetDisplayValue(const nsAString & aDisplayValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIASN1Object_h__ */

View File

@@ -0,0 +1,181 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/security/manager/ssl/public/nsIASN1Sequence.idl
*/
#ifndef __gen_nsIASN1Sequence_h__
#define __gen_nsIASN1Sequence_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
#ifndef __gen_nsIASN1Object_h__
#include "nsIASN1Object.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIMutableArray; /* forward declaration */
/* starting interface: nsIASN1Sequence */
#define NS_IASN1SEQUENCE_IID_STR "b6b957e6-1dd1-11b2-89d7-e30624f50b00"
#define NS_IASN1SEQUENCE_IID \
{0xb6b957e6, 0x1dd1, 0x11b2, \
{ 0x89, 0xd7, 0xe3, 0x06, 0x24, 0xf5, 0x0b, 0x00 }}
/**
* This represents a sequence of ASN.1 objects,
* where ASN.1 is "Abstract Syntax Notation number One".
*
* Overview of how this ASN1 interface is intended to
* work.
*
* First off, the nsIASN1Sequence is any type in ASN1
* that consists of sub-elements (ie SEQUENCE, SET)
* nsIASN1Printable Items are all the other types that
* can be viewed by themselves without interpreting further.
* Examples would include INTEGER, UTF-8 STRING, OID.
* These are not intended to directly reflect the numberous
* types that exist in ASN1, but merely an interface to ease
* producing a tree display the ASN1 structure of any DER
* object.
*
* The additional state information carried in this interface
* makes it fit for being used as the data structure
* when working with visual reprenstation of ASN.1 objects
* in a human user interface, like in a tree widget
* where open/close state of nodes must be remembered.
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIASN1Sequence : public nsIASN1Object {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IASN1SEQUENCE_IID)
/**
* The array of objects stored in the sequence.
*/
/* attribute nsIMutableArray ASN1Objects; */
NS_IMETHOD GetASN1Objects(nsIMutableArray * *aASN1Objects) = 0;
NS_IMETHOD SetASN1Objects(nsIMutableArray * aASN1Objects) = 0;
/**
* Whether the node at this position in the ASN.1 data structure
* sequence contains sub elements understood by the
* application.
*/
/* attribute boolean isValidContainer; */
NS_IMETHOD GetIsValidContainer(PRBool *aIsValidContainer) = 0;
NS_IMETHOD SetIsValidContainer(PRBool aIsValidContainer) = 0;
/**
* Whether the contained objects should be shown or hidden.
* A UI implementation can use this flag to store the current
* expansion state when shown in a tree widget.
*/
/* attribute boolean isExpanded; */
NS_IMETHOD GetIsExpanded(PRBool *aIsExpanded) = 0;
NS_IMETHOD SetIsExpanded(PRBool aIsExpanded) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIASN1SEQUENCE \
NS_IMETHOD GetASN1Objects(nsIMutableArray * *aASN1Objects); \
NS_IMETHOD SetASN1Objects(nsIMutableArray * aASN1Objects); \
NS_IMETHOD GetIsValidContainer(PRBool *aIsValidContainer); \
NS_IMETHOD SetIsValidContainer(PRBool aIsValidContainer); \
NS_IMETHOD GetIsExpanded(PRBool *aIsExpanded); \
NS_IMETHOD SetIsExpanded(PRBool aIsExpanded);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIASN1SEQUENCE(_to) \
NS_IMETHOD GetASN1Objects(nsIMutableArray * *aASN1Objects) { return _to GetASN1Objects(aASN1Objects); } \
NS_IMETHOD SetASN1Objects(nsIMutableArray * aASN1Objects) { return _to SetASN1Objects(aASN1Objects); } \
NS_IMETHOD GetIsValidContainer(PRBool *aIsValidContainer) { return _to GetIsValidContainer(aIsValidContainer); } \
NS_IMETHOD SetIsValidContainer(PRBool aIsValidContainer) { return _to SetIsValidContainer(aIsValidContainer); } \
NS_IMETHOD GetIsExpanded(PRBool *aIsExpanded) { return _to GetIsExpanded(aIsExpanded); } \
NS_IMETHOD SetIsExpanded(PRBool aIsExpanded) { return _to SetIsExpanded(aIsExpanded); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIASN1SEQUENCE(_to) \
NS_IMETHOD GetASN1Objects(nsIMutableArray * *aASN1Objects) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetASN1Objects(aASN1Objects); } \
NS_IMETHOD SetASN1Objects(nsIMutableArray * aASN1Objects) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetASN1Objects(aASN1Objects); } \
NS_IMETHOD GetIsValidContainer(PRBool *aIsValidContainer) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsValidContainer(aIsValidContainer); } \
NS_IMETHOD SetIsValidContainer(PRBool aIsValidContainer) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetIsValidContainer(aIsValidContainer); } \
NS_IMETHOD GetIsExpanded(PRBool *aIsExpanded) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsExpanded(aIsExpanded); } \
NS_IMETHOD SetIsExpanded(PRBool aIsExpanded) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetIsExpanded(aIsExpanded); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsASN1Sequence : public nsIASN1Sequence
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIASN1SEQUENCE
nsASN1Sequence();
private:
~nsASN1Sequence();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsASN1Sequence, nsIASN1Sequence)
nsASN1Sequence::nsASN1Sequence()
{
/* member initializers and constructor code */
}
nsASN1Sequence::~nsASN1Sequence()
{
/* destructor code */
}
/* attribute nsIMutableArray ASN1Objects; */
NS_IMETHODIMP nsASN1Sequence::GetASN1Objects(nsIMutableArray * *aASN1Objects)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Sequence::SetASN1Objects(nsIMutableArray * aASN1Objects)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean isValidContainer; */
NS_IMETHODIMP nsASN1Sequence::GetIsValidContainer(PRBool *aIsValidContainer)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Sequence::SetIsValidContainer(PRBool aIsValidContainer)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute boolean isExpanded; */
NS_IMETHODIMP nsASN1Sequence::GetIsExpanded(PRBool *aIsExpanded)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsASN1Sequence::SetIsExpanded(PRBool aIsExpanded)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIASN1Sequence_h__ */

View File

@@ -0,0 +1,219 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/security/manager/ssl/public/nsIBadCertListener.idl
*/
#ifndef __gen_nsIBadCertListener_h__
#define __gen_nsIBadCertListener_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIX509Cert; /* forward declaration */
class nsIInterfaceRequestor; /* forward declaration */
/* starting interface: nsIBadCertListener */
#define NS_IBADCERTLISTENER_IID_STR "86960956-edb0-11d4-998b-00b0d02354a0"
#define NS_IBADCERTLISTENER_IID \
{0x86960956, 0xedb0, 0x11d4, \
{ 0x99, 0x8b, 0x00, 0xb0, 0xd0, 0x23, 0x54, 0xa0 }}
/**
* Functions that display warnings for problems with web site trust.
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIBadCertListener : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBADCERTLISTENER_IID)
/**
* No decision was made by the user, whether to trust a cert.
*/
enum { UNINIT_ADD_FLAG = -1 };
/**
* The user decided to add trust to a certificate temporarily
* for the current application session only.
*/
enum { ADD_TRUSTED_FOR_SESSION = 1 };
/**
* The user decided to add trust to a certificate permanently.
*/
enum { ADD_TRUSTED_PERMANENTLY = 2 };
/**
* Inform the user there are problems with the trust of a certificate,
* and request a decision from the user.
* The UI should offer the user a way to look at the certificate in detail.
* The following is a sample UI message to be shown to the user:
*
* Unable to verify the identity of %S as a trusted site.
* Possible reasons for this error:
* - Your browser does not recognize the Certificate Authority
* that issued the site's certificate.
* - The site's certificate is incomplete due to a
* server misconfiguration.
* - You are connected to a site pretending to be %S,
* possibly to obtain your confidential information.
* Please notify the site's webmaster about this problem.
* Before accepting this certificate, you should examine this site's
* certificate carefully. Are you willing to to accept this certificate
* for the purpose of identifying the Web site %S?
* o Accept this certificate permanently
* x Accept this certificate temporarily for this session
* o Do not accept this certificate and do not connect to this Web site
*
* @param socketInfo A network communication context that can be used to obtain more information
* about the active connection.
* @param cert The certificate that is not trusted and that is having the problem.
* @param certAddType The user's trust decision. See constants defined above.
*
* @return true if the user decided to connect anyway, false if the user decided to not connect
*/
/* boolean confirmUnknownIssuer (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert, out short certAddType); */
NS_IMETHOD ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRInt16 *certAddType, PRBool *_retval) = 0;
/**
* Inform the user there are problems with the trust of a certificate,
* and request a decision from the user.
* The hostname mentioned in the server's certificate is not the hostname
* that was used as a destination address for the current connection.
*
* @param socketInfo A network communication context that can be used to obtain more information
* about the active connection.
* @param targetURL The URL that was used to open the current connection.
* @param cert The certificate that was presented by the server.
*
* @return true if the user decided to connect anyway, false if the user decided to not connect
*/
/* boolean confirmMismatchDomain (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */
NS_IMETHOD ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert, PRBool *_retval) = 0;
/**
* Inform the user there are problems with the trust of a certificate,
* and request a decision from the user.
* The certificate presented by the server is no longer valid because
* the validity period has expired.
*
* @param socketInfo A network communication context that can be used to obtain more information
* about the active connection.
* @param cert The certificate that was presented by the server.
*
* @return true if the user decided to connect anyway, false if the user decided to not connect
*/
/* boolean confirmCertExpired (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert); */
NS_IMETHOD ConfirmCertExpired(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRBool *_retval) = 0;
/**
* Inform the user there are problems with the trust of a certificate,
* and request a decision from the user.
* The Certificate Authority (CA) that issued the server's certificate has issued a
* Certificate Revocation List (CRL).
* However, the application does not have a current version of the CA's CRL.
* Due to the application configuration, the application disallows the connection
* to the remote site.
*
* @param socketInfo A network communication context that can be used to obtain more information
* about the active connection.
* @param targetURL The URL that was used to open the current connection.
* @param cert The certificate that was presented by the server.
*/
/* void notifyCrlNextupdate (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */
NS_IMETHOD NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIBADCERTLISTENER \
NS_IMETHOD ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRInt16 *certAddType, PRBool *_retval); \
NS_IMETHOD ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert, PRBool *_retval); \
NS_IMETHOD ConfirmCertExpired(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRBool *_retval); \
NS_IMETHOD NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIBADCERTLISTENER(_to) \
NS_IMETHOD ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRInt16 *certAddType, PRBool *_retval) { return _to ConfirmUnknownIssuer(socketInfo, cert, certAddType, _retval); } \
NS_IMETHOD ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert, PRBool *_retval) { return _to ConfirmMismatchDomain(socketInfo, targetURL, cert, _retval); } \
NS_IMETHOD ConfirmCertExpired(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRBool *_retval) { return _to ConfirmCertExpired(socketInfo, cert, _retval); } \
NS_IMETHOD NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert) { return _to NotifyCrlNextupdate(socketInfo, targetURL, cert); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIBADCERTLISTENER(_to) \
NS_IMETHOD ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRInt16 *certAddType, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ConfirmUnknownIssuer(socketInfo, cert, certAddType, _retval); } \
NS_IMETHOD ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ConfirmMismatchDomain(socketInfo, targetURL, cert, _retval); } \
NS_IMETHOD ConfirmCertExpired(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ConfirmCertExpired(socketInfo, cert, _retval); } \
NS_IMETHOD NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifyCrlNextupdate(socketInfo, targetURL, cert); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsBadCertListener : public nsIBadCertListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIBADCERTLISTENER
nsBadCertListener();
private:
~nsBadCertListener();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsBadCertListener, nsIBadCertListener)
nsBadCertListener::nsBadCertListener()
{
/* member initializers and constructor code */
}
nsBadCertListener::~nsBadCertListener()
{
/* destructor code */
}
/* boolean confirmUnknownIssuer (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert, out short certAddType); */
NS_IMETHODIMP nsBadCertListener::ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRInt16 *certAddType, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean confirmMismatchDomain (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */
NS_IMETHODIMP nsBadCertListener::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean confirmCertExpired (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert); */
NS_IMETHODIMP nsBadCertListener::ConfirmCertExpired(nsIInterfaceRequestor *socketInfo, nsIX509Cert *cert, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void notifyCrlNextupdate (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */
NS_IMETHODIMP nsBadCertListener::NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, const nsACString & targetURL, nsIX509Cert *cert)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#define NS_BADCERTLISTENER_CONTRACTID "@mozilla.org/nsBadCertListener;1"
#endif /* __gen_nsIBadCertListener_h__ */

View File

@@ -0,0 +1,205 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/security/manager/ssl/public/nsICRLInfo.idl
*/
#ifndef __gen_nsICRLInfo_h__
#define __gen_nsICRLInfo_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsICRLInfo */
#define NS_ICRLINFO_IID_STR "c185d920-4a3e-11d5-ba27-00108303b117"
#define NS_ICRLINFO_IID \
{0xc185d920, 0x4a3e, 0x11d5, \
{ 0xba, 0x27, 0x00, 0x10, 0x83, 0x03, 0xb1, 0x17 }}
/**
* Information on a Certificate Revocation List (CRL)
* issued by a Aertificate Authority (CA).
*
* @status FROZEN
*/
class NS_NO_VTABLE nsICRLInfo : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICRLINFO_IID)
/**
* The issuing CA's organization.
*/
/* readonly attribute AString organization; */
NS_IMETHOD GetOrganization(nsAString & aOrganization) = 0;
/**
* The issuing CA's organizational unit.
*/
/* readonly attribute AString organizationalUnit; */
NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit) = 0;
/**
* The time this CRL was created at.
*/
/* readonly attribute PRTime lastUpdate; */
NS_IMETHOD GetLastUpdate(PRTime *aLastUpdate) = 0;
/**
* The time the suggested next update for this CRL.
*/
/* readonly attribute PRTime nextUpdate; */
NS_IMETHOD GetNextUpdate(PRTime *aNextUpdate) = 0;
/**
* lastUpdate formatted as a human readable string
* formatted according to the environment locale.
*/
/* readonly attribute AString lastUpdateLocale; */
NS_IMETHOD GetLastUpdateLocale(nsAString & aLastUpdateLocale) = 0;
/**
* nextUpdate formatted as a human readable string
* formatted according to the environment locale.
*/
/* readonly attribute AString nextUpdateLocale; */
NS_IMETHOD GetNextUpdateLocale(nsAString & aNextUpdateLocale) = 0;
/**
* The key identifying the CRL in the database.
*/
/* readonly attribute AString nameInDb; */
NS_IMETHOD GetNameInDb(nsAString & aNameInDb) = 0;
/**
* The URL this CRL was last fetched from.
*/
/* readonly attribute AUTF8String lastFetchURL; */
NS_IMETHOD GetLastFetchURL(nsACString & aLastFetchURL) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICRLINFO \
NS_IMETHOD GetOrganization(nsAString & aOrganization); \
NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit); \
NS_IMETHOD GetLastUpdate(PRTime *aLastUpdate); \
NS_IMETHOD GetNextUpdate(PRTime *aNextUpdate); \
NS_IMETHOD GetLastUpdateLocale(nsAString & aLastUpdateLocale); \
NS_IMETHOD GetNextUpdateLocale(nsAString & aNextUpdateLocale); \
NS_IMETHOD GetNameInDb(nsAString & aNameInDb); \
NS_IMETHOD GetLastFetchURL(nsACString & aLastFetchURL);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICRLINFO(_to) \
NS_IMETHOD GetOrganization(nsAString & aOrganization) { return _to GetOrganization(aOrganization); } \
NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit) { return _to GetOrganizationalUnit(aOrganizationalUnit); } \
NS_IMETHOD GetLastUpdate(PRTime *aLastUpdate) { return _to GetLastUpdate(aLastUpdate); } \
NS_IMETHOD GetNextUpdate(PRTime *aNextUpdate) { return _to GetNextUpdate(aNextUpdate); } \
NS_IMETHOD GetLastUpdateLocale(nsAString & aLastUpdateLocale) { return _to GetLastUpdateLocale(aLastUpdateLocale); } \
NS_IMETHOD GetNextUpdateLocale(nsAString & aNextUpdateLocale) { return _to GetNextUpdateLocale(aNextUpdateLocale); } \
NS_IMETHOD GetNameInDb(nsAString & aNameInDb) { return _to GetNameInDb(aNameInDb); } \
NS_IMETHOD GetLastFetchURL(nsACString & aLastFetchURL) { return _to GetLastFetchURL(aLastFetchURL); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICRLINFO(_to) \
NS_IMETHOD GetOrganization(nsAString & aOrganization) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOrganization(aOrganization); } \
NS_IMETHOD GetOrganizationalUnit(nsAString & aOrganizationalUnit) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOrganizationalUnit(aOrganizationalUnit); } \
NS_IMETHOD GetLastUpdate(PRTime *aLastUpdate) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLastUpdate(aLastUpdate); } \
NS_IMETHOD GetNextUpdate(PRTime *aNextUpdate) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextUpdate(aNextUpdate); } \
NS_IMETHOD GetLastUpdateLocale(nsAString & aLastUpdateLocale) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLastUpdateLocale(aLastUpdateLocale); } \
NS_IMETHOD GetNextUpdateLocale(nsAString & aNextUpdateLocale) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNextUpdateLocale(aNextUpdateLocale); } \
NS_IMETHOD GetNameInDb(nsAString & aNameInDb) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNameInDb(aNameInDb); } \
NS_IMETHOD GetLastFetchURL(nsACString & aLastFetchURL) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLastFetchURL(aLastFetchURL); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsCRLInfo : public nsICRLInfo
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICRLINFO
nsCRLInfo();
private:
~nsCRLInfo();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsCRLInfo, nsICRLInfo)
nsCRLInfo::nsCRLInfo()
{
/* member initializers and constructor code */
}
nsCRLInfo::~nsCRLInfo()
{
/* destructor code */
}
/* readonly attribute AString organization; */
NS_IMETHODIMP nsCRLInfo::GetOrganization(nsAString & aOrganization)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AString organizationalUnit; */
NS_IMETHODIMP nsCRLInfo::GetOrganizationalUnit(nsAString & aOrganizationalUnit)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRTime lastUpdate; */
NS_IMETHODIMP nsCRLInfo::GetLastUpdate(PRTime *aLastUpdate)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRTime nextUpdate; */
NS_IMETHODIMP nsCRLInfo::GetNextUpdate(PRTime *aNextUpdate)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AString lastUpdateLocale; */
NS_IMETHODIMP nsCRLInfo::GetLastUpdateLocale(nsAString & aLastUpdateLocale)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AString nextUpdateLocale; */
NS_IMETHODIMP nsCRLInfo::GetNextUpdateLocale(nsAString & aNextUpdateLocale)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AString nameInDb; */
NS_IMETHODIMP nsCRLInfo::GetNameInDb(nsAString & aNameInDb)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AUTF8String lastFetchURL; */
NS_IMETHODIMP nsCRLInfo::GetLastFetchURL(nsACString & aLastFetchURL)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsICRLInfo_h__ */

View File

@@ -0,0 +1,190 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/components/nsICategoryManager.idl
*/
#ifndef __gen_nsICategoryManager_h__
#define __gen_nsICategoryManager_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
#ifndef __gen_nsISimpleEnumerator_h__
#include "nsISimpleEnumerator.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsICategoryManager */
#define NS_ICATEGORYMANAGER_IID_STR "3275b2cd-af6d-429a-80d7-f0c5120342ac"
#define NS_ICATEGORYMANAGER_IID \
{0x3275b2cd, 0xaf6d, 0x429a, \
{ 0x80, 0xd7, 0xf0, 0xc5, 0x12, 0x03, 0x42, 0xac }}
class NS_NO_VTABLE nsICategoryManager : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICATEGORYMANAGER_IID)
/**
* Get the value for the given category's entry.
* @param aCategory The name of the category ("protocol")
* @param aEntry The entry you're looking for ("http")
* @return The value.
*/
/* string getCategoryEntry (in string aCategory, in string aEntry); */
NS_IMETHOD GetCategoryEntry(const char *aCategory, const char *aEntry, char **_retval) = 0;
/**
* Add an entry to a category.
* @param aCategory The name of the category ("protocol")
* @param aEntry The entry to be added ("http")
* @param aValue The value for the entry ("moz.httprulez.1")
* @param aPersist Should this data persist between invocations?
* @param aReplace Should we replace an existing entry?
* @return Previous entry, if any
*/
/* string addCategoryEntry (in string aCategory, in string aEntry, in string aValue, in boolean aPersist, in boolean aReplace); */
NS_IMETHOD AddCategoryEntry(const char *aCategory, const char *aEntry, const char *aValue, PRBool aPersist, PRBool aReplace, char **_retval) = 0;
/**
* Delete an entry from the category.
* @param aCategory The name of the category ("protocol")
* @param aEntry The entry to be added ("http")
* @param aPersist Delete persistent data from registry, if present?
*/
/* void deleteCategoryEntry (in string aCategory, in string aEntry, in boolean aPersist); */
NS_IMETHOD DeleteCategoryEntry(const char *aCategory, const char *aEntry, PRBool aPersist) = 0;
/**
* Delete a category and all entries.
* @param aCategory The category to be deleted.
*/
/* void deleteCategory (in string aCategory); */
NS_IMETHOD DeleteCategory(const char *aCategory) = 0;
/**
* Enumerate the entries in a category.
* @param aCategory The category to be enumerated.
* @return a simple enumerator, each result QIs to
* nsISupportsCString.
*/
/* nsISimpleEnumerator enumerateCategory (in string aCategory); */
NS_IMETHOD EnumerateCategory(const char *aCategory, nsISimpleEnumerator **_retval) = 0;
/**
* Enumerate all existing categories
* @param aCategory The category to be enumerated.
* @return a simple enumerator, each result QIs to
* nsISupportsCString.
*/
/* nsISimpleEnumerator enumerateCategories (); */
NS_IMETHOD EnumerateCategories(nsISimpleEnumerator **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICATEGORYMANAGER \
NS_IMETHOD GetCategoryEntry(const char *aCategory, const char *aEntry, char **_retval); \
NS_IMETHOD AddCategoryEntry(const char *aCategory, const char *aEntry, const char *aValue, PRBool aPersist, PRBool aReplace, char **_retval); \
NS_IMETHOD DeleteCategoryEntry(const char *aCategory, const char *aEntry, PRBool aPersist); \
NS_IMETHOD DeleteCategory(const char *aCategory); \
NS_IMETHOD EnumerateCategory(const char *aCategory, nsISimpleEnumerator **_retval); \
NS_IMETHOD EnumerateCategories(nsISimpleEnumerator **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICATEGORYMANAGER(_to) \
NS_IMETHOD GetCategoryEntry(const char *aCategory, const char *aEntry, char **_retval) { return _to GetCategoryEntry(aCategory, aEntry, _retval); } \
NS_IMETHOD AddCategoryEntry(const char *aCategory, const char *aEntry, const char *aValue, PRBool aPersist, PRBool aReplace, char **_retval) { return _to AddCategoryEntry(aCategory, aEntry, aValue, aPersist, aReplace, _retval); } \
NS_IMETHOD DeleteCategoryEntry(const char *aCategory, const char *aEntry, PRBool aPersist) { return _to DeleteCategoryEntry(aCategory, aEntry, aPersist); } \
NS_IMETHOD DeleteCategory(const char *aCategory) { return _to DeleteCategory(aCategory); } \
NS_IMETHOD EnumerateCategory(const char *aCategory, nsISimpleEnumerator **_retval) { return _to EnumerateCategory(aCategory, _retval); } \
NS_IMETHOD EnumerateCategories(nsISimpleEnumerator **_retval) { return _to EnumerateCategories(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICATEGORYMANAGER(_to) \
NS_IMETHOD GetCategoryEntry(const char *aCategory, const char *aEntry, char **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCategoryEntry(aCategory, aEntry, _retval); } \
NS_IMETHOD AddCategoryEntry(const char *aCategory, const char *aEntry, const char *aValue, PRBool aPersist, PRBool aReplace, char **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddCategoryEntry(aCategory, aEntry, aValue, aPersist, aReplace, _retval); } \
NS_IMETHOD DeleteCategoryEntry(const char *aCategory, const char *aEntry, PRBool aPersist) { return !_to ? NS_ERROR_NULL_POINTER : _to->DeleteCategoryEntry(aCategory, aEntry, aPersist); } \
NS_IMETHOD DeleteCategory(const char *aCategory) { return !_to ? NS_ERROR_NULL_POINTER : _to->DeleteCategory(aCategory); } \
NS_IMETHOD EnumerateCategory(const char *aCategory, nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateCategory(aCategory, _retval); } \
NS_IMETHOD EnumerateCategories(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateCategories(_retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsCategoryManager : public nsICategoryManager
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICATEGORYMANAGER
nsCategoryManager();
private:
~nsCategoryManager();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsCategoryManager, nsICategoryManager)
nsCategoryManager::nsCategoryManager()
{
/* member initializers and constructor code */
}
nsCategoryManager::~nsCategoryManager()
{
/* destructor code */
}
/* string getCategoryEntry (in string aCategory, in string aEntry); */
NS_IMETHODIMP nsCategoryManager::GetCategoryEntry(const char *aCategory, const char *aEntry, char **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* string addCategoryEntry (in string aCategory, in string aEntry, in string aValue, in boolean aPersist, in boolean aReplace); */
NS_IMETHODIMP nsCategoryManager::AddCategoryEntry(const char *aCategory, const char *aEntry, const char *aValue, PRBool aPersist, PRBool aReplace, char **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void deleteCategoryEntry (in string aCategory, in string aEntry, in boolean aPersist); */
NS_IMETHODIMP nsCategoryManager::DeleteCategoryEntry(const char *aCategory, const char *aEntry, PRBool aPersist)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void deleteCategory (in string aCategory); */
NS_IMETHODIMP nsCategoryManager::DeleteCategory(const char *aCategory)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISimpleEnumerator enumerateCategory (in string aCategory); */
NS_IMETHODIMP nsCategoryManager::EnumerateCategory(const char *aCategory, nsISimpleEnumerator **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISimpleEnumerator enumerateCategories (); */
NS_IMETHODIMP nsCategoryManager::EnumerateCategories(nsISimpleEnumerator **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsICategoryManager_h__ */

View File

@@ -0,0 +1,220 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/security/manager/ssl/public/nsICertificateDialogs.idl
*/
#ifndef __gen_nsICertificateDialogs_h__
#define __gen_nsICertificateDialogs_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIInterfaceRequestor; /* forward declaration */
class nsIX509Cert; /* forward declaration */
class nsICRLInfo; /* forward declaration */
/* starting interface: nsICertificateDialogs */
#define NS_ICERTIFICATEDIALOGS_IID_STR "a03ca940-09be-11d5-ac5d-000064657374"
#define NS_ICERTIFICATEDIALOGS_IID \
{0xa03ca940, 0x09be, 0x11d5, \
{ 0xac, 0x5d, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 }}
/**
* Functions that implement user interface dialogs to manage certificates.
*
* @status FROZEN
*/
class NS_NO_VTABLE nsICertificateDialogs : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICERTIFICATEDIALOGS_IID)
/**
* UI shown when a user is asked to download a new CA cert.
* Provides user with ability to choose trust settings for the cert.
* Asks the user to grant permission to import the certificate.
*
* @param ctx A user interface context.
* @param cert The certificate that is about to get installed.
* @param trust a bit mask of trust flags,
* see nsIX509CertDB for possible values.
*
* @return true if the user allows to import the certificate.
*/
/* boolean confirmDownloadCACert (in nsIInterfaceRequestor ctx, in nsIX509Cert cert, out unsigned long trust); */
NS_IMETHOD ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert, PRUint32 *trust, PRBool *_retval) = 0;
/**
* UI shown when a web site has delivered a CA certificate to
* be imported, but the certificate is already contained in the
* user's storage.
*
* @param ctx A user interface context.
*/
/* void notifyCACertExists (in nsIInterfaceRequestor ctx); */
NS_IMETHOD NotifyCACertExists(nsIInterfaceRequestor *ctx) = 0;
/**
* UI shown when a user's personal certificate is going to be
* exported to a backup file.
* The implementation of this dialog should make sure
* to prompt the user to type the password twice in order to
* confirm correct input.
* The wording in the dialog should also motivate the user
* to enter a strong password.
*
* @param ctx A user interface context.
* @param password The password provided by the user.
*
* @return false if the user requests to cancel.
*/
/* boolean setPKCS12FilePassword (in nsIInterfaceRequestor ctx, out AString password); */
NS_IMETHOD SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval) = 0;
/**
* UI shown when a user is about to restore a personal
* certificate from a backup file.
* The user is requested to enter the password
* that was used in the past to protect that backup file.
*
* @param ctx A user interface context.
* @param password The password provided by the user.
*
* @return false if the user requests to cancel.
*/
/* boolean getPKCS12FilePassword (in nsIInterfaceRequestor ctx, out AString password); */
NS_IMETHOD GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval) = 0;
/**
* UI shown when a certificate needs to be shown to the user.
* The implementation should try to display as many attributes
* as possible.
*
* @param ctx A user interface context.
* @param cert The certificate to be shown to the user.
*/
/* void viewCert (in nsIInterfaceRequestor ctx, in nsIX509Cert cert); */
NS_IMETHOD ViewCert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert) = 0;
/**
* UI shown after a Certificate Revocation List (CRL) has been
* successfully imported.
*
* @param ctx A user interface context.
* @param crl Information describing the CRL that was imported.
*/
/* void crlImportStatusDialog (in nsIInterfaceRequestor ctx, in nsICRLInfo crl); */
NS_IMETHOD CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICERTIFICATEDIALOGS \
NS_IMETHOD ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert, PRUint32 *trust, PRBool *_retval); \
NS_IMETHOD NotifyCACertExists(nsIInterfaceRequestor *ctx); \
NS_IMETHOD SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval); \
NS_IMETHOD GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval); \
NS_IMETHOD ViewCert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert); \
NS_IMETHOD CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICERTIFICATEDIALOGS(_to) \
NS_IMETHOD ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert, PRUint32 *trust, PRBool *_retval) { return _to ConfirmDownloadCACert(ctx, cert, trust, _retval); } \
NS_IMETHOD NotifyCACertExists(nsIInterfaceRequestor *ctx) { return _to NotifyCACertExists(ctx); } \
NS_IMETHOD SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval) { return _to SetPKCS12FilePassword(ctx, password, _retval); } \
NS_IMETHOD GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval) { return _to GetPKCS12FilePassword(ctx, password, _retval); } \
NS_IMETHOD ViewCert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert) { return _to ViewCert(ctx, cert); } \
NS_IMETHOD CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl) { return _to CrlImportStatusDialog(ctx, crl); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICERTIFICATEDIALOGS(_to) \
NS_IMETHOD ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert, PRUint32 *trust, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ConfirmDownloadCACert(ctx, cert, trust, _retval); } \
NS_IMETHOD NotifyCACertExists(nsIInterfaceRequestor *ctx) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifyCACertExists(ctx); } \
NS_IMETHOD SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetPKCS12FilePassword(ctx, password, _retval); } \
NS_IMETHOD GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPKCS12FilePassword(ctx, password, _retval); } \
NS_IMETHOD ViewCert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert) { return !_to ? NS_ERROR_NULL_POINTER : _to->ViewCert(ctx, cert); } \
NS_IMETHOD CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl) { return !_to ? NS_ERROR_NULL_POINTER : _to->CrlImportStatusDialog(ctx, crl); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsCertificateDialogs : public nsICertificateDialogs
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICERTIFICATEDIALOGS
nsCertificateDialogs();
private:
~nsCertificateDialogs();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsCertificateDialogs, nsICertificateDialogs)
nsCertificateDialogs::nsCertificateDialogs()
{
/* member initializers and constructor code */
}
nsCertificateDialogs::~nsCertificateDialogs()
{
/* destructor code */
}
/* boolean confirmDownloadCACert (in nsIInterfaceRequestor ctx, in nsIX509Cert cert, out unsigned long trust); */
NS_IMETHODIMP nsCertificateDialogs::ConfirmDownloadCACert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert, PRUint32 *trust, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void notifyCACertExists (in nsIInterfaceRequestor ctx); */
NS_IMETHODIMP nsCertificateDialogs::NotifyCACertExists(nsIInterfaceRequestor *ctx)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean setPKCS12FilePassword (in nsIInterfaceRequestor ctx, out AString password); */
NS_IMETHODIMP nsCertificateDialogs::SetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean getPKCS12FilePassword (in nsIInterfaceRequestor ctx, out AString password); */
NS_IMETHODIMP nsCertificateDialogs::GetPKCS12FilePassword(nsIInterfaceRequestor *ctx, nsAString & password, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void viewCert (in nsIInterfaceRequestor ctx, in nsIX509Cert cert); */
NS_IMETHODIMP nsCertificateDialogs::ViewCert(nsIInterfaceRequestor *ctx, nsIX509Cert *cert)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void crlImportStatusDialog (in nsIInterfaceRequestor ctx, in nsICRLInfo crl); */
NS_IMETHODIMP nsCertificateDialogs::CrlImportStatusDialog(nsIInterfaceRequestor *ctx, nsICRLInfo *crl)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#define NS_CERTIFICATEDIALOGS_CONTRACTID "@mozilla.org/nsCertificateDialogs;1"
#endif /* __gen_nsICertificateDialogs_h__ */

View File

@@ -0,0 +1,404 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/netwerk/base/public/nsIChannel.idl
*/
#ifndef __gen_nsIChannel_h__
#define __gen_nsIChannel_h__
#ifndef __gen_nsIRequest_h__
#include "nsIRequest.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIURI; /* forward declaration */
class nsIInterfaceRequestor; /* forward declaration */
class nsIInputStream; /* forward declaration */
class nsIStreamListener; /* forward declaration */
/* starting interface: nsIChannel */
#define NS_ICHANNEL_IID_STR "c63a055a-a676-4e71-bf3c-6cfa11082018"
#define NS_ICHANNEL_IID \
{0xc63a055a, 0xa676, 0x4e71, \
{ 0xbf, 0x3c, 0x6c, 0xfa, 0x11, 0x08, 0x20, 0x18 }}
/**
* The nsIChannel interface allows clients to construct "GET" requests for
* specific protocols, and manage them in a uniform way. Once a channel is
* created (via nsIIOService::newChannel), parameters for that request may
* be set by using the channel attributes, or by QI'ing to a subclass of
* nsIChannel for protocol-specific parameters. Then, the URI can be fetched
* by calling nsIChannel::open or nsIChannel::asyncOpen.
*
* After a request has been completed, the channel is still valid for accessing
* protocol-specific results. For example, QI'ing to nsIHttpChannel allows
* response headers to be retrieved for the corresponding http transaction.
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIChannel : public nsIRequest {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHANNEL_IID)
/**
* The original URI used to construct the channel. This is used in the case
* of a redirect or URI "resolution" (e.g. resolving a resource: URI to a
* file: URI) so that the original pre-redirect URI can still be obtained.
*
* NOTE: this is distinctly different from the http Referer (referring URI),
* which is typically the page that contained the original URI (accessible
* from nsIHttpChannel).
*/
/* attribute nsIURI originalURI; */
NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI) = 0;
NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI) = 0;
/**
* The URI corresponding to the channel. Its value is immutable.
*/
/* readonly attribute nsIURI URI; */
NS_IMETHOD GetURI(nsIURI * *aURI) = 0;
/**
* The owner, corresponding to the entity that is responsible for this
* channel. Used by the security manager to grant or deny privileges to
* mobile code loaded from this channel.
*
* NOTE: this is a strong reference to the owner, so if the owner is also
* holding a strong reference to the channel, care must be taken to
* explicitly drop its reference to the channel.
*/
/* attribute nsISupports owner; */
NS_IMETHOD GetOwner(nsISupports * *aOwner) = 0;
NS_IMETHOD SetOwner(nsISupports * aOwner) = 0;
/**
* The notification callbacks for the channel. This is set by clients, who
* wish to provide a means to receive progress, status and protocol-specific
* notifications. If this value is NULL, the channel implementation may use
* the notification callbacks from its load group. The channel may also
* query the notification callbacks from its load group if its notification
* callbacks do not supply the requested interface.
*
* Interfaces commonly requested include: nsIProgressEventSink, nsIPrompt,
* and nsIAuthPrompt.
*
* When the channel is done, it must not continue holding references to
* this object.
*
* NOTE: A channel implementation should take care when "caching" an
* interface pointer queried from its notification callbacks. If the
* notification callbacks are changed, then a cached interface pointer may
* become invalid and may therefore need to be re-queried.
*/
/* attribute nsIInterfaceRequestor notificationCallbacks; */
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) = 0;
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) = 0;
/**
* Transport-level security information (if any) corresponding to the channel.
*/
/* readonly attribute nsISupports securityInfo; */
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) = 0;
/**
* The MIME type of the channel's content if available.
*
* NOTE: the content type can often be wrongly specified (e.g., wrong file
* extension, wrong MIME type, wrong document type stored on a server, etc.),
* and the caller most likely wants to verify with the actual data.
*
* Setting contentType before the channel has been opened provides a hint
* to the channel as to what the MIME type is. The channel may ignore this
* hint in deciding on the actual MIME type that it will report.
*
* Setting contentType after onStartRequest has been fired or after open()
* is called will override the type determined by the channel.
*
* Setting contentType between the time that asyncOpen() is called and the
* time when onStartRequest is fired has undefined behavior at this time.
*
* The value of the contentType attribute is a lowercase string. A value
* assigned to this attribute will be parsed and normalized as follows:
* 1- any parameters (delimited with a ';') will be stripped.
* 2- if a charset parameter is given, then its value will replace the
* the contentCharset attribute of the channel.
* 3- the stripped contentType will be lowercased.
* Any implementation of nsIChannel must follow these rules.
*/
/* attribute ACString contentType; */
NS_IMETHOD GetContentType(nsACString & aContentType) = 0;
NS_IMETHOD SetContentType(const nsACString & aContentType) = 0;
/**
* The character set of the channel's content if available and if applicable.
* This attribute only applies to textual data.
*
* The value of the contentCharset attribute is a mixedcase string.
*/
/* attribute ACString contentCharset; */
NS_IMETHOD GetContentCharset(nsACString & aContentCharset) = 0;
NS_IMETHOD SetContentCharset(const nsACString & aContentCharset) = 0;
/**
* The length of the data associated with the channel if available. A value
* of -1 indicates that the content length is unknown.
*
* Callers should prefer getting the "content-length" property
* as 64-bit value by QIing the channel to nsIPropertyBag2,
* if that interface is exposed by the channel.
*/
/* attribute long contentLength; */
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) = 0;
NS_IMETHOD SetContentLength(PRInt32 aContentLength) = 0;
/**
* Synchronously open the channel.
*
* @return blocking input stream to the channel's data.
*
* NOTE: nsIChannel implementations are not required to implement this
* method. Moreover, since this method may block the calling thread, it
* should not be called on a thread that processes UI events.
*/
/* nsIInputStream open (); */
NS_IMETHOD Open(nsIInputStream **_retval) = 0;
/**
* Asynchronously open this channel. Data is fed to the specified stream
* listener as it becomes available. The stream listener's methods are
* called on the thread that calls asyncOpen and are not called until
* after asyncOpen returns.
*
* @param aListener the nsIStreamListener implementation
* @param aContext an opaque parameter forwarded to aListener's methods
*/
/* void asyncOpen (in nsIStreamListener aListener, in nsISupports aContext); */
NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) = 0;
/**************************************************************************
* Channel specific load flags:
*
* Bits 21-31 are reserved for future use by this interface or one of its
* derivatives (e.g., see nsICachingChannel).
*/
/**
* Set (e.g., by the docshell) to indicate whether or not the channel
* corresponds to a document URI.
*/
enum { LOAD_DOCUMENT_URI = 65536U };
/**
* If the end consumer for this load has been retargeted after discovering
* it's content, this flag will be set:
*/
enum { LOAD_RETARGETED_DOCUMENT_URI = 131072U };
/**
* This flag is set to indicate that onStopRequest may be followed by
* another onStartRequest/onStopRequest pair. This flag is, for example,
* used by the multipart/replace stream converter.
*/
enum { LOAD_REPLACE = 262144U };
/**
* Set (e.g., by the docshell) to indicate whether or not the channel
* corresponds to an initial document URI load (e.g., link click).
*/
enum { LOAD_INITIAL_DOCUMENT_URI = 524288U };
/**
* Set (e.g., by the URILoader) to indicate whether or not the end consumer
* for this load has been determined.
*/
enum { LOAD_TARGETED = 1048576U };
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICHANNEL \
NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI); \
NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI); \
NS_IMETHOD GetURI(nsIURI * *aURI); \
NS_IMETHOD GetOwner(nsISupports * *aOwner); \
NS_IMETHOD SetOwner(nsISupports * aOwner); \
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks); \
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks); \
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo); \
NS_IMETHOD GetContentType(nsACString & aContentType); \
NS_IMETHOD SetContentType(const nsACString & aContentType); \
NS_IMETHOD GetContentCharset(nsACString & aContentCharset); \
NS_IMETHOD SetContentCharset(const nsACString & aContentCharset); \
NS_IMETHOD GetContentLength(PRInt32 *aContentLength); \
NS_IMETHOD SetContentLength(PRInt32 aContentLength); \
NS_IMETHOD Open(nsIInputStream **_retval); \
NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext); \
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICHANNEL(_to) \
NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI) { return _to GetOriginalURI(aOriginalURI); } \
NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI) { return _to SetOriginalURI(aOriginalURI); } \
NS_IMETHOD GetURI(nsIURI * *aURI) { return _to GetURI(aURI); } \
NS_IMETHOD GetOwner(nsISupports * *aOwner) { return _to GetOwner(aOwner); } \
NS_IMETHOD SetOwner(nsISupports * aOwner) { return _to SetOwner(aOwner); } \
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { return _to GetNotificationCallbacks(aNotificationCallbacks); } \
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return _to SetNotificationCallbacks(aNotificationCallbacks); } \
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { return _to GetSecurityInfo(aSecurityInfo); } \
NS_IMETHOD GetContentType(nsACString & aContentType) { return _to GetContentType(aContentType); } \
NS_IMETHOD SetContentType(const nsACString & aContentType) { return _to SetContentType(aContentType); } \
NS_IMETHOD GetContentCharset(nsACString & aContentCharset) { return _to GetContentCharset(aContentCharset); } \
NS_IMETHOD SetContentCharset(const nsACString & aContentCharset) { return _to SetContentCharset(aContentCharset); } \
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return _to GetContentLength(aContentLength); } \
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return _to SetContentLength(aContentLength); } \
NS_IMETHOD Open(nsIInputStream **_retval) { return _to Open(_retval); } \
NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) { return _to AsyncOpen(aListener, aContext); } \
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICHANNEL(_to) \
NS_IMETHOD GetOriginalURI(nsIURI * *aOriginalURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOriginalURI(aOriginalURI); } \
NS_IMETHOD SetOriginalURI(nsIURI * aOriginalURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOriginalURI(aOriginalURI); } \
NS_IMETHOD GetURI(nsIURI * *aURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetURI(aURI); } \
NS_IMETHOD GetOwner(nsISupports * *aOwner) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOwner(aOwner); } \
NS_IMETHOD SetOwner(nsISupports * aOwner) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOwner(aOwner); } \
NS_IMETHOD GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNotificationCallbacks(aNotificationCallbacks); } \
NS_IMETHOD SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetNotificationCallbacks(aNotificationCallbacks); } \
NS_IMETHOD GetSecurityInfo(nsISupports * *aSecurityInfo) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSecurityInfo(aSecurityInfo); } \
NS_IMETHOD GetContentType(nsACString & aContentType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetContentType(aContentType); } \
NS_IMETHOD SetContentType(const nsACString & aContentType) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetContentType(aContentType); } \
NS_IMETHOD GetContentCharset(nsACString & aContentCharset) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetContentCharset(aContentCharset); } \
NS_IMETHOD SetContentCharset(const nsACString & aContentCharset) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetContentCharset(aContentCharset); } \
NS_IMETHOD GetContentLength(PRInt32 *aContentLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetContentLength(aContentLength); } \
NS_IMETHOD SetContentLength(PRInt32 aContentLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetContentLength(aContentLength); } \
NS_IMETHOD Open(nsIInputStream **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Open(_retval); } \
NS_IMETHOD AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext) { return !_to ? NS_ERROR_NULL_POINTER : _to->AsyncOpen(aListener, aContext); } \
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsChannel : public nsIChannel
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICHANNEL
nsChannel();
private:
~nsChannel();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsChannel, nsIChannel)
nsChannel::nsChannel()
{
/* member initializers and constructor code */
}
nsChannel::~nsChannel()
{
/* destructor code */
}
/* attribute nsIURI originalURI; */
NS_IMETHODIMP nsChannel::GetOriginalURI(nsIURI * *aOriginalURI)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChannel::SetOriginalURI(nsIURI * aOriginalURI)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIURI URI; */
NS_IMETHODIMP nsChannel::GetURI(nsIURI * *aURI)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsISupports owner; */
NS_IMETHODIMP nsChannel::GetOwner(nsISupports * *aOwner)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChannel::SetOwner(nsISupports * aOwner)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute nsIInterfaceRequestor notificationCallbacks; */
NS_IMETHODIMP nsChannel::GetNotificationCallbacks(nsIInterfaceRequestor * *aNotificationCallbacks)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotificationCallbacks)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsISupports securityInfo; */
NS_IMETHODIMP nsChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute ACString contentType; */
NS_IMETHODIMP nsChannel::GetContentType(nsACString & aContentType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChannel::SetContentType(const nsACString & aContentType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute ACString contentCharset; */
NS_IMETHODIMP nsChannel::GetContentCharset(nsACString & aContentCharset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChannel::SetContentCharset(const nsACString & aContentCharset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute long contentLength; */
NS_IMETHODIMP nsChannel::GetContentLength(PRInt32 *aContentLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsChannel::SetContentLength(PRInt32 aContentLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIInputStream open (); */
NS_IMETHODIMP nsChannel::Open(nsIInputStream **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void asyncOpen (in nsIStreamListener aListener, in nsISupports aContext); */
NS_IMETHODIMP nsChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIChannel_h__ */

View File

@@ -0,0 +1,245 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/components/nsIClassInfo.idl
*/
#ifndef __gen_nsIClassInfo_h__
#define __gen_nsIClassInfo_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
#ifndef __gen_nsIProgrammingLanguage_h__
#include "nsIProgrammingLanguage.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIClassInfo */
#define NS_ICLASSINFO_IID_STR "986c11d0-f340-11d4-9075-0010a4e73d9a"
#define NS_ICLASSINFO_IID \
{0x986c11d0, 0xf340, 0x11d4, \
{ 0x90, 0x75, 0x00, 0x10, 0xa4, 0xe7, 0x3d, 0x9a }}
/**
* Provides information about a specific implementation class
* @status FROZEN
*/
class NS_NO_VTABLE nsIClassInfo : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICLASSINFO_IID)
/**
* Get an ordered list of the interface ids that instances of the class
* promise to implement. Note that nsISupports is an implicit member
* of any such list and need not be included.
*
* Should set *count = 0 and *array = null and return NS_OK if getting the
* list is not supported.
*/
/* void getInterfaces (out PRUint32 count, [array, size_is (count), retval] out nsIIDPtr array); */
NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array) = 0;
/**
* Get a language mapping specific helper object that may assist in using
* objects of this class in a specific lanaguage. For instance, if asked
* for the helper for nsIProgrammingLanguage::JAVASCRIPT this might return
* an object that can be QI'd into the nsIXPCScriptable interface to assist
* XPConnect in supplying JavaScript specific behavior to callers of the
* instance object.
*
* see: nsIProgrammingLanguage.idl
*
* Should return null if no helper available for given language.
*/
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHOD GetHelperForLanguage(PRUint32 language, nsISupports **_retval) = 0;
/**
* A contract ID through which an instance of this class can be created
* (or accessed as a service, if |flags & SINGLETON|), or null.
*/
/* readonly attribute string contractID; */
NS_IMETHOD GetContractID(char * *aContractID) = 0;
/**
* A human readable string naming the class, or null.
*/
/* readonly attribute string classDescription; */
NS_IMETHOD GetClassDescription(char * *aClassDescription) = 0;
/**
* A class ID through which an instance of this class can be created
* (or accessed as a service, if |flags & SINGLETON|), or null.
*/
/* readonly attribute nsCIDPtr classID; */
NS_IMETHOD GetClassID(nsCID * *aClassID) = 0;
/**
* Return language type from list in nsIProgrammingLanguage
*/
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage) = 0;
/**
* Bitflags for 'flags' attribute.
*/
enum { SINGLETON = 1U };
enum { THREADSAFE = 2U };
enum { MAIN_THREAD_ONLY = 4U };
enum { DOM_OBJECT = 8U };
enum { PLUGIN_OBJECT = 16U };
enum { EAGER_CLASSINFO = 32U };
/**
* 'flags' attribute bitflag: whether objects of this type implement
* nsIContent.
*/
enum { CONTENT_NODE = 64U };
enum { RESERVED = 2147483648U };
/* readonly attribute PRUint32 flags; */
NS_IMETHOD GetFlags(PRUint32 *aFlags) = 0;
/**
* Also a class ID through which an instance of this class can be created
* (or accessed as a service, if |flags & SINGLETON|). If the class does
* not have a CID, it should return NS_ERROR_NOT_AVAILABLE. This attribute
* exists so C++ callers can avoid allocating and freeing a CID, as would
* happen if they used classID.
*/
/* [notxpcom] readonly attribute nsCID classIDNoAlloc; */
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICLASSINFO \
NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array); \
NS_IMETHOD GetHelperForLanguage(PRUint32 language, nsISupports **_retval); \
NS_IMETHOD GetContractID(char * *aContractID); \
NS_IMETHOD GetClassDescription(char * *aClassDescription); \
NS_IMETHOD GetClassID(nsCID * *aClassID); \
NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage); \
NS_IMETHOD GetFlags(PRUint32 *aFlags); \
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICLASSINFO(_to) \
NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array) { return _to GetInterfaces(count, array); } \
NS_IMETHOD GetHelperForLanguage(PRUint32 language, nsISupports **_retval) { return _to GetHelperForLanguage(language, _retval); } \
NS_IMETHOD GetContractID(char * *aContractID) { return _to GetContractID(aContractID); } \
NS_IMETHOD GetClassDescription(char * *aClassDescription) { return _to GetClassDescription(aClassDescription); } \
NS_IMETHOD GetClassID(nsCID * *aClassID) { return _to GetClassID(aClassID); } \
NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage) { return _to GetImplementationLanguage(aImplementationLanguage); } \
NS_IMETHOD GetFlags(PRUint32 *aFlags) { return _to GetFlags(aFlags); } \
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) { return _to GetClassIDNoAlloc(aClassIDNoAlloc); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICLASSINFO(_to) \
NS_IMETHOD GetInterfaces(PRUint32 *count, nsIID * **array) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInterfaces(count, array); } \
NS_IMETHOD GetHelperForLanguage(PRUint32 language, nsISupports **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetHelperForLanguage(language, _retval); } \
NS_IMETHOD GetContractID(char * *aContractID) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetContractID(aContractID); } \
NS_IMETHOD GetClassDescription(char * *aClassDescription) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClassDescription(aClassDescription); } \
NS_IMETHOD GetClassID(nsCID * *aClassID) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClassID(aClassID); } \
NS_IMETHOD GetImplementationLanguage(PRUint32 *aImplementationLanguage) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetImplementationLanguage(aImplementationLanguage); } \
NS_IMETHOD GetFlags(PRUint32 *aFlags) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFlags(aFlags); } \
NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClassIDNoAlloc(aClassIDNoAlloc); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsClassInfo : public nsIClassInfo
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICLASSINFO
nsClassInfo();
private:
~nsClassInfo();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsClassInfo, nsIClassInfo)
nsClassInfo::nsClassInfo()
{
/* member initializers and constructor code */
}
nsClassInfo::~nsClassInfo()
{
/* destructor code */
}
/* void getInterfaces (out PRUint32 count, [array, size_is (count), retval] out nsIIDPtr array); */
NS_IMETHODIMP nsClassInfo::GetInterfaces(PRUint32 *count, nsIID * **array)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISupports getHelperForLanguage (in PRUint32 language); */
NS_IMETHODIMP nsClassInfo::GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute string contractID; */
NS_IMETHODIMP nsClassInfo::GetContractID(char * *aContractID)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute string classDescription; */
NS_IMETHODIMP nsClassInfo::GetClassDescription(char * *aClassDescription)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsCIDPtr classID; */
NS_IMETHODIMP nsClassInfo::GetClassID(nsCID * *aClassID)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRUint32 implementationLanguage; */
NS_IMETHODIMP nsClassInfo::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRUint32 flags; */
NS_IMETHODIMP nsClassInfo::GetFlags(PRUint32 *aFlags)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* [notxpcom] readonly attribute nsCID classIDNoAlloc; */
NS_IMETHODIMP nsClassInfo::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIClassInfo_h__ */

View File

@@ -0,0 +1,317 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/webshell/public/nsIClipboardCommands.idl
*/
#ifndef __gen_nsIClipboardCommands_h__
#define __gen_nsIClipboardCommands_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIClipboardCommands */
#define NS_ICLIPBOARDCOMMANDS_IID_STR "b8100c90-73be-11d2-92a5-00105a1b0d64"
#define NS_ICLIPBOARDCOMMANDS_IID \
{0xb8100c90, 0x73be, 0x11d2, \
{ 0x92, 0xa5, 0x00, 0x10, 0x5a, 0x1b, 0x0d, 0x64 }}
/**
* An interface for embedding clients who wish to interact with
* the system-wide OS clipboard. Mozilla does not use a private
* clipboard, instead it places its data directly onto the system
* clipboard. The webshell implements this interface.
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIClipboardCommands : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICLIPBOARDCOMMANDS_IID)
/**
* Returns whether there is a selection and it is not read-only.
*
* @return <code>true</code> if the current selection can be cut,
* <code>false</code> otherwise.
*/
/* boolean canCutSelection (); */
NS_IMETHOD CanCutSelection(PRBool *_retval) = 0;
/**
* Returns whether there is a selection and it is copyable.
*
* @return <code>true</code> if there is a selection,
* <code>false</code> otherwise.
*/
/* boolean canCopySelection (); */
NS_IMETHOD CanCopySelection(PRBool *_retval) = 0;
/**
* Returns whether we can copy a link location.
*
* @return <code>true</code> if a link is selected,
* <code>false</code> otherwise.
*/
/* boolean canCopyLinkLocation (); */
NS_IMETHOD CanCopyLinkLocation(PRBool *_retval) = 0;
/**
* Returns whether we can copy an image location.
*
* @return <code>true</code> if an image is selected,
<code>false</code> otherwise.
*/
/* boolean canCopyImageLocation (); */
NS_IMETHOD CanCopyImageLocation(PRBool *_retval) = 0;
/**
* Returns whether we can copy an image's contents.
*
* @return <code>true</code> if an image is selected,
* <code>false</code> otherwise
*/
/* boolean canCopyImageContents (); */
NS_IMETHOD CanCopyImageContents(PRBool *_retval) = 0;
/**
* Returns whether the current contents of the clipboard can be
* pasted and if the current selection is not read-only.
*
* @return <code>true</code> there is data to paste on the clipboard
* and the current selection is not read-only,
* <code>false</code> otherwise
*/
/* boolean canPaste (); */
NS_IMETHOD CanPaste(PRBool *_retval) = 0;
/**
* Cut the current selection onto the clipboard.
*/
/* void cutSelection (); */
NS_IMETHOD CutSelection(void) = 0;
/**
* Copy the current selection onto the clipboard.
*/
/* void copySelection (); */
NS_IMETHOD CopySelection(void) = 0;
/**
* Copy the link location of the current selection (e.g.,
* the |href| attribute of a selected |a| tag).
*/
/* void copyLinkLocation (); */
NS_IMETHOD CopyLinkLocation(void) = 0;
/**
* Copy the location of the selected image.
*/
/* void copyImageLocation (); */
NS_IMETHOD CopyImageLocation(void) = 0;
/**
* Copy the contents of the selected image.
*/
/* void copyImageContents (); */
NS_IMETHOD CopyImageContents(void) = 0;
/**
* Paste the contents of the clipboard into the current selection.
*/
/* void paste (); */
NS_IMETHOD Paste(void) = 0;
/**
* Select the entire contents.
*/
/* void selectAll (); */
NS_IMETHOD SelectAll(void) = 0;
/**
* Clear the current selection (if any). Insertion point ends up
* at beginning of current selection.
*/
/* void selectNone (); */
NS_IMETHOD SelectNone(void) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICLIPBOARDCOMMANDS \
NS_IMETHOD CanCutSelection(PRBool *_retval); \
NS_IMETHOD CanCopySelection(PRBool *_retval); \
NS_IMETHOD CanCopyLinkLocation(PRBool *_retval); \
NS_IMETHOD CanCopyImageLocation(PRBool *_retval); \
NS_IMETHOD CanCopyImageContents(PRBool *_retval); \
NS_IMETHOD CanPaste(PRBool *_retval); \
NS_IMETHOD CutSelection(void); \
NS_IMETHOD CopySelection(void); \
NS_IMETHOD CopyLinkLocation(void); \
NS_IMETHOD CopyImageLocation(void); \
NS_IMETHOD CopyImageContents(void); \
NS_IMETHOD Paste(void); \
NS_IMETHOD SelectAll(void); \
NS_IMETHOD SelectNone(void);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICLIPBOARDCOMMANDS(_to) \
NS_IMETHOD CanCutSelection(PRBool *_retval) { return _to CanCutSelection(_retval); } \
NS_IMETHOD CanCopySelection(PRBool *_retval) { return _to CanCopySelection(_retval); } \
NS_IMETHOD CanCopyLinkLocation(PRBool *_retval) { return _to CanCopyLinkLocation(_retval); } \
NS_IMETHOD CanCopyImageLocation(PRBool *_retval) { return _to CanCopyImageLocation(_retval); } \
NS_IMETHOD CanCopyImageContents(PRBool *_retval) { return _to CanCopyImageContents(_retval); } \
NS_IMETHOD CanPaste(PRBool *_retval) { return _to CanPaste(_retval); } \
NS_IMETHOD CutSelection(void) { return _to CutSelection(); } \
NS_IMETHOD CopySelection(void) { return _to CopySelection(); } \
NS_IMETHOD CopyLinkLocation(void) { return _to CopyLinkLocation(); } \
NS_IMETHOD CopyImageLocation(void) { return _to CopyImageLocation(); } \
NS_IMETHOD CopyImageContents(void) { return _to CopyImageContents(); } \
NS_IMETHOD Paste(void) { return _to Paste(); } \
NS_IMETHOD SelectAll(void) { return _to SelectAll(); } \
NS_IMETHOD SelectNone(void) { return _to SelectNone(); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICLIPBOARDCOMMANDS(_to) \
NS_IMETHOD CanCutSelection(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanCutSelection(_retval); } \
NS_IMETHOD CanCopySelection(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanCopySelection(_retval); } \
NS_IMETHOD CanCopyLinkLocation(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanCopyLinkLocation(_retval); } \
NS_IMETHOD CanCopyImageLocation(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanCopyImageLocation(_retval); } \
NS_IMETHOD CanCopyImageContents(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanCopyImageContents(_retval); } \
NS_IMETHOD CanPaste(PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanPaste(_retval); } \
NS_IMETHOD CutSelection(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CutSelection(); } \
NS_IMETHOD CopySelection(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopySelection(); } \
NS_IMETHOD CopyLinkLocation(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyLinkLocation(); } \
NS_IMETHOD CopyImageLocation(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyImageLocation(); } \
NS_IMETHOD CopyImageContents(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->CopyImageContents(); } \
NS_IMETHOD Paste(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Paste(); } \
NS_IMETHOD SelectAll(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->SelectAll(); } \
NS_IMETHOD SelectNone(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->SelectNone(); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsClipboardCommands : public nsIClipboardCommands
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICLIPBOARDCOMMANDS
nsClipboardCommands();
private:
~nsClipboardCommands();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsClipboardCommands, nsIClipboardCommands)
nsClipboardCommands::nsClipboardCommands()
{
/* member initializers and constructor code */
}
nsClipboardCommands::~nsClipboardCommands()
{
/* destructor code */
}
/* boolean canCutSelection (); */
NS_IMETHODIMP nsClipboardCommands::CanCutSelection(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean canCopySelection (); */
NS_IMETHODIMP nsClipboardCommands::CanCopySelection(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean canCopyLinkLocation (); */
NS_IMETHODIMP nsClipboardCommands::CanCopyLinkLocation(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean canCopyImageLocation (); */
NS_IMETHODIMP nsClipboardCommands::CanCopyImageLocation(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean canCopyImageContents (); */
NS_IMETHODIMP nsClipboardCommands::CanCopyImageContents(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean canPaste (); */
NS_IMETHODIMP nsClipboardCommands::CanPaste(PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void cutSelection (); */
NS_IMETHODIMP nsClipboardCommands::CutSelection()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void copySelection (); */
NS_IMETHODIMP nsClipboardCommands::CopySelection()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void copyLinkLocation (); */
NS_IMETHODIMP nsClipboardCommands::CopyLinkLocation()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void copyImageLocation (); */
NS_IMETHODIMP nsClipboardCommands::CopyImageLocation()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void copyImageContents (); */
NS_IMETHODIMP nsClipboardCommands::CopyImageContents()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void paste (); */
NS_IMETHODIMP nsClipboardCommands::Paste()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void selectAll (); */
NS_IMETHODIMP nsClipboardCommands::SelectAll()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void selectNone (); */
NS_IMETHODIMP nsClipboardCommands::SelectNone()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIClipboardCommands_h__ */

View File

@@ -0,0 +1,165 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/components/nsIComponentManager.idl
*/
#ifndef __gen_nsIComponentManager_h__
#define __gen_nsIComponentManager_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIFactory; /* forward declaration */
/* starting interface: nsIComponentManager */
#define NS_ICOMPONENTMANAGER_IID_STR "a88e5a60-205a-4bb1-94e1-2628daf51eae"
#define NS_ICOMPONENTMANAGER_IID \
{0xa88e5a60, 0x205a, 0x4bb1, \
{ 0x94, 0xe1, 0x26, 0x28, 0xda, 0xf5, 0x1e, 0xae }}
class NS_NO_VTABLE nsIComponentManager : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPONENTMANAGER_IID)
/**
* getClassObject
*
* Returns the factory object that can be used to create instances of
* CID aClass
*
* @param aClass The classid of the factory that is being requested
*/
/* void getClassObject (in nsCIDRef aClass, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHOD GetClassObject(const nsCID & aClass, const nsIID & aIID, void * *result) = 0;
/**
* getClassObjectByContractID
*
* Returns the factory object that can be used to create instances of
* CID aClass
*
* @param aClass The classid of the factory that is being requested
*/
/* void getClassObjectByContractID (in string aContractID, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHOD GetClassObjectByContractID(const char *aContractID, const nsIID & aIID, void * *result) = 0;
/**
* createInstance
*
* Create an instance of the CID aClass and return the interface aIID.
*
* @param aClass : ClassID of object instance requested
* @param aDelegate : Used for aggregation
* @param aIID : IID of interface requested
*/
/* void createInstance (in nsCIDRef aClass, in nsISupports aDelegate, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHOD CreateInstance(const nsCID & aClass, nsISupports *aDelegate, const nsIID & aIID, void * *result) = 0;
/**
* createInstanceByContractID
*
* Create an instance of the CID that implements aContractID and return the
* interface aIID.
*
* @param aContractID : aContractID of object instance requested
* @param aDelegate : Used for aggregation
* @param aIID : IID of interface requested
*/
/* void createInstanceByContractID (in string aContractID, in nsISupports aDelegate, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHOD CreateInstanceByContractID(const char *aContractID, nsISupports *aDelegate, const nsIID & aIID, void * *result) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICOMPONENTMANAGER \
NS_IMETHOD GetClassObject(const nsCID & aClass, const nsIID & aIID, void * *result); \
NS_IMETHOD GetClassObjectByContractID(const char *aContractID, const nsIID & aIID, void * *result); \
NS_IMETHOD CreateInstance(const nsCID & aClass, nsISupports *aDelegate, const nsIID & aIID, void * *result); \
NS_IMETHOD CreateInstanceByContractID(const char *aContractID, nsISupports *aDelegate, const nsIID & aIID, void * *result);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICOMPONENTMANAGER(_to) \
NS_IMETHOD GetClassObject(const nsCID & aClass, const nsIID & aIID, void * *result) { return _to GetClassObject(aClass, aIID, result); } \
NS_IMETHOD GetClassObjectByContractID(const char *aContractID, const nsIID & aIID, void * *result) { return _to GetClassObjectByContractID(aContractID, aIID, result); } \
NS_IMETHOD CreateInstance(const nsCID & aClass, nsISupports *aDelegate, const nsIID & aIID, void * *result) { return _to CreateInstance(aClass, aDelegate, aIID, result); } \
NS_IMETHOD CreateInstanceByContractID(const char *aContractID, nsISupports *aDelegate, const nsIID & aIID, void * *result) { return _to CreateInstanceByContractID(aContractID, aDelegate, aIID, result); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICOMPONENTMANAGER(_to) \
NS_IMETHOD GetClassObject(const nsCID & aClass, const nsIID & aIID, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClassObject(aClass, aIID, result); } \
NS_IMETHOD GetClassObjectByContractID(const char *aContractID, const nsIID & aIID, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetClassObjectByContractID(aContractID, aIID, result); } \
NS_IMETHOD CreateInstance(const nsCID & aClass, nsISupports *aDelegate, const nsIID & aIID, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateInstance(aClass, aDelegate, aIID, result); } \
NS_IMETHOD CreateInstanceByContractID(const char *aContractID, nsISupports *aDelegate, const nsIID & aIID, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateInstanceByContractID(aContractID, aDelegate, aIID, result); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsComponentManager : public nsIComponentManager
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICOMPONENTMANAGER
nsComponentManager();
private:
~nsComponentManager();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsComponentManager, nsIComponentManager)
nsComponentManager::nsComponentManager()
{
/* member initializers and constructor code */
}
nsComponentManager::~nsComponentManager()
{
/* destructor code */
}
/* void getClassObject (in nsCIDRef aClass, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHODIMP nsComponentManager::GetClassObject(const nsCID & aClass, const nsIID & aIID, void * *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void getClassObjectByContractID (in string aContractID, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHODIMP nsComponentManager::GetClassObjectByContractID(const char *aContractID, const nsIID & aIID, void * *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void createInstance (in nsCIDRef aClass, in nsISupports aDelegate, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHODIMP nsComponentManager::CreateInstance(const nsCID & aClass, nsISupports *aDelegate, const nsIID & aIID, void * *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void createInstanceByContractID (in string aContractID, in nsISupports aDelegate, in nsIIDRef aIID, [iid_is (aIID), retval] out nsQIResult result); */
NS_IMETHODIMP nsComponentManager::CreateInstanceByContractID(const char *aContractID, nsISupports *aDelegate, const nsIID & aIID, void * *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#ifdef MOZILLA_INTERNAL_API
#include "nsComponentManagerUtils.h"
#endif
#endif /* __gen_nsIComponentManager_h__ */

View File

@@ -0,0 +1,375 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/xpcom/components/nsIComponentRegistrar.idl
*/
#ifndef __gen_nsIComponentRegistrar_h__
#define __gen_nsIComponentRegistrar_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIFile; /* forward declaration */
class nsIFactory; /* forward declaration */
class nsISimpleEnumerator; /* forward declaration */
/* starting interface: nsIComponentRegistrar */
#define NS_ICOMPONENTREGISTRAR_IID_STR "2417cbfe-65ad-48a6-b4b6-eb84db174392"
#define NS_ICOMPONENTREGISTRAR_IID \
{0x2417cbfe, 0x65ad, 0x48a6, \
{ 0xb4, 0xb6, 0xeb, 0x84, 0xdb, 0x17, 0x43, 0x92 }}
class NS_NO_VTABLE nsIComponentRegistrar : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMPONENTREGISTRAR_IID)
/**
* autoRegister
*
* Register a component file or all component files in a directory.
*
* Component files must have an associated loader and export the required
* symbols which this loader defines. For example, if the given file is a
* native library (which is built into XPCOM), it must export the symbol
* "NSGetModule". Other loaders may have different semantics.
*
* This method may only be called from the main thread.
*
* @param aSpec : Filename spec for component file's location. If aSpec
* is a directory, then every component file in the
* directory will be registered.
* If the aSpec is null, then the application component's
* directory as defined by NS_XPCOM_COMPONENT_DIR will be
* registered (see nsIDirectoryService.idl)
*
* @return NS_OK : Registration was successful.
* NS_ERROR: Method failure.
*/
/* void autoRegister (in nsIFile aSpec); */
NS_IMETHOD AutoRegister(nsIFile *aSpec) = 0;
/**
* autoUnregister
*
* Unregister a component file or all component files in a directory.
* This method may only be called from the main thread.
*
* @param aSpec : Filename spec for component file's location. If aSpec
* is a directory, the every component file in the directory
* will be registered.
* If aSpec is null, then the application component's
* directory as defined by NS_XPCOM_COMPONENT_DIR will be
* registered. (see nsIDirectoryService.idl)
*
* @return NS_OK Unregistration was successful.
* NS_ERROR* Method failure.
*/
/* void autoUnregister (in nsIFile aSpec); */
NS_IMETHOD AutoUnregister(nsIFile *aSpec) = 0;
/**
* registerFactory
*
* Register a factory with a given ContractID, CID and Class Name.
*
* @param aClass : CID of object
* @param aClassName : Class Name of CID
* @param aContractID : ContractID associated with CID aClass
* @param aFactory : Factory that will be registered for CID aClass
*
* @return NS_OK Registration was successful.
* NS_ERROR* method failure.
*/
/* void registerFactory (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFactory aFactory); */
NS_IMETHOD RegisterFactory(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFactory *aFactory) = 0;
/**
* unregisterFactory
*
* Unregister a factory associated with CID aClass.
*
* @param aClass : CID being unregistered
* @param aFactory : Factory previously registered to create instances of
* CID aClass.
*
* @return NS_OK Unregistration was successful.
* NS_ERROR* Method failure.
*/
/* void unregisterFactory (in nsCIDRef aClass, in nsIFactory aFactory); */
NS_IMETHOD UnregisterFactory(const nsCID & aClass, nsIFactory *aFactory) = 0;
/**
* registerFactoryLocation
*
* Register a factory with a given ContractID, CID and Class Name
*
* @param aClass : CID of object
* @param aClassName : Class Name of CID
* @param aContractID : ContractID associated with CID aClass
* @param aFile : Component File. This file must have an associated
* loader and export the required symbols which this
* loader specifies.
* @param aLoaderStr : Opaque loader specific string. This value is
* passed into the nsIModule's registerSelf
* callback and must be fowarded unmodified when
* registering factories via their location.
* @param aType : Component Type of CID aClass. This value is
* passed into the nsIModule's registerSelf
* callback and must be fowarded unmodified when
* registering factories via their location.
*
* @return NS_OK Registration was successful.
* NS_ERROR* Method failure.
*/
/* void registerFactoryLocation (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aFile, in string aLoaderStr, in string aType); */
NS_IMETHOD RegisterFactoryLocation(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFile *aFile, const char *aLoaderStr, const char *aType) = 0;
/**
* unregisterFactoryLocation
*
* Unregister a factory associated with CID aClass.
*
* @param aClass : CID being unregistered
* @param aFile : Component File previously registered
*
* @return NS_OK Unregistration was successful.
* NS_ERROR* Method failure.
*/
/* void unregisterFactoryLocation (in nsCIDRef aClass, in nsIFile aFile); */
NS_IMETHOD UnregisterFactoryLocation(const nsCID & aClass, nsIFile *aFile) = 0;
/**
* isCIDRegistered
*
* Returns true if a factory is registered for the CID.
*
* @param aClass : CID queried for registeration
* @return : true if a factory is registered for CID
* false otherwise.
*/
/* boolean isCIDRegistered (in nsCIDRef aClass); */
NS_IMETHOD IsCIDRegistered(const nsCID & aClass, PRBool *_retval) = 0;
/**
* isContractIDRegistered
*
* Returns true if a factory is registered for the contract id.
*
* @param aClass : contract id queried for registeration
* @return : true if a factory is registered for contract id
* false otherwise.
*/
/* boolean isContractIDRegistered (in string aContractID); */
NS_IMETHOD IsContractIDRegistered(const char *aContractID, PRBool *_retval) = 0;
/**
* enumerateCIDs
*
* Enumerate the list of all registered CIDs.
*
* @return : enumerator for CIDs. Elements of the enumeration can be QI'ed
* for the nsISupportsID interface. From the nsISupportsID, you
* can obtain the actual CID.
*/
/* nsISimpleEnumerator enumerateCIDs (); */
NS_IMETHOD EnumerateCIDs(nsISimpleEnumerator **_retval) = 0;
/**
* enumerateContractIDs
*
* Enumerate the list of all registered ContractIDs.
*
* @return : enumerator for ContractIDs. Elements of the enumeration can be
* QI'ed for the nsISupportsCString interface. From the
* nsISupportsCString interface, you can obtain the actual
* Contract ID string.
*/
/* nsISimpleEnumerator enumerateContractIDs (); */
NS_IMETHOD EnumerateContractIDs(nsISimpleEnumerator **_retval) = 0;
/**
* CIDToContractID
*
* Returns the Contract ID for a given CID, if one exists and is registered.
*
* @return : Contract ID.
*/
/* string CIDToContractID (in nsCIDRef aClass); */
NS_IMETHOD CIDToContractID(const nsCID & aClass, char **_retval) = 0;
/**
* contractIDToCID
*
* Returns the CID for a given Contract ID, if one exists and is registered.
*
* @return : Contract ID.
*/
/* nsCIDPtr contractIDToCID (in string aContractID); */
NS_IMETHOD ContractIDToCID(const char *aContractID, nsCID * *_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICOMPONENTREGISTRAR \
NS_IMETHOD AutoRegister(nsIFile *aSpec); \
NS_IMETHOD AutoUnregister(nsIFile *aSpec); \
NS_IMETHOD RegisterFactory(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFactory *aFactory); \
NS_IMETHOD UnregisterFactory(const nsCID & aClass, nsIFactory *aFactory); \
NS_IMETHOD RegisterFactoryLocation(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFile *aFile, const char *aLoaderStr, const char *aType); \
NS_IMETHOD UnregisterFactoryLocation(const nsCID & aClass, nsIFile *aFile); \
NS_IMETHOD IsCIDRegistered(const nsCID & aClass, PRBool *_retval); \
NS_IMETHOD IsContractIDRegistered(const char *aContractID, PRBool *_retval); \
NS_IMETHOD EnumerateCIDs(nsISimpleEnumerator **_retval); \
NS_IMETHOD EnumerateContractIDs(nsISimpleEnumerator **_retval); \
NS_IMETHOD CIDToContractID(const nsCID & aClass, char **_retval); \
NS_IMETHOD ContractIDToCID(const char *aContractID, nsCID * *_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICOMPONENTREGISTRAR(_to) \
NS_IMETHOD AutoRegister(nsIFile *aSpec) { return _to AutoRegister(aSpec); } \
NS_IMETHOD AutoUnregister(nsIFile *aSpec) { return _to AutoUnregister(aSpec); } \
NS_IMETHOD RegisterFactory(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFactory *aFactory) { return _to RegisterFactory(aClass, aClassName, aContractID, aFactory); } \
NS_IMETHOD UnregisterFactory(const nsCID & aClass, nsIFactory *aFactory) { return _to UnregisterFactory(aClass, aFactory); } \
NS_IMETHOD RegisterFactoryLocation(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFile *aFile, const char *aLoaderStr, const char *aType) { return _to RegisterFactoryLocation(aClass, aClassName, aContractID, aFile, aLoaderStr, aType); } \
NS_IMETHOD UnregisterFactoryLocation(const nsCID & aClass, nsIFile *aFile) { return _to UnregisterFactoryLocation(aClass, aFile); } \
NS_IMETHOD IsCIDRegistered(const nsCID & aClass, PRBool *_retval) { return _to IsCIDRegistered(aClass, _retval); } \
NS_IMETHOD IsContractIDRegistered(const char *aContractID, PRBool *_retval) { return _to IsContractIDRegistered(aContractID, _retval); } \
NS_IMETHOD EnumerateCIDs(nsISimpleEnumerator **_retval) { return _to EnumerateCIDs(_retval); } \
NS_IMETHOD EnumerateContractIDs(nsISimpleEnumerator **_retval) { return _to EnumerateContractIDs(_retval); } \
NS_IMETHOD CIDToContractID(const nsCID & aClass, char **_retval) { return _to CIDToContractID(aClass, _retval); } \
NS_IMETHOD ContractIDToCID(const char *aContractID, nsCID * *_retval) { return _to ContractIDToCID(aContractID, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICOMPONENTREGISTRAR(_to) \
NS_IMETHOD AutoRegister(nsIFile *aSpec) { return !_to ? NS_ERROR_NULL_POINTER : _to->AutoRegister(aSpec); } \
NS_IMETHOD AutoUnregister(nsIFile *aSpec) { return !_to ? NS_ERROR_NULL_POINTER : _to->AutoUnregister(aSpec); } \
NS_IMETHOD RegisterFactory(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFactory *aFactory) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterFactory(aClass, aClassName, aContractID, aFactory); } \
NS_IMETHOD UnregisterFactory(const nsCID & aClass, nsIFactory *aFactory) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterFactory(aClass, aFactory); } \
NS_IMETHOD RegisterFactoryLocation(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFile *aFile, const char *aLoaderStr, const char *aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterFactoryLocation(aClass, aClassName, aContractID, aFile, aLoaderStr, aType); } \
NS_IMETHOD UnregisterFactoryLocation(const nsCID & aClass, nsIFile *aFile) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterFactoryLocation(aClass, aFile); } \
NS_IMETHOD IsCIDRegistered(const nsCID & aClass, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsCIDRegistered(aClass, _retval); } \
NS_IMETHOD IsContractIDRegistered(const char *aContractID, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsContractIDRegistered(aContractID, _retval); } \
NS_IMETHOD EnumerateCIDs(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateCIDs(_retval); } \
NS_IMETHOD EnumerateContractIDs(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->EnumerateContractIDs(_retval); } \
NS_IMETHOD CIDToContractID(const nsCID & aClass, char **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CIDToContractID(aClass, _retval); } \
NS_IMETHOD ContractIDToCID(const char *aContractID, nsCID * *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ContractIDToCID(aContractID, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsComponentRegistrar : public nsIComponentRegistrar
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICOMPONENTREGISTRAR
nsComponentRegistrar();
private:
~nsComponentRegistrar();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsComponentRegistrar, nsIComponentRegistrar)
nsComponentRegistrar::nsComponentRegistrar()
{
/* member initializers and constructor code */
}
nsComponentRegistrar::~nsComponentRegistrar()
{
/* destructor code */
}
/* void autoRegister (in nsIFile aSpec); */
NS_IMETHODIMP nsComponentRegistrar::AutoRegister(nsIFile *aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void autoUnregister (in nsIFile aSpec); */
NS_IMETHODIMP nsComponentRegistrar::AutoUnregister(nsIFile *aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void registerFactory (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFactory aFactory); */
NS_IMETHODIMP nsComponentRegistrar::RegisterFactory(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFactory *aFactory)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void unregisterFactory (in nsCIDRef aClass, in nsIFactory aFactory); */
NS_IMETHODIMP nsComponentRegistrar::UnregisterFactory(const nsCID & aClass, nsIFactory *aFactory)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void registerFactoryLocation (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aFile, in string aLoaderStr, in string aType); */
NS_IMETHODIMP nsComponentRegistrar::RegisterFactoryLocation(const nsCID & aClass, const char *aClassName, const char *aContractID, nsIFile *aFile, const char *aLoaderStr, const char *aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void unregisterFactoryLocation (in nsCIDRef aClass, in nsIFile aFile); */
NS_IMETHODIMP nsComponentRegistrar::UnregisterFactoryLocation(const nsCID & aClass, nsIFile *aFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean isCIDRegistered (in nsCIDRef aClass); */
NS_IMETHODIMP nsComponentRegistrar::IsCIDRegistered(const nsCID & aClass, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean isContractIDRegistered (in string aContractID); */
NS_IMETHODIMP nsComponentRegistrar::IsContractIDRegistered(const char *aContractID, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISimpleEnumerator enumerateCIDs (); */
NS_IMETHODIMP nsComponentRegistrar::EnumerateCIDs(nsISimpleEnumerator **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsISimpleEnumerator enumerateContractIDs (); */
NS_IMETHODIMP nsComponentRegistrar::EnumerateContractIDs(nsISimpleEnumerator **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* string CIDToContractID (in nsCIDRef aClass); */
NS_IMETHODIMP nsComponentRegistrar::CIDToContractID(const nsCID & aClass, char **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsCIDPtr contractIDToCID (in string aContractID); */
NS_IMETHODIMP nsComponentRegistrar::ContractIDToCID(const char *aContractID, nsCID * *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIComponentRegistrar_h__ */

View File

@@ -0,0 +1,149 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/embedding/browser/webBrowser/nsIContextMenuListener.idl
*/
#ifndef __gen_nsIContextMenuListener_h__
#define __gen_nsIContextMenuListener_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIDOMEvent; /* forward declaration */
class nsIDOMNode; /* forward declaration */
/* starting interface: nsIContextMenuListener */
#define NS_ICONTEXTMENULISTENER_IID_STR "3478b6b0-3875-11d4-94ef-0020183bf181"
#define NS_ICONTEXTMENULISTENER_IID \
{0x3478b6b0, 0x3875, 0x11d4, \
{ 0x94, 0xef, 0x00, 0x20, 0x18, 0x3b, 0xf1, 0x81 }}
/**
* An optional interface for embedding clients wishing to receive
* notifications for context menu events (e.g. generated by
* a user right-mouse clicking on a link). The embedder implements
* this interface on the web browser chrome object associated
* with the window that notifications are required for. When a context
* menu event, the browser will call this interface if present.
*
* @see nsIDOMNode
* @see nsIDOMEvent
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIContextMenuListener : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTEXTMENULISTENER_IID)
/** Flag. No context. */
enum { CONTEXT_NONE = 0U };
/** Flag. Context is a link element. */
enum { CONTEXT_LINK = 1U };
/** Flag. Context is an image element. */
enum { CONTEXT_IMAGE = 2U };
/** Flag. Context is the whole document. */
enum { CONTEXT_DOCUMENT = 4U };
/** Flag. Context is a text area element. */
enum { CONTEXT_TEXT = 8U };
/** Flag. Context is an input element. */
enum { CONTEXT_INPUT = 16U };
/**
* Called when the browser receives a context menu event (e.g. user is right-mouse
* clicking somewhere on the document). The combination of flags, event and node
* provided in the call indicate where and what was clicked on.
*
* The following table describes what context flags and node combinations are
* possible.
*
* <TABLE>
* <TR><TD><B>aContextFlag</B></TD><TD>aNode</TD></TR>
* <TR><TD>CONTEXT_LINK</TD><TD>&lt;A&gt;</TD></TR>
* <TR><TD>CONTEXT_IMAGE</TD><TD>&lt;IMG&gt;</TD></TR>
* <TR><TD>CONTEXT_IMAGE | CONTEXT_LINK</TD><TD>&lt;IMG&gt;
* with an &lt;A&gt; as an ancestor</TD></TR>
* <TR><TD>CONTEXT_INPUT</TD><TD>&lt;INPUT&gt;</TD></TR>
* <TR><TD>CONTEXT_TEXT</TD><TD>&lt;TEXTAREA&gt;</TD></TR>
* <TR><TD>CONTEXT_DOCUMENT</TD><TD>&lt;HTML&gt;</TD></TR>
* </TABLE>
*
* @param aContextFlags Flags indicating the kind of context.
* @param aEvent The DOM context menu event.
* @param aNode The DOM node most relevant to the context.
*
* @return <CODE>NS_OK</CODE> always.
*/
/* void onShowContextMenu (in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); */
NS_IMETHOD OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICONTEXTMENULISTENER \
NS_IMETHOD OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICONTEXTMENULISTENER(_to) \
NS_IMETHOD OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) { return _to OnShowContextMenu(aContextFlags, aEvent, aNode); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICONTEXTMENULISTENER(_to) \
NS_IMETHOD OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnShowContextMenu(aContextFlags, aEvent, aNode); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsContextMenuListener : public nsIContextMenuListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICONTEXTMENULISTENER
nsContextMenuListener();
private:
~nsContextMenuListener();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsContextMenuListener, nsIContextMenuListener)
nsContextMenuListener::nsContextMenuListener()
{
/* member initializers and constructor code */
}
nsContextMenuListener::~nsContextMenuListener()
{
/* destructor code */
}
/* void onShowContextMenu (in unsigned long aContextFlags, in nsIDOMEvent aEvent, in nsIDOMNode aNode); */
NS_IMETHODIMP nsContextMenuListener::OnShowContextMenu(PRUint32 aContextFlags, nsIDOMEvent *aEvent, nsIDOMNode *aNode)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIContextMenuListener_h__ */

View File

@@ -0,0 +1,257 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/netwerk/cookie/public/nsICookie.idl
*/
#ifndef __gen_nsICookie_h__
#define __gen_nsICookie_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/**
* An optional interface for accessing the HTTP or
* javascript cookie object
*
* @status FROZEN
*/
typedef PRInt32 nsCookieStatus;
typedef PRInt32 nsCookiePolicy;
/* starting interface: nsICookie */
#define NS_ICOOKIE_IID_STR "e9fcb9a4-d376-458f-b720-e65e7df593bc"
#define NS_ICOOKIE_IID \
{0xe9fcb9a4, 0xd376, 0x458f, \
{ 0xb7, 0x20, 0xe6, 0x5e, 0x7d, 0xf5, 0x93, 0xbc }}
class NS_NO_VTABLE nsICookie : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOOKIE_IID)
/**
* the name of the cookie
*/
/* readonly attribute ACString name; */
NS_IMETHOD GetName(nsACString & aName) = 0;
/**
* the cookie value
*/
/* readonly attribute ACString value; */
NS_IMETHOD GetValue(nsACString & aValue) = 0;
/**
* true if the cookie is a domain cookie, false otherwise
*/
/* readonly attribute boolean isDomain; */
NS_IMETHOD GetIsDomain(PRBool *aIsDomain) = 0;
/**
* the host (possibly fully qualified) of the cookie
*/
/* readonly attribute AUTF8String host; */
NS_IMETHOD GetHost(nsACString & aHost) = 0;
/**
* the path pertaining to the cookie
*/
/* readonly attribute AUTF8String path; */
NS_IMETHOD GetPath(nsACString & aPath) = 0;
/**
* true if the cookie was transmitted over ssl, false otherwise
*/
/* readonly attribute boolean isSecure; */
NS_IMETHOD GetIsSecure(PRBool *aIsSecure) = 0;
/**
* expiration time (local timezone) expressed as number of seconds since Jan 1, 1970
*/
/* readonly attribute PRUint64 expires; */
NS_IMETHOD GetExpires(PRUint64 *aExpires) = 0;
/**
* P3P status of cookie. Values are
*
* STATUS_UNKNOWN -- cookie collected in a previous session and this info no longer available
* STATUS_ACCEPTED -- cookie was accepted as it
* STATUS_DOWNGRADED -- cookie was accepted but downgraded to a session cookie
* STATUS_FLAGGED -- cookie was accepted with a warning being issued to the user
* STATUS_REJECTED -- cookie was not accepted
*/
enum { STATUS_UNKNOWN = 0 };
enum { STATUS_ACCEPTED = 1 };
enum { STATUS_DOWNGRADED = 2 };
enum { STATUS_FLAGGED = 3 };
enum { STATUS_REJECTED = 4 };
/* readonly attribute nsCookieStatus status; */
NS_IMETHOD GetStatus(nsCookieStatus *aStatus) = 0;
/**
* Site's compact policy. Values are
*
* POLICY_UNKNOWN -- cookie collected in a previous session and this info no longer available
* POLICY_NONE -- site did not send a compact policy along with the cookie
* POLICY_NO_CONSENT -- site collects identfiable information without user involvement
* POLICY_IMPLICIT_CONSENT -- site collects identifiable information unless user opts out
* POLICY_EXPLICIT_CONSENT -- site does not collect identifiable information unless user opts in
* POLICY_NO_II -- site does not collect identifiable information
*/
enum { POLICY_UNKNOWN = 0 };
enum { POLICY_NONE = 1 };
enum { POLICY_NO_CONSENT = 2 };
enum { POLICY_IMPLICIT_CONSENT = 3 };
enum { POLICY_EXPLICIT_CONSENT = 4 };
enum { POLICY_NO_II = 5 };
/* readonly attribute nsCookiePolicy policy; */
NS_IMETHOD GetPolicy(nsCookiePolicy *aPolicy) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICOOKIE \
NS_IMETHOD GetName(nsACString & aName); \
NS_IMETHOD GetValue(nsACString & aValue); \
NS_IMETHOD GetIsDomain(PRBool *aIsDomain); \
NS_IMETHOD GetHost(nsACString & aHost); \
NS_IMETHOD GetPath(nsACString & aPath); \
NS_IMETHOD GetIsSecure(PRBool *aIsSecure); \
NS_IMETHOD GetExpires(PRUint64 *aExpires); \
NS_IMETHOD GetStatus(nsCookieStatus *aStatus); \
NS_IMETHOD GetPolicy(nsCookiePolicy *aPolicy);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICOOKIE(_to) \
NS_IMETHOD GetName(nsACString & aName) { return _to GetName(aName); } \
NS_IMETHOD GetValue(nsACString & aValue) { return _to GetValue(aValue); } \
NS_IMETHOD GetIsDomain(PRBool *aIsDomain) { return _to GetIsDomain(aIsDomain); } \
NS_IMETHOD GetHost(nsACString & aHost) { return _to GetHost(aHost); } \
NS_IMETHOD GetPath(nsACString & aPath) { return _to GetPath(aPath); } \
NS_IMETHOD GetIsSecure(PRBool *aIsSecure) { return _to GetIsSecure(aIsSecure); } \
NS_IMETHOD GetExpires(PRUint64 *aExpires) { return _to GetExpires(aExpires); } \
NS_IMETHOD GetStatus(nsCookieStatus *aStatus) { return _to GetStatus(aStatus); } \
NS_IMETHOD GetPolicy(nsCookiePolicy *aPolicy) { return _to GetPolicy(aPolicy); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICOOKIE(_to) \
NS_IMETHOD GetName(nsACString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
NS_IMETHOD GetValue(nsACString & aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetValue(aValue); } \
NS_IMETHOD GetIsDomain(PRBool *aIsDomain) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsDomain(aIsDomain); } \
NS_IMETHOD GetHost(nsACString & aHost) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetHost(aHost); } \
NS_IMETHOD GetPath(nsACString & aPath) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPath(aPath); } \
NS_IMETHOD GetIsSecure(PRBool *aIsSecure) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsSecure(aIsSecure); } \
NS_IMETHOD GetExpires(PRUint64 *aExpires) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetExpires(aExpires); } \
NS_IMETHOD GetStatus(nsCookieStatus *aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStatus(aStatus); } \
NS_IMETHOD GetPolicy(nsCookiePolicy *aPolicy) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPolicy(aPolicy); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsCookie : public nsICookie
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICOOKIE
nsCookie();
private:
~nsCookie();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsCookie, nsICookie)
nsCookie::nsCookie()
{
/* member initializers and constructor code */
}
nsCookie::~nsCookie()
{
/* destructor code */
}
/* readonly attribute ACString name; */
NS_IMETHODIMP nsCookie::GetName(nsACString & aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute ACString value; */
NS_IMETHODIMP nsCookie::GetValue(nsACString & aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute boolean isDomain; */
NS_IMETHODIMP nsCookie::GetIsDomain(PRBool *aIsDomain)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AUTF8String host; */
NS_IMETHODIMP nsCookie::GetHost(nsACString & aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute AUTF8String path; */
NS_IMETHODIMP nsCookie::GetPath(nsACString & aPath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute boolean isSecure; */
NS_IMETHODIMP nsCookie::GetIsSecure(PRBool *aIsSecure)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute PRUint64 expires; */
NS_IMETHODIMP nsCookie::GetExpires(PRUint64 *aExpires)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsCookieStatus status; */
NS_IMETHODIMP nsCookie::GetStatus(nsCookieStatus *aStatus)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsCookiePolicy policy; */
NS_IMETHODIMP nsCookie::GetPolicy(nsCookiePolicy *aPolicy)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsICookie_h__ */

View File

@@ -0,0 +1,138 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/netwerk/cookie/public/nsICookieManager.idl
*/
#ifndef __gen_nsICookieManager_h__
#define __gen_nsICookieManager_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
#ifndef __gen_nsISimpleEnumerator_h__
#include "nsISimpleEnumerator.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsICookieManager */
#define NS_ICOOKIEMANAGER_IID_STR "aaab6710-0f2c-11d5-a53b-0010a401eb10"
#define NS_ICOOKIEMANAGER_IID \
{0xaaab6710, 0x0f2c, 0x11d5, \
{ 0xa5, 0x3b, 0x00, 0x10, 0xa4, 0x01, 0xeb, 0x10 }}
/**
* An optional interface for accessing or removing the cookies
* that are in the cookie list
*
* @status FROZEN
*/
class NS_NO_VTABLE nsICookieManager : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOOKIEMANAGER_IID)
/**
* Called to remove all cookies from the cookie list
*/
/* void removeAll (); */
NS_IMETHOD RemoveAll(void) = 0;
/**
* Called to enumerate through each cookie in the cookie list.
* The objects enumerated over are of type nsICookie
*/
/* readonly attribute nsISimpleEnumerator enumerator; */
NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator) = 0;
/**
* Called to remove an individual cookie from the cookie list
*
* @param aDomain The host or domain for which the cookie was set
* @param aName The name specified in the cookie
* @param aBlocked Indicates if cookies from this host should be permanently blocked
*
*/
/* void remove (in AUTF8String aDomain, in ACString aName, in AUTF8String aPath, in boolean aBlocked); */
NS_IMETHOD Remove(const nsACString & aDomain, const nsACString & aName, const nsACString & aPath, PRBool aBlocked) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICOOKIEMANAGER \
NS_IMETHOD RemoveAll(void); \
NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator); \
NS_IMETHOD Remove(const nsACString & aDomain, const nsACString & aName, const nsACString & aPath, PRBool aBlocked);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICOOKIEMANAGER(_to) \
NS_IMETHOD RemoveAll(void) { return _to RemoveAll(); } \
NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator) { return _to GetEnumerator(aEnumerator); } \
NS_IMETHOD Remove(const nsACString & aDomain, const nsACString & aName, const nsACString & aPath, PRBool aBlocked) { return _to Remove(aDomain, aName, aPath, aBlocked); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICOOKIEMANAGER(_to) \
NS_IMETHOD RemoveAll(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveAll(); } \
NS_IMETHOD GetEnumerator(nsISimpleEnumerator * *aEnumerator) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEnumerator(aEnumerator); } \
NS_IMETHOD Remove(const nsACString & aDomain, const nsACString & aName, const nsACString & aPath, PRBool aBlocked) { return !_to ? NS_ERROR_NULL_POINTER : _to->Remove(aDomain, aName, aPath, aBlocked); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsCookieManager : public nsICookieManager
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICOOKIEMANAGER
nsCookieManager();
private:
~nsCookieManager();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsCookieManager, nsICookieManager)
nsCookieManager::nsCookieManager()
{
/* member initializers and constructor code */
}
nsCookieManager::~nsCookieManager()
{
/* destructor code */
}
/* void removeAll (); */
NS_IMETHODIMP nsCookieManager::RemoveAll()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsISimpleEnumerator enumerator; */
NS_IMETHODIMP nsCookieManager::GetEnumerator(nsISimpleEnumerator * *aEnumerator)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void remove (in AUTF8String aDomain, in ACString aName, in AUTF8String aPath, in boolean aBlocked); */
NS_IMETHODIMP nsCookieManager::Remove(const nsACString & aDomain, const nsACString & aName, const nsACString & aPath, PRBool aBlocked)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsICookieManager_h__ */

View File

@@ -0,0 +1,151 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsID_h__
#define nsID_h__
#include <string.h>
#ifndef nscore_h___
#include "nscore.h"
#endif
/**
* A "unique identifier". This is modeled after OSF DCE UUIDs.
* @status FROZEN
*/
struct nsID {
/**
* @name Indentifier values
*/
//@{
PRUint32 m0;
PRUint16 m1;
PRUint16 m2;
PRUint8 m3[8];
//@}
/**
* @name Methods
*/
//@{
/**
* Equivalency method. Compares this nsID with another.
* @return <b>PR_TRUE</b> if they are the same, <b>PR_FALSE</b> if not.
*/
inline PRBool Equals(const nsID& other) const {
// One would think that this could be done faster with a really
// efficient implementation of memcmp(), but evidently no
// memcmp()'s out there are better than this code.
//
// See bug http://bugzilla.mozilla.org/show_bug.cgi?id=164580 for
// details.
return (PRBool)
((((PRUint32*) &m0)[0] == ((PRUint32*) &other.m0)[0]) &&
(((PRUint32*) &m0)[1] == ((PRUint32*) &other.m0)[1]) &&
(((PRUint32*) &m0)[2] == ((PRUint32*) &other.m0)[2]) &&
(((PRUint32*) &m0)[3] == ((PRUint32*) &other.m0)[3]));
}
/**
* nsID Parsing method. Turns a {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
* string into an nsID
*/
NS_COM_GLUE PRBool Parse(const char *aIDStr);
/**
* nsID string encoder. Returns an allocated string in
* {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} format. Caller should free string.
*/
NS_COM_GLUE char* ToString() const;
//@}
};
/*
* Class IDs
*/
typedef nsID nsCID;
// Define an CID
#define NS_DEFINE_CID(_name, _cidspec) \
const nsCID _name = _cidspec
#define REFNSCID const nsCID&
/**
* An "interface id" which can be used to uniquely identify a given
* interface.
*/
typedef nsID nsIID;
/**
* A macro shorthand for <tt>const nsIID&<tt>
*/
#define REFNSIID const nsIID&
/**
* Define an IID
* obsolete - do not use this macro
*/
#define NS_DEFINE_IID(_name, _iidspec) \
const nsIID _name = _iidspec
/**
* A macro to build the static const IID accessor method
*/
#define NS_DEFINE_STATIC_IID_ACCESSOR(the_iid) \
static const nsIID& GetIID() {static const nsIID iid = the_iid; return iid;}
/**
* A macro to build the static const CID accessor method
*/
#define NS_DEFINE_STATIC_CID_ACCESSOR(the_cid) \
static const nsID& GetCID() {static const nsID cid = the_cid; return cid;}
#endif

View File

@@ -0,0 +1,96 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/events/nsIDOM3DocumentEvent.idl
*/
#ifndef __gen_nsIDOM3DocumentEvent_h__
#define __gen_nsIDOM3DocumentEvent_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOM3DocumentEvent */
#define NS_IDOM3DOCUMENTEVENT_IID_STR "090ecc19-b7cb-4f47-ae47-ed68d4926249"
#define NS_IDOM3DOCUMENTEVENT_IID \
{0x090ecc19, 0xb7cb, 0x4f47, \
{ 0xae, 0x47, 0xed, 0x68, 0xd4, 0x92, 0x62, 0x49 }}
/**
* The nsIDOMDocumentEvent interface is the interface to the event
* factory method on a DOM document object.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-3-Events/
*/
class NS_NO_VTABLE nsIDOM3DocumentEvent : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOM3DOCUMENTEVENT_IID)
/* nsIDOMEventGroup createEventGroup (); */
NS_IMETHOD CreateEventGroup(nsIDOMEventGroup **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOM3DOCUMENTEVENT \
NS_IMETHOD CreateEventGroup(nsIDOMEventGroup **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOM3DOCUMENTEVENT(_to) \
NS_IMETHOD CreateEventGroup(nsIDOMEventGroup **_retval) { return _to CreateEventGroup(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOM3DOCUMENTEVENT(_to) \
NS_IMETHOD CreateEventGroup(nsIDOMEventGroup **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateEventGroup(_retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOM3DocumentEvent : public nsIDOM3DocumentEvent
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOM3DOCUMENTEVENT
nsDOM3DocumentEvent();
private:
~nsDOM3DocumentEvent();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOM3DocumentEvent, nsIDOM3DocumentEvent)
nsDOM3DocumentEvent::nsDOM3DocumentEvent()
{
/* member initializers and constructor code */
}
nsDOM3DocumentEvent::~nsDOM3DocumentEvent()
{
/* destructor code */
}
/* nsIDOMEventGroup createEventGroup (); */
NS_IMETHODIMP nsDOM3DocumentEvent::CreateEventGroup(nsIDOMEventGroup **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOM3DocumentEvent_h__ */

View File

@@ -0,0 +1,132 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/events/nsIDOM3EventTarget.idl
*/
#ifndef __gen_nsIDOM3EventTarget_h__
#define __gen_nsIDOM3EventTarget_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOM3EventTarget */
#define NS_IDOM3EVENTTARGET_IID_STR "3e9c01a7-de97-4c3b-8294-b4bd9d7056d1"
#define NS_IDOM3EVENTTARGET_IID \
{0x3e9c01a7, 0xde97, 0x4c3b, \
{ 0x82, 0x94, 0xb4, 0xbd, 0x9d, 0x70, 0x56, 0xd1 }}
/**
* The nsIDOMEventTarget interface is the interface implemented by all
* event targets in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-3-Events/
*/
class NS_NO_VTABLE nsIDOM3EventTarget : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOM3EVENTTARGET_IID)
/* void addGroupedEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in nsIDOMEventGroup evtGroup); */
NS_IMETHOD AddGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup) = 0;
/* void removeGroupedEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in nsIDOMEventGroup evtGroup); */
NS_IMETHOD RemoveGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup) = 0;
/* boolean canTrigger (in DOMString type); */
NS_IMETHOD CanTrigger(const nsAString & type, PRBool *_retval) = 0;
/* boolean isRegisteredHere (in DOMString type); */
NS_IMETHOD IsRegisteredHere(const nsAString & type, PRBool *_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOM3EVENTTARGET \
NS_IMETHOD AddGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup); \
NS_IMETHOD RemoveGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup); \
NS_IMETHOD CanTrigger(const nsAString & type, PRBool *_retval); \
NS_IMETHOD IsRegisteredHere(const nsAString & type, PRBool *_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOM3EVENTTARGET(_to) \
NS_IMETHOD AddGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup) { return _to AddGroupedEventListener(type, listener, useCapture, evtGroup); } \
NS_IMETHOD RemoveGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup) { return _to RemoveGroupedEventListener(type, listener, useCapture, evtGroup); } \
NS_IMETHOD CanTrigger(const nsAString & type, PRBool *_retval) { return _to CanTrigger(type, _retval); } \
NS_IMETHOD IsRegisteredHere(const nsAString & type, PRBool *_retval) { return _to IsRegisteredHere(type, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOM3EVENTTARGET(_to) \
NS_IMETHOD AddGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddGroupedEventListener(type, listener, useCapture, evtGroup); } \
NS_IMETHOD RemoveGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveGroupedEventListener(type, listener, useCapture, evtGroup); } \
NS_IMETHOD CanTrigger(const nsAString & type, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CanTrigger(type, _retval); } \
NS_IMETHOD IsRegisteredHere(const nsAString & type, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IsRegisteredHere(type, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOM3EventTarget : public nsIDOM3EventTarget
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOM3EVENTTARGET
nsDOM3EventTarget();
private:
~nsDOM3EventTarget();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOM3EventTarget, nsIDOM3EventTarget)
nsDOM3EventTarget::nsDOM3EventTarget()
{
/* member initializers and constructor code */
}
nsDOM3EventTarget::~nsDOM3EventTarget()
{
/* destructor code */
}
/* void addGroupedEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in nsIDOMEventGroup evtGroup); */
NS_IMETHODIMP nsDOM3EventTarget::AddGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void removeGroupedEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in nsIDOMEventGroup evtGroup); */
NS_IMETHODIMP nsDOM3EventTarget::RemoveGroupedEventListener(const nsAString & type, nsIDOMEventListener *listener, PRBool useCapture, nsIDOMEventGroup *evtGroup)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean canTrigger (in DOMString type); */
NS_IMETHODIMP nsDOM3EventTarget::CanTrigger(const nsAString & type, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean isRegisteredHere (in DOMString type); */
NS_IMETHODIMP nsDOM3EventTarget::IsRegisteredHere(const nsAString & type, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOM3EventTarget_h__ */

View File

@@ -0,0 +1,98 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/views/nsIDOMAbstractView.idl
*/
#ifndef __gen_nsIDOMAbstractView_h__
#define __gen_nsIDOMAbstractView_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMAbstractView */
#define NS_IDOMABSTRACTVIEW_IID_STR "f51ebade-8b1a-11d3-aae7-0010830123b4"
#define NS_IDOMABSTRACTVIEW_IID \
{0xf51ebade, 0x8b1a, 0x11d3, \
{ 0xaa, 0xe7, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 }}
class NS_NO_VTABLE nsIDOMAbstractView : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMABSTRACTVIEW_IID)
/**
* The nsIDOMAbstractView interface is a datatype for a view in the
* Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Views
*
* @status FROZEN
*/
/* readonly attribute nsIDOMDocumentView document; */
NS_IMETHOD GetDocument(nsIDOMDocumentView * *aDocument) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMABSTRACTVIEW \
NS_IMETHOD GetDocument(nsIDOMDocumentView * *aDocument);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMABSTRACTVIEW(_to) \
NS_IMETHOD GetDocument(nsIDOMDocumentView * *aDocument) { return _to GetDocument(aDocument); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMABSTRACTVIEW(_to) \
NS_IMETHOD GetDocument(nsIDOMDocumentView * *aDocument) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDocument(aDocument); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMAbstractView : public nsIDOMAbstractView
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMABSTRACTVIEW
nsDOMAbstractView();
private:
~nsDOMAbstractView();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMAbstractView, nsIDOMAbstractView)
nsDOMAbstractView::nsDOMAbstractView()
{
/* member initializers and constructor code */
}
nsDOMAbstractView::~nsDOMAbstractView()
{
/* destructor code */
}
/* readonly attribute nsIDOMDocumentView document; */
NS_IMETHODIMP nsDOMAbstractView::GetDocument(nsIDOMDocumentView * *aDocument)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMAbstractView_h__ */

View File

@@ -0,0 +1,143 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMAttr.idl
*/
#ifndef __gen_nsIDOMAttr_h__
#define __gen_nsIDOMAttr_h__
#ifndef __gen_nsIDOMNode_h__
#include "nsIDOMNode.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMAttr */
#define NS_IDOMATTR_IID_STR "a6cf9070-15b3-11d2-932e-00805f8add32"
#define NS_IDOMATTR_IID \
{0xa6cf9070, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMAttr : public nsIDOMNode {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMATTR_IID)
/**
* The nsIDOMAttr interface represents an attribute in an "Element" object.
* Typically the allowable values for the attribute are defined in a document
* type definition.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
*
* @status FROZEN
*/
/* readonly attribute DOMString name; */
NS_IMETHOD GetName(nsAString & aName) = 0;
/* readonly attribute boolean specified; */
NS_IMETHOD GetSpecified(PRBool *aSpecified) = 0;
/* attribute DOMString value; */
NS_IMETHOD GetValue(nsAString & aValue) = 0;
NS_IMETHOD SetValue(const nsAString & aValue) = 0;
/* readonly attribute nsIDOMElement ownerElement; */
NS_IMETHOD GetOwnerElement(nsIDOMElement * *aOwnerElement) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMATTR \
NS_IMETHOD GetName(nsAString & aName); \
NS_IMETHOD GetSpecified(PRBool *aSpecified); \
NS_IMETHOD GetValue(nsAString & aValue); \
NS_IMETHOD SetValue(const nsAString & aValue); \
NS_IMETHOD GetOwnerElement(nsIDOMElement * *aOwnerElement);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMATTR(_to) \
NS_IMETHOD GetName(nsAString & aName) { return _to GetName(aName); } \
NS_IMETHOD GetSpecified(PRBool *aSpecified) { return _to GetSpecified(aSpecified); } \
NS_IMETHOD GetValue(nsAString & aValue) { return _to GetValue(aValue); } \
NS_IMETHOD SetValue(const nsAString & aValue) { return _to SetValue(aValue); } \
NS_IMETHOD GetOwnerElement(nsIDOMElement * *aOwnerElement) { return _to GetOwnerElement(aOwnerElement); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMATTR(_to) \
NS_IMETHOD GetName(nsAString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
NS_IMETHOD GetSpecified(PRBool *aSpecified) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSpecified(aSpecified); } \
NS_IMETHOD GetValue(nsAString & aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetValue(aValue); } \
NS_IMETHOD SetValue(const nsAString & aValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetValue(aValue); } \
NS_IMETHOD GetOwnerElement(nsIDOMElement * *aOwnerElement) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOwnerElement(aOwnerElement); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMAttr : public nsIDOMAttr
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMATTR
nsDOMAttr();
private:
~nsDOMAttr();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMAttr, nsIDOMAttr)
nsDOMAttr::nsDOMAttr()
{
/* member initializers and constructor code */
}
nsDOMAttr::~nsDOMAttr()
{
/* destructor code */
}
/* readonly attribute DOMString name; */
NS_IMETHODIMP nsDOMAttr::GetName(nsAString & aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute boolean specified; */
NS_IMETHODIMP nsDOMAttr::GetSpecified(PRBool *aSpecified)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute DOMString value; */
NS_IMETHODIMP nsDOMAttr::GetValue(nsAString & aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMAttr::SetValue(const nsAString & aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMElement ownerElement; */
NS_IMETHODIMP nsDOMAttr::GetOwnerElement(nsIDOMElement * *aOwnerElement)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMAttr_h__ */

View File

@@ -0,0 +1,104 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/base/nsIDOMBarProp.idl
*/
#ifndef __gen_nsIDOMBarProp_h__
#define __gen_nsIDOMBarProp_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMBarProp */
#define NS_IDOMBARPROP_IID_STR "9eb2c150-1d56-11d3-8221-0060083a0bcf"
#define NS_IDOMBARPROP_IID \
{0x9eb2c150, 0x1d56, 0x11d3, \
{ 0x82, 0x21, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
class NS_NO_VTABLE nsIDOMBarProp : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMBARPROP_IID)
/**
* The nsIDOMBarProp interface is the interface for controlling and
* accessing the visibility of certain UI items (scrollbars, menubars,
* toolbars, ...) through the DOM.
*
* @status FROZEN
*/
/* attribute boolean visible; */
NS_IMETHOD GetVisible(PRBool *aVisible) = 0;
NS_IMETHOD SetVisible(PRBool aVisible) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMBARPROP \
NS_IMETHOD GetVisible(PRBool *aVisible); \
NS_IMETHOD SetVisible(PRBool aVisible);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMBARPROP(_to) \
NS_IMETHOD GetVisible(PRBool *aVisible) { return _to GetVisible(aVisible); } \
NS_IMETHOD SetVisible(PRBool aVisible) { return _to SetVisible(aVisible); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMBARPROP(_to) \
NS_IMETHOD GetVisible(PRBool *aVisible) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetVisible(aVisible); } \
NS_IMETHOD SetVisible(PRBool aVisible) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetVisible(aVisible); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMBarProp : public nsIDOMBarProp
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMBARPROP
nsDOMBarProp();
private:
~nsDOMBarProp();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMBarProp, nsIDOMBarProp)
nsDOMBarProp::nsDOMBarProp()
{
/* member initializers and constructor code */
}
nsDOMBarProp::~nsDOMBarProp()
{
/* destructor code */
}
/* attribute boolean visible; */
NS_IMETHODIMP nsDOMBarProp::GetVisible(PRBool *aVisible)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMBarProp::SetVisible(PRBool aVisible)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMBarProp_h__ */

View File

@@ -0,0 +1,80 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMCDATASection.idl
*/
#ifndef __gen_nsIDOMCDATASection_h__
#define __gen_nsIDOMCDATASection_h__
#ifndef __gen_nsIDOMText_h__
#include "nsIDOMText.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCDATASection */
#define NS_IDOMCDATASECTION_IID_STR "a6cf9071-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCDATASECTION_IID \
{0xa6cf9071, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMCDATASection : public nsIDOMText {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCDATASECTION_IID)
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCDATASECTION \
/* no methods! */
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCDATASECTION(_to) \
/* no methods! */
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCDATASECTION(_to) \
/* no methods! */
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCDATASection : public nsIDOMCDATASection
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCDATASECTION
nsDOMCDATASection();
private:
~nsDOMCDATASection();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCDATASection, nsIDOMCDATASection)
nsDOMCDATASection::nsDOMCDATASection()
{
/* member initializers and constructor code */
}
nsDOMCDATASection::~nsDOMCDATASection()
{
/* destructor code */
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCDATASection_h__ */

View File

@@ -0,0 +1,234 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSPrimitiveValue.idl
*/
#ifndef __gen_nsIDOMCSSPrimitiveValue_h__
#define __gen_nsIDOMCSSPrimitiveValue_h__
#ifndef __gen_nsIDOMCSSValue_h__
#include "nsIDOMCSSValue.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSPrimitiveValue */
#define NS_IDOMCSSPRIMITIVEVALUE_IID_STR "e249031f-8df9-4e7a-b644-18946dce0019"
#define NS_IDOMCSSPRIMITIVEVALUE_IID \
{0xe249031f, 0x8df9, 0x4e7a, \
{ 0xb6, 0x44, 0x18, 0x94, 0x6d, 0xce, 0x00, 0x19 }}
class NS_NO_VTABLE nsIDOMCSSPrimitiveValue : public nsIDOMCSSValue {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSPRIMITIVEVALUE_IID)
/**
* The nsIDOMCSSPrimitiveValue interface is a datatype for a primitive
* CSS value in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
enum { CSS_UNKNOWN = 0U };
enum { CSS_NUMBER = 1U };
enum { CSS_PERCENTAGE = 2U };
enum { CSS_EMS = 3U };
enum { CSS_EXS = 4U };
enum { CSS_PX = 5U };
enum { CSS_CM = 6U };
enum { CSS_MM = 7U };
enum { CSS_IN = 8U };
enum { CSS_PT = 9U };
enum { CSS_PC = 10U };
enum { CSS_DEG = 11U };
enum { CSS_RAD = 12U };
enum { CSS_GRAD = 13U };
enum { CSS_MS = 14U };
enum { CSS_S = 15U };
enum { CSS_HZ = 16U };
enum { CSS_KHZ = 17U };
enum { CSS_DIMENSION = 18U };
enum { CSS_STRING = 19U };
enum { CSS_URI = 20U };
enum { CSS_IDENT = 21U };
enum { CSS_ATTR = 22U };
enum { CSS_COUNTER = 23U };
enum { CSS_RECT = 24U };
enum { CSS_RGBCOLOR = 25U };
/* readonly attribute unsigned short primitiveType; */
NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType) = 0;
/* void setFloatValue (in unsigned short unitType, in float floatValue) raises (DOMException); */
NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue) = 0;
/* float getFloatValue (in unsigned short unitType) raises (DOMException); */
NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval) = 0;
/* void setStringValue (in unsigned short stringType, in DOMString stringValue) raises (DOMException); */
NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue) = 0;
/* DOMString getStringValue () raises (DOMException); */
NS_IMETHOD GetStringValue(nsAString & _retval) = 0;
/* nsIDOMCounter getCounterValue () raises (DOMException); */
NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval) = 0;
/* nsIDOMRect getRectValue () raises (DOMException); */
NS_IMETHOD GetRectValue(nsIDOMRect **_retval) = 0;
/* nsIDOMRGBColor getRGBColorValue () raises (DOMException); */
NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSPRIMITIVEVALUE \
NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType); \
NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue); \
NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval); \
NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue); \
NS_IMETHOD GetStringValue(nsAString & _retval); \
NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval); \
NS_IMETHOD GetRectValue(nsIDOMRect **_retval); \
NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSPRIMITIVEVALUE(_to) \
NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType) { return _to GetPrimitiveType(aPrimitiveType); } \
NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue) { return _to SetFloatValue(unitType, floatValue); } \
NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval) { return _to GetFloatValue(unitType, _retval); } \
NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue) { return _to SetStringValue(stringType, stringValue); } \
NS_IMETHOD GetStringValue(nsAString & _retval) { return _to GetStringValue(_retval); } \
NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval) { return _to GetCounterValue(_retval); } \
NS_IMETHOD GetRectValue(nsIDOMRect **_retval) { return _to GetRectValue(_retval); } \
NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval) { return _to GetRGBColorValue(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSPRIMITIVEVALUE(_to) \
NS_IMETHOD GetPrimitiveType(PRUint16 *aPrimitiveType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPrimitiveType(aPrimitiveType); } \
NS_IMETHOD SetFloatValue(PRUint16 unitType, float floatValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetFloatValue(unitType, floatValue); } \
NS_IMETHOD GetFloatValue(PRUint16 unitType, float *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFloatValue(unitType, _retval); } \
NS_IMETHOD SetStringValue(PRUint16 stringType, const nsAString & stringValue) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetStringValue(stringType, stringValue); } \
NS_IMETHOD GetStringValue(nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStringValue(_retval); } \
NS_IMETHOD GetCounterValue(nsIDOMCounter **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCounterValue(_retval); } \
NS_IMETHOD GetRectValue(nsIDOMRect **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRectValue(_retval); } \
NS_IMETHOD GetRGBColorValue(nsIDOMRGBColor **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetRGBColorValue(_retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSPrimitiveValue : public nsIDOMCSSPrimitiveValue
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSPRIMITIVEVALUE
nsDOMCSSPrimitiveValue();
private:
~nsDOMCSSPrimitiveValue();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSPrimitiveValue, nsIDOMCSSPrimitiveValue)
nsDOMCSSPrimitiveValue::nsDOMCSSPrimitiveValue()
{
/* member initializers and constructor code */
}
nsDOMCSSPrimitiveValue::~nsDOMCSSPrimitiveValue()
{
/* destructor code */
}
/* readonly attribute unsigned short primitiveType; */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetPrimitiveType(PRUint16 *aPrimitiveType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setFloatValue (in unsigned short unitType, in float floatValue) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::SetFloatValue(PRUint16 unitType, float floatValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* float getFloatValue (in unsigned short unitType) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetFloatValue(PRUint16 unitType, float *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setStringValue (in unsigned short stringType, in DOMString stringValue) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::SetStringValue(PRUint16 stringType, const nsAString & stringValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getStringValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetStringValue(nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMCounter getCounterValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetCounterValue(nsIDOMCounter **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMRect getRectValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetRectValue(nsIDOMRect **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMRGBColor getRGBColorValue () raises (DOMException); */
NS_IMETHODIMP nsDOMCSSPrimitiveValue::GetRGBColorValue(nsIDOMRGBColor **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSPrimitiveValue_h__ */

View File

@@ -0,0 +1,156 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSRule.idl
*/
#ifndef __gen_nsIDOMCSSRule_h__
#define __gen_nsIDOMCSSRule_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSRule */
#define NS_IDOMCSSRULE_IID_STR "a6cf90c1-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCSSRULE_IID \
{0xa6cf90c1, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMCSSRule : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSRULE_IID)
/**
* The nsIDOMCSSRule interface is a datatype for a CSS style rule in
* the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
enum { UNKNOWN_RULE = 0U };
enum { STYLE_RULE = 1U };
enum { CHARSET_RULE = 2U };
enum { IMPORT_RULE = 3U };
enum { MEDIA_RULE = 4U };
enum { FONT_FACE_RULE = 5U };
enum { PAGE_RULE = 6U };
/* readonly attribute unsigned short type; */
NS_IMETHOD GetType(PRUint16 *aType) = 0;
/* attribute DOMString cssText; */
NS_IMETHOD GetCssText(nsAString & aCssText) = 0;
NS_IMETHOD SetCssText(const nsAString & aCssText) = 0;
/* readonly attribute nsIDOMCSSStyleSheet parentStyleSheet; */
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet * *aParentStyleSheet) = 0;
/* readonly attribute nsIDOMCSSRule parentRule; */
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSRULE \
NS_IMETHOD GetType(PRUint16 *aType); \
NS_IMETHOD GetCssText(nsAString & aCssText); \
NS_IMETHOD SetCssText(const nsAString & aCssText); \
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet * *aParentStyleSheet); \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSRULE(_to) \
NS_IMETHOD GetType(PRUint16 *aType) { return _to GetType(aType); } \
NS_IMETHOD GetCssText(nsAString & aCssText) { return _to GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsAString & aCssText) { return _to SetCssText(aCssText); } \
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet * *aParentStyleSheet) { return _to GetParentStyleSheet(aParentStyleSheet); } \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) { return _to GetParentRule(aParentRule); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSRULE(_to) \
NS_IMETHOD GetType(PRUint16 *aType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetType(aType); } \
NS_IMETHOD GetCssText(nsAString & aCssText) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsAString & aCssText) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCssText(aCssText); } \
NS_IMETHOD GetParentStyleSheet(nsIDOMCSSStyleSheet * *aParentStyleSheet) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParentStyleSheet(aParentStyleSheet); } \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParentRule(aParentRule); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSRule : public nsIDOMCSSRule
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSRULE
nsDOMCSSRule();
private:
~nsDOMCSSRule();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSRule, nsIDOMCSSRule)
nsDOMCSSRule::nsDOMCSSRule()
{
/* member initializers and constructor code */
}
nsDOMCSSRule::~nsDOMCSSRule()
{
/* destructor code */
}
/* readonly attribute unsigned short type; */
NS_IMETHODIMP nsDOMCSSRule::GetType(PRUint16 *aType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute DOMString cssText; */
NS_IMETHODIMP nsDOMCSSRule::GetCssText(nsAString & aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMCSSRule::SetCssText(const nsAString & aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMCSSStyleSheet parentStyleSheet; */
NS_IMETHODIMP nsDOMCSSRule::GetParentStyleSheet(nsIDOMCSSStyleSheet * *aParentStyleSheet)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMCSSRule parentRule; */
NS_IMETHODIMP nsDOMCSSRule::GetParentRule(nsIDOMCSSRule * *aParentRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSRule_h__ */

View File

@@ -0,0 +1,110 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSRuleList.idl
*/
#ifndef __gen_nsIDOMCSSRuleList_h__
#define __gen_nsIDOMCSSRuleList_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSRuleList */
#define NS_IDOMCSSRULELIST_IID_STR "a6cf90c0-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCSSRULELIST_IID \
{0xa6cf90c0, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMCSSRuleList : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSRULELIST_IID)
/**
* The nsIDOMCSSRuleList interface is a datatype for a list of CSS
* style rules in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
/* readonly attribute unsigned long length; */
NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
/* nsIDOMCSSRule item (in unsigned long index); */
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSRule **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSRULELIST \
NS_IMETHOD GetLength(PRUint32 *aLength); \
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSRule **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSRULELIST(_to) \
NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSRule **_retval) { return _to Item(index, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSRULELIST(_to) \
NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSRule **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Item(index, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSRuleList : public nsIDOMCSSRuleList
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSRULELIST
nsDOMCSSRuleList();
private:
~nsDOMCSSRuleList();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSRuleList, nsIDOMCSSRuleList)
nsDOMCSSRuleList::nsDOMCSSRuleList()
{
/* member initializers and constructor code */
}
nsDOMCSSRuleList::~nsDOMCSSRuleList()
{
/* destructor code */
}
/* readonly attribute unsigned long length; */
NS_IMETHODIMP nsDOMCSSRuleList::GetLength(PRUint32 *aLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMCSSRule item (in unsigned long index); */
NS_IMETHODIMP nsDOMCSSRuleList::Item(PRUint32 index, nsIDOMCSSRule **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSRuleList_h__ */

View File

@@ -0,0 +1,202 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSStyleDeclaration.idl
*/
#ifndef __gen_nsIDOMCSSStyleDeclaration_h__
#define __gen_nsIDOMCSSStyleDeclaration_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSStyleDeclaration */
#define NS_IDOMCSSSTYLEDECLARATION_IID_STR "a6cf90be-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCSSSTYLEDECLARATION_IID \
{0xa6cf90be, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMCSSStyleDeclaration : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSSTYLEDECLARATION_IID)
/**
* The nsIDOMCSSStyleDeclaration interface is a datatype for a CSS
* style declaration in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
/* attribute DOMString cssText; */
NS_IMETHOD GetCssText(nsAString & aCssText) = 0;
NS_IMETHOD SetCssText(const nsAString & aCssText) = 0;
/* DOMString getPropertyValue (in DOMString propertyName); */
NS_IMETHOD GetPropertyValue(const nsAString & propertyName, nsAString & _retval) = 0;
/* nsIDOMCSSValue getPropertyCSSValue (in DOMString propertyName); */
NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName, nsIDOMCSSValue **_retval) = 0;
/* DOMString removeProperty (in DOMString propertyName) raises (DOMException); */
NS_IMETHOD RemoveProperty(const nsAString & propertyName, nsAString & _retval) = 0;
/* DOMString getPropertyPriority (in DOMString propertyName); */
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName, nsAString & _retval) = 0;
/* void setProperty (in DOMString propertyName, in DOMString value, in DOMString priority) raises (DOMException); */
NS_IMETHOD SetProperty(const nsAString & propertyName, const nsAString & value, const nsAString & priority) = 0;
/* readonly attribute unsigned long length; */
NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
/* DOMString item (in unsigned long index); */
NS_IMETHOD Item(PRUint32 index, nsAString & _retval) = 0;
/* readonly attribute nsIDOMCSSRule parentRule; */
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSSTYLEDECLARATION \
NS_IMETHOD GetCssText(nsAString & aCssText); \
NS_IMETHOD SetCssText(const nsAString & aCssText); \
NS_IMETHOD GetPropertyValue(const nsAString & propertyName, nsAString & _retval); \
NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName, nsIDOMCSSValue **_retval); \
NS_IMETHOD RemoveProperty(const nsAString & propertyName, nsAString & _retval); \
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName, nsAString & _retval); \
NS_IMETHOD SetProperty(const nsAString & propertyName, const nsAString & value, const nsAString & priority); \
NS_IMETHOD GetLength(PRUint32 *aLength); \
NS_IMETHOD Item(PRUint32 index, nsAString & _retval); \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSSTYLEDECLARATION(_to) \
NS_IMETHOD GetCssText(nsAString & aCssText) { return _to GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsAString & aCssText) { return _to SetCssText(aCssText); } \
NS_IMETHOD GetPropertyValue(const nsAString & propertyName, nsAString & _retval) { return _to GetPropertyValue(propertyName, _retval); } \
NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName, nsIDOMCSSValue **_retval) { return _to GetPropertyCSSValue(propertyName, _retval); } \
NS_IMETHOD RemoveProperty(const nsAString & propertyName, nsAString & _retval) { return _to RemoveProperty(propertyName, _retval); } \
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName, nsAString & _retval) { return _to GetPropertyPriority(propertyName, _retval); } \
NS_IMETHOD SetProperty(const nsAString & propertyName, const nsAString & value, const nsAString & priority) { return _to SetProperty(propertyName, value, priority); } \
NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
NS_IMETHOD Item(PRUint32 index, nsAString & _retval) { return _to Item(index, _retval); } \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) { return _to GetParentRule(aParentRule); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSSTYLEDECLARATION(_to) \
NS_IMETHOD GetCssText(nsAString & aCssText) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsAString & aCssText) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCssText(aCssText); } \
NS_IMETHOD GetPropertyValue(const nsAString & propertyName, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPropertyValue(propertyName, _retval); } \
NS_IMETHOD GetPropertyCSSValue(const nsAString & propertyName, nsIDOMCSSValue **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPropertyCSSValue(propertyName, _retval); } \
NS_IMETHOD RemoveProperty(const nsAString & propertyName, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveProperty(propertyName, _retval); } \
NS_IMETHOD GetPropertyPriority(const nsAString & propertyName, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPropertyPriority(propertyName, _retval); } \
NS_IMETHOD SetProperty(const nsAString & propertyName, const nsAString & value, const nsAString & priority) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetProperty(propertyName, value, priority); } \
NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
NS_IMETHOD Item(PRUint32 index, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Item(index, _retval); } \
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetParentRule(aParentRule); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSStyleDeclaration : public nsIDOMCSSStyleDeclaration
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSSTYLEDECLARATION
nsDOMCSSStyleDeclaration();
private:
~nsDOMCSSStyleDeclaration();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSStyleDeclaration, nsIDOMCSSStyleDeclaration)
nsDOMCSSStyleDeclaration::nsDOMCSSStyleDeclaration()
{
/* member initializers and constructor code */
}
nsDOMCSSStyleDeclaration::~nsDOMCSSStyleDeclaration()
{
/* destructor code */
}
/* attribute DOMString cssText; */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::GetCssText(nsAString & aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMCSSStyleDeclaration::SetCssText(const nsAString & aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getPropertyValue (in DOMString propertyName); */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::GetPropertyValue(const nsAString & propertyName, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMCSSValue getPropertyCSSValue (in DOMString propertyName); */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::GetPropertyCSSValue(const nsAString & propertyName, nsIDOMCSSValue **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString removeProperty (in DOMString propertyName) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::RemoveProperty(const nsAString & propertyName, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString getPropertyPriority (in DOMString propertyName); */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::GetPropertyPriority(const nsAString & propertyName, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setProperty (in DOMString propertyName, in DOMString value, in DOMString priority) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::SetProperty(const nsAString & propertyName, const nsAString & value, const nsAString & priority)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long length; */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::GetLength(PRUint32 *aLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString item (in unsigned long index); */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::Item(PRUint32 index, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMCSSRule parentRule; */
NS_IMETHODIMP nsDOMCSSStyleDeclaration::GetParentRule(nsIDOMCSSRule * *aParentRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSStyleDeclaration_h__ */

View File

@@ -0,0 +1,134 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSStyleSheet.idl
*/
#ifndef __gen_nsIDOMCSSStyleSheet_h__
#define __gen_nsIDOMCSSStyleSheet_h__
#ifndef __gen_nsIDOMStyleSheet_h__
#include "nsIDOMStyleSheet.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSStyleSheet */
#define NS_IDOMCSSSTYLESHEET_IID_STR "a6cf90c2-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCSSSTYLESHEET_IID \
{0xa6cf90c2, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMCSSStyleSheet : public nsIDOMStyleSheet {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSSTYLESHEET_IID)
/**
* The nsIDOMCSSStyleSheet interface is a datatype for a CSS style
* sheet in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
/* readonly attribute nsIDOMCSSRule ownerRule; */
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule * *aOwnerRule) = 0;
/* readonly attribute nsIDOMCSSRuleList cssRules; */
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList * *aCssRules) = 0;
/* unsigned long insertRule (in DOMString rule, in unsigned long index) raises (DOMException); */
NS_IMETHOD InsertRule(const nsAString & rule, PRUint32 index, PRUint32 *_retval) = 0;
/* void deleteRule (in unsigned long index) raises (DOMException); */
NS_IMETHOD DeleteRule(PRUint32 index) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSSTYLESHEET \
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule * *aOwnerRule); \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList * *aCssRules); \
NS_IMETHOD InsertRule(const nsAString & rule, PRUint32 index, PRUint32 *_retval); \
NS_IMETHOD DeleteRule(PRUint32 index);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSSTYLESHEET(_to) \
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule * *aOwnerRule) { return _to GetOwnerRule(aOwnerRule); } \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList * *aCssRules) { return _to GetCssRules(aCssRules); } \
NS_IMETHOD InsertRule(const nsAString & rule, PRUint32 index, PRUint32 *_retval) { return _to InsertRule(rule, index, _retval); } \
NS_IMETHOD DeleteRule(PRUint32 index) { return _to DeleteRule(index); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSSTYLESHEET(_to) \
NS_IMETHOD GetOwnerRule(nsIDOMCSSRule * *aOwnerRule) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOwnerRule(aOwnerRule); } \
NS_IMETHOD GetCssRules(nsIDOMCSSRuleList * *aCssRules) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCssRules(aCssRules); } \
NS_IMETHOD InsertRule(const nsAString & rule, PRUint32 index, PRUint32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->InsertRule(rule, index, _retval); } \
NS_IMETHOD DeleteRule(PRUint32 index) { return !_to ? NS_ERROR_NULL_POINTER : _to->DeleteRule(index); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSStyleSheet : public nsIDOMCSSStyleSheet
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSSTYLESHEET
nsDOMCSSStyleSheet();
private:
~nsDOMCSSStyleSheet();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSStyleSheet, nsIDOMCSSStyleSheet)
nsDOMCSSStyleSheet::nsDOMCSSStyleSheet()
{
/* member initializers and constructor code */
}
nsDOMCSSStyleSheet::~nsDOMCSSStyleSheet()
{
/* destructor code */
}
/* readonly attribute nsIDOMCSSRule ownerRule; */
NS_IMETHODIMP nsDOMCSSStyleSheet::GetOwnerRule(nsIDOMCSSRule * *aOwnerRule)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMCSSRuleList cssRules; */
NS_IMETHODIMP nsDOMCSSStyleSheet::GetCssRules(nsIDOMCSSRuleList * *aCssRules)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* unsigned long insertRule (in DOMString rule, in unsigned long index) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSStyleSheet::InsertRule(const nsAString & rule, PRUint32 index, PRUint32 *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void deleteRule (in unsigned long index) raises (DOMException); */
NS_IMETHODIMP nsDOMCSSStyleSheet::DeleteRule(PRUint32 index)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSStyleSheet_h__ */

View File

@@ -0,0 +1,126 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSValue.idl
*/
#ifndef __gen_nsIDOMCSSValue_h__
#define __gen_nsIDOMCSSValue_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSValue */
#define NS_IDOMCSSVALUE_IID_STR "009f7ea5-9e80-41be-b008-db62f10823f2"
#define NS_IDOMCSSVALUE_IID \
{0x009f7ea5, 0x9e80, 0x41be, \
{ 0xb0, 0x08, 0xdb, 0x62, 0xf1, 0x08, 0x23, 0xf2 }}
class NS_NO_VTABLE nsIDOMCSSValue : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSVALUE_IID)
/**
* The nsIDOMCSSValue interface is a datatype for a CSS value in the
* Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
enum { CSS_INHERIT = 0U };
enum { CSS_PRIMITIVE_VALUE = 1U };
enum { CSS_VALUE_LIST = 2U };
enum { CSS_CUSTOM = 3U };
/* attribute DOMString cssText; */
NS_IMETHOD GetCssText(nsAString & aCssText) = 0;
NS_IMETHOD SetCssText(const nsAString & aCssText) = 0;
/* readonly attribute unsigned short cssValueType; */
NS_IMETHOD GetCssValueType(PRUint16 *aCssValueType) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSVALUE \
NS_IMETHOD GetCssText(nsAString & aCssText); \
NS_IMETHOD SetCssText(const nsAString & aCssText); \
NS_IMETHOD GetCssValueType(PRUint16 *aCssValueType);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSVALUE(_to) \
NS_IMETHOD GetCssText(nsAString & aCssText) { return _to GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsAString & aCssText) { return _to SetCssText(aCssText); } \
NS_IMETHOD GetCssValueType(PRUint16 *aCssValueType) { return _to GetCssValueType(aCssValueType); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSVALUE(_to) \
NS_IMETHOD GetCssText(nsAString & aCssText) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCssText(aCssText); } \
NS_IMETHOD SetCssText(const nsAString & aCssText) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCssText(aCssText); } \
NS_IMETHOD GetCssValueType(PRUint16 *aCssValueType) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCssValueType(aCssValueType); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSValue : public nsIDOMCSSValue
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSVALUE
nsDOMCSSValue();
private:
~nsDOMCSSValue();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSValue, nsIDOMCSSValue)
nsDOMCSSValue::nsDOMCSSValue()
{
/* member initializers and constructor code */
}
nsDOMCSSValue::~nsDOMCSSValue()
{
/* destructor code */
}
/* attribute DOMString cssText; */
NS_IMETHODIMP nsDOMCSSValue::GetCssText(nsAString & aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMCSSValue::SetCssText(const nsAString & aCssText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned short cssValueType; */
NS_IMETHODIMP nsDOMCSSValue::GetCssValueType(PRUint16 *aCssValueType)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSValue_h__ */

View File

@@ -0,0 +1,110 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/css/nsIDOMCSSValueList.idl
*/
#ifndef __gen_nsIDOMCSSValueList_h__
#define __gen_nsIDOMCSSValueList_h__
#ifndef __gen_nsIDOMCSSValue_h__
#include "nsIDOMCSSValue.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCSSValueList */
#define NS_IDOMCSSVALUELIST_IID_STR "8f09fa84-39b9-4dca-9b2f-db0eeb186286"
#define NS_IDOMCSSVALUELIST_IID \
{0x8f09fa84, 0x39b9, 0x4dca, \
{ 0x9b, 0x2f, 0xdb, 0x0e, 0xeb, 0x18, 0x62, 0x86 }}
class NS_NO_VTABLE nsIDOMCSSValueList : public nsIDOMCSSValue {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCSSVALUELIST_IID)
/**
* The nsIDOMCSSValueList interface is a datatype for a list of CSS
* values in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Style
*
* @status FROZEN
*/
/* readonly attribute unsigned long length; */
NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
/* nsIDOMCSSValue item (in unsigned long index); */
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSValue **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCSSVALUELIST \
NS_IMETHOD GetLength(PRUint32 *aLength); \
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSValue **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCSSVALUELIST(_to) \
NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSValue **_retval) { return _to Item(index, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCSSVALUELIST(_to) \
NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
NS_IMETHOD Item(PRUint32 index, nsIDOMCSSValue **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Item(index, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCSSValueList : public nsIDOMCSSValueList
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCSSVALUELIST
nsDOMCSSValueList();
private:
~nsDOMCSSValueList();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCSSValueList, nsIDOMCSSValueList)
nsDOMCSSValueList::nsDOMCSSValueList()
{
/* member initializers and constructor code */
}
nsDOMCSSValueList::~nsDOMCSSValueList()
{
/* destructor code */
}
/* readonly attribute unsigned long length; */
NS_IMETHODIMP nsDOMCSSValueList::GetLength(PRUint32 *aLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMCSSValue item (in unsigned long index); */
NS_IMETHODIMP nsDOMCSSValueList::Item(PRUint32 index, nsIDOMCSSValue **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCSSValueList_h__ */

View File

@@ -0,0 +1,178 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMCharacterData.idl
*/
#ifndef __gen_nsIDOMCharacterData_h__
#define __gen_nsIDOMCharacterData_h__
#ifndef __gen_nsIDOMNode_h__
#include "nsIDOMNode.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCharacterData */
#define NS_IDOMCHARACTERDATA_IID_STR "a6cf9072-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCHARACTERDATA_IID \
{0xa6cf9072, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMCharacterData : public nsIDOMNode {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCHARACTERDATA_IID)
/**
* The nsIDOMCharacterData interface extends nsIDOMNode with a set of
* attributes and methods for accessing character data in the DOM.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
*
* @status FROZEN
*/
/* attribute DOMString data; */
NS_IMETHOD GetData(nsAString & aData) = 0;
NS_IMETHOD SetData(const nsAString & aData) = 0;
/* readonly attribute unsigned long length; */
NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
/* DOMString substringData (in unsigned long offset, in unsigned long count) raises (DOMException); */
NS_IMETHOD SubstringData(PRUint32 offset, PRUint32 count, nsAString & _retval) = 0;
/* void appendData (in DOMString arg) raises (DOMException); */
NS_IMETHOD AppendData(const nsAString & arg) = 0;
/* void insertData (in unsigned long offset, in DOMString arg) raises (DOMException); */
NS_IMETHOD InsertData(PRUint32 offset, const nsAString & arg) = 0;
/* void deleteData (in unsigned long offset, in unsigned long count) raises (DOMException); */
NS_IMETHOD DeleteData(PRUint32 offset, PRUint32 count) = 0;
/* void replaceData (in unsigned long offset, in unsigned long count, in DOMString arg) raises (DOMException); */
NS_IMETHOD ReplaceData(PRUint32 offset, PRUint32 count, const nsAString & arg) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCHARACTERDATA \
NS_IMETHOD GetData(nsAString & aData); \
NS_IMETHOD SetData(const nsAString & aData); \
NS_IMETHOD GetLength(PRUint32 *aLength); \
NS_IMETHOD SubstringData(PRUint32 offset, PRUint32 count, nsAString & _retval); \
NS_IMETHOD AppendData(const nsAString & arg); \
NS_IMETHOD InsertData(PRUint32 offset, const nsAString & arg); \
NS_IMETHOD DeleteData(PRUint32 offset, PRUint32 count); \
NS_IMETHOD ReplaceData(PRUint32 offset, PRUint32 count, const nsAString & arg);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCHARACTERDATA(_to) \
NS_IMETHOD GetData(nsAString & aData) { return _to GetData(aData); } \
NS_IMETHOD SetData(const nsAString & aData) { return _to SetData(aData); } \
NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
NS_IMETHOD SubstringData(PRUint32 offset, PRUint32 count, nsAString & _retval) { return _to SubstringData(offset, count, _retval); } \
NS_IMETHOD AppendData(const nsAString & arg) { return _to AppendData(arg); } \
NS_IMETHOD InsertData(PRUint32 offset, const nsAString & arg) { return _to InsertData(offset, arg); } \
NS_IMETHOD DeleteData(PRUint32 offset, PRUint32 count) { return _to DeleteData(offset, count); } \
NS_IMETHOD ReplaceData(PRUint32 offset, PRUint32 count, const nsAString & arg) { return _to ReplaceData(offset, count, arg); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCHARACTERDATA(_to) \
NS_IMETHOD GetData(nsAString & aData) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetData(aData); } \
NS_IMETHOD SetData(const nsAString & aData) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetData(aData); } \
NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
NS_IMETHOD SubstringData(PRUint32 offset, PRUint32 count, nsAString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->SubstringData(offset, count, _retval); } \
NS_IMETHOD AppendData(const nsAString & arg) { return !_to ? NS_ERROR_NULL_POINTER : _to->AppendData(arg); } \
NS_IMETHOD InsertData(PRUint32 offset, const nsAString & arg) { return !_to ? NS_ERROR_NULL_POINTER : _to->InsertData(offset, arg); } \
NS_IMETHOD DeleteData(PRUint32 offset, PRUint32 count) { return !_to ? NS_ERROR_NULL_POINTER : _to->DeleteData(offset, count); } \
NS_IMETHOD ReplaceData(PRUint32 offset, PRUint32 count, const nsAString & arg) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReplaceData(offset, count, arg); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCharacterData : public nsIDOMCharacterData
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCHARACTERDATA
nsDOMCharacterData();
private:
~nsDOMCharacterData();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCharacterData, nsIDOMCharacterData)
nsDOMCharacterData::nsDOMCharacterData()
{
/* member initializers and constructor code */
}
nsDOMCharacterData::~nsDOMCharacterData()
{
/* destructor code */
}
/* attribute DOMString data; */
NS_IMETHODIMP nsDOMCharacterData::GetData(nsAString & aData)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMCharacterData::SetData(const nsAString & aData)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute unsigned long length; */
NS_IMETHODIMP nsDOMCharacterData::GetLength(PRUint32 *aLength)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* DOMString substringData (in unsigned long offset, in unsigned long count) raises (DOMException); */
NS_IMETHODIMP nsDOMCharacterData::SubstringData(PRUint32 offset, PRUint32 count, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void appendData (in DOMString arg) raises (DOMException); */
NS_IMETHODIMP nsDOMCharacterData::AppendData(const nsAString & arg)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void insertData (in unsigned long offset, in DOMString arg) raises (DOMException); */
NS_IMETHODIMP nsDOMCharacterData::InsertData(PRUint32 offset, const nsAString & arg)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void deleteData (in unsigned long offset, in unsigned long count) raises (DOMException); */
NS_IMETHODIMP nsDOMCharacterData::DeleteData(PRUint32 offset, PRUint32 count)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void replaceData (in unsigned long offset, in unsigned long count, in DOMString arg) raises (DOMException); */
NS_IMETHODIMP nsDOMCharacterData::ReplaceData(PRUint32 offset, PRUint32 count, const nsAString & arg)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCharacterData_h__ */

View File

@@ -0,0 +1,80 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMComment.idl
*/
#ifndef __gen_nsIDOMComment_h__
#define __gen_nsIDOMComment_h__
#ifndef __gen_nsIDOMCharacterData_h__
#include "nsIDOMCharacterData.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMComment */
#define NS_IDOMCOMMENT_IID_STR "a6cf9073-15b3-11d2-932e-00805f8add32"
#define NS_IDOMCOMMENT_IID \
{0xa6cf9073, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMComment : public nsIDOMCharacterData {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCOMMENT_IID)
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCOMMENT \
/* no methods! */
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCOMMENT(_to) \
/* no methods! */
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCOMMENT(_to) \
/* no methods! */
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMComment : public nsIDOMComment
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCOMMENT
nsDOMComment();
private:
~nsDOMComment();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMComment, nsIDOMComment)
nsDOMComment::nsDOMComment()
{
/* member initializers and constructor code */
}
nsDOMComment::~nsDOMComment()
{
/* destructor code */
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMComment_h__ */

View File

@@ -0,0 +1,108 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/events/nsIDOMCustomEvent.idl
*/
#ifndef __gen_nsIDOMCustomEvent_h__
#define __gen_nsIDOMCustomEvent_h__
#ifndef __gen_nsIDOMEvent_h__
#include "nsIDOMEvent.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMCustomEvent */
#define NS_IDOMCUSTOMEVENT_IID_STR "55c7af7b-1a64-40bf-87eb-2c2cbee0491b"
#define NS_IDOMCUSTOMEVENT_IID \
{0x55c7af7b, 0x1a64, 0x40bf, \
{ 0x87, 0xeb, 0x2c, 0x2c, 0xbe, 0xe0, 0x49, 0x1b }}
/**
* The nsIDOMEventTarget interface is the interface implemented by all
* event targets in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-3-Events/
*/
class NS_NO_VTABLE nsIDOMCustomEvent : public nsIDOMEvent {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCUSTOMEVENT_IID)
/* void setCurrentTarget (in nsIDOMNode target); */
NS_IMETHOD SetCurrentTarget(nsIDOMNode *target) = 0;
/* void setEventPhase (in unsigned short phase); */
NS_IMETHOD SetEventPhase(PRUint16 phase) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMCUSTOMEVENT \
NS_IMETHOD SetCurrentTarget(nsIDOMNode *target); \
NS_IMETHOD SetEventPhase(PRUint16 phase);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMCUSTOMEVENT(_to) \
NS_IMETHOD SetCurrentTarget(nsIDOMNode *target) { return _to SetCurrentTarget(target); } \
NS_IMETHOD SetEventPhase(PRUint16 phase) { return _to SetEventPhase(phase); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMCUSTOMEVENT(_to) \
NS_IMETHOD SetCurrentTarget(nsIDOMNode *target) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetCurrentTarget(target); } \
NS_IMETHOD SetEventPhase(PRUint16 phase) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetEventPhase(phase); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMCustomEvent : public nsIDOMCustomEvent
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMCUSTOMEVENT
nsDOMCustomEvent();
private:
~nsDOMCustomEvent();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMCustomEvent, nsIDOMCustomEvent)
nsDOMCustomEvent::nsDOMCustomEvent()
{
/* member initializers and constructor code */
}
nsDOMCustomEvent::~nsDOMCustomEvent()
{
/* destructor code */
}
/* void setCurrentTarget (in nsIDOMNode target); */
NS_IMETHODIMP nsDOMCustomEvent::SetCurrentTarget(nsIDOMNode *target)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setEventPhase (in unsigned short phase); */
NS_IMETHODIMP nsDOMCustomEvent::SetEventPhase(PRUint16 phase)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMCustomEvent_h__ */

View File

@@ -0,0 +1,136 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMDOMException.idl
*/
#ifndef __gen_nsIDOMDOMException_h__
#define __gen_nsIDOMDOMException_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDOMException */
#define NS_IDOMDOMEXCEPTION_IID_STR "a6cf910a-15b3-11d2-932e-00805f8add32"
#define NS_IDOMDOMEXCEPTION_IID \
{0xa6cf910a, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
/**
* In general, DOM methods return specific error values in ordinary
* processing situations, such as out-of-bound errors.
* However, DOM operations can raise exceptions in "exceptional"
* circumstances, i.e., when an operation is impossible to perform
* (either for logical reasons, because data is lost, or because the
* implementation has become unstable)
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-3-Core/
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIDOMDOMException : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDOMEXCEPTION_IID)
enum { INDEX_SIZE_ERR = 1U };
enum { DOMSTRING_SIZE_ERR = 2U };
enum { HIERARCHY_REQUEST_ERR = 3U };
enum { WRONG_DOCUMENT_ERR = 4U };
enum { INVALID_CHARACTER_ERR = 5U };
enum { NO_DATA_ALLOWED_ERR = 6U };
enum { NO_MODIFICATION_ALLOWED_ERR = 7U };
enum { NOT_FOUND_ERR = 8U };
enum { NOT_SUPPORTED_ERR = 9U };
enum { INUSE_ATTRIBUTE_ERR = 10U };
enum { INVALID_STATE_ERR = 11U };
enum { SYNTAX_ERR = 12U };
enum { INVALID_MODIFICATION_ERR = 13U };
enum { NAMESPACE_ERR = 14U };
enum { INVALID_ACCESS_ERR = 15U };
enum { VALIDATION_ERR = 16U };
enum { TYPE_MISMATCH_ERR = 17U };
/* readonly attribute unsigned long code; */
NS_IMETHOD GetCode(PRUint32 *aCode) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOMEXCEPTION \
NS_IMETHOD GetCode(PRUint32 *aCode);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOMEXCEPTION(_to) \
NS_IMETHOD GetCode(PRUint32 *aCode) { return _to GetCode(aCode); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOMEXCEPTION(_to) \
NS_IMETHOD GetCode(PRUint32 *aCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetCode(aCode); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDOMException : public nsIDOMDOMException
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOMEXCEPTION
nsDOMDOMException();
private:
~nsDOMDOMException();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDOMException, nsIDOMDOMException)
nsDOMDOMException::nsDOMDOMException()
{
/* member initializers and constructor code */
}
nsDOMDOMException::~nsDOMDOMException()
{
/* destructor code */
}
/* readonly attribute unsigned long code; */
NS_IMETHODIMP nsDOMDOMException::GetCode(PRUint32 *aCode)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDOMException_h__ */

View File

@@ -0,0 +1,123 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMDOMImplementation.idl
*/
#ifndef __gen_nsIDOMDOMImplementation_h__
#define __gen_nsIDOMDOMImplementation_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDOMImplementation */
#define NS_IDOMDOMIMPLEMENTATION_IID_STR "a6cf9074-15b3-11d2-932e-00805f8add32"
#define NS_IDOMDOMIMPLEMENTATION_IID \
{0xa6cf9074, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMDOMImplementation : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDOMIMPLEMENTATION_IID)
/**
* The nsIDOMDOMImplementation interface provides a number of methods for
* performing operations that are independent of any particular instance
* of the document object model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
*
* @status FROZEN
*/
/* boolean hasFeature (in DOMString feature, in DOMString version); */
NS_IMETHOD HasFeature(const nsAString & feature, const nsAString & version, PRBool *_retval) = 0;
/* nsIDOMDocumentType createDocumentType (in DOMString qualifiedName, in DOMString publicId, in DOMString systemId) raises (DOMException); */
NS_IMETHOD CreateDocumentType(const nsAString & qualifiedName, const nsAString & publicId, const nsAString & systemId, nsIDOMDocumentType **_retval) = 0;
/* nsIDOMDocument createDocument (in DOMString namespaceURI, in DOMString qualifiedName, in nsIDOMDocumentType doctype) raises (DOMException); */
NS_IMETHOD CreateDocument(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMDocumentType *doctype, nsIDOMDocument **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOMIMPLEMENTATION \
NS_IMETHOD HasFeature(const nsAString & feature, const nsAString & version, PRBool *_retval); \
NS_IMETHOD CreateDocumentType(const nsAString & qualifiedName, const nsAString & publicId, const nsAString & systemId, nsIDOMDocumentType **_retval); \
NS_IMETHOD CreateDocument(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMDocumentType *doctype, nsIDOMDocument **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOMIMPLEMENTATION(_to) \
NS_IMETHOD HasFeature(const nsAString & feature, const nsAString & version, PRBool *_retval) { return _to HasFeature(feature, version, _retval); } \
NS_IMETHOD CreateDocumentType(const nsAString & qualifiedName, const nsAString & publicId, const nsAString & systemId, nsIDOMDocumentType **_retval) { return _to CreateDocumentType(qualifiedName, publicId, systemId, _retval); } \
NS_IMETHOD CreateDocument(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMDocumentType *doctype, nsIDOMDocument **_retval) { return _to CreateDocument(namespaceURI, qualifiedName, doctype, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOMIMPLEMENTATION(_to) \
NS_IMETHOD HasFeature(const nsAString & feature, const nsAString & version, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->HasFeature(feature, version, _retval); } \
NS_IMETHOD CreateDocumentType(const nsAString & qualifiedName, const nsAString & publicId, const nsAString & systemId, nsIDOMDocumentType **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateDocumentType(qualifiedName, publicId, systemId, _retval); } \
NS_IMETHOD CreateDocument(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMDocumentType *doctype, nsIDOMDocument **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateDocument(namespaceURI, qualifiedName, doctype, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDOMImplementation : public nsIDOMDOMImplementation
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOMIMPLEMENTATION
nsDOMDOMImplementation();
private:
~nsDOMDOMImplementation();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDOMImplementation, nsIDOMDOMImplementation)
nsDOMDOMImplementation::nsDOMDOMImplementation()
{
/* member initializers and constructor code */
}
nsDOMDOMImplementation::~nsDOMDOMImplementation()
{
/* destructor code */
}
/* boolean hasFeature (in DOMString feature, in DOMString version); */
NS_IMETHODIMP nsDOMDOMImplementation::HasFeature(const nsAString & feature, const nsAString & version, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMDocumentType createDocumentType (in DOMString qualifiedName, in DOMString publicId, in DOMString systemId) raises (DOMException); */
NS_IMETHODIMP nsDOMDOMImplementation::CreateDocumentType(const nsAString & qualifiedName, const nsAString & publicId, const nsAString & systemId, nsIDOMDocumentType **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMDocument createDocument (in DOMString namespaceURI, in DOMString qualifiedName, in nsIDOMDocumentType doctype) raises (DOMException); */
NS_IMETHODIMP nsDOMDOMImplementation::CreateDocument(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMDocumentType *doctype, nsIDOMDocument **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDOMImplementation_h__ */

View File

@@ -0,0 +1,295 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMDocument.idl
*/
#ifndef __gen_nsIDOMDocument_h__
#define __gen_nsIDOMDocument_h__
#ifndef __gen_nsIDOMNode_h__
#include "nsIDOMNode.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDocument */
#define NS_IDOMDOCUMENT_IID_STR "a6cf9075-15b3-11d2-932e-00805f8add32"
#define NS_IDOMDOCUMENT_IID \
{0xa6cf9075, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMDocument : public nsIDOMNode {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDOCUMENT_IID)
/**
* The nsIDOMDocument interface represents the entire HTML or XML document.
* Conceptually, it is the root of the document tree, and provides the
* primary access to the document's data.
* Since elements, text nodes, comments, processing instructions, etc.
* cannot exist outside the context of a Document, the nsIDOMDocument
* interface also contains the factory methods needed to create these
* objects.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
*
* @status FROZEN
*/
/* readonly attribute nsIDOMDocumentType doctype; */
NS_IMETHOD GetDoctype(nsIDOMDocumentType * *aDoctype) = 0;
/* readonly attribute nsIDOMDOMImplementation implementation; */
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation * *aImplementation) = 0;
/* readonly attribute nsIDOMElement documentElement; */
NS_IMETHOD GetDocumentElement(nsIDOMElement * *aDocumentElement) = 0;
/* nsIDOMElement createElement (in DOMString tagName) raises (DOMException); */
NS_IMETHOD CreateElement(const nsAString & tagName, nsIDOMElement **_retval) = 0;
/* nsIDOMDocumentFragment createDocumentFragment (); */
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment **_retval) = 0;
/* nsIDOMText createTextNode (in DOMString data); */
NS_IMETHOD CreateTextNode(const nsAString & data, nsIDOMText **_retval) = 0;
/* nsIDOMComment createComment (in DOMString data); */
NS_IMETHOD CreateComment(const nsAString & data, nsIDOMComment **_retval) = 0;
/* nsIDOMCDATASection createCDATASection (in DOMString data) raises (DOMException); */
NS_IMETHOD CreateCDATASection(const nsAString & data, nsIDOMCDATASection **_retval) = 0;
/* nsIDOMProcessingInstruction createProcessingInstruction (in DOMString target, in DOMString data) raises (DOMException); */
NS_IMETHOD CreateProcessingInstruction(const nsAString & target, const nsAString & data, nsIDOMProcessingInstruction **_retval) = 0;
/* nsIDOMAttr createAttribute (in DOMString name) raises (DOMException); */
NS_IMETHOD CreateAttribute(const nsAString & name, nsIDOMAttr **_retval) = 0;
/* nsIDOMEntityReference createEntityReference (in DOMString name) raises (DOMException); */
NS_IMETHOD CreateEntityReference(const nsAString & name, nsIDOMEntityReference **_retval) = 0;
/* nsIDOMNodeList getElementsByTagName (in DOMString tagname); */
NS_IMETHOD GetElementsByTagName(const nsAString & tagname, nsIDOMNodeList **_retval) = 0;
/* nsIDOMNode importNode (in nsIDOMNode importedNode, in boolean deep) raises (DOMException); */
NS_IMETHOD ImportNode(nsIDOMNode *importedNode, PRBool deep, nsIDOMNode **_retval) = 0;
/* nsIDOMElement createElementNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */
NS_IMETHOD CreateElementNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMElement **_retval) = 0;
/* nsIDOMAttr createAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */
NS_IMETHOD CreateAttributeNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMAttr **_retval) = 0;
/* nsIDOMNodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName); */
NS_IMETHOD GetElementsByTagNameNS(const nsAString & namespaceURI, const nsAString & localName, nsIDOMNodeList **_retval) = 0;
/* nsIDOMElement getElementById (in DOMString elementId); */
NS_IMETHOD GetElementById(const nsAString & elementId, nsIDOMElement **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOCUMENT \
NS_IMETHOD GetDoctype(nsIDOMDocumentType * *aDoctype); \
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation * *aImplementation); \
NS_IMETHOD GetDocumentElement(nsIDOMElement * *aDocumentElement); \
NS_IMETHOD CreateElement(const nsAString & tagName, nsIDOMElement **_retval); \
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment **_retval); \
NS_IMETHOD CreateTextNode(const nsAString & data, nsIDOMText **_retval); \
NS_IMETHOD CreateComment(const nsAString & data, nsIDOMComment **_retval); \
NS_IMETHOD CreateCDATASection(const nsAString & data, nsIDOMCDATASection **_retval); \
NS_IMETHOD CreateProcessingInstruction(const nsAString & target, const nsAString & data, nsIDOMProcessingInstruction **_retval); \
NS_IMETHOD CreateAttribute(const nsAString & name, nsIDOMAttr **_retval); \
NS_IMETHOD CreateEntityReference(const nsAString & name, nsIDOMEntityReference **_retval); \
NS_IMETHOD GetElementsByTagName(const nsAString & tagname, nsIDOMNodeList **_retval); \
NS_IMETHOD ImportNode(nsIDOMNode *importedNode, PRBool deep, nsIDOMNode **_retval); \
NS_IMETHOD CreateElementNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMElement **_retval); \
NS_IMETHOD CreateAttributeNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMAttr **_retval); \
NS_IMETHOD GetElementsByTagNameNS(const nsAString & namespaceURI, const nsAString & localName, nsIDOMNodeList **_retval); \
NS_IMETHOD GetElementById(const nsAString & elementId, nsIDOMElement **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOCUMENT(_to) \
NS_IMETHOD GetDoctype(nsIDOMDocumentType * *aDoctype) { return _to GetDoctype(aDoctype); } \
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation * *aImplementation) { return _to GetImplementation(aImplementation); } \
NS_IMETHOD GetDocumentElement(nsIDOMElement * *aDocumentElement) { return _to GetDocumentElement(aDocumentElement); } \
NS_IMETHOD CreateElement(const nsAString & tagName, nsIDOMElement **_retval) { return _to CreateElement(tagName, _retval); } \
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment **_retval) { return _to CreateDocumentFragment(_retval); } \
NS_IMETHOD CreateTextNode(const nsAString & data, nsIDOMText **_retval) { return _to CreateTextNode(data, _retval); } \
NS_IMETHOD CreateComment(const nsAString & data, nsIDOMComment **_retval) { return _to CreateComment(data, _retval); } \
NS_IMETHOD CreateCDATASection(const nsAString & data, nsIDOMCDATASection **_retval) { return _to CreateCDATASection(data, _retval); } \
NS_IMETHOD CreateProcessingInstruction(const nsAString & target, const nsAString & data, nsIDOMProcessingInstruction **_retval) { return _to CreateProcessingInstruction(target, data, _retval); } \
NS_IMETHOD CreateAttribute(const nsAString & name, nsIDOMAttr **_retval) { return _to CreateAttribute(name, _retval); } \
NS_IMETHOD CreateEntityReference(const nsAString & name, nsIDOMEntityReference **_retval) { return _to CreateEntityReference(name, _retval); } \
NS_IMETHOD GetElementsByTagName(const nsAString & tagname, nsIDOMNodeList **_retval) { return _to GetElementsByTagName(tagname, _retval); } \
NS_IMETHOD ImportNode(nsIDOMNode *importedNode, PRBool deep, nsIDOMNode **_retval) { return _to ImportNode(importedNode, deep, _retval); } \
NS_IMETHOD CreateElementNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMElement **_retval) { return _to CreateElementNS(namespaceURI, qualifiedName, _retval); } \
NS_IMETHOD CreateAttributeNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMAttr **_retval) { return _to CreateAttributeNS(namespaceURI, qualifiedName, _retval); } \
NS_IMETHOD GetElementsByTagNameNS(const nsAString & namespaceURI, const nsAString & localName, nsIDOMNodeList **_retval) { return _to GetElementsByTagNameNS(namespaceURI, localName, _retval); } \
NS_IMETHOD GetElementById(const nsAString & elementId, nsIDOMElement **_retval) { return _to GetElementById(elementId, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOCUMENT(_to) \
NS_IMETHOD GetDoctype(nsIDOMDocumentType * *aDoctype) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDoctype(aDoctype); } \
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation * *aImplementation) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetImplementation(aImplementation); } \
NS_IMETHOD GetDocumentElement(nsIDOMElement * *aDocumentElement) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDocumentElement(aDocumentElement); } \
NS_IMETHOD CreateElement(const nsAString & tagName, nsIDOMElement **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateElement(tagName, _retval); } \
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateDocumentFragment(_retval); } \
NS_IMETHOD CreateTextNode(const nsAString & data, nsIDOMText **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateTextNode(data, _retval); } \
NS_IMETHOD CreateComment(const nsAString & data, nsIDOMComment **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateComment(data, _retval); } \
NS_IMETHOD CreateCDATASection(const nsAString & data, nsIDOMCDATASection **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateCDATASection(data, _retval); } \
NS_IMETHOD CreateProcessingInstruction(const nsAString & target, const nsAString & data, nsIDOMProcessingInstruction **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateProcessingInstruction(target, data, _retval); } \
NS_IMETHOD CreateAttribute(const nsAString & name, nsIDOMAttr **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateAttribute(name, _retval); } \
NS_IMETHOD CreateEntityReference(const nsAString & name, nsIDOMEntityReference **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateEntityReference(name, _retval); } \
NS_IMETHOD GetElementsByTagName(const nsAString & tagname, nsIDOMNodeList **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetElementsByTagName(tagname, _retval); } \
NS_IMETHOD ImportNode(nsIDOMNode *importedNode, PRBool deep, nsIDOMNode **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->ImportNode(importedNode, deep, _retval); } \
NS_IMETHOD CreateElementNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMElement **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateElementNS(namespaceURI, qualifiedName, _retval); } \
NS_IMETHOD CreateAttributeNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMAttr **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateAttributeNS(namespaceURI, qualifiedName, _retval); } \
NS_IMETHOD GetElementsByTagNameNS(const nsAString & namespaceURI, const nsAString & localName, nsIDOMNodeList **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetElementsByTagNameNS(namespaceURI, localName, _retval); } \
NS_IMETHOD GetElementById(const nsAString & elementId, nsIDOMElement **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetElementById(elementId, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDocument : public nsIDOMDocument
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOCUMENT
nsDOMDocument();
private:
~nsDOMDocument();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDocument, nsIDOMDocument)
nsDOMDocument::nsDOMDocument()
{
/* member initializers and constructor code */
}
nsDOMDocument::~nsDOMDocument()
{
/* destructor code */
}
/* readonly attribute nsIDOMDocumentType doctype; */
NS_IMETHODIMP nsDOMDocument::GetDoctype(nsIDOMDocumentType * *aDoctype)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMDOMImplementation implementation; */
NS_IMETHODIMP nsDOMDocument::GetImplementation(nsIDOMDOMImplementation * *aImplementation)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMElement documentElement; */
NS_IMETHODIMP nsDOMDocument::GetDocumentElement(nsIDOMElement * *aDocumentElement)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMElement createElement (in DOMString tagName) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateElement(const nsAString & tagName, nsIDOMElement **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMDocumentFragment createDocumentFragment (); */
NS_IMETHODIMP nsDOMDocument::CreateDocumentFragment(nsIDOMDocumentFragment **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMText createTextNode (in DOMString data); */
NS_IMETHODIMP nsDOMDocument::CreateTextNode(const nsAString & data, nsIDOMText **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMComment createComment (in DOMString data); */
NS_IMETHODIMP nsDOMDocument::CreateComment(const nsAString & data, nsIDOMComment **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMCDATASection createCDATASection (in DOMString data) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateCDATASection(const nsAString & data, nsIDOMCDATASection **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMProcessingInstruction createProcessingInstruction (in DOMString target, in DOMString data) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateProcessingInstruction(const nsAString & target, const nsAString & data, nsIDOMProcessingInstruction **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMAttr createAttribute (in DOMString name) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateAttribute(const nsAString & name, nsIDOMAttr **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMEntityReference createEntityReference (in DOMString name) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateEntityReference(const nsAString & name, nsIDOMEntityReference **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMNodeList getElementsByTagName (in DOMString tagname); */
NS_IMETHODIMP nsDOMDocument::GetElementsByTagName(const nsAString & tagname, nsIDOMNodeList **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMNode importNode (in nsIDOMNode importedNode, in boolean deep) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::ImportNode(nsIDOMNode *importedNode, PRBool deep, nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMElement createElementNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateElementNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMElement **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMAttr createAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException); */
NS_IMETHODIMP nsDOMDocument::CreateAttributeNS(const nsAString & namespaceURI, const nsAString & qualifiedName, nsIDOMAttr **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMNodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName); */
NS_IMETHODIMP nsDOMDocument::GetElementsByTagNameNS(const nsAString & namespaceURI, const nsAString & localName, nsIDOMNodeList **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMElement getElementById (in DOMString elementId); */
NS_IMETHODIMP nsDOMDocument::GetElementById(const nsAString & elementId, nsIDOMElement **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDocument_h__ */

View File

@@ -0,0 +1,98 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/events/nsIDOMDocumentEvent.idl
*/
#ifndef __gen_nsIDOMDocumentEvent_h__
#define __gen_nsIDOMDocumentEvent_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDocumentEvent */
#define NS_IDOMDOCUMENTEVENT_IID_STR "46b91d66-28e2-11d4-ab1e-0010830123b4"
#define NS_IDOMDOCUMENTEVENT_IID \
{0x46b91d66, 0x28e2, 0x11d4, \
{ 0xab, 0x1e, 0x00, 0x10, 0x83, 0x01, 0x23, 0xb4 }}
/**
* The nsIDOMDocumentEvent interface is the interface to the event
* factory method on a DOM document object.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Events/
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIDOMDocumentEvent : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDOCUMENTEVENT_IID)
/* nsIDOMEvent createEvent (in DOMString eventType) raises (DOMException); */
NS_IMETHOD CreateEvent(const nsAString & eventType, nsIDOMEvent **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOCUMENTEVENT \
NS_IMETHOD CreateEvent(const nsAString & eventType, nsIDOMEvent **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOCUMENTEVENT(_to) \
NS_IMETHOD CreateEvent(const nsAString & eventType, nsIDOMEvent **_retval) { return _to CreateEvent(eventType, _retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOCUMENTEVENT(_to) \
NS_IMETHOD CreateEvent(const nsAString & eventType, nsIDOMEvent **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateEvent(eventType, _retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDocumentEvent : public nsIDOMDocumentEvent
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOCUMENTEVENT
nsDOMDocumentEvent();
private:
~nsDOMDocumentEvent();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDocumentEvent, nsIDOMDocumentEvent)
nsDOMDocumentEvent::nsDOMDocumentEvent()
{
/* member initializers and constructor code */
}
nsDOMDocumentEvent::~nsDOMDocumentEvent()
{
/* destructor code */
}
/* nsIDOMEvent createEvent (in DOMString eventType) raises (DOMException); */
NS_IMETHODIMP nsDOMDocumentEvent::CreateEvent(const nsAString & eventType, nsIDOMEvent **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDocumentEvent_h__ */

View File

@@ -0,0 +1,80 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/core/nsIDOMDocumentFragment.idl
*/
#ifndef __gen_nsIDOMDocumentFragment_h__
#define __gen_nsIDOMDocumentFragment_h__
#ifndef __gen_nsIDOMNode_h__
#include "nsIDOMNode.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDocumentFragment */
#define NS_IDOMDOCUMENTFRAGMENT_IID_STR "a6cf9076-15b3-11d2-932e-00805f8add32"
#define NS_IDOMDOCUMENTFRAGMENT_IID \
{0xa6cf9076, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE nsIDOMDocumentFragment : public nsIDOMNode {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDOCUMENTFRAGMENT_IID)
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOCUMENTFRAGMENT \
/* no methods! */
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOCUMENTFRAGMENT(_to) \
/* no methods! */
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOCUMENTFRAGMENT(_to) \
/* no methods! */
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDocumentFragment : public nsIDOMDocumentFragment
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOCUMENTFRAGMENT
nsDOMDocumentFragment();
private:
~nsDOMDocumentFragment();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDocumentFragment, nsIDOMDocumentFragment)
nsDOMDocumentFragment::nsDOMDocumentFragment()
{
/* member initializers and constructor code */
}
nsDOMDocumentFragment::~nsDOMDocumentFragment()
{
/* destructor code */
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDocumentFragment_h__ */

View File

@@ -0,0 +1,98 @@
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM c:/mozilla/dom/public/idl/range/nsIDOMDocumentRange.idl
*/
#ifndef __gen_nsIDOMDocumentRange_h__
#define __gen_nsIDOMDocumentRange_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDocumentRange */
#define NS_IDOMDOCUMENTRANGE_IID_STR "7b9badc6-c9bc-447a-8670-dbd195aed24b"
#define NS_IDOMDOCUMENTRANGE_IID \
{0x7b9badc6, 0xc9bc, 0x447a, \
{ 0x86, 0x70, 0xdb, 0xd1, 0x95, 0xae, 0xd2, 0x4b }}
/**
* The nsIDOMDocumentRange interface is an interface to a document
* object that supports ranges in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Traversal-Range/
*
* @status FROZEN
*/
class NS_NO_VTABLE nsIDOMDocumentRange : public nsISupports {
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMDOCUMENTRANGE_IID)
/* nsIDOMRange createRange (); */
NS_IMETHOD CreateRange(nsIDOMRange **_retval) = 0;
};
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOCUMENTRANGE \
NS_IMETHOD CreateRange(nsIDOMRange **_retval);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOCUMENTRANGE(_to) \
NS_IMETHOD CreateRange(nsIDOMRange **_retval) { return _to CreateRange(_retval); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOCUMENTRANGE(_to) \
NS_IMETHOD CreateRange(nsIDOMRange **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateRange(_retval); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDocumentRange : public nsIDOMDocumentRange
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOCUMENTRANGE
nsDOMDocumentRange();
private:
~nsDOMDocumentRange();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDocumentRange, nsIDOMDocumentRange)
nsDOMDocumentRange::nsDOMDocumentRange()
{
/* member initializers and constructor code */
}
nsDOMDocumentRange::~nsDOMDocumentRange()
{
/* destructor code */
}
/* nsIDOMRange createRange (); */
NS_IMETHODIMP nsDOMDocumentRange::CreateRange(nsIDOMRange **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDocumentRange_h__ */

Some files were not shown because too many files have changed in this diff Show More