Clean up npupp.h and rename it to npfunctions.h. b=455458 r/sr=jst
authorJosh Aas <joshmoz@gmail.com>
Tue, 07 Oct 2008 21:50:25 -0400
changeset 20125 2225040a7f30d8fac3d84b611df096236d73ff48
parent 20124 ea6ec55b087f60f275004aa580a8f876c8731077
child 20126 cf62923208e19b9458dae1d5805afa0b3cd162ce
push idunknown
push userunknown
push dateunknown
bugs455458
milestone1.9.1b2pre
Clean up npupp.h and rename it to npfunctions.h. b=455458 r/sr=jst
embedding/browser/activex/src/plugin/npwin.cpp
modules/plugin/base/public/Makefile.in
modules/plugin/base/public/npapi.h
modules/plugin/base/public/npfunctions.h
modules/plugin/base/public/npupp.h
modules/plugin/base/src/nsNPAPIPlugin.cpp
modules/plugin/base/src/nsNPAPIPlugin.h
modules/plugin/base/src/nsNPAPIPluginInstance.cpp
modules/plugin/base/src/nsNPAPIPluginInstance.h
modules/plugin/default/mac/npmac.cpp
modules/plugin/default/os2/npos2.cpp
modules/plugin/default/unix/npunix.c
modules/plugin/default/windows/npwin.cpp
modules/plugin/sdk/samples/common/npn_gate.cpp
modules/plugin/sdk/samples/include/npplat.h
modules/plugin/sdk/samples/npruntime/np_entry.cpp
modules/plugin/sdk/samples/npruntime/npn_gate.cpp
modules/plugin/sdk/samples/npruntime/plugin.cpp
modules/plugin/sdk/samples/npthread/windows/np_entry.cpp
modules/plugin/sdk/samples/npthread/windows/npn_gate.cpp
modules/plugin/sdk/samples/npthread/windows/npp_gate.cpp
modules/plugin/sdk/samples/npthread/windows/plugin.cpp
modules/plugin/sdk/samples/unixprinting/npunix.c
modules/plugin/test/testplugin/nptest.cpp
--- a/embedding/browser/activex/src/plugin/npwin.cpp
+++ b/embedding/browser/activex/src/plugin/npwin.cpp
@@ -1,22 +1,17 @@
 /* IMPORTANT NOTE - This file has been hacked to add support for NPP_GetValue & NPP_SetValue! */
 
 /* npwin.cpp */
 
 //\\// INCLUDE
 //#include "StdAfx.h"
 
-// netscape
-#ifndef _NPAPI_H_
 #include "npapi.h"
-#endif
-#ifndef _NPUPP_H_
-#include "npupp.h"
-#endif
+#include "npfunctions.h"
 
 //\\// DEFINE
 #ifdef WIN32
     #define NP_EXPORT
 #else
     #define NP_EXPORT _export
 #endif
 
--- a/modules/plugin/base/public/Makefile.in
+++ b/modules/plugin/base/public/Makefile.in
@@ -53,17 +53,17 @@ EXPORTS		= \
 		nsDefaultPlugin.h \
 		nsPluginNativeWindow.h \
 		nsPluginsCID.h \
 		nsIPluginInstanceInternal.h \
 		$(NULL)
 
 SDK_HEADERS	 = \
 		npapi.h \
-		npupp.h \
+		npfunctions.h \
 		nptypes.h \
 		npruntime.h \
 		$(NULL)
 
 XPIDLSRCS 	= \
 		nspluginroot.idl \
 		nsIPluginStreamInfo.idl \
 		nsIPluginManager.idl \
--- a/modules/plugin/base/public/npapi.h
+++ b/modules/plugin/base/public/npapi.h
@@ -30,23 +30,18 @@
  * 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: 3.48 $
- *  Netscape client plug-in API spec
- */
-
-#ifndef _NPAPI_H_
-#define _NPAPI_H_
+#ifndef npapi_h_
+#define npapi_h_
 
 #ifdef __OS2__
 #pragma pack(1)
 #endif
 
 #include "nptypes.h"
 
 #ifdef OJI
@@ -119,28 +114,24 @@ RCDATA NP_INFO_FileOpenName{ "MMOS2 vide
 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
@@ -419,17 +410,18 @@ typedef struct _NPWindow
 #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 */
+  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;
@@ -462,66 +454,61 @@ typedef struct _NPEvent
 } NPEvent;
 #elif defined (XP_UNIX) && defined(MOZ_X11)
 typedef XEvent NPEvent;
 #else
 typedef void*  NPEvent;
 #endif /* XP_MACOSX */
 
 #ifdef XP_MACOSX
+
 typedef void* NPRegion;
 #ifndef NP_NO_QUICKDRAW
 typedef RgnHandle NPQDRegion;
 #endif
 typedef CGPathRef NPCGRegion;
 #elif defined(XP_WIN)
 typedef HRGN NPRegion;
 #elif defined(XP_UNIX) && defined(MOZ_X11)
 typedef Region NPRegion;
 #else
 typedef void *NPRegion;
-#endif /* XP_MACOSX */
+#endif
 
 #ifdef XP_MACOSX
-/*
- *  Mac-specific structures and definitions.
- */
-
 typedef struct NP_Port
 {
-  CGrafPtr port; /* Grafport */
-  int32_t portx;   /* position inside the topmost window */
+  CGrafPtr port;
+  int32_t portx; /* position inside the topmost window */
   int32_t porty;
 } NP_Port;
 
 typedef struct NP_CGContext
 {
   CGContextRef context;
   WindowRef window;
 } NP_CGContext;
 
-/*
- *  Non-standard event types that can be passed to HandleEvent
- */
-
+/* 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_MACOSX */
 
 /*
  * Values for mode passed to NPP_New:
  */
 #define NP_EMBED 1
 #define NP_FULL  2
 
@@ -591,37 +578,31 @@ enum NPEventType {
 #define NPVERS_HAS_NPOBJECT_ENUM            18
 #define NPVERS_HAS_PLUGIN_THREAD_ASYNC_CALL 19
 #define NPVERS_HAS_ALL_NETWORK_STREAMS      20
 
 /*----------------------------------------------------------------------*/
 /*                        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.
- */
+/* NPP_* functions are provided by the plugin and called by the navigator. */
 
 #ifdef XP_UNIX
 char* NPP_GetMIMEDescription(void);
-#endif /* XP_UNIX */
+#endif
 
 NPError NP_LOADDS NPP_Initialize(void);
 void    NP_LOADDS NPP_Shutdown(void);
 NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
                           uint16_t mode, int16_t 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);
@@ -640,60 +621,62 @@ int16_t NP_LOADDS NPP_HandleEvent(NPP in
 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_t len,
-                                    const char* buf, NPBool file,
-                                    void* notifyData);
-NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
-                              const char* target, uint32_t len,
-                              const char* buf, NPBool file);
-NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
-NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
+/* 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_t len,
+                                        const char* buf, NPBool file,
+                                        void* notifyData);
+NPError     NP_LOADDS NPN_PostURL(NPP instance, const char* url,
+                                  const char* target, uint32_t 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_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer);
-NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream, NPReason reason);
-void    NP_LOADDS NPN_Status(NPP instance, const char* message);
+int32_t     NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t 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_t size);
-void    NP_LOADDS NPN_MemFree(void* ptr);
-uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
-void    NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
+void*       NP_LOADDS NPN_MemAlloc(uint32_t size);
+void        NP_LOADDS NPN_MemFree(void* ptr);
+uint32_t    NP_LOADDS NPN_MemFlush(uint32_t size);
+void        NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
 #ifdef OJI
-JRIEnv* NP_LOADDS NPN_GetJavaEnv(void);
-jref    NP_LOADDS NPN_GetJavaPeer(NPP instance);
+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);
-void    NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
-                                            void (*func) (void *),
-                                            void *userData);
+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);
+void        NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
+                                                void (*func) (void *), void *userData);
 
 #ifdef __cplusplus
 }  /* end extern "C" */
 #endif
 
 #endif /* RC_INVOKED */
 #ifdef __OS2__
 #pragma pack()
 #endif
 
