home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / np40sdk.exe / NP40SDK.OS2 / common / npos2.cpp
Text File  |  1998-09-23  |  21KB  |  627 lines

  1. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  2. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  3. //
  4. // FILE:     npos2.cpp
  5. // DESCRIPT: Common source file for building OS/2 plugins
  6. // VERSION:  4.0
  7. //
  8. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  9. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  10.  
  11. //\\// INCLUDE
  12. #include <os2.h>
  13. #define DWORD ULONG
  14. #define LPVOID PVOID
  15.  
  16. // netscape specific includes
  17. #include "npapi.h"
  18. #include "npupp.h"
  19.  
  20. //\\// DEFINES
  21. #define NP_EXPORT _Export
  22.  
  23. //\\// GLOBAL DATA
  24. // We need these to be global since we have to fill the structures
  25. // with data (class) which requires knowledge of the navigator
  26. // jump-table. This jump table is known at Initialize time (NP_Initialize)
  27. // which is called after NP_GetEntryPoint.
  28. NPNetscapeFuncs* g_pNavigatorFuncs = NULL;
  29. NPPluginFuncs* g_pluginFuncs;
  30.  
  31.  
  32. #ifdef _cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  37. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  38. // DllEntryPoint
  39. //
  40. //
  41. BOOL DLLInitTerm( HMODULE hmod, int Flag)
  42. {
  43.   #ifdef DEBUG1
  44.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  45.                  "DLLInitTerm","DEBUG1: npos2.cpp",
  46.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  47.   #endif
  48.    return 0;
  49. }
  50.  
  51.  
  52. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  53. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  54. //                                              PLUGIN DLL entry points
  55. //
  56. // These are the OS/2 specific DLL entry points. They must be exoprted.
  57. //
  58.  
  59.  
  60. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  61. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  62. // NP_GetEntryPoints
  63. //
  64. //  Fills in the func table used by Navigator to call entry points in the
  65. //  plugin DLL.  Note that these entry points ensure that DS is loaded
  66. //  by using the NP_EXPORT macro.
  67. //
  68. NPError
  69. NP_GetEntryPoints(NPPluginFuncs* pFuncs)
  70. {
  71.   char temp[100];
  72.   #ifdef DEBUG1
  73.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  74.                  "NP_GetEntryPoints","DEBUG1: npos2.cpp",
  75.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  76.   #endif
  77.     // trap a NULL ptr
  78.     if (pFuncs == NULL)
  79.       {
  80.        #ifdef DEBUG1
  81.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  82.                  "passed in pointer fFuncs is NULL","DEBUG1: npos2.cpp:NP_GetEntryPoints",
  83.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  84.        #endif
  85.  
  86.        return NPERR_INVALID_FUNCTABLE_ERROR;
  87.       }
  88.     // if the plugin's function table is smaller than the plugin expects,
  89.     // then they are incompatible, and should return an error
  90.   #ifdef DEBUG1
  91.        sprintf(temp,"pFuncs->size = %d NPPluginFuncs = %d",
  92.                pFuncs->size,sizeof(NPPluginFuncs));
  93.  
  94.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  95.                  temp,"DEBUG1: npos2.cpp:NP_GetEntryPoints",
  96.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  97.   #endif
  98. //  if (pFuncs->size < sizeof( NPPluginFuncs))
  99. //     return NPERR_INVALID_FUNCTABLE_ERROR;
  100.   #ifdef DEBUG1
  101.     if (pFuncs->size < sizeof( NPPluginFuncs))
  102.       {
  103.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  104.                  "difference in pFuncs table size",
  105.                  "DEBUG1: npos2.cpp:NP_GetEntryPoints",
  106.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  107.       }
  108.   #endif
  109.  
  110.     pFuncs->version       = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
  111.     pFuncs->newp          = NPP_New;
  112.     pFuncs->destroy       = NPP_Destroy;
  113.     pFuncs->setwindow     = NPP_SetWindow;
  114.     pFuncs->newstream     = NPP_NewStream;
  115.     pFuncs->destroystream = NPP_DestroyStream;
  116.     pFuncs->asfile        = NPP_StreamAsFile;
  117.     pFuncs->writeready    = NPP_WriteReady;
  118.     pFuncs->write         = NPP_Write;
  119.     pFuncs->print         = NPP_Print;
  120. #ifdef IBMJAVA
  121.     pFuncs->event         = (NPP_HandleEventUPP) NPP_HandleEvent;
  122.     pFuncs->urlnotify     = NPP_URLNotify;
  123.     pFuncs->javaClass     = NULL;
  124.     pFuncs->getvalue      = (NPP_GetValueUPP) NPP_GetValue;
  125.     pFuncs->setvalue      = (NPP_SetValueUPP) NPP_SetValue;
  126. #endif
  127.  
  128.     g_pluginFuncs         = pFuncs;
  129.  
  130.     return NPERR_NO_ERROR;
  131. }
  132.  
  133. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  134. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  135. // NP_Initialize
  136. //
  137. //  Called immediately after the plugin DLL is loaded (after call to
  138. //  NP_GetEntryPoints).
  139. //
  140. NPError
  141. NP_Initialize(NPNetscapeFuncs* pFuncs)
  142. {
  143.         jclass  sclass;    // From GetEntryPoints
  144.   #ifdef DEBUG1
  145.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  146.                  "NP_Initialize","DEBUG1: npos2.cpp",
  147.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  148.   #endif
  149.     // trap a NULL ptr
  150.     if (pFuncs == NULL)
  151.       {
  152.        return NPERR_INVALID_FUNCTABLE_ERROR;
  153.       }
  154.  
  155.     g_pNavigatorFuncs = pFuncs; // save it for future reference
  156.  
  157.     // if the plugin's major ver level is lower than the Navigator's,
  158.     // then they are incompatible, and should return an error
  159.  
  160.     if (HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
  161.       {
  162.        return NPERR_INCOMPATIBLE_VERSION_ERROR;
  163.       }
  164.     // if the Navigator's function table is smaller than the plugin expects,
  165.     // then they are incompatible, and should return an error
  166.  
  167.     if (pFuncs->size < sizeof (NPNetscapeFuncs))
  168.       {
  169.        return NPERR_INVALID_FUNCTABLE_ERROR;
  170.       }
  171.  
  172. #ifdef IBMJAVA
  173.     g_pluginFuncs->javaClass  = NPP_GetJavaClass();
  174. #endif
  175.   #ifdef DEBUG1
  176.         WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  177.                  "after NPP_GetJavaClass","DEBUG1: npsimple.cpp: NP_Initialize: ",
  178.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  179.   #endif
  180.  
  181.  
  182.     return NPP_Initialize();
  183. }
  184.  
  185. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  186. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  187. // NP_Shutdown
  188. //
  189. //  Called immediately before the plugin DLL is unloaded.
  190. //  This function should check for some ref count on the dll to see if it is
  191. //  unloadable or it needs to stay in memory.
  192. //
  193. NPError
  194. NP_Shutdown()
  195. {
  196.   #ifdef DEBUG1
  197.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  198.                  "NP_Shutdown","DEBUG1: npos2.cpp",
  199.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  200.   #endif
  201.     NPP_Shutdown();
  202.  
  203.     g_pNavigatorFuncs = NULL;
  204.  
  205.     return NPERR_NO_ERROR;
  206. }
  207.  
  208. #ifdef _cplusplus
  209. }
  210. #endif
  211.  
  212. //                                              END - PLUGIN DLL entry points
  213. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  214. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  215.  
  216.  
  217.  
  218. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  219. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  220. //                                              NAVIGATOR Entry points
  221. //
  222. // These entry points expect to be called from within the plugin.  The
  223. // noteworthy assumption is that DS has already been set to point to the
  224. // plugin's DLL data segment.  Don't call these functions from outside
  225. // the plugin without ensuring DS is set to the DLLs data segment first.
  226. //
  227.  
  228. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  229. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  230. // NP_Version
  231. //
  232. //  Returns the major/minor version numbers of the Plugin API for the plugin
  233. //  and the Navigator
  234. //
  235. void
  236. NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
  237. {
  238.   #ifdef DEBUG1
  239.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  240.                  "NPN_Version","DEBUG1: npos2.cpp",
  241.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  242.   #endif
  243.     *plugin_major   = NP_VERSION_MAJOR;
  244.     *plugin_minor   = NP_VERSION_MINOR;
  245.     *netscape_major = HIBYTE(g_pNavigatorFuncs->version);
  246.     *netscape_minor = LOBYTE(g_pNavigatorFuncs->version);
  247. }
  248.  
  249. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  250. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  251. // NPN_GetURL
  252. //
  253. //  Causes the specified URL to be fetched and streamed in
  254. //
  255. NPError
  256. NPN_GetURL(NPP instance, const char *url, const char *window)
  257. {
  258.   #ifdef DEBUG1
  259.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  260.                  "NPN_GetURL","DEBUG1: npos2.cpp",
  261.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  262.   #endif
  263.     return g_pNavigatorFuncs->geturl(instance, url, window);
  264. }
  265.  
  266. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  267. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  268. // NPN_PostURL
  269. //
  270. //
  271. //
  272. NPError
  273. NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file)
  274. {
  275.   #ifdef DEBUG1
  276.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  277.                  "NPN_PostURL","DEBUG1: npos2.cpp",
  278.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  279.   #endif
  280.     return g_pNavigatorFuncs->posturl(instance, url, window, len, buf, file);
  281. }
  282.  
  283. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  284. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  285. // NPN_RequestRead
  286. //
  287. //  Requests that a number of bytes be provided on a stream.  Typically
  288. //  this would be used if a stream was in "pull" mode.  An optional
  289. //  position can be provided for streams which are seekable.
  290. //
  291. NPError
  292. NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
  293. {
  294.   #ifdef DEBUG1
  295.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  296.                  "NPN_RequestRead","DEBUG1: npos2.cpp",
  297.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  298.   #endif
  299.     return g_pNavigatorFuncs->requestread(stream, rangeList);
  300. }
  301.  
  302. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  303. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  304. // NPN_NewStream
  305. //
  306. //  Creates a new stream of data from the plug-in to be interpreted
  307. //  by Netscape in the current window.
  308. //
  309. NPError
  310. NPN_NewStream(NPP instance, NPMIMEType type, const char* target, NPStream** stream)
  311. {
  312.   #ifdef DEBUG1
  313.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  314.                  "NPN_NewStream","DEBUG1: npos2.cpp",
  315.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  316.   #endif
  317.     return g_pNavigatorFuncs->newstream(instance, type, target, stream);
  318. }
  319.  
  320. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  321. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  322. // NPN_Write
  323. //
  324. //  Provides len bytes of data.
  325. //
  326. int32
  327. NPN_Write(NPP instance, NPStream *stream,
  328.                 int32 len, void *buffer)
  329. {
  330.   #ifdef DEBUG1
  331.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  332.                  "NPN_Write","DEBUG1: npos2.cpp",
  333.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  334.   #endif
  335.     return g_pNavigatorFuncs->write(instance, stream, len, buffer);
  336. }
  337.  
  338. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  339. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  340. // NPN_DestroyStream
  341. //
  342. //  Closes a stream object. Reason indicates why the stream was closed.
  343. //
  344. NPError
  345. NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
  346. {
  347.   #ifdef DEBUG1
  348.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  349.                  "NPN_DestroyStream","DEBUG1: npos2.cpp",
  350.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  351.   #endif
  352.     return g_pNavigatorFuncs->destroystream(instance, stream, reason);
  353. }
  354.  
  355. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  356. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  357. // NPN_Status
  358. //
  359. //  Provides a text status message in the Netscape client user interface
  360. //
  361. void
  362. NPN_Status(NPP instance, const char *message)
  363. {
  364.   #ifdef DEBUG1
  365.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  366.                  "NPN_Status","DEBUG1: npos2.cpp",
  367.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  368.   #endif
  369.     g_pNavigatorFuncs->status(instance, message);
  370. }
  371.  
  372. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  373. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  374. // NPN_UserAgent
  375. //
  376. //  Returns the user agent string of Navigator, which contains version info
  377. //
  378. const char*
  379. NPN_UserAgent(NPP instance)
  380. {
  381.   #ifdef DEBUG1
  382.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  383.                  "NPN_UserAgent","DEBUG1: npos2.cpp",
  384.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  385.   #endif
  386.     return g_pNavigatorFuncs->uagent(instance);
  387. }
  388.  
  389. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  390. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  391. // NPN_MemAlloc
  392. //
  393. //  Allocates memory from the Navigator's memory space.  Necessary so that
  394. //  saved instance data may be freed by Navigator when exiting.
  395. //
  396. void*
  397. NPN_MemAlloc(uint32 size)
  398. {
  399.   #ifdef DEBUG1
  400.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  401.                  "NPN_MemAlloc","DEBUG1: npos2.cpp",
  402.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  403.   #endif
  404.     return g_pNavigatorFuncs->memalloc(size);
  405. }
  406.  
  407. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  408. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  409. // NPN_MemFree
  410. //
  411. //  Reciprocal of MemAlloc() above
  412. //
  413. void
  414. NPN_MemFree(void* ptr)
  415. {
  416.   #ifdef DEBUG1
  417.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  418.                  "NPN_MemFree","DEBUG1: npos2.cpp",
  419.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  420.   #endif
  421.     g_pNavigatorFuncs->memfree(ptr);
  422. }
  423.  
  424. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  425. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  426. // NPN_ReloadPLugins
  427. //
  428. //  Private function to Netscape.  do not use!
  429. //
  430. void
  431. NPN_ReloadPlugins(NPBool reloadPages)
  432. {
  433.   #ifdef DEBUG1
  434.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  435.                  "NPN_ReloadPlugins","DEBUG1: npos2.cpp",
  436.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  437.   #endif
  438.     g_pNavigatorFuncs->reloadplugins(reloadPages);
  439. }
  440.  
  441. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  442. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  443. // NPN_GetJavaEnv
  444. //
  445. //
  446. //
  447. JNIEnv*
  448. NPN_GetJavaEnv(void)
  449. {
  450.   #ifdef DEBUG1
  451.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  452.                  "NPN_GetJavaEnv","DEBUG1: npos2.cpp",
  453.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  454.   #endif
  455.     return g_pNavigatorFuncs->getJavaEnv();
  456. }
  457.  
  458. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  459. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  460. // NPN_GetJavaPeer
  461. //
  462. //
  463. //
  464. jref
  465. NPN_GetJavaPeer(NPP instance)
  466. {
  467.   #ifdef DEBUG1
  468.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  469.                  "NPN_GetJavaPeer","DEBUG1: npos2.cpp",
  470.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  471.   #endif
  472.     return g_pNavigatorFuncs->getJavaPeer(instance);
  473. }
  474.  
  475. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  476. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  477. // NPN_GetURLNotify
  478. //
  479. //
  480. //
  481. NPError
  482. NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
  483. {
  484.   #ifdef DEBUG1
  485.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  486.                  "NPN_GetURLNotify","DEBUG1: npos2.cpp",
  487.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  488.   #endif
  489.     return g_pNavigatorFuncs->geturlnotify(instance, url, window, notifyData);
  490. }
  491.  
  492. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  493. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  494. // NPN_PostURLNotify
  495. //
  496. //
  497. //
  498. NPError
  499. NPN_PostURLNotify(NPP instance, const char* url, const char* target,
  500.                   uint32 len, const char* buf, NPBool file, void* notifyData)
  501. {
  502.   #ifdef DEBUG1
  503.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  504.                  "NPN_PostURLNotify","DEBUG1: npos2.cpp",
  505.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  506.   #endif
  507.     return g_pNavigatorFuncs->posturlnotify(instance, url, target, len,
  508.                                             buf, file, notifyData);
  509. }
  510.  
  511. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  512. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  513. // NPN_GetValue
  514. //
  515. //  Retrieves value of specified browser variable.
  516. //
  517. NPError
  518. NPN_GetValue(NPP instance, NPNVariable variable, void* value)
  519. {
  520.   #ifdef DEBUG1
  521.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  522.                  "NPN_GetValue","DEBUG1: npos2.cpp",
  523.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  524.   #endif
  525.     return g_pNavigatorFuncs->getvalue(instance, variable, value);
  526. }
  527.  
  528. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  529. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  530. // NPN_SetValue
  531. //
  532. //  Sets value of specified browser variable.
  533. //
  534. NPError
  535. NPN_SetValue(NPP instance, NPPVariable variable, void* value)
  536. {
  537.   #ifdef DEBUG1
  538.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  539.                  "NPN_SetValue","DEBUG1: npos2.cpp",
  540.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  541.   #endif
  542.     return g_pNavigatorFuncs->setvalue(instance, variable, value);
  543. }
  544.  
  545. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  546. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  547. // NPN_InvalidateRect
  548. //
  549. //  Invalidate rectangle of windowless plugin.
  550. //
  551. void
  552. NPN_InvalidateRect(NPP instance, NPRect* rect)
  553. {
  554.   #ifdef DEBUG1
  555.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  556.                  "NPN_InvalidateRect","DEBUG1: npos2.cpp",
  557.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  558.   #endif
  559.     g_pNavigatorFuncs->invalidaterect(instance, rect);
  560. }
  561.  
  562. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  563. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  564. // NPN_InvalidateRegion
  565. //
  566. //  Invalidate region of windowless plugin.
  567. //
  568. void
  569. NPN_InvalidateRegion(NPP instance, NPRegion region)
  570. {
  571.   #ifdef DEBUG1
  572.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  573.                  "NPN_InvalidateRegion","DEBUG1: npos2.cpp",
  574.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  575.   #endif
  576.     g_pNavigatorFuncs->invalidateregion(instance, region);
  577. }
  578.  
  579. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  580. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  581. // NPN_ForceRedraw
  582. //
  583. //  Cause windowless plugin to be updated.
  584. //
  585. void
  586. NPN_ForceRedraw(NPP instance)
  587. {
  588.   #ifdef DEBUG1
  589.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  590.                  "NPN_ForceRedraw","DEBUG1: npos2.cpp",
  591.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  592.   #endif
  593.     g_pNavigatorFuncs->forceredraw(instance);
  594. }
  595.  
  596. #ifdef NAVIGATOR40
  597. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  598. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  599. // NPN_SevereError
  600. //
  601. //  Notify Navigator that the plugin has had a severe error and can not
  602. //  continue. The reason parm notifies the Navigator whether the single
  603. //  specified instance has been destroyed or whether the plugin is unloading
  604. //  and all instances should be destroyed. Choices are:
  605. //     NPRES_INSTANCE_DESTROYED
  606. //     NPRES_PLUGIN_UNLOADING
  607. //
  608. //  After receiving this call the Navigator will no longer make any calls
  609. //  to the plugin instance(s).
  610. //
  611. void
  612. NPN_SevereError(NPP instance, NPError reason)
  613. {
  614.   #ifdef DEBUG1
  615.        WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
  616.                  "NPN_SevereError","DEBUG1: npos2.cpp",
  617.                  0, MB_ICONEXCLAMATION | MB_OK | MB_SYSTEMMODAL);
  618.   #endif
  619.     g_pNavigatorFuncs->severeerror(instance, reason);
  620. }
  621. #endif
  622.  
  623. //                                              END NAVIGATOR Entry points
  624. ////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
  625. //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
  626.  
  627.