43 #include "npfunctions.h"
46 #define HIBYTE(x) ((((uint32_t)(x)) & 0xff00) >> 8)
50 #define LOBYTE(W) ((W) & 0xFF)
55 void NPN_Version(
int* plugin_major,
int* plugin_minor,
int* netscape_major,
int* netscape_minor)
57 *plugin_major = NP_VERSION_MAJOR;
58 *plugin_minor = NP_VERSION_MINOR;
59 *netscape_major = HIBYTE(NPNFuncs.version);
60 *netscape_minor = LOBYTE(NPNFuncs.version);
63 NPError NPN_GetURLNotify(
NPP instance,
const char *url,
const char *target,
void* notifyData)
65 int navMinorVers = NPNFuncs.version & 0xFF;
66 NPError rv = NPERR_NO_ERROR;
68 if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
69 rv = NPNFuncs.geturlnotify(instance, url, target, notifyData);
71 rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
76 NPError NPN_GetURL(
NPP instance,
const char *url,
const char *target)
78 NPError rv = NPNFuncs.geturl(instance, url, target);
82 NPError NPN_PostURLNotify(
NPP instance,
const char* url,
const char* window, uint32_t len,
const char* buf, NPBool file,
void* notifyData)
84 int navMinorVers = NPNFuncs.version & 0xFF;
85 NPError rv = NPERR_NO_ERROR;
87 if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
88 rv = NPNFuncs.posturlnotify(instance, url, window, len, buf, file, notifyData);
90 rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
95 NPError NPN_PostURL(
NPP instance,
const char* url,
const char* window, uint32_t len,
const char* buf, NPBool file)
97 NPError rv = NPNFuncs.posturl(instance, url, window, len, buf, file);
103 NPError rv = NPNFuncs.requestread(stream, rangeList);
107 NPError NPN_NewStream(
NPP instance, NPMIMEType type,
const char* target,
NPStream** stream)
109 int navMinorVersion = NPNFuncs.version & 0xFF;
111 NPError rv = NPERR_NO_ERROR;
113 if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT )
114 rv = NPNFuncs.newstream(instance, type, target, stream);
116 rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
121 int32_t NPN_Write(
NPP instance,
NPStream *stream, int32_t len,
void *buffer)
123 int navMinorVersion = NPNFuncs.version & 0xFF;
126 if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT )
127 rv = NPNFuncs.write(instance, stream, len, buffer);
134 NPError NPN_DestroyStream(
NPP instance,
NPStream* stream, NPError reason)
136 int navMinorVersion = NPNFuncs.version & 0xFF;
137 NPError rv = NPERR_NO_ERROR;
139 if( navMinorVersion >= NPVERS_HAS_STREAMOUTPUT )
140 rv = NPNFuncs.destroystream(instance, stream, reason);
142 rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
147 void NPN_Status(
NPP instance,
const char *message)
149 NPNFuncs.status(instance, message);
152 const char* NPN_UserAgent(
NPP instance)
154 const char * rv = NULL;
155 rv = NPNFuncs.uagent(instance);
159 void* NPN_MemAlloc(uint32_t size)
162 rv = NPNFuncs.memalloc(size);
166 void NPN_MemFree(
void* ptr)
168 NPNFuncs.memfree(ptr);
171 uint32_t NPN_MemFlush(uint32_t size)
173 uint32_t rv = NPNFuncs.memflush(size);
177 void NPN_ReloadPlugins(NPBool reloadPages)
179 NPNFuncs.reloadplugins(reloadPages);
196 NPError NPN_GetValue(
NPP instance, NPNVariable variable,
void *value)
198 NPError rv = NPNFuncs.getvalue(instance, variable, value);
202 NPError NPN_SetValue(
NPP instance, NPPVariable variable,
void *value)
204 NPError rv = NPNFuncs.setvalue(instance, variable, value);
208 void NPN_InvalidateRect(
NPP instance,
NPRect *invalidRect)
210 NPNFuncs.invalidaterect(instance, invalidRect);
213 void NPN_InvalidateRegion(
NPP instance, NPRegion invalidRegion)
215 NPNFuncs.invalidateregion(instance, invalidRegion);
218 void NPN_ForceRedraw(
NPP instance)
220 NPNFuncs.forceredraw(instance);
223 NPIdentifier NPN_GetStringIdentifier(
const NPUTF8 *name)
225 return NPNFuncs.getstringidentifier(name);
228 void NPN_GetStringIdentifiers(
const NPUTF8 **names, uint32_t nameCount,
229 NPIdentifier *identifiers)
231 return NPNFuncs.getstringidentifiers(names, nameCount, identifiers);
234 NPIdentifier NPN_GetStringIdentifier(int32_t intid)
236 return NPNFuncs.getintidentifier(intid);
239 bool NPN_IdentifierIsString(NPIdentifier identifier)
241 return NPNFuncs.identifierisstring(identifier);
244 NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
246 return NPNFuncs.utf8fromidentifier(identifier);
249 int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
251 return NPNFuncs.intfromidentifier(identifier);
256 return NPNFuncs.createobject(npp, aClass);
261 return NPNFuncs.retainobject(obj);
264 void NPN_ReleaseObject(
NPObject *obj)
266 return NPNFuncs.releaseobject(obj);
269 bool NPN_Invoke(
NPP npp,
NPObject* obj, NPIdentifier methodName,
272 return NPNFuncs.invoke(npp, obj, methodName, args, argCount, result);
278 return NPNFuncs.invokeDefault(npp, obj, args, argCount, result);
284 return NPNFuncs.evaluate(npp, obj, script, result);
287 bool NPN_GetProperty(
NPP npp,
NPObject* obj, NPIdentifier propertyName,
290 return NPNFuncs.getproperty(npp, obj, propertyName, result);
293 bool NPN_SetProperty(
NPP npp,
NPObject* obj, NPIdentifier propertyName,
296 return NPNFuncs.setproperty(npp, obj, propertyName, value);
299 bool NPN_RemoveProperty(
NPP npp,
NPObject* obj, NPIdentifier propertyName)
301 return NPNFuncs.removeproperty(npp, obj, propertyName);
304 bool NPN_Enumerate(
NPP npp,
NPObject *obj, NPIdentifier **identifier,
307 return NPNFuncs.enumerate(npp, obj, identifier, count);
313 return NPNFuncs.construct(npp, obj, args, argCount, result);
316 bool NPN_HasProperty(
NPP npp,
NPObject* obj, NPIdentifier propertyName)
318 return NPNFuncs.hasproperty(npp, obj, propertyName);
321 bool NPN_HasMethod(
NPP npp,
NPObject* obj, NPIdentifier methodName)
323 return NPNFuncs.hasmethod(npp, obj, methodName);
326 void NPN_ReleaseVariantValue(
NPVariant *variant)
328 NPNFuncs.releasevariantvalue(variant);
331 void NPN_SetException(
NPObject* obj,
const NPUTF8 *message)
333 NPNFuncs.setexception(obj, message);