-#endif /* _NPAPI_H_ */
+#endif /* npapi_h_ */
rename from modules/plugin/base/public/npupp.h
rename to modules/plugin/base/public/npfunctions.h
--- a/modules/plugin/base/src/nsNPAPIPlugin.cpp
+++ b/modules/plugin/base/src/nsNPAPIPlugin.cpp
@@ -254,156 +254,66 @@ nsNPAPIPlugin::CheckClassInitialized(voi
   static PRBool initialized = PR_FALSE;
 
   if (initialized)
     return;
 
   // XXX It'd be nice to make this const and initialize it statically...
   CALLBACKS.size = sizeof(CALLBACKS);
   CALLBACKS.version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
-
-  CALLBACKS.geturl =
-    NewNPN_GetURLProc(FP2TV(_geturl));
-
-  CALLBACKS.posturl =
-    NewNPN_PostURLProc(FP2TV(_posturl));
-
-  CALLBACKS.requestread =
-    NewNPN_RequestReadProc(FP2TV(_requestread));
-
-  CALLBACKS.newstream =
-    NewNPN_NewStreamProc(FP2TV(_newstream));
-
-  CALLBACKS.write =
-    NewNPN_WriteProc(FP2TV(_write));
-
-  CALLBACKS.destroystream =
-    NewNPN_DestroyStreamProc(FP2TV(_destroystream));
-
-  CALLBACKS.status =
-    NewNPN_StatusProc(FP2TV(_status));
-
-  CALLBACKS.uagent =
-    NewNPN_UserAgentProc(FP2TV(_useragent));
-
-  CALLBACKS.memalloc =
-    NewNPN_MemAllocProc(FP2TV(_memalloc));
-
-  CALLBACKS.memfree =
-    NewNPN_MemFreeProc(FP2TV(_memfree));
-
-  CALLBACKS.memflush =
-    NewNPN_MemFlushProc(FP2TV(_memflush));
-
-  CALLBACKS.reloadplugins =
-    NewNPN_ReloadPluginsProc(FP2TV(_reloadplugins));
+  CALLBACKS.geturl = ((NPN_GetURLProcPtr)FP2TV(_geturl));
+  CALLBACKS.posturl = ((NPN_PostURLProcPtr)FP2TV(_posturl));
+  CALLBACKS.requestread = ((NPN_RequestReadProcPtr)FP2TV(_requestread));
+  CALLBACKS.newstream = ((NPN_NewStreamProcPtr)FP2TV(_newstream));
+  CALLBACKS.write = ((NPN_WriteProcPtr)FP2TV(_write));
+  CALLBACKS.destroystream = ((NPN_DestroyStreamProcPtr)FP2TV(_destroystream));
+  CALLBACKS.status = ((NPN_StatusProcPtr)FP2TV(_status));
+  CALLBACKS.uagent = ((NPN_UserAgentProcPtr)FP2TV(_useragent));
+  CALLBACKS.memalloc = ((NPN_MemAllocProcPtr)FP2TV(_memalloc));
+  CALLBACKS.memfree = ((NPN_MemFreeProcPtr)FP2TV(_memfree));
+  CALLBACKS.memflush = ((NPN_MemFlushProcPtr)FP2TV(_memflush));
+  CALLBACKS.reloadplugins = ((NPN_ReloadPluginsProcPtr)FP2TV(_reloadplugins));
 
   // Deprecated API callbacks.
-  CALLBACKS.getJavaEnv =
-    NewNPN_GetJavaEnvProc(FP2TV(_getJavaEnv));
-  CALLBACKS.getJavaPeer =
-    NewNPN_GetJavaPeerProc(FP2TV(_getJavaPeer));
-
-  CALLBACKS.geturlnotify =
-    NewNPN_GetURLNotifyProc(FP2TV(_geturlnotify));
-
-  CALLBACKS.posturlnotify =
-    NewNPN_PostURLNotifyProc(FP2TV(_posturlnotify));
-
-  CALLBACKS.getvalue =
-    NewNPN_GetValueProc(FP2TV(_getvalue));
-
-  CALLBACKS.setvalue =
-    NewNPN_SetValueProc(FP2TV(_setvalue));
-
-  CALLBACKS.invalidaterect =
-    NewNPN_InvalidateRectProc(FP2TV(_invalidaterect));
-
-  CALLBACKS.invalidateregion =
-    NewNPN_InvalidateRegionProc(FP2TV(_invalidateregion));
-
-  CALLBACKS.forceredraw =
-    NewNPN_ForceRedrawProc(FP2TV(_forceredraw));
-
-  CALLBACKS.getstringidentifier =
-    NewNPN_GetStringIdentifierProc(FP2TV(_getstringidentifier));
-
-  CALLBACKS.getstringidentifiers =
-    NewNPN_GetStringIdentifiersProc(FP2TV(_getstringidentifiers));
-
-  CALLBACKS.getintidentifier =
-    NewNPN_GetIntIdentifierProc(FP2TV(_getintidentifier));
-
-  CALLBACKS.identifierisstring =
-    NewNPN_IdentifierIsStringProc(FP2TV(_identifierisstring));
-
-  CALLBACKS.utf8fromidentifier =
-    NewNPN_UTF8FromIdentifierProc(FP2TV(_utf8fromidentifier));
-
-  CALLBACKS.intfromidentifier =
-    NewNPN_IntFromIdentifierProc(FP2TV(_intfromidentifier));
-
-  CALLBACKS.createobject =
-    NewNPN_CreateObjectProc(FP2TV(_createobject));
-
-  CALLBACKS.retainobject =
-    NewNPN_RetainObjectProc(FP2TV(_retainobject));
-
-  CALLBACKS.releaseobject =
-    NewNPN_ReleaseObjectProc(FP2TV(_releaseobject));
-
-  CALLBACKS.invoke =
-    NewNPN_InvokeProc(FP2TV(_invoke));
-
-  CALLBACKS.invokeDefault =
-    NewNPN_InvokeDefaultProc(FP2TV(_invokeDefault));
-
-  CALLBACKS.evaluate =
-    NewNPN_EvaluateProc(FP2TV(_evaluate));
-
-  CALLBACKS.getproperty =
-    NewNPN_GetPropertyProc(FP2TV(_getproperty));
-
-  CALLBACKS.setproperty =
-    NewNPN_SetPropertyProc(FP2TV(_setproperty));
-
-  CALLBACKS.removeproperty =
-    NewNPN_RemovePropertyProc(FP2TV(_removeproperty));
-
-  CALLBACKS.hasproperty =
-    NewNPN_HasPropertyProc(FP2TV(_hasproperty));
-
-  CALLBACKS.hasmethod =
-    NewNPN_HasMethodProc(FP2TV(_hasmethod));
-
-  CALLBACKS.enumerate =
-    NewNPN_EnumerateProc(FP2TV(_enumerate));
-
-  CALLBACKS.construct =
-    NewNPN_ConstructProc(FP2TV(_construct));
-
-  CALLBACKS.releasevariantvalue =
-    NewNPN_ReleaseVariantValueProc(FP2TV(_releasevariantvalue));
-
-  CALLBACKS.setexception =
-    NewNPN_SetExceptionProc(FP2TV(_setexception));
-
-  CALLBACKS.pushpopupsenabledstate =
-    NewNPN_PushPopupsEnabledStateProc(FP2TV(_pushpopupsenabledstate));
-
-  CALLBACKS.poppopupsenabledstate =
-    NewNPN_PopPopupsEnabledStateProc(FP2TV(_poppopupsenabledstate));
-
-  CALLBACKS.pluginthreadasynccall =
-    NewNPN_PluginThreadAsyncCallProc(FP2TV(_pluginthreadasynccall));
-
-  if (!sPluginThreadAsyncCallLock) {
-    sPluginThreadAsyncCallLock =
-      nsAutoLock::NewLock("sPluginThreadAsyncCallLock");
-  }
+  CALLBACKS.getJavaEnv = ((NPN_GetJavaEnvProcPtr)FP2TV(_getJavaEnv));
+  CALLBACKS.getJavaPeer = ((NPN_GetJavaPeerProcPtr)FP2TV(_getJavaPeer));
+  CALLBACKS.geturlnotify = ((NPN_GetURLNotifyProcPtr)FP2TV(_geturlnotify));
+  CALLBACKS.posturlnotify = ((NPN_PostURLNotifyProcPtr)FP2TV(_posturlnotify));
+  CALLBACKS.getvalue = ((NPN_GetValueProcPtr)FP2TV(_getvalue));
+  CALLBACKS.setvalue = ((NPN_SetValueProcPtr)FP2TV(_setvalue));
+  CALLBACKS.invalidaterect = ((NPN_InvalidateRectProcPtr)FP2TV(_invalidaterect));
+  CALLBACKS.invalidateregion = ((NPN_InvalidateRegionProcPtr)FP2TV(_invalidateregion));
+  CALLBACKS.forceredraw = ((NPN_ForceRedrawProcPtr)FP2TV(_forceredraw));
+  CALLBACKS.getstringidentifier = ((NPN_GetStringIdentifierProcPtr)FP2TV(_getstringidentifier));
+  CALLBACKS.getstringidentifiers = ((NPN_GetStringIdentifiersProcPtr)FP2TV(_getstringidentifiers));
+  CALLBACKS.getintidentifier = ((NPN_GetIntIdentifierProcPtr)FP2TV(_getintidentifier));
+  CALLBACKS.identifierisstring = ((NPN_IdentifierIsStringProcPtr)FP2TV(_identifierisstring));
+  CALLBACKS.utf8fromidentifier = ((NPN_UTF8FromIdentifierProcPtr)FP2TV(_utf8fromidentifier));
+  CALLBACKS.intfromidentifier = ((NPN_IntFromIdentifierProcPtr)FP2TV(_intfromidentifier));
+  CALLBACKS.createobject = ((NPN_CreateObjectProcPtr)FP2TV(_createobject));
+  CALLBACKS.retainobject = ((NPN_RetainObjectProcPtr)FP2TV(_retainobject));
+  CALLBACKS.releaseobject = ((NPN_ReleaseObjectProcPtr)FP2TV(_releaseobject));
+  CALLBACKS.invoke = ((NPN_InvokeProcPtr)FP2TV(_invoke));
+  CALLBACKS.invokeDefault = ((NPN_InvokeDefaultProcPtr)FP2TV(_invokeDefault));
+  CALLBACKS.evaluate = ((NPN_EvaluateProcPtr)FP2TV(_evaluate));
+  CALLBACKS.getproperty = ((NPN_GetPropertyProcPtr)FP2TV(_getproperty));
+  CALLBACKS.setproperty = ((NPN_SetPropertyProcPtr)FP2TV(_setproperty));
+  CALLBACKS.removeproperty = ((NPN_RemovePropertyProcPtr)FP2TV(_removeproperty));
+  CALLBACKS.hasproperty = ((NPN_HasPropertyProcPtr)FP2TV(_hasproperty));
+  CALLBACKS.hasmethod = ((NPN_HasMethodProcPtr)FP2TV(_hasmethod));
+  CALLBACKS.enumerate = ((NPN_EnumerateProcPtr)FP2TV(_enumerate));
+  CALLBACKS.construct = ((NPN_ConstructProcPtr)FP2TV(_construct));
+  CALLBACKS.releasevariantvalue = ((NPN_ReleaseVariantValueProcPtr)FP2TV(_releasevariantvalue));
+  CALLBACKS.setexception = ((NPN_SetExceptionProcPtr)FP2TV(_setexception));
+  CALLBACKS.pushpopupsenabledstate = ((NPN_PushPopupsEnabledStateProcPtr)FP2TV(_pushpopupsenabledstate));
+  CALLBACKS.poppopupsenabledstate = ((NPN_PopPopupsEnabledStateProcPtr)FP2TV(_poppopupsenabledstate));
+  CALLBACKS.pluginthreadasynccall = ((NPN_PluginThreadAsyncCallProcPtr)FP2TV(_pluginthreadasynccall));
+
+  if (!sPluginThreadAsyncCallLock)
+    sPluginThreadAsyncCallLock = nsAutoLock::NewLock("sPluginThreadAsyncCallLock");
 
   initialized = PR_TRUE;
 
   NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL,("NPN callbacks initialized\n"));
 }
 
 NS_IMPL_ISUPPORTS2(nsNPAPIPlugin, nsIPlugin, nsIFactory)
 
@@ -456,27 +366,25 @@ nsNPAPIPlugin::nsNPAPIPlugin(NPPluginFun
     if (pfnGetEntryPoints(&np_callbacks) != NPERR_NO_ERROR)
       return;
   }
   else
 #endif
   {
     // call into the entry point
     NP_MAIN pfnMain = (NP_MAIN)PR_FindSymbol(aLibrary, "main");
-
-    if (pfnMain == NULL)
+    if (!pfnMain)
       return;
 
     NPError error;
-    NPP_ShutdownUPP pfnMainShutdown;
+    NPP_ShutdownProcPtr pfnMainShutdown;
     NS_TRY_SAFE_CALL_RETURN(error,
-                            CallNPP_MainEntryProc(pfnMain,
-                                                  &(nsNPAPIPlugin::CALLBACKS),
-                                                  &np_callbacks,
-                                                  &pfnMainShutdown),
+                            (*pfnMain)(&(nsNPAPIPlugin::CALLBACKS),
+                                       &np_callbacks,
+                                       &pfnMainShutdown),
                             aLibrary,
                             nsnull);
     
     NPP_PLUGIN_LOG(PLUGIN_LOG_BASIC,
                    ("NPP MainEntryProc called: return=%d\n",error));
     
     if (error != NPERR_NO_ERROR)
       return;
@@ -489,30 +397,30 @@ nsNPAPIPlugin::nsNPAPIPlugin(NPPluginFun
     if ((cb_version >> 8) < NP_VERSION_MAJOR)
       return;
   }
 
   // wrap all plugin entry points tvectors as mach-o callable function
   // pointers.
   fCallbacks.size = sizeof(fCallbacks);
   fCallbacks.version = np_callbacks.version;
-  fCallbacks.newp = (NPP_NewUPP) TV2FP(np_callbacks.newp);
-  fCallbacks.destroy = (NPP_DestroyUPP) TV2FP(np_callbacks.destroy);
-  fCallbacks.setwindow = (NPP_SetWindowUPP) TV2FP(np_callbacks.setwindow);
-  fCallbacks.newstream = (NPP_NewStreamUPP) TV2FP(np_callbacks.newstream);
+  fCallbacks.newp = (NPP_NewProcPtr) TV2FP(np_callbacks.newp);
+  fCallbacks.destroy = (NPP_DestroyProcPtr) TV2FP(np_callbacks.destroy);
+  fCallbacks.setwindow = (NPP_SetWindowProcPtr) TV2FP(np_callbacks.setwindow);
+  fCallbacks.newstream = (NPP_NewStreamProcPtr) TV2FP(np_callbacks.newstream);
   fCallbacks.destroystream =
-    (NPP_DestroyStreamUPP) TV2FP(np_callbacks.destroystream);
-  fCallbacks.asfile = (NPP_StreamAsFileUPP) TV2FP(np_callbacks.asfile);
-  fCallbacks.writeready = (NPP_WriteReadyUPP) TV2FP(np_callbacks.writeready);
-  fCallbacks.write = (NPP_WriteUPP) TV2FP(np_callbacks.write);
-  fCallbacks.print = (NPP_PrintUPP) TV2FP(np_callbacks.print);
-  fCallbacks.event = (NPP_HandleEventUPP) TV2FP(np_callbacks.event);
-  fCallbacks.urlnotify = (NPP_URLNotifyUPP) TV2FP(np_callbacks.urlnotify);
-  fCallbacks.getvalue = (NPP_GetValueUPP) TV2FP(np_callbacks.getvalue);
-  fCallbacks.setvalue = (NPP_SetValueUPP) TV2FP(np_callbacks.setvalue);
+    (NPP_DestroyStreamProcPtr) TV2FP(np_callbacks.destroystream);
+  fCallbacks.asfile = (NPP_StreamAsFileProcPtr) TV2FP(np_callbacks.asfile);
+  fCallbacks.writeready = (NPP_WriteReadyProcPtr) TV2FP(np_callbacks.writeready);
+  fCallbacks.write = (NPP_WriteProcPtr) TV2FP(np_callbacks.write);
+  fCallbacks.print = (NPP_PrintProcPtr) TV2FP(np_callbacks.print);
+  fCallbacks.event = (NPP_HandleEventProcPtr) TV2FP(np_callbacks.event);
+  fCallbacks.urlnotify = (NPP_URLNotifyProcPtr) TV2FP(np_callbacks.urlnotify);
+  fCallbacks.getvalue = (NPP_GetValueProcPtr) TV2FP(np_callbacks.getvalue);
+  fCallbacks.setvalue = (NPP_SetValueProcPtr) TV2FP(np_callbacks.setvalue);
 #else // for everyone else
   memcpy((void*) &fCallbacks, (void*) callbacks, sizeof(fCallbacks));
   fShutdownEntry = aShutdown;
 #endif
 
   fLibrary = aLibrary;
 }
 
