Back to index

lightning-sunbird  0.9+nobinonly
npplat.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef _NPPLAT_H_
00039 #define _NPPLAT_H_
00040 
00041 #include "npapi.h"
00042 #include "npupp.h"
00043 
00044 /**************************************************/
00045 /*                                                */
00046 /*                   Windows                      */
00047 /*                                                */
00048 /**************************************************/
00049 #ifdef XP_WIN
00050 #include "windows.h"
00051 #endif //XP_WIN
00052 
00053 /**************************************************/
00054 /*                                                */
00055 /*                    Unix                        */
00056 /*                                                */
00057 /**************************************************/
00058 #ifdef XP_UNIX
00059 #include <stdio.h>
00060 #endif //XP_UNIX
00061 
00062 /**************************************************/
00063 /*                                                */
00064 /*                     Mac                        */
00065 /*                                                */
00066 /**************************************************/
00067 #ifdef XP_MAC
00068 
00069 #include <Processes.h>
00070 #include <Gestalt.h>
00071 #include <CodeFragments.h>
00072 #include <Timer.h>
00073 #include <Resources.h>
00074 #include <ToolUtils.h>
00075 
00076 #include "jri.h"
00077 
00078 // The Mixed Mode procInfos defined in npupp.h assume Think C-
00079 // style calling conventions.  These conventions are used by
00080 // Metrowerks with the exception of pointer return types, which
00081 // in Metrowerks 68K are returned in A0, instead of the standard
00082 // D0. Thus, since NPN_MemAlloc and NPN_UserAgent return pointers,
00083 // Mixed Mode will return the values to a 68K plugin in D0, but 
00084 // a 68K plugin compiled by Metrowerks will expect the result in
00085 // A0.  The following pragma forces Metrowerks to use D0 instead.
00086 //
00087 #ifdef __MWERKS__
00088 #ifndef powerc
00089 #pragma pointers_in_D0
00090 #endif
00091 #endif
00092 
00093 #ifdef __MWERKS__
00094 #ifndef powerc
00095 #pragma pointers_in_A0
00096 #endif
00097 #endif
00098 
00099 // The following fix for static initializers (which fixes a preious
00100 // incompatibility with some parts of PowerPlant, was submitted by 
00101 // Jan Ulbrich.
00102 #ifdef __MWERKS__
00103        #ifdef __cplusplus
00104        extern "C" {
00105        #endif
00106               #ifndef powerc
00107                      extern void   __InitCode__(void);
00108               #else
00109                      extern void __sinit(void);
00110                      #define __InitCode__ __sinit
00111               #endif
00112               extern void   __destroy_global_chain(void);
00113        #ifdef __cplusplus
00114        }
00115        #endif // __cplusplus
00116 #endif // __MWERKS__
00117 
00118 // Wrapper functions for all calls from Netscape to the plugin.
00119 // These functions let the plugin developer just create the APIs
00120 // as documented and defined in npapi.h, without needing to 
00121 // install those functions in the function table or worry about
00122 // setting up globals for 68K plugins.
00123 NPError Private_Initialize(void);
00124 void    Private_Shutdown(void);
00125 NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
00126 NPError Private_Destroy(NPP instance, NPSavedData** save);
00127 NPError Private_SetWindow(NPP instance, NPWindow* window);
00128 NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
00129 NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
00130 int32   Private_WriteReady(NPP instance, NPStream* stream);
00131 int32   Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
00132 void    Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
00133 void    Private_Print(NPP instance, NPPrint* platformPrint);
00134 int16   Private_HandleEvent(NPP instance, void* event);
00135 void    Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData);
00136 jref    Private_GetJavaClass(void);
00137 NPError Private_GetValue(NPP instance, NPPVariable variable, void *result);
00138 NPError Private_SetValue(NPP instance, NPNVariable variable, void *value);
00139 
00140 #endif //XP_MAC
00141 
00142 #ifndef HIBYTE
00143 #define HIBYTE(i) (i >> 8)
00144 #endif
00145 
00146 #ifndef LOBYTE
00147 #define LOBYTE(i) (i & 0xff)
00148 #endif
00149 
00150 #endif //_NPPLAT_H_