OLD | NEW |
| (Empty) |
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | |
2 /* ***** BEGIN LICENSE BLOCK ***** | |
3 * Version: NPL 1.1/GPL 2.0/LGPL 2.1 | |
4 * | |
5 * The contents of this file are subject to the Netscape Public License | |
6 * Version 1.1 (the "License"); you may not use this file except in | |
7 * compliance with the License. You may obtain a copy of the License at | |
8 * http://www.mozilla.org/NPL/ | |
9 * | |
10 * Software distributed under the License is distributed on an "AS IS" basis, | |
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |
12 * for the specific language governing rights and limitations under the | |
13 * License. | |
14 * | |
15 * The Original Code is mozilla.org code. | |
16 * | |
17 * The Initial Developer of the Original Code is | |
18 * Netscape Communications Corporation. | |
19 * Portions created by the Initial Developer are Copyright (C) 1998 | |
20 * the Initial Developer. All Rights Reserved. | |
21 * | |
22 * Contributor(s): | |
23 * | |
24 * Alternatively, the contents of this file may be used under the terms of | |
25 * either the GNU General Public License Version 2 or later (the "GPL"), or | |
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), | |
27 * in which case the provisions of the GPL or the LGPL are applicable instead | |
28 * of those above. If you wish to allow use of your version of this file only | |
29 * under the terms of either the GPL or the LGPL, and not to allow others to | |
30 * use your version of this file under the terms of the NPL, indicate your | |
31 * decision by deleting the provisions above and replace them with the notice | |
32 * and other provisions required by the GPL or the LGPL. If you do not delete | |
33 * the provisions above, a recipient may use your version of this file under | |
34 * the terms of any one of the NPL, the GPL or the LGPL. | |
35 * | |
36 * ***** END LICENSE BLOCK ***** */ | |
37 | |
38 #ifndef OMAHA_PLUGINS_COMMON_NPPLAT_H_ | |
39 #define OMAHA_PLUGINS_COMMON_NPPLAT_H_ | |
40 | |
41 /**************************************************/ | |
42 /* */ | |
43 /* Windows */ | |
44 /* */ | |
45 /**************************************************/ | |
46 #ifdef XP_WIN | |
47 #include "windows.h" | |
48 #endif //XP_WIN | |
49 | |
50 /**************************************************/ | |
51 /* */ | |
52 /* Unix */ | |
53 /* */ | |
54 /**************************************************/ | |
55 #ifdef XP_UNIX | |
56 #include <stdio.h> | |
57 #endif //XP_UNIX | |
58 | |
59 /**************************************************/ | |
60 /* */ | |
61 /* Mac */ | |
62 /* */ | |
63 /**************************************************/ | |
64 #ifdef XP_MAC | |
65 | |
66 #include <Processes.h> | |
67 #include <Gestalt.h> | |
68 #include <CodeFragments.h> | |
69 #include <Timer.h> | |
70 #include <Resources.h> | |
71 #include <ToolUtils.h> | |
72 | |
73 #include "jri.h" | |
74 | |
75 // The Mixed Mode procInfos defined in npupp.h assume Think C- | |
76 // style calling conventions. These conventions are used by | |
77 // Metrowerks with the exception of pointer return types, which | |
78 // in Metrowerks 68K are returned in A0, instead of the standard | |
79 // D0. Thus, since NPN_MemAlloc and NPN_UserAgent return pointers, | |
80 // Mixed Mode will return the values to a 68K plugin in D0, but | |
81 // a 68K plugin compiled by Metrowerks will expect the result in | |
82 // A0. The following pragma forces Metrowerks to use D0 instead. | |
83 // | |
84 #ifdef __MWERKS__ | |
85 #ifndef powerc | |
86 #pragma pointers_in_D0 | |
87 #endif | |
88 #endif | |
89 | |
90 #ifdef __MWERKS__ | |
91 #ifndef powerc | |
92 #pragma pointers_in_A0 | |
93 #endif | |
94 #endif | |
95 | |
96 // The following fix for static initializers (which fixes a preious | |
97 // incompatibility with some parts of PowerPlant, was submitted by | |
98 // Jan Ulbrich. | |
99 #ifdef __MWERKS__ | |
100 #ifdef __cplusplus | |
101 extern "C" { | |
102 #endif | |
103 #ifndef powerc | |
104 extern void __InitCode__(void); | |
105 #else | |
106 extern void __sinit(void); | |
107 #define __InitCode__ __sinit | |
108 #endif | |
109 extern void __destroy_global_chain(void); | |
110 #ifdef __cplusplus | |
111 } | |
112 #endif // __cplusplus | |
113 #endif // __MWERKS__ | |
114 | |
115 // Wrapper functions for all calls from Netscape to the plugin. | |
116 // These functions let the plugin developer just create the APIs | |
117 // as documented and defined in npapi.h, without needing to | |
118 // install those functions in the function table or worry about | |
119 // setting up globals for 68K plugins. | |
120 NPError Private_Initialize(void); | |
121 void Private_Shutdown(void); | |
122 NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc
, char* argn[], char* argv[], NPSavedData* saved); | |
123 NPError Private_Destroy(NPP instance, NPSavedData** save); | |
124 NPError Private_SetWindow(NPP instance, NPWindow* window); | |
125 NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBoo
l seekable, uint16* stype); | |
126 NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason); | |
127 int32 Private_WriteReady(NPP instance, NPStream* stream); | |
128 int32 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, v
oid* buffer); | |
129 void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname); | |
130 void Private_Print(NPP instance, NPPrint* platformPrint); | |
131 int16 Private_HandleEvent(NPP instance, void* event); | |
132 void Private_URLNotify(NPP instance, const char* url, NPReason reason, void*
notifyData); | |
133 jref Private_GetJavaClass(void); | |
134 NPError Private_GetValue(NPP instance, NPPVariable variable, void *result); | |
135 NPError Private_SetValue(NPP instance, NPNVariable variable, void *value); | |
136 | |
137 #endif //XP_MAC | |
138 | |
139 #include "third_party/npapi/bindings/nphostapi.h" | |
140 | |
141 #ifndef HIBYTE | |
142 #define HIBYTE(i) (i >> 8) | |
143 #endif | |
144 | |
145 #ifndef LOBYTE | |
146 #define LOBYTE(i) (i & 0xff) | |
147 #endif | |
148 | |
149 #endif // OMAHA_PLUGINS_COMMON_NPPLAT_H_ | |
OLD | NEW |