@@ -827,19 +735,19 @@ nsNPAPIPlugin::Initialize(void)
 }
 
 nsresult
 nsNPAPIPlugin::Shutdown(void)
 {
   NPP_PLUGIN_LOG(PLUGIN_LOG_BASIC,
                  ("NPP Shutdown to be called: this=%p\n", this));
 
-  if (fShutdownEntry != nsnull) {
+  if (fShutdownEntry) {
 #if defined(XP_MACOSX)
-    CallNPP_ShutdownProc(fShutdownEntry);
+    (*fShutdownEntry)();
     if (fPluginRefNum > 0)
       ::CloseResFile(fPluginRefNum);
 #else
     NS_TRY_SAFE_CALL_VOID(fShutdownEntry(), fLibrary, nsnull);
 #endif
 
 #if defined(XP_MACOSX) && defined(__POWERPC__)
     // release the wrapped plugin function.
--- a/modules/plugin/base/src/nsNPAPIPlugin.h
+++ b/modules/plugin/base/src/nsNPAPIPlugin.h
@@ -38,46 +38,44 @@
 #ifndef nsNPAPIPlugin_h_
 #define nsNPAPIPlugin_h_
 
 #include "nsIFactory.h"
 #include "nsIPlugin.h"
 #include "nsIPluginInstancePeer.h"
 #include "nsIWindowlessPlugInstPeer.h"
 #include "prlink.h"
-#include "npupp.h"
+#include "npfunctions.h"
 #include "nsPluginHostImpl.h"
 
 /*
  * Use this macro before each exported function
  * (between the return address and the function
  * itself), to ensure that the function has the
  * right calling conventions on Win16.
  */
-// XXX NP_CALLBACK should be the same as NP_LOADDS in npapi.h which differs
-// for WIN16 and maybe WIN64?
 #ifdef XP_OS2
 #define NP_CALLBACK _System
 #else
 #define NP_CALLBACK
 #endif
 #if defined(XP_WIN)
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name)
 #elif defined(XP_OS2)
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name)
 #else
 #define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
 #endif
 
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_GETENTRYPOINTS) (NPPluginFuncs* pCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGININIT) (const NPNetscapeFuncs* pCallbacks);
-typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks,NPPluginFuncs* fCallbacks);
+typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFuncs* pCallbacks, NPPluginFuncs* fCallbacks);
 typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void);
 #ifdef XP_MACOSX
-typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_MAIN) (NPNetscapeFuncs* nCallbacks, NPPluginFuncs* pCallbacks, NPP_ShutdownUPP* unloadUpp);
+typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_MAIN) (NPNetscapeFuncs* nCallbacks, NPPluginFuncs* pCallbacks, NPP_ShutdownProcPtr* unloadProcPtr);
 #endif
 
 class nsNPAPIPlugin : public nsIPlugin
 {
 public:
   nsNPAPIPlugin(NPPluginFuncs* callbacks, PRLibrary* aLibrary,
                 NP_PLUGINSHUTDOWN aShutdown);
   virtual ~nsNPAPIPlugin(void);
--- a/modules/plugin/base/src/nsNPAPIPluginInstance.cpp
+++ b/modules/plugin/base/src/nsNPAPIPluginInstance.cpp
@@ -152,20 +152,17 @@ nsresult nsNPAPIPluginStreamListener::Cl
 
   NPP npp;
   mInst->GetNPP(&npp);
 
   if (mStreamStarted && callbacks->destroystream) {
     PRLibrary* lib = nsnull;
     lib = mInst->fLibrary;
     NPError error;
-    NS_TRY_SAFE_CALL_RETURN(error, CallNPP_DestroyStreamProc(callbacks->destroystream,
-                                                               npp,
-                                                               &mNPStream,
-                                                               reason), lib, mInst);
+    NS_TRY_SAFE_CALL_RETURN(error, (*callbacks->destroystream)(npp, &mNPStream, reason), lib, mInst);
 
     NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
     ("NPP DestroyStream called: this=%p, npp=%p, reason=%d, return=%d, url=%s\n",
     this, npp, reason, error, mNPStream.url));
 
     if (error == NPERR_NO_ERROR)
       rv = NS_OK;
   }
@@ -195,21 +192,17 @@ void nsNPAPIPluginStreamListener::CallUR
   if (!callbacks)
     return;
   
   if (callbacks->urlnotify) {
 
     NPP npp;
     mInst->GetNPP(&npp);
 
-    NS_TRY_SAFE_CALL_VOID(CallNPP_URLNotifyProc(callbacks->urlnotify,
-                                                npp,
-                                                mNotifyURL,
-                                                reason,
-                                                mNotifyData), mInst->fLibrary, mInst);
+    NS_TRY_SAFE_CALL_VOID((*callbacks->urlnotify)(npp, mNotifyURL, reason, mNotifyData), mInst->fLibrary, mInst);
 
     NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
     ("NPP URLNotify called: this=%p, npp=%p, notify=%p, reason=%d, url=%s\n",
     this, npp, mNotifyData, reason, mNotifyURL));
   }
 }
 
 NS_IMETHODIMP
@@ -245,22 +238,17 @@ nsNPAPIPluginStreamListener::OnStartBind
   
   if (!mResponseHeaders.IsEmpty()) {
     mResponseHeaderBuf = PL_strdup(mResponseHeaders.get());
     mNPStream.headers = mResponseHeaderBuf;
   }
 
   mStreamInfo = pluginInfo;
 
-  NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewStreamProc(callbacks->newstream,
-                                                       npp,
-                                                       (char *)contentType,
-                                                       &mNPStream,
-                                                       seekable,
-                                                       &streamType), mInst->fLibrary, mInst);
+  NS_TRY_SAFE_CALL_RETURN(error, (*callbacks->newstream)(npp, (char*)contentType, &mNPStream, seekable, &streamType), mInst->fLibrary, mInst);
 
   NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPP NewStream called: this=%p, npp=%p, mime=%s, seek=%d, type=%d, return=%d, url=%s\n",
   this, npp, (char *)contentType, seekable, streamType, error, mNPStream.url));
 
   if (error != NPERR_NO_ERROR)
     return NS_ERROR_FAILURE;
 
@@ -493,21 +481,17 @@ nsNPAPIPluginStreamListener::OnDataAvail
     PRInt32 zeroBytesWriteCount = 0;
 
     // mStreamBufferByteCount tells us how many bytes there are in the
     // buffer. WriteReady returns to us how many bytes the plugin is
     // ready to handle.
     while (mStreamBufferByteCount > 0) {
       PRInt32 numtowrite;
       if (callbacks->writeready) {
-        NS_TRY_SAFE_CALL_RETURN(numtowrite, 
-                                CallNPP_WriteReadyProc(callbacks->writeready,
-                                                       npp, &mNPStream),
-                                mInst->fLibrary, mInst);
-
+        NS_TRY_SAFE_CALL_RETURN(numtowrite, (*callbacks->writeready)(npp, &mNPStream), mInst->fLibrary, mInst);
         NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                        ("NPP WriteReady called: this=%p, npp=%p, "
                         "return(towrite)=%d, url=%s\n",
                         this, npp, numtowrite, mNPStream.url));
 
         if (!mStreamStarted) {
           // The plugin called NPN_DestroyStream() from within
           // NPP_WriteReady(), kill the stream.
@@ -544,22 +528,17 @@ nsNPAPIPluginStreamListener::OnDataAvail
         numtowrite = PR_MIN(numtowrite, mStreamBufferByteCount);
       } else {
         // if WriteReady is not supported by the plugin, just write
         // the whole buffer
         numtowrite = mStreamBufferByteCount;
       }
 
       PRInt32 writeCount = 0; // bytes consumed by plugin instance
-      NS_TRY_SAFE_CALL_RETURN(writeCount, 
-                              CallNPP_WriteProc(callbacks->write, npp,
-                                                &mNPStream, streamPosition,
-                                                numtowrite,
-                                                ptrStreamBuffer),
-                              mInst->fLibrary, mInst);
+      NS_TRY_SAFE_CALL_RETURN(writeCount, (*callbacks->write)(npp, &mNPStream, streamPosition, numtowrite, ptrStreamBuffer), mInst->fLibrary, mInst);
 
       NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
                      ("NPP Write called: this=%p, npp=%p, pos=%d, len=%d, "
                       "buf=%s, return(written)=%d,  url=%s\n",
                       this, npp, streamPosition, numtowrite,
                       ptrStreamBuffer, writeCount, mNPStream.url));
 
       if (!mStreamStarted) {
@@ -657,20 +636,17 @@ nsNPAPIPluginStreamListener::OnFileAvail
     return NS_ERROR_FAILURE;
   
   NPP npp;
   mInst->GetNPP(&npp);
 
   PRLibrary* lib = nsnull;
   lib = mInst->fLibrary;
 
-  NS_TRY_SAFE_CALL_VOID(CallNPP_StreamAsFileProc(callbacks->asfile,
-                                                   npp,
-                                                   &mNPStream,
-                                                   fileName), lib, mInst);
+  NS_TRY_SAFE_CALL_VOID((*callbacks->asfile)(npp, &mNPStream, fileName), lib, mInst);
 
   NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPP StreamAsFile called: this=%p, npp=%p, url=%s, file=%s\n",
   this, npp, mNPStream.url, fileName));
 
   return NS_OK;
 }
 
@@ -906,17 +882,17 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Sto
     mStreams = is;
 
     // Clean up our stream after removing it from the list because 
     // it may be released and destroyed at this point.
     if (listener)
       listener->CleanUpStream(NPRES_USER_BREAK);
   }
 
-  NS_TRY_SAFE_CALL_RETURN(error, CallNPP_DestroyProc(fCallbacks->destroy, &fNPP, &sdata), fLibrary, this);
+  NS_TRY_SAFE_CALL_RETURN(error, (*fCallbacks->destroy)(&fNPP, &sdata), fLibrary, this);
 
   NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPP Destroy called: this=%p, npp=%p, return=%d\n", this, &fNPP, error));
 
   nsJSNPRuntime::OnPluginDestroy(&fNPP);
 
   if (error != NPERR_NO_ERROR)
     return NS_ERROR_FAILURE;
@@ -1057,24 +1033,17 @@ nsresult nsNPAPIPluginInstance::Initiali
   // that assume these are set before returning. If the plugin returns failure,
   // we'll clear them out below.
   mPeer = peer;
   mStarted = PR_TRUE;
 
   PRBool oldVal = mInPluginInitCall;
   mInPluginInitCall = PR_TRUE;
 
-  NS_TRY_SAFE_CALL_RETURN(error, CallNPP_NewProc(fCallbacks->newp,
-                                          (char *)mimetype,
-                                          &fNPP,
-                                          (PRUint16)mode,
-                                          count,
-                                          (char**)names,
-                                          (char**)values,
-                                          NULL), fLibrary,this);
+  NS_TRY_SAFE_CALL_RETURN(error, (*fCallbacks->newp)((char*)mimetype, &fNPP, (PRUint16)mode, count, (char**)names, (char**)values, NULL), fLibrary,this);
 
   mInPluginInitCall = oldVal;
 
   NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPP New called: this=%p, npp=%p, mime=%s, mode=%d, argc=%d, return=%d\n",
   this, &fNPP, mimetype, mode, count, error));
 
   if (error != NPERR_NO_ERROR) {
@@ -1119,19 +1088,17 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Set
     // XXX Turns out that NPPluginWindow and NPWindow are structurally
     // identical (on purpose!), so there's no need to make a copy.
 
     PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("nsNPAPIPluginInstance::SetWindow (about to call it) this=%p\n",this));
 
     PRBool oldVal = mInPluginInitCall;
     mInPluginInitCall = PR_TRUE;
 
-    NS_TRY_SAFE_CALL_RETURN(error, CallNPP_SetWindowProc(fCallbacks->setwindow,
-                                  &fNPP,
-                                  (NPWindow*) window), fLibrary, this);
+    NS_TRY_SAFE_CALL_RETURN(error, (*fCallbacks->setwindow)(&fNPP, (NPWindow*)window), fLibrary, this);
 
     mInPluginInitCall = oldVal;
 
     NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
     ("NPP SetWindow called: this=%p, [x=%d,y=%d,w=%d,h=%d], clip[t=%d,b=%d,l=%d,r=%d], return=%d\n",
     this, window->x, window->y, window->width, window->height,
     window->clipRect.top, window->clipRect.bottom, window->clipRect.left, window->clipRect.right, error));
       
@@ -1201,21 +1168,18 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Pri
         void** destination = (void **)&(thePrint->print.embedPrint.window.type); 
         *destination = source;
       } 
       else 
         NS_ASSERTION(PR_FALSE, "Incompatible OS for assignment");
     }
   }
 
-  if (fCallbacks->print) {
-      NS_TRY_SAFE_CALL_VOID(CallNPP_PrintProc(fCallbacks->print,
-                                              &fNPP,
-                                              thePrint), fLibrary, this);
-  }
+  if (fCallbacks->print)
+      NS_TRY_SAFE_CALL_VOID((*fCallbacks->print)(&fNPP, thePrint), fLibrary, this);
 
   NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
   ("NPP PrintProc called: this=%p, pDC=%p, [x=%d,y=%d,w=%d,h=%d], clip[t=%d,b=%d,l=%d,r=%d]\n",
   this,
   platformPrint->print.embedPrint.platformPrint,
   platformPrint->print.embedPrint.window.x,
   platformPrint->print.embedPrint.window.y,
   platformPrint->print.embedPrint.window.width,
@@ -1237,34 +1201,28 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Han
     return NS_ERROR_FAILURE;
 
   PluginDestructionGuard guard(this);
 
   PRInt16 result = 0;
   
   if (fCallbacks->event) {
 #ifdef XP_MACOSX
-    result = CallNPP_HandleEventProc(fCallbacks->event,
-                                     &fNPP,
-                                     (void*) event->event);
+    result = (*fCallbacks->event)(&fNPP, (void*)event->event);
 
 #elif defined(XP_WIN) || defined(XP_OS2)
       NPEvent npEvent;
       npEvent.event = event->event;
       npEvent.wParam = event->wParam;
       npEvent.lParam = event->lParam;
 
-      NS_TRY_SAFE_CALL_RETURN(result, CallNPP_HandleEventProc(fCallbacks->event,
-                                    &fNPP,
-                                    (void*)&npEvent), fLibrary, this);
+      NS_TRY_SAFE_CALL_RETURN(result, (*fCallbacks->event)(&fNPP, (void*)&npEvent), fLibrary, this);
 
 #else // MOZ_X11 or other
-      result = CallNPP_HandleEventProc(fCallbacks->event,
-                                       &fNPP,
-                                       (void*)&event->event);
+      result = (*fCallbacks->event)(&fNPP, (void*)&event->event);
 #endif
 
       NPP_PLUGIN_LOG(PLUGIN_LOG_NOISY,
       ("NPP HandleEvent called: this=%p, npp=%p, event=%d, return=%d\n", 
       this, &fNPP, event->event, result));
 
       *handled = result;
     }
@@ -1273,37 +1231,31 @@ NS_IMETHODIMP nsNPAPIPluginInstance::Han
 }
 
 nsresult nsNPAPIPluginInstance::GetValueInternal(NPPVariable variable, void* value)
 {
   nsresult  res = NS_OK;
   if (fCallbacks->getvalue && mStarted) {
     PluginDestructionGuard guard(this);
 
-    NS_TRY_SAFE_CALL_RETURN(res, 
-                            CallNPP_GetValueProc(fCallbacks->getvalue, 
-                                                 &fNPP, 
-                                                 variable, 
-                                                 value), 
-                                                 fLibrary, this);
+    NS_TRY_SAFE_CALL_RETURN(res, (*fCallbacks->getvalue)(&fNPP, variable, value), fLibrary, this);
     NPP_PLUGIN_LOG(PLUGIN_LOG_NORMAL,
     ("NPP GetValue called: this=%p, npp=%p, var=%d, value=%d, return=%d\n", 
     this, &fNPP, variable, value, res));
 
 #ifdef XP_OS2
     /* Query interface for legacy Flash plugin */
     if (res == NS_OK && variable == NPPVpluginScriptableInstance)
     {
       nsCOMPtr<nsILegacyPluginWrapperOS2> wrapper =
                do_GetService(NS_LEGACY_PLUGIN_WRAPPER_CONTRACTID, &res);
       if (res == NS_OK)
       {
         nsIID *iid = nsnull; 
-        res = CallNPP_GetValueProc(fCallbacks->getvalue, &fNPP, 
-                                   NPPVpluginScriptableIID, (void *)&iid);
+        res = (*fCallbacks->getvalue)(&fNPP, NPPVpluginScriptableIID, (void *)&iid);
         if (res == NS_OK)
           res = wrapper->MaybeWrap(*iid, *(nsISupports**)value,
                                    (nsISupports**)value);
       }
     }
 #endif
   }
 
--- a/modules/plugin/base/src/nsNPAPIPluginInstance.h
+++ b/modules/plugin/base/src/nsNPAPIPluginInstance.h
@@ -44,17 +44,17 @@
 #include "nsVoidArray.h"
 #include "nsIPlugin.h"
 #include "nsIPluginInstance.h"
 #include "nsIPluginInstancePeer.h"
 #include "nsIPluginTagInfo2.h"
 #include "nsIScriptablePlugin.h"
 #include "nsIPluginInstanceInternal.h"
 
-#include "npupp.h"
+#include "npfunctions.h"
 #include "prlink.h"
 
 class nsNPAPIPluginStreamListener;
 class nsPIDOMWindow;
 
 struct nsInstanceStream
 {
     nsInstanceStream *mNext;
--- a/modules/plugin/default/mac/npmac.cpp
+++ b/modules/plugin/default/mac/npmac.cpp
@@ -4,17 +4,17 @@
 //
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 #include <string.h>
 
 #include <Carbon/Carbon.h>
 
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 //
 // Define PLUGIN_TRACE to 1 to have the wrapper functions emit
 // DebugStr messages whenever they are called.
 //
 //#define PLUGIN_TRACE 1
 
 #if PLUGIN_TRACE
@@ -121,18 +121,17 @@ static void* SetupTVtoFPGlue(TTVtoFPGlue
 
 short			gResFile;			// Refnum of the pluginÕs resource file
 NPNetscapeFuncs	gNetscapeFuncs;		// Function table for procs in Netscape called by plugin
 
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 //
 // Wrapper functions for all calls from the plugin to Netscape.
 // These functions let the plugin developer just call the APIs
-// as documented and defined in npapi.h, without needing to know
-// about the function table and call macros in npupp.h.
+// as documented and defined in npapi.h.
 //
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 
 void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
 {
 	*plugin_major = NP_VERSION_MAJOR;
 	*plugin_minor = NP_VERSION_MINOR;
@@ -142,168 +141,167 @@ void NPN_Version(int* plugin_major, int*
 
 NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
 {
 	int navMinorVers = gNetscapeFuncs.version & 0xFF;
 	NPError err;
 	
 	if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
 	{
-		err = CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
+		err = (*gNetscapeFuncs.geturlnotify)(instance, url, window, notifyData);
 	}
 	else
 	{
 		err = NPERR_INCOMPATIBLE_VERSION_ERROR;
 	}
 	return err;
 }
 
 NPError NPN_GetURL(NPP instance, const char* url, const char* window)
 {
-	return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
+	return (*gNetscapeFuncs.geturl)(instance, url, window);
 }
 
 NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData)
 {
 	int navMinorVers = gNetscapeFuncs.version & 0xFF;
 	NPError err;
 	
 	if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
 	{
-		err = CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, instance, url, 
-														window, len, buf, file, notifyData);
+		err = (*gNetscapeFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData);
 	}
 	else
 	{
 		err = NPERR_INCOMPATIBLE_VERSION_ERROR;
 	}
 	return err;
 }
 
 NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file)
 {
-	return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, url, window, len, buf, file);
+	return (*gNetscapeFuncs.posturl)(instance, url, window, len, buf, file);
 }
 
 NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
-	return CallNPN_RequestReadProc(gNetscapeFuncs.requestread, stream, rangeList);
+	return (*gNetscapeFuncs.requestread)(stream, rangeList);
 }
 
 NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* window, NPStream** stream)
 {
 	int navMinorVers = gNetscapeFuncs.version & 0xFF;
 	NPError err;
 	
 	if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
 	{
-		err = CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, type, window, stream);
+		err = (*gNetscapeFuncs.newstream)(instance, type, window, stream);
 	}
 	else
 	{
 		err = NPERR_INCOMPATIBLE_VERSION_ERROR;
 	}
 	return err;
 }
 
 int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
 {
 	int navMinorVers = gNetscapeFuncs.version & 0xFF;
 	NPError err;
 	
 	if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
 	{
-		err = CallNPN_WriteProc(gNetscapeFuncs.write, instance, stream, len, buffer);
+		err = (*gNetscapeFuncs.write)(instance, stream, len, buffer);
 	}
 	else
 	{
 		err = NPERR_INCOMPATIBLE_VERSION_ERROR;
 	}
 	return err;
 }
 
 NPError	NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
 	int navMinorVers = gNetscapeFuncs.version & 0xFF;
 	NPError err;
 	
 	if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
 	{
-		err = CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, instance, stream, reason);
+		err = (*gNetscapeFuncs.destroystream)(instance, stream, reason);
 	}
 	else
 	{
 		err = NPERR_INCOMPATIBLE_VERSION_ERROR;
 	}
 	return err;
 }
 
 void NPN_Status(NPP instance, const char* message)
 {
-	CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
+	(*gNetscapeFuncs.status)(instance, message);
 }
 
 const char* NPN_UserAgent(NPP instance)
 {
-	return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
+	return (*gNetscapeFuncs.uagent)(instance);
 }
 
 void* NPN_MemAlloc(uint32_t size)
 {
-	return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
+	return (*gNetscapeFuncs.memalloc)(size);
 }
 
 void NPN_MemFree(void* ptr)
 {
-	CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
+	(*gNetscapeFuncs.memfree)(ptr);
 }
 
 uint32_t NPN_MemFlush(uint32_t size)
 {
-	return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
+	return (*gNetscapeFuncs.memflush)(size);
 }
 
 void NPN_ReloadPlugins(NPBool reloadPages)
 {
-	CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
+	(*gNetscapeFuncs.reloadplugins)(reloadPages);
 }
 
 NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
 {
-	return CallNPN_GetValueProc( gNetscapeFuncs.getvalue, instance, variable, value);
+	return (*gNetscapeFuncs.getvalue)(instance, variable, value);
 }
 
 NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
 {
-	return CallNPN_SetValueProc( gNetscapeFuncs.setvalue, instance, variable, value);
+	return (*gNetscapeFuncs.setvalue)(instance, variable, value);
 }
 
 void NPN_InvalidateRect(NPP instance, NPRect *rect)
 {
-	CallNPN_InvalidateRectProc( gNetscapeFuncs.invalidaterect, instance, rect);
+	(*gNetscapeFuncs.invalidaterect)(instance, rect);
 }
 
 void NPN_InvalidateRegion(NPP instance, NPRegion region)
 {
-	CallNPN_InvalidateRegionProc( gNetscapeFuncs.invalidateregion, instance, region);
+	(*gNetscapeFuncs.invalidateregion)(instance, region);
 }
 
 void NPN_ForceRedraw(NPP instance)
 {
-	CallNPN_ForceRedrawProc( gNetscapeFuncs.forceredraw, instance);
+	(*gNetscapeFuncs.forceredraw)(instance);
 }
 
 void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
 {
-	CallNPN_PushPopupsEnabledStateProc( gNetscapeFuncs.pushpopupsenabledstate, instance, enabled);
+	(*gNetscapeFuncs.pushpopupsenabledstate)(instance, enabled);
 }
 
 void NPN_PopPopupsEnabledState(NPP instance)
 {
-	CallNPN_PopPopupsEnabledStateProc( gNetscapeFuncs.poppopupsenabledstate, instance);
+	(*gNetscapeFuncs.poppopupsenabledstate)(instance);
 }
 
 #pragma mark -
 
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 //
 // Wrapper functions for all calls from Netscape to the plugin.
 // These functions let the plugin developer just create the APIs
@@ -414,28 +412,28 @@ void SetUpQD(void)
 	//
 	// Memorize the pluginÕs resource file 
 	// refnum for later use.
 	//
 	gResFile = CurResFile();
 }
 
 
-int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
+int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownProcPtr* unloadProcPtr);
 
-DEFINE_API_C(int) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
+DEFINE_API_C(int) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownProcPtr* unloadProcPtr)
 {
 	PLUGINDEBUGSTR("\pmain");
 
 	NPError err = NPERR_NO_ERROR;
 	
 	//
 	// Ensure that everything Netscape passed us is valid!
 	//
-	if ((nsTable == NULL) || (pluginFuncs == NULL) || (unloadUpp == NULL))
+	if ((nsTable == NULL) || (pluginFuncs == NULL) || (unloadProcPtr == NULL))
 		err = NPERR_INVALID_FUNCTABLE_ERROR;
 	
 	//
 	// Check the ŌmajorĶ version passed in NetscapeÕs function table.
 	// We wonÕt load if the major version is newer than what we expect.
 	// Also check that the function tables passed in are big enough for
 	// all the functions we need (they could be bigger, if Netscape added
 	// new APIs, but thatÕs OK with us -- weÕll just ignore them).
@@ -456,71 +454,71 @@ DEFINE_API_C(int) main(NPNetscapeFuncs* 
 		// the whole structure, because the Netscape function table
 		// could actually be bigger than what we expect.
 		//
 		
 		int navMinorVers = nsTable->version & 0xFF;
 
 		gNetscapeFuncs.version          = nsTable->version;
 		gNetscapeFuncs.size             = nsTable->size;
-		gNetscapeFuncs.posturl          = (NPN_PostURLUPP)HOST_TO_PLUGIN_GLUE(posturl, nsTable->posturl);
-		gNetscapeFuncs.geturl           = (NPN_GetURLUPP)HOST_TO_PLUGIN_GLUE(geturl, nsTable->geturl);
-		gNetscapeFuncs.requestread      = (NPN_RequestReadUPP)HOST_TO_PLUGIN_GLUE(requestread, nsTable->requestread);
-		gNetscapeFuncs.newstream        = (NPN_NewStreamUPP)HOST_TO_PLUGIN_GLUE(newstream, nsTable->newstream);
-		gNetscapeFuncs.write            = (NPN_WriteUPP)HOST_TO_PLUGIN_GLUE(write, nsTable->write);
-		gNetscapeFuncs.destroystream    = (NPN_DestroyStreamUPP)HOST_TO_PLUGIN_GLUE(destroystream, nsTable->destroystream);
-		gNetscapeFuncs.status           = (NPN_StatusUPP)HOST_TO_PLUGIN_GLUE(status, nsTable->status);
-		gNetscapeFuncs.uagent           = (NPN_UserAgentUPP)HOST_TO_PLUGIN_GLUE(uagent, nsTable->uagent);
-		gNetscapeFuncs.memalloc         = (NPN_MemAllocUPP)HOST_TO_PLUGIN_GLUE(memalloc, nsTable->memalloc);
-		gNetscapeFuncs.memfree          = (NPN_MemFreeUPP)HOST_TO_PLUGIN_GLUE(memfree, nsTable->memfree);
-		gNetscapeFuncs.memflush         = (NPN_MemFlushUPP)HOST_TO_PLUGIN_GLUE(memflush, nsTable->memflush);
-		gNetscapeFuncs.reloadplugins    = (NPN_ReloadPluginsUPP)HOST_TO_PLUGIN_GLUE(reloadplugins, nsTable->reloadplugins);
+		gNetscapeFuncs.posturl          = (NPN_PostURLProcPtr)HOST_TO_PLUGIN_GLUE(posturl, nsTable->posturl);
+		gNetscapeFuncs.geturl           = (NPN_GetURLProcPtr)HOST_TO_PLUGIN_GLUE(geturl, nsTable->geturl);
+		gNetscapeFuncs.requestread      = (NPN_RequestReadProcPtr)HOST_TO_PLUGIN_GLUE(requestread, nsTable->requestread);
+		gNetscapeFuncs.newstream        = (NPN_NewStreamProcPtr)HOST_TO_PLUGIN_GLUE(newstream, nsTable->newstream);
+		gNetscapeFuncs.write            = (NPN_WriteProcPtr)HOST_TO_PLUGIN_GLUE(write, nsTable->write);
+		gNetscapeFuncs.destroystream    = (NPN_DestroyStreamProcPtr)HOST_TO_PLUGIN_GLUE(destroystream, nsTable->destroystream);
+		gNetscapeFuncs.status           = (NPN_StatusProcPtr)HOST_TO_PLUGIN_GLUE(status, nsTable->status);
+		gNetscapeFuncs.uagent           = (NPN_UserAgentProcPtr)HOST_TO_PLUGIN_GLUE(uagent, nsTable->uagent);
+		gNetscapeFuncs.memalloc         = (NPN_MemAllocProcPtr)HOST_TO_PLUGIN_GLUE(memalloc, nsTable->memalloc);
+		gNetscapeFuncs.memfree          = (NPN_MemFreeProcPtr)HOST_TO_PLUGIN_GLUE(memfree, nsTable->memfree);
+		gNetscapeFuncs.memflush         = (NPN_MemFlushProcPtr)HOST_TO_PLUGIN_GLUE(memflush, nsTable->memflush);
+		gNetscapeFuncs.reloadplugins    = (NPN_ReloadPluginsProcPtr)HOST_TO_PLUGIN_GLUE(reloadplugins, nsTable->reloadplugins);
 		if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
 		{
 			gNetscapeFuncs.getJavaEnv     = NULL;
 			gNetscapeFuncs.getJavaPeer    = NULL;
 		}
 		if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
 		{	
-			gNetscapeFuncs.geturlnotify 	= (NPN_GetURLNotifyUPP)HOST_TO_PLUGIN_GLUE(geturlnotify, nsTable->geturlnotify);
-			gNetscapeFuncs.posturlnotify 	= (NPN_PostURLNotifyUPP)HOST_TO_PLUGIN_GLUE(posturlnotify, nsTable->posturlnotify);
+			gNetscapeFuncs.geturlnotify 	= (NPN_GetURLNotifyProcPtr)HOST_TO_PLUGIN_GLUE(geturlnotify, nsTable->geturlnotify);
+			gNetscapeFuncs.posturlnotify 	= (NPN_PostURLNotifyProcPtr)HOST_TO_PLUGIN_GLUE(posturlnotify, nsTable->posturlnotify);
 		}
-		gNetscapeFuncs.getvalue         = (NPN_GetValueUPP)HOST_TO_PLUGIN_GLUE(getvalue, nsTable->getvalue);
-		gNetscapeFuncs.setvalue         = (NPN_SetValueUPP)HOST_TO_PLUGIN_GLUE(setvalue, nsTable->setvalue);
-		gNetscapeFuncs.invalidaterect   = (NPN_InvalidateRectUPP)HOST_TO_PLUGIN_GLUE(invalidaterect, nsTable->invalidaterect);
-		gNetscapeFuncs.invalidateregion = (NPN_InvalidateRegionUPP)HOST_TO_PLUGIN_GLUE(invalidateregion, nsTable->invalidateregion);
-		gNetscapeFuncs.forceredraw      = (NPN_ForceRedrawUPP)HOST_TO_PLUGIN_GLUE(forceredraw, nsTable->forceredraw);
-		gNetscapeFuncs.pushpopupsenabledstate = (NPN_PushPopupsEnabledStateUPP)HOST_TO_PLUGIN_GLUE(pushpopupsenabledstate, nsTable->pushpopupsenabledstate);
-		gNetscapeFuncs.poppopupsenabledstate  = (NPN_PopPopupsEnabledStateUPP)HOST_TO_PLUGIN_GLUE(poppopupsenabledstate, nsTable->poppopupsenabledstate);
+		gNetscapeFuncs.getvalue         = (NPN_GetValueProcPtr)HOST_TO_PLUGIN_GLUE(getvalue, nsTable->getvalue);
+		gNetscapeFuncs.setvalue         = (NPN_SetValueProcPtr)HOST_TO_PLUGIN_GLUE(setvalue, nsTable->setvalue);
+		gNetscapeFuncs.invalidaterect   = (NPN_InvalidateRectProcPtr)HOST_TO_PLUGIN_GLUE(invalidaterect, nsTable->invalidaterect);
+		gNetscapeFuncs.invalidateregion = (NPN_InvalidateRegionProcPtr)HOST_TO_PLUGIN_GLUE(invalidateregion, nsTable->invalidateregion);
+		gNetscapeFuncs.forceredraw      = (NPN_ForceRedrawProcPtr)HOST_TO_PLUGIN_GLUE(forceredraw, nsTable->forceredraw);
+		gNetscapeFuncs.pushpopupsenabledstate = (NPN_PushPopupsEnabledStateProcPtr)HOST_TO_PLUGIN_GLUE(pushpopupsenabledstate, nsTable->pushpopupsenabledstate);
+		gNetscapeFuncs.poppopupsenabledstate  = (NPN_PopPopupsEnabledStateProcPtr)HOST_TO_PLUGIN_GLUE(poppopupsenabledstate, nsTable->poppopupsenabledstate);
 		
 		//
 		// Set up the plugin function table that Netscape will use to
 		// call us.  Netscape needs to know about our version and size
 		// and have a UniversalProcPointer for every function we implement.
 		//
 		pluginFuncs->version        = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
 		pluginFuncs->size           = sizeof(NPPluginFuncs);
-		pluginFuncs->newp           = NewNPP_NewProc(PLUGIN_TO_HOST_GLUE(newp, Private_New));
-		pluginFuncs->destroy        = NewNPP_DestroyProc(PLUGIN_TO_HOST_GLUE(destroy, Private_Destroy));
-		pluginFuncs->setwindow      = NewNPP_SetWindowProc(PLUGIN_TO_HOST_GLUE(setwindow, Private_SetWindow));
-		pluginFuncs->newstream      = NewNPP_NewStreamProc(PLUGIN_TO_HOST_GLUE(newstream, Private_NewStream));
-		pluginFuncs->destroystream  = NewNPP_DestroyStreamProc(PLUGIN_TO_HOST_GLUE(destroystream, Private_DestroyStream));
-		pluginFuncs->asfile         = NewNPP_StreamAsFileProc(PLUGIN_TO_HOST_GLUE(asfile, Private_StreamAsFile));
-		pluginFuncs->writeready     = NewNPP_WriteReadyProc(PLUGIN_TO_HOST_GLUE(writeready, Private_WriteReady));
-		pluginFuncs->write          = NewNPP_WriteProc(PLUGIN_TO_HOST_GLUE(write, Private_Write));
-		pluginFuncs->print          = NewNPP_PrintProc(PLUGIN_TO_HOST_GLUE(print, Private_Print));
-		pluginFuncs->event          = NewNPP_HandleEventProc(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));	
+		pluginFuncs->newp           = (NPP_NewProcPtr)(PLUGIN_TO_HOST_GLUE(newp, Private_New));
+		pluginFuncs->destroy        = (NPP_DestroyProcPtr)(PLUGIN_TO_HOST_GLUE(destroy, Private_Destroy));
+		pluginFuncs->setwindow      = (NPP_SetWindowProcPtr)(PLUGIN_TO_HOST_GLUE(setwindow, Private_SetWindow));
+		pluginFuncs->newstream      = (NPP_NewStreamProcPtr)(PLUGIN_TO_HOST_GLUE(newstream, Private_NewStream));
+		pluginFuncs->destroystream  = (NPP_DestroyStreamProcPtr)(PLUGIN_TO_HOST_GLUE(destroystream, Private_DestroyStream));
+		pluginFuncs->asfile         = (NPP_StreamAsFileProcPtr)(PLUGIN_TO_HOST_GLUE(asfile, Private_StreamAsFile));
+		pluginFuncs->writeready     = (NPP_WriteReadyProcPtr)(PLUGIN_TO_HOST_GLUE(writeready, Private_WriteReady));
+		pluginFuncs->write          = (NPP_WriteProcPtr)(PLUGIN_TO_HOST_GLUE(write, Private_Write));
+		pluginFuncs->print          = (NPP_PrintProcPtr)(PLUGIN_TO_HOST_GLUE(print, Private_Print));
+		pluginFuncs->event          = (NPP_HandleEventProcPtr)(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));	
 		if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
 		{	
-			pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));			
+			pluginFuncs->urlnotify = (NPP_URLNotifyProcPtr)(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));			
 		}
 		if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
 		{
 			pluginFuncs->javaClass	= NULL;
 		}
-		*unloadUpp = NewNPP_ShutdownProc(PLUGIN_TO_HOST_GLUE(shutdown, Private_Shutdown));
+		*unloadProcPtr = (NPP_ShutdownProcPtr)(PLUGIN_TO_HOST_GLUE(shutdown, Private_Shutdown));
 
 		SetUpQD();
 		err = Private_Initialize();
 	}
 	
 	return err;
 }
--- a/modules/plugin/default/os2/npos2.cpp
+++ b/modules/plugin/default/os2/npos2.cpp
@@ -32,22 +32,18 @@
  * 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 ***** */
 
 #include <os2.h>
 
-#ifndef _NPAPI_H_
 #include "npapi.h"
-#endif
-#ifndef _NPUPP_H_
-#include "npupp.h"
-#endif
+#include "npfunctions.h"
 
 #include "nsDefaultPlugin.h"
 
 //\\// DEFINE
 #define NP_EXPORT
 
 //\\// GLOBAL DATA
 NPNetscapeFuncs* g_pNavigatorFuncs = 0;
--- a/modules/plugin/default/unix/npunix.c
+++ b/modules/plugin/default/unix/npunix.c
@@ -50,17 +50,17 @@
  *  YOU WILL NOT NEED TO EDIT THIS FILE.
  *----------------------------------------------------------------------
  */
 
 #define XP_UNIX 1
 
 #include <stdio.h>
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 /*
  * Define PLUGIN_TRACE to have the wrapper functions print
  * messages to stderr whenever they are called.
  */
 
 #ifdef PLUGIN_TRACE
 #include <stdio.h>
@@ -100,259 +100,236 @@ NPN_Version(int* plugin_major, int* plug
     *netscape_major = gNetscapeFuncs.version >> 8;
     /* Minor version is in low byte */
     *netscape_minor = gNetscapeFuncs.version & 0xFF;
 }
 
 NPError
 NPN_GetValue(NPP instance, NPNVariable variable, void *r_value)
 {
-    return CallNPN_GetValueProc(gNetscapeFuncs.getvalue,
-                    instance, variable, r_value);
+    return (*gNetscapeFuncs.getvalue)(instance, variable, r_value);
 }
 
 NPError
 NPN_SetValue(NPP instance, NPPVariable variable, void *value)
 {
-    return CallNPN_SetValueProc(gNetscapeFuncs.setvalue,
-                    instance, variable, value);
+    return (*gNetscapeFuncs.setvalue)(instance, variable, value);
 }
 
 NPError
 NPN_GetURL(NPP instance, const char* url, const char* window)
 {
-    return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
+    return (*gNetscapeFuncs.geturl)(instance, url, window);
 }
 
 NPError
 NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
 {
-    return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
+    return (*gNetscapeFuncs.geturlnotify)(instance, url, window, notifyData);
 }
 
 NPError
 NPN_PostURL(NPP instance, const char* url, const char* window,
          uint32_t len, const char* buf, NPBool file)
 {
-    return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
-                    url, window, len, buf, file);
+    return (*gNetscapeFuncs.posturl)(instance, url, window, len, buf, file);
 }
 
 NPError
 NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
                   const char* buf, NPBool file, void* notifyData)
 {
-    return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
-            instance, url, window, len, buf, file, notifyData);
+    return (*gNetscapeFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData);
 }
 
 NPError
 NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
-    return CallNPN_RequestReadProc(gNetscapeFuncs.requestread,
-                    stream, rangeList);
+    return (*gNetscapeFuncs.requestread)(stream, rangeList);
 }
 
 NPError
 NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
           NPStream** stream_ptr)
 {
-    return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance,
-                    type, window, stream_ptr);
+    return (*gNetscapeFuncs.newstream)(instance, type, window, stream_ptr);
 }
 
 int32_t
 NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
 {
-    return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
-                    stream, len, buffer);
+    return (*gNetscapeFuncs.write)(instance, stream, len, buffer);
 }
 
 NPError
 NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
-    return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream,
-                        instance, stream, reason);
+    return (*gNetscapeFuncs.destroystream)(instance, stream, reason);
 }
 
 void
 NPN_Status(NPP instance, const char* message)
 {
-    CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
+    (*gNetscapeFuncs.status)(instance, message);
 }
 
 const char*
 NPN_UserAgent(NPP instance)
 {
-    return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
+    return (*gNetscapeFuncs.uagent)(instance);
 }
 
 void*
 NPN_MemAlloc(uint32_t size)
 {
-    return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
+    return (*gNetscapeFuncs.memalloc)(size);
 }
 
 void NPN_MemFree(void* ptr)
 {
-    CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
+    (*gNetscapeFuncs.memfree)(ptr);
 }
 
 uint32_t NPN_MemFlush(uint32_t size)
 {
-    return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
+    return (*gNetscapeFuncs.memflush)(size);
 }
 
 void NPN_ReloadPlugins(NPBool reloadPages)
 {
-    CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
+    (*gNetscapeFuncs.reloadplugins)(reloadPages);
 }
 
 void
 NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
 {
-    CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance,
-        invalidRect);
+    (*gNetscapeFuncs.invalidaterect)(instance, invalidRect);
 }
 
 void
 NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
 {
-    CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance,
-        invalidRegion);
+    (*gNetscapeFuncs.invalidateregion)(instance, invalidRegion);
 }
 
 void
 NPN_ForceRedraw(NPP instance)
 {
-    CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance);
+    (*gNetscapeFuncs.forceredraw)(instance);
 }
 
 void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
 {
-    CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate,
-        instance, enabled);
+    (*gNetscapeFuncs.pushpopupsenabledstate)(instance, enabled);
 }
 
 void NPN_PopPopupsEnabledState(NPP instance)
 {
-    CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate,
-        instance);
+    (*gNetscapeFuncs.poppopupsenabledstate)(instance);
 }
 
 NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
 {
-    return CallNPN_GetStringIdentifierProc(gNetscapeFuncs.getstringidentifier,
-                                           name);
+    return (*gNetscapeFuncs.getstringidentifier)(name);
 }
 
 void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount,
                               NPIdentifier *identifiers)
 {
-    CallNPN_GetStringIdentifiersProc(gNetscapeFuncs.getstringidentifiers,
-        names, nameCount, identifiers);
+    (*gNetscapeFuncs.getstringidentifiers)(names, nameCount, identifiers);
 }
 
 NPIdentifier NPN_GetIntIdentifier(int32_t intid)
 {
-    return CallNPN_GetIntIdentifierProc(gNetscapeFuncs.getintidentifier, intid);
+    return (*gNetscapeFuncs.getintidentifier)(intid);
 }
 
 bool NPN_IdentifierIsString(NPIdentifier identifier)
 {
-    return CallNPN_IdentifierIsStringProc(gNetscapeFuncs.identifierisstring,
-        identifier);
+    return (*gNetscapeFuncs.identifierisstring)(identifier);
 }
 
 NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
 {
-    return CallNPN_UTF8FromIdentifierProc(gNetscapeFuncs.utf8fromidentifier,
-        identifier);
+    return (*gNetscapeFuncs.utf8fromidentifier)(identifier);
 }
 
 int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
 {
-    return CallNPN_IntFromIdentifierProc(gNetscapeFuncs.intfromidentifier,
-        identifier);
+    return (*gNetscapeFuncs.intfromidentifier)(identifier);
 }
 
 NPObject *NPN_CreateObject(NPP npp, NPClass *aClass)
 {
-    return CallNPN_CreateObjectProc(gNetscapeFuncs.createobject, npp, aClass);
+    return (*gNetscapeFuncs.createobject)(npp, aClass);
 }
 
 NPObject *NPN_RetainObject(NPObject *obj)
 {
-    return CallNPN_RetainObjectProc(gNetscapeFuncs.retainobject, obj);
+    return (*gNetscapeFuncs.retainobject)(obj);
 }
 
 void NPN_ReleaseObject(NPObject *obj)
 {
-    CallNPN_ReleaseObjectProc(gNetscapeFuncs.releaseobject, obj);
+    (*gNetscapeFuncs.releaseobject)(obj);
 }
 
 bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName,
                 const NPVariant *args, uint32_t argCount, NPVariant *result)
 {
-    return CallNPN_InvokeProc(gNetscapeFuncs.invoke, npp, obj, methodName,
-        args, argCount, result);
+    return (*gNetscapeFuncs.invoke)(npp, obj, methodName, args, argCount, result);
 }
 
 bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args,
                        uint32_t argCount, NPVariant *result)
 {
-    return CallNPN_InvokeDefaultProc(gNetscapeFuncs.invokeDefault, npp, obj,
-        args, argCount, result);
+    return (*gNetscapeFuncs.invokeDefault)(npp, obj, args, argCount, result);
 }
 
 bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script,
                   NPVariant *result)
 {
-    return CallNPN_EvaluateProc(gNetscapeFuncs.evaluate, npp, obj, script, result);
+    return (*gNetscapeFuncs.evaluate)(npp, obj, script, result);
 }
 
 bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
                      NPVariant *result)
 {
-    return CallNPN_GetPropertyProc(gNetscapeFuncs.getproperty, npp, obj,
-        propertyName, result);
+    return (*gNetscapeFuncs.getproperty)(npp, obj, propertyName, result);
 }
 
 bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName,
                      const NPVariant *value)
 {
-    return CallNPN_SetPropertyProc(gNetscapeFuncs.setproperty, npp, obj,
-        propertyName, value);
+    return (*gNetscapeFuncs.setproperty)(npp, obj, propertyName, value);
 }
 
 bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
 {
-    return CallNPN_RemovePropertyProc(gNetscapeFuncs.removeproperty, npp, obj,
-        propertyName);
+    return (*gNetscapeFuncs.removeproperty)(npp, obj, propertyName);
 }
 
 bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName)
 {
-    return CallNPN_HasPropertyProc(gNetscapeFuncs.hasproperty, npp, obj,
-        propertyName);
+    return (*gNetscapeFuncs.hasproperty)(npp, obj, propertyName);
 }
 
 bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName)
 {
-    return CallNPN_HasMethodProc(gNetscapeFuncs.hasmethod, npp, obj, methodName);
+    return (*gNetscapeFuncs.hasmethod)(npp, obj, methodName);
 }
 
 void NPN_ReleaseVariantValue(NPVariant *variant)
 {
-    CallNPN_ReleaseVariantValueProc(gNetscapeFuncs.releasevariantvalue, variant);
+    (*gNetscapeFuncs.releasevariantvalue)(variant);
 }
 
 void NPN_SetException(NPObject* obj, const NPUTF8 *message)
 {
-    CallNPN_SetExceptionProc(gNetscapeFuncs.setexception, obj, message);
+    (*gNetscapeFuncs.setexception)(obj, message);
 }
 
 
 /***********************************************************************
  *
  * Wrapper functions : Netscape Navigator -> plugin
  *
  * These functions let the plugin developer just create the APIs
@@ -632,32 +609,32 @@ NP_Initialize(NPNetscapeFuncs* nsTable, 
         /*
          * Set up the plugin function table that Netscape will use to
          * call us.  Netscape needs to know about our version and size
          * and have a UniversalProcPointer for every function we
          * implement.
          */
         pluginFuncs->version    = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
         pluginFuncs->size       = sizeof(NPPluginFuncs);
-        pluginFuncs->newp       = NewNPP_NewProc(Private_New);
-        pluginFuncs->destroy    = NewNPP_DestroyProc(Private_Destroy);
-        pluginFuncs->setwindow  = NewNPP_SetWindowProc(Private_SetWindow);
-        pluginFuncs->newstream  = NewNPP_NewStreamProc(Private_NewStream);
-        pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
-        pluginFuncs->asfile     = NewNPP_StreamAsFileProc(Private_StreamAsFile);
-        pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
-        pluginFuncs->write      = NewNPP_WriteProc(Private_Write);
-        pluginFuncs->print      = NewNPP_PrintProc(Private_Print);
-        pluginFuncs->urlnotify  = NewNPP_URLNotifyProc(Private_URLNotify);
+        pluginFuncs->newp       = (NPP_NewProcPtr)(Private_New);
+        pluginFuncs->destroy    = (NPP_DestroyProcPtr)(Private_Destroy);
+        pluginFuncs->setwindow  = (NPP_SetWindowProcPtr)(Private_SetWindow);
+        pluginFuncs->newstream  = (NPP_NewStreamProcPtr)(Private_NewStream);
+        pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
+        pluginFuncs->asfile     = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
+        pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
+        pluginFuncs->write      = (NPP_WriteProcPtr)(Private_Write);
+        pluginFuncs->print      = (NPP_PrintProcPtr)(Private_Print);
+        pluginFuncs->urlnotify  = (NPP_URLNotifyProcPtr)(Private_URLNotify);
         pluginFuncs->event      = NULL;
         pluginFuncs->javaClass  = NULL;
 
         // This function is supposedly loaded magically, but that doesn't
         // seem to be true.
-        pluginFuncs->getvalue      = NewNPP_GetValueProc(NP_GetValue);
+        pluginFuncs->getvalue   = (NPP_GetValueProcPtr)(NP_GetValue);
 
         err = NPP_Initialize();
     }
     
     return err;
 }
 
 /*
--- a/modules/plugin/default/windows/npwin.cpp
+++ b/modules/plugin/default/windows/npwin.cpp
@@ -30,22 +30,18 @@
  * 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 _NPAPI_H_
 #include "npapi.h"
-#endif
-#ifndef _NPUPP_H_
-#include "npupp.h"
-#endif
+#include "npfunctions.h"
 
 #include "nsDefaultPlugin.h"
 
 //\\// DEFINE
 #define NP_EXPORT
 
 //\\// GLOBAL DATA
 NPNetscapeFuncs* g_pNavigatorFuncs = 0;
--- a/modules/plugin/sdk/samples/common/npn_gate.cpp
+++ b/modules/plugin/sdk/samples/common/npn_gate.cpp
@@ -50,137 +50,137 @@ void NPN_Version(int* plugin_major, int*
 }
 
 NPError NPN_GetURLNotify(NPP instance, const char *url, const char *target, void* notifyData)
 {
 	int navMinorVers = NPNFuncs.version & 0xFF;
   NPError rv = NPERR_NO_ERROR;
 
   if (navMinorVers >= NPVERS_HAS_NOTIFICATION)
-		rv = CallNPN_GetURLNotifyProc(NPNFuncs.geturlnotify, instance, url, target, notifyData);
+		rv = (*NPNFuncs.geturlnotify)(instance, url, target, notifyData);
 	else
 		rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
 
   return rv;
 }
 
 NPError NPN_GetURL(NPP instance, const char *url, const char *target)
 {
-  return CallNPN_GetURLProc(NPNFuncs.geturl, instance, url, target);
+  return (*NPNFuncs.geturl)(instance, url, target);
 }
 
 NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData)
 {
 	int navMinorVers = NPNFuncs.version & 0xFF;
   NPError rv = NPERR_NO_ERROR;
 
 	if (navMinorVers >= NPVERS_HAS_NOTIFICATION)
-		rv = CallNPN_PostURLNotifyProc(NPNFuncs.posturlnotify, instance, url, window, len, buf, file, notifyData);
+		rv = (*NPNFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData);
 	else
 		rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
 
   return rv;
 }
 
 NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file)
 {
-  return CallNPN_PostURLProc(NPNFuncs.posturl, instance, url, window, len, buf, file);
+  return (*NPNFuncs.posturl)(instance, url, window, len, buf, file);
 } 
 
 NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
-  return CallNPN_RequestReadProc(NPNFuncs.requestread, stream, rangeList);
+  return (*NPNFuncs.requestread)(stream, rangeList);
 }
 
 NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream)
 {
 	int navMinorVersion = NPNFuncs.version & 0xFF;
 
   NPError rv = NPERR_NO_ERROR;
 
 	if (navMinorVersion >= NPVERS_HAS_STREAMOUTPUT)
-		rv = CallNPN_NewStreamProc(NPNFuncs.newstream, instance, type, target, stream);
+		rv = (*NPNFuncs.newstream)(instance, type, target, stream);
 	else
 		rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
 
   return rv;
 }
 
 int32_t NPN_Write(NPP instance, NPStream *stream, int32_t len, void *buffer)
 {
 	int navMinorVersion = NPNFuncs.version & 0xFF;
   int32_t rv = 0;
 
   if (navMinorVersion >= NPVERS_HAS_STREAMOUTPUT)
-		rv = CallNPN_WriteProc(NPNFuncs.write, instance, stream, len, buffer);
+		rv = (*NPNFuncs.write)(instance, stream, len, buffer);
 	else
 		rv = -1;
 
   return rv;
 }
 
 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
 	int navMinorVersion = NPNFuncs.version & 0xFF;
   NPError rv = NPERR_NO_ERROR;
 
   if (navMinorVersion >= NPVERS_HAS_STREAMOUTPUT)
-		rv = CallNPN_DestroyStreamProc(NPNFuncs.destroystream, instance, stream, reason);
+		rv = (*NPNFuncs.destroystream)(instance, stream, reason);
 	else
 		rv = NPERR_INCOMPATIBLE_VERSION_ERROR;
 
   return rv;
 }
 
 void NPN_Status(NPP instance, const char *message)
 {
-  CallNPN_StatusProc(NPNFuncs.status, instance, message);
+  (*NPNFuncs.status)(instance, message);
 }
 
 const char* NPN_UserAgent(NPP instance)
 {
-  return CallNPN_UserAgentProc(NPNFuncs.uagent, instance);
+  return (*NPNFuncs.uagent)(instance);
 }
 
 void* NPN_MemAlloc(uint32_t size)
 {
-  return CallNPN_MemAllocProc(NPNFuncs.memalloc, size);
+  return (*NPNFuncs.memalloc)(size);
 }
 
 void NPN_MemFree(void* ptr)
 {
-  CallNPN_MemFreeProc(NPNFuncs.memfree, ptr);
+  (*NPNFuncs.memfree)(ptr);
 }
 
 uint32_t NPN_MemFlush(uint32_t size)
 {
-  return CallNPN_MemFlushProc(NPNFuncs.memflush, size);
+  return (*NPNFuncs.memflush)(size);
 }
 
 void NPN_ReloadPlugins(NPBool reloadPages)
 {
-  CallNPN_ReloadPluginsProc(NPNFuncs.reloadplugins, reloadPages);
+  (*NPNFuncs.reloadplugins)(reloadPages);
 }
 
 NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
 {
-  return CallNPN_GetValueProc(NPNFuncs.getvalue, instance, variable, value);
+  return (*NPNFuncs.getvalue)(instance, variable, value);
 }
 
 NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
 {
-  return CallNPN_SetValueProc(NPNFuncs.setvalue, instance, variable, value);
+  return (*NPNFuncs.setvalue)(instance, variable, value);
 }
 
 void NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
 {
-  CallNPN_InvalidateRectProc(NPNFuncs.invalidaterect, instance, invalidRect);
+  (*NPNFuncs.invalidaterect)(instance, invalidRect);
 }
 
 void NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
 {
-  CallNPN_InvalidateRegionProc(NPNFuncs.invalidateregion, instance, invalidRegion);
+  (*NPNFuncs.invalidateregion)(instance, invalidRegion);
 }
 
 void NPN_ForceRedraw(NPP instance)
 {
-  CallNPN_ForceRedrawProc(NPNFuncs.forceredraw, instance);
+  (*NPNFuncs.forceredraw)(instance);
 }
--- a/modules/plugin/sdk/samples/include/npplat.h
+++ b/modules/plugin/sdk/samples/include/npplat.h
@@ -34,17 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef npplat_h_
 #define npplat_h_
 
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 #ifdef XP_WIN
 #include "windows.h"
 #endif
 
 #ifdef XP_UNIX
 #include <stdio.h>
 #endif
--- a/modules/plugin/sdk/samples/npruntime/np_entry.cpp
+++ b/modules/plugin/sdk/samples/npruntime/np_entry.cpp
@@ -156,28 +156,28 @@ NP_Initialize(NPNetscapeFuncs* pFuncs
   /*
    * Set up the plugin function table that Netscape will use to
    * call us.  Netscape needs to know about our version and size
    * and have a UniversalProcPointer for every function we
    * implement.
    */
   pluginFuncs->version    = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
   pluginFuncs->size       = sizeof(NPPluginFuncs);
-  pluginFuncs->newp       = NewNPP_NewProc(NPP_New);
-  pluginFuncs->destroy    = NewNPP_DestroyProc(NPP_Destroy);
-  pluginFuncs->setwindow  = NewNPP_SetWindowProc(NPP_SetWindow);
-  pluginFuncs->newstream  = NewNPP_NewStreamProc(NPP_NewStream);
-  pluginFuncs->destroystream = NewNPP_DestroyStreamProc(NPP_DestroyStream);
-  pluginFuncs->asfile     = NewNPP_StreamAsFileProc(NPP_StreamAsFile);
-  pluginFuncs->writeready = NewNPP_WriteReadyProc(NPP_WriteReady);
-  pluginFuncs->write      = NewNPP_WriteProc(NPP_Write);
-  pluginFuncs->print      = NewNPP_PrintProc(NPP_Print);
-  pluginFuncs->urlnotify  = NewNPP_URLNotifyProc(NPP_URLNotify);
+  pluginFuncs->newp       = (NPP_NewProcPtr)(NPP_New);
+  pluginFuncs->destroy    = (NPP_DestroyProcPtr)(NPP_Destroy);
+  pluginFuncs->setwindow  = (NPP_SetWindowProcPtr)(NPP_SetWindow);
+  pluginFuncs->newstream  = (NPP_NewStreamProcPtr)(NPP_NewStream);
+  pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(NPP_DestroyStream);
+  pluginFuncs->asfile     = (NPP_StreamAsFileProcPtr)(NPP_StreamAsFile);
+  pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(NPP_WriteReady);
+  pluginFuncs->write      = (NPP_WriteProcPtr)(NPP_Write);
+  pluginFuncs->print      = (NPP_PrintProcPtr)(NPP_Print);
+  pluginFuncs->urlnotify  = (NPP_URLNotifyProcPtr)(NPP_URLNotify);
   pluginFuncs->event      = NULL;
-  pluginFuncs->getvalue   = NewNPP_GetValueProc(NPP_GetValue);
+  pluginFuncs->getvalue   = (NPP_GetValueProcPtr)(NPP_GetValue);
   pluginFuncs->javaClass  = NULL;
 
   NPP_Initialize();
 #endif
 
   return NPERR_NO_ERROR;
 }
 
--- a/modules/plugin/sdk/samples/npruntime/npn_gate.cpp
+++ b/modules/plugin/sdk/samples/npruntime/npn_gate.cpp
@@ -35,17 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 ////////////////////////////////////////////////////////////
 //
 // Implementation of Netscape entry points (NPN_*)
 //
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 #ifndef HIBYTE
 #define HIBYTE(x) ((((uint32_t)(x)) & 0xff00) >> 8)
 #endif
 
 #ifndef LOBYTE
 #define LOBYTE(W) ((W) & 0xFF)
 #endif
--- a/modules/plugin/sdk/samples/npruntime/plugin.cpp
+++ b/modules/plugin/sdk/samples/npruntime/plugin.cpp
@@ -48,17 +48,17 @@
 #include <TextEdit.h>
 #endif
 
 #ifdef XP_UNIX
 #include <string.h>
 #endif
 
 #include "plugin.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 static NPIdentifier sFoo_id;
 static NPIdentifier sBar_id;
 static NPIdentifier sDocument_id;
 static NPIdentifier sBody_id;
 static NPIdentifier sCreateElement_id;
 static NPIdentifier sCreateTextNode_id;
 static NPIdentifier sAppendChild_id;
--- a/modules/plugin/sdk/samples/npthread/windows/np_entry.cpp
+++ b/modules/plugin/sdk/samples/npthread/windows/np_entry.cpp
@@ -31,17 +31,17 @@
  * 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 ***** */
 
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 #include "dbg.h"
 
 NPNetscapeFuncs NPNFuncs;
 
 NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* aPluginFuncs)
 {
   dbgOut1("wrapper: NP_GetEntryPoints");
 
--- a/modules/plugin/sdk/samples/npthread/windows/npn_gate.cpp
+++ b/modules/plugin/sdk/samples/npthread/windows/npn_gate.cpp
@@ -31,17 +31,17 @@
  * 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 ***** */
 
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 #include "dbg.h"
 
 extern NPNetscapeFuncs NPNFuncs;
 
 void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
 {
   dbgOut1("wrapper: NPN_Version");
 
--- a/modules/plugin/sdk/samples/npthread/windows/npp_gate.cpp
+++ b/modules/plugin/sdk/samples/npthread/windows/npp_gate.cpp
@@ -32,17 +32,17 @@
  * 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 ***** */
 
 #include "windows.h"
 
-#include "npupp.h"
+#include "npfunctions.h"
 #include "npapi.h"
 #include "plugin.h"
 #include "dbg.h"
 
 nsPluginThread * thePluginThread = NULL;
 
 NPError NPP_New(NPMIMEType aType,
                 NPP aInstance,
--- a/modules/plugin/sdk/samples/npthread/windows/plugin.cpp
+++ b/modules/plugin/sdk/samples/npthread/windows/plugin.cpp
@@ -32,17 +32,17 @@
  * 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 ***** */
 
 #include "windows.h"
 
-#include "npupp.h"
+#include "npfunctions.h"
 #include "npapi.h"
 #include "plugin.h"
 #include "plugload.h"
 #include "dbg.h"
 
 extern NPNetscapeFuncs NPNFuncs;
 NPNetscapeFuncs wrapperNPNFuncs;
 NPPluginFuncs pluginNPPFuncs;
--- a/modules/plugin/sdk/samples/unixprinting/npunix.c
+++ b/modules/plugin/sdk/samples/unixprinting/npunix.c
@@ -50,17 +50,17 @@
  *  YOU WILL NOT NEED TO EDIT THIS FILE.
  *----------------------------------------------------------------------
  */
 
 #define XP_UNIX 1
 
 #include <stdio.h>
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 /*
  * Define PLUGIN_TRACE to have the wrapper functions print
  * messages to stderr whenever they are called.
  */
 
 #ifdef PLUGIN_TRACE
 #include <stdio.h>
@@ -79,18 +79,17 @@
 static NPNetscapeFuncs   gNetscapeFuncs;    /* Netscape Function table */
 
 
 /***********************************************************************
  *
  * Wrapper functions : plugin calling Netscape Navigator
  *
  * These functions let the plugin developer just call the APIs
- * as documented and defined in npapi.h, without needing to know
- * about the function table and call macros in npupp.h.
+ * as documented and defined in npapi.h.
  *
  ***********************************************************************/
 
 void
 NPN_Version(int* plugin_major, int* plugin_minor,
          int* netscape_major, int* netscape_minor)
 {
     *plugin_major = NP_VERSION_MAJOR;
@@ -100,147 +99,135 @@ NPN_Version(int* plugin_major, int* plug
     *netscape_major = gNetscapeFuncs.version >> 8;
     /* Minor version is in low byte */
     *netscape_minor = gNetscapeFuncs.version & 0xFF;
 }
 
 NPError
 NPN_GetValue(NPP instance, NPNVariable variable, void *r_value)
 {
-    return CallNPN_GetValueProc(gNetscapeFuncs.getvalue,
-                    instance, variable, r_value);
+    return (*gNetscapeFuncs.getvalue)(instance, variable, r_value);
 }
 
 NPError
 NPN_SetValue(NPP instance, NPPVariable variable, void *value)
 {
-    return CallNPN_SetValueProc(gNetscapeFuncs.setvalue,
-                    instance, variable, value);
+    return (*gNetscapeFuncs.setvalue)(instance, variable, value);
 }
 
 NPError
 NPN_GetURL(NPP instance, const char* url, const char* window)
 {
-    return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
+    return (*gNetscapeFuncs.geturl)(instance, url, window);
 }
 
 NPError
 NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
 {
-    return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
+    return (*gNetscapeFuncs.geturlnotify)(instance, url, window, notifyData);
 }
 
 NPError
 NPN_PostURL(NPP instance, const char* url, const char* window,
          uint32_t len, const char* buf, NPBool file)
 {
-    return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
-                    url, window, len, buf, file);
+    return (*gNetscapeFuncs.posturl)(instance, url, window, len, buf, file);
 }
 
 NPError
 NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32_t len,
                   const char* buf, NPBool file, void* notifyData)
 {
-    return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
-            instance, url, window, len, buf, file, notifyData);
+    return (*gNetscapeFuncs.posturlnotify)(instance, url, window, len, buf, file, notifyData);
 }
 
 NPError
 NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
 {
-    return CallNPN_RequestReadProc(gNetscapeFuncs.requestread,
-                    stream, rangeList);
+    return (*gNetscapeFuncs.requestread)(stream, rangeList);
 }
 
 NPError
 NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
           NPStream** stream_ptr)
 {
-    return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance,
-                    type, window, stream_ptr);
+    return (*gNetscapeFuncs.newstream)(instance, type, window, stream_ptr);
 }
 
 int32_t
 NPN_Write(NPP instance, NPStream* stream, int32_t len, void* buffer)
 {
-    return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
-                    stream, len, buffer);
+    return (*gNetscapeFuncs.write)(instance, stream, len, buffer);
 }
 
 NPError
 NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
 {
-    return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream,
-                        instance, stream, reason);
+    return (*gNetscapeFuncs.destroystream)(instance, stream, reason);
 }
 
 void
 NPN_Status(NPP instance, const char* message)
 {
-    CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
+    (*gNetscapeFuncs.status)(instance, message);
 }
 
 const char*
 NPN_UserAgent(NPP instance)
 {
-    return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
+    return (*gNetscapeFuncs.uagent)(instance);
 }
 
 void*
 NPN_MemAlloc(uint32_t size)
 {
-    return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
+    return (*gNetscapeFuncs.memalloc)(size);
 }
 
 void NPN_MemFree(void* ptr)
 {
-    CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
+    (*gNetscapeFuncs.memfree)(ptr);
 }
 
 uint32_t NPN_MemFlush(uint32_t size)
 {
-    return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
+    return (*gNetscapeFuncs.memflush)(size);
 }
 
 void NPN_ReloadPlugins(NPBool reloadPages)
 {
-    CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
+    (*gNetscapeFuncs.reloadplugins)(reloadPages);
 }
 
 void
 NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
 {
-    CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance,
-        invalidRect);
+    (*gNetscapeFuncs.invalidaterect)(instance, invalidRect);
 }
 
 void
 NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
 {
-    CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance,
-        invalidRegion);
+    (*gNetscapeFuncs.invalidateregion)(instance, invalidRegion);
 }
 
 void
 NPN_ForceRedraw(NPP instance)
 {
-    CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance);
+    (*gNetscapeFuncs.forceredraw)(instance);
 }
 
 void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled)
 {
-    CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate,
-        instance, enabled);
+    (*gNetscapeFuncs.pushpopupsenabledstate)(instance, enabled);
 }
 
 void NPN_PopPopupsEnabledState(NPP instance)
 {
-    CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate,
-        instance);
+    (*gNetscapeFuncs.poppopupsenabledstate)(instance);
 }
 
 
 
 /***********************************************************************
  *
  * Wrapper functions : Netscape Navigator -> plugin
  *
@@ -462,26 +449,26 @@ NP_Initialize(NPNetscapeFuncs* nsTable, 
         /*
          * Set up the plugin function table that Netscape will use to
          * call us.  Netscape needs to know about our version and size
          * and have a UniversalProcPointer for every function we
          * implement.
          */
         pluginFuncs->version    = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
         pluginFuncs->size       = sizeof(NPPluginFuncs);
-        pluginFuncs->newp       = NewNPP_NewProc(Private_New);
-        pluginFuncs->destroy    = NewNPP_DestroyProc(Private_Destroy);
-        pluginFuncs->setwindow  = NewNPP_SetWindowProc(Private_SetWindow);
-        pluginFuncs->newstream  = NewNPP_NewStreamProc(Private_NewStream);
-        pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
-        pluginFuncs->asfile     = NewNPP_StreamAsFileProc(Private_StreamAsFile);
-        pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
-        pluginFuncs->write      = NewNPP_WriteProc(Private_Write);
-        pluginFuncs->print      = NewNPP_PrintProc(Private_Print);
-        pluginFuncs->urlnotify  = NewNPP_URLNotifyProc(Private_URLNotify);
+        pluginFuncs->newp       = (NPP_NewProcPtr)(Private_New);
+        pluginFuncs->destroy    = (NPP_DestroyProcPtr)(Private_Destroy);
+        pluginFuncs->setwindow  = (NPP_SetWindowProcPtr)(Private_SetWindow);
+        pluginFuncs->newstream  = (NPP_NewStreamProcPtr)(Private_NewStream);
+        pluginFuncs->destroystream = (NPP_DestroyStreamProcPtr)(Private_DestroyStream);
+        pluginFuncs->asfile     = (NPP_StreamAsFileProcPtr)(Private_StreamAsFile);
+        pluginFuncs->writeready = (NPP_WriteReadyProcPtr)(Private_WriteReady);
+        pluginFuncs->write      = (NPP_WriteProcPtr)(Private_Write);
+        pluginFuncs->print      = (NPP_PrintProcPtr)(Private_Print);
+        pluginFuncs->urlnotify  = (NPP_URLNotifyProcPtr)(Private_URLNotify);
         pluginFuncs->event      = NULL;
         pluginFuncs->javaClass  = NULL;
 
         err = NPP_Initialize();
     }
     
     return err;
 }
--- a/modules/plugin/test/testplugin/nptest.cpp
+++ b/modules/plugin/test/testplugin/nptest.cpp
@@ -31,17 +31,17 @@
  * 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 ***** */
 
 #include "npapi.h"
-#include "npupp.h"
+#include "npfunctions.h"
 
 #if defined(XP_UNIX)
 
 #define PLUGIN_NAME         "Test Plug-in"
 #define PLUGIN_DESCRIPTION  "Plug-in for testing purposes."
 #define PLUGIN_VERSION      "1.0.0.0"
 
 NP_EXPORT(char*)