summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-14 15:54:55 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-14 15:54:55 +0000
commitd017e93a6a22f6d4c2c7e76deec1cdeca632135e (patch)
tree7703052799dc65cee9eacf6f573fb5c4afcd3936 /plugin
R6.6 is the Xorg base-lineXORG-MAINXORG-STABLE
Diffstat (limited to 'plugin')
-rw-r--r--plugin/Global.c97
-rw-r--r--plugin/Main.c630
-rw-r--r--plugin/NewNDest.c71
-rw-r--r--plugin/PProcess.c1017
-rw-r--r--plugin/RxPlugin.h171
-rw-r--r--plugin/SetWin.c213
-rw-r--r--plugin/common/npunix.c407
-rw-r--r--plugin/include/jri.h639
-rw-r--r--plugin/include/jri_md.h501
-rw-r--r--plugin/include/jritypes.h181
-rw-r--r--plugin/include/npapi.h393
-rw-r--r--plugin/include/npupp.h996
-rw-r--r--plugin/libxrx.man152
-rw-r--r--plugin/stubs.c15
14 files changed, 5483 insertions, 0 deletions
diff --git a/plugin/Global.c b/plugin/Global.c
new file mode 100644
index 0000000..3372f48
--- /dev/null
+++ b/plugin/Global.c
@@ -0,0 +1,97 @@
+/* $Xorg: Global.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+#include "RxPlugin.h"
+
+#include <stdio.h>
+
+/* global variable to handle data global to all instances */
+PluginGlobal RxGlobal;
+
+
+NPError
+NPP_Initialize(void)
+{
+#ifdef PLUGIN_TRACE
+ (void) fprintf (stderr, "%s\n", "NPP_Initialize");
+#endif
+ RxGlobal.has_appgroup = RxUndef;
+ RxGlobal.has_real_server = RxUndef;
+ RxGlobal.has_ui_lbx = RxUndef;
+ RxGlobal.has_print_lbx = RxUndef;
+ RxGlobal.has_printer = RxUndef;
+ RxGlobal.has_ui_fwp = RxUndef;
+ RxGlobal.has_print_fwp = RxUndef;
+ RxGlobal.pdpy_name = NULL;
+ RxGlobal.printer_name = NULL;
+ RxGlobal.fwp_dpyname = NULL;
+ RxGlobal.pfwp_dpyname = NULL;
+ RxGlobal.ice_conn = NULL;
+ RxGlobal.pm_opcode = 0;
+ RxGlobal.get_prefs = True;
+ RxGlobal.dpy = NULL;
+ RxGlobal.pdpy = NULL;
+ RxGlobal.wm_delete_window = 0;
+ RxGlobal.wm_protocols = 0;
+ return NPERR_NO_ERROR;
+}
+
+void
+NPP_Shutdown(void)
+{
+#ifdef PLUGIN_TRACE
+ (void) fprintf (stderr, "%s\n", "NPP_Shutdown");
+#endif
+/*
+ * Netscape doesn't try to cache plug-ins at all, and it unloads
+ * the plug-in immediately after the last instance that uses it is
+ * gone. So if you load a page that uses the plug-in, and then reload
+ * the page, Netscape will unload the plug-in and call NPP_Shutdown.
+ * Then it will reload the plug-in and call NPP_Initialize. And when
+ * it reloads it, zeroes the plug-in's DATA segment so even if we
+ * tried to be smart in NPP_Initialize, Netscape would defeat us
+ * anyway.
+ */
+ if (RxGlobal.pdpy_name != NULL)
+ NPN_MemFree(RxGlobal.pdpy_name);
+ if (RxGlobal.printer_name != NULL)
+ NPN_MemFree(RxGlobal.printer_name);
+ if (RxGlobal.fwp_dpyname != NULL)
+ NPN_MemFree(RxGlobal.fwp_dpyname);
+ if (RxGlobal.pfwp_dpyname != NULL)
+ NPN_MemFree(RxGlobal.pfwp_dpyname);
+ if (RxGlobal.get_prefs == False)
+ FreePreferences(&RxGlobal.prefs);
+ if (RxGlobal.pdpy != NULL && RxGlobal.pdpy != RxGlobal.dpy)
+ XCloseDisplay(RxGlobal.pdpy);
+ if (RxGlobal.ice_conn) {
+ IceProtocolShutdown (RxGlobal.ice_conn, RxGlobal.pm_opcode);
+ IceCloseConnection (RxGlobal.ice_conn);
+ }
+}
diff --git a/plugin/Main.c b/plugin/Main.c
new file mode 100644
index 0000000..913f235
--- /dev/null
+++ b/plugin/Main.c
@@ -0,0 +1,630 @@
+/* $Xorg: Main.c,v 1.5 2001/02/09 02:05:57 xorgcvs Exp $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+/*
+ * RX plug-in module based on the UnixTemplate file provided by Netcape.
+ */
+
+/* -*- Mode: C; tab-width: 4; -*- */
+/******************************************************************************
+ * Copyright 1996 Netscape Communications. All rights reserved.
+ ******************************************************************************/
+/*
+ * UnixShell.c
+ *
+ * Netscape Client Plugin API
+ * - Function that need to be implemented by plugin developers
+ *
+ * This file defines a "Template" plugin that plugin developers can use
+ * as the basis for a real plugin. This shell just provides empty
+ * implementations of all functions that the plugin can implement
+ * that will be called by Netscape (the NPP_xxx methods defined in
+ * npapi.h).
+ *
+ * dp Suresh <dp@netscape.com>
+ *
+ */
+
+#include <ctype.h>
+#include <stdlib.h>
+#include "RxPlugin.h"
+#include "X11/StringDefs.h"
+
+
+/***********************************************************************
+ * Utility functions to deal with list of arguments
+ ***********************************************************************/
+
+/* Free list of arguments */
+static void
+FreeArgs(char* argn[], char* argv[], int argc)
+{
+ int i;
+ if (argc != 0) {
+ for (i = 0; i < argc; i++) {
+ NPN_MemFree(argn[i]);
+ NPN_MemFree(argv[i]);
+ }
+ NPN_MemFree(argn);
+ NPN_MemFree(argv);
+ }
+}
+
+/* Copy list 2 to list 1 */
+static NPError
+CopyArgs(char** argn1[], char** argv1[], int16* argc1,
+ char* argn2[], char* argv2[], int16 argc2)
+{
+ char **argn, **argv;
+ int i;
+
+ argn = (char **)NPN_MemAlloc(sizeof(char *) * argc2);
+ if (!argn)
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ argv = (char **)NPN_MemAlloc(sizeof(char *) * argc2);
+ if (!argv) {
+ NPN_MemFree(argn);
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ }
+ memset(argn, 0, sizeof(char *) * argc2);
+ memset(argv, 0, sizeof(char *) * argc2);
+ for (i = 0; i < argc2; i++) {
+ char *name, *value;
+ name = (char *)NPN_MemAlloc(strlen(argn2[i]) + 1);
+ if (!name) {
+ FreeArgs(argn, argv, i - 1);
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ }
+ strcpy(name, argn2[i]);
+ value = (char *)NPN_MemAlloc(strlen(argv2[i]) + 1);
+ if (!value) {
+ NPN_MemFree(name);
+ FreeArgs(argn, argv, i - 1);
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ }
+ strcpy(value, argv2[i]);
+ argn[i] = name;
+ argv[i] = value;
+ }
+ *argc1 = argc2;
+ *argn1 = argn;
+ *argv1 = argv;
+
+ return NPERR_NO_ERROR;
+}
+
+
+char*
+NPP_GetMIMEDescription(void)
+{
+ return(PLUGIN_MIME_DESCRIPTION);
+}
+
+NPError
+NPP_GetValue(void *future, NPPVariable variable, void *value)
+{
+ NPError err = NPERR_NO_ERROR;
+
+ switch (variable) {
+ case NPPVpluginNameString:
+ *((char **)value) = PLUGIN_NAME;
+ break;
+ case NPPVpluginDescriptionString:
+ *((char **)value) = PLUGIN_DESCRIPTION;
+ break;
+ default:
+ err = NPERR_GENERIC_ERROR;
+ }
+ return err;
+}
+
+jref
+NPP_GetJavaClass()
+{
+ return NULL;
+}
+
+NPError
+NPP_New(NPMIMEType pluginType,
+ NPP instance,
+ uint16 mode,
+ int16 argc,
+ char* argn[],
+ char* argv[],
+ NPSavedData* saved)
+{
+ PluginInstance* This;
+
+ if (instance == NULL)
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
+
+ This = (PluginInstance*) instance->pdata;
+
+ if (This == NULL)
+ return NPERR_OUT_OF_MEMORY_ERROR;
+
+ This->instance = instance;
+ if (argc != 0) { /* copy the arguments list */
+ if (CopyArgs(&This->argn, &This->argv, &This->argc,
+ argn, argv, argc) == NPERR_OUT_OF_MEMORY_ERROR) {
+ NPN_MemFree(This);
+ return NPERR_OUT_OF_MEMORY_ERROR;
+ }
+ } else {
+ This->argc = 0;
+ This->argn = This->argv = NULL;
+ }
+ This->parse_reply = 0;
+ This->status = 0;
+ This->dont_reparent = RxUndef;
+ This->state = LOADING;
+ This->status_widget = NULL;
+ This->plugin_widget = NULL;
+ RxpNew(This);
+
+ return NPERR_NO_ERROR;
+}
+
+
+NPError
+NPP_Destroy(NPP instance, NPSavedData** save)
+{
+ PluginInstance* This;
+
+ if (instance == NULL)
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ This = (PluginInstance*) instance->pdata;
+
+ /* PLUGIN DEVELOPERS:
+ * If desired, call NP_MemAlloc to create a
+ * NPSavedDate structure containing any state information
+ * that you want restored if this plugin instance is later
+ * recreated.
+ */
+
+ if (This != NULL) {
+ RxpDestroy(This);
+ if (This->argc != 0)
+ FreeArgs(This->argn, This->argv, This->argc);
+ if (This->query != NULL)
+ NPN_MemFree(This->query);
+ NPN_MemFree(instance->pdata);
+ instance->pdata = NULL;
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+
+/* private buffer structure */
+typedef struct {
+ char *buf;
+ uint32 size;
+} RxStreamBuf;
+
+NPError
+NPP_NewStream(NPP instance,
+ NPMIMEType type,
+ NPStream *stream,
+ NPBool seekable,
+ uint16 *stype)
+{
+ PluginInstance* This;
+ RxStreamBuf *streambuf;
+
+ if (instance == NULL)
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ This = (PluginInstance*) instance->pdata;
+
+ if (This->parse_reply != 0)
+ return NPERR_NO_ERROR;
+
+ /* malloc structure to store RX document */
+ streambuf = (RxStreamBuf *) NPN_MemAlloc(sizeof(RxStreamBuf));
+ if (streambuf == NULL)
+ return NPERR_OUT_OF_MEMORY_ERROR;
+
+ streambuf->buf = NULL;
+ streambuf->size = 0;
+ stream->pdata = (void *) streambuf;
+
+ return NPERR_NO_ERROR;
+}
+
+
+/* PLUGIN DEVELOPERS:
+ * These next 2 functions are directly relevant in a plug-in which
+ * handles the data in a streaming manner. If you want zero bytes
+ * because no buffer space is YET available, return 0. As long as
+ * the stream has not been written to the plugin, Navigator will
+ * continue trying to send bytes. If the plugin doesn't want them,
+ * just return some large number from NPP_WriteReady(), and
+ * ignore them in NPP_Write(). For a NP_ASFILE stream, they are
+ * still called but can safely be ignored using this strategy.
+ */
+
+int32 STREAMBUFSIZE = 0X0FFFFFFF; /* If we are reading from a file in NPAsFile
+ * mode so we can take any size stream in our
+ * write call (since we ignore it) */
+
+int32
+NPP_WriteReady(NPP instance, NPStream *stream)
+{
+ PluginInstance* This;
+ if (instance != NULL)
+ This = (PluginInstance*) instance->pdata;
+
+ return STREAMBUFSIZE;
+}
+
+int32
+NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buf)
+{
+ PluginInstance* This;
+
+ if (instance == NULL)
+ return len;
+
+ This = (PluginInstance*) instance->pdata;
+
+ if (This->parse_reply == 0) {
+ /* copy stream buffer to private storage, concatenating if necessary:
+ * since Netscape doesn't provide an NPN_MemRealloc we must do
+ * a new malloc, copy, and free :-(
+ */
+ RxStreamBuf *streambuf = (RxStreamBuf *) stream->pdata;
+ uint32 size = streambuf->size;
+ char *cbuf;
+
+ /* if first chunk add 1 for null terminating character */
+ if (size == 0)
+ size++;
+
+ size += len;
+ cbuf = (char *) NPN_MemAlloc(size);
+ if (cbuf == NULL)
+ return -1;
+ if (streambuf->size != 0) {
+ memcpy(cbuf, streambuf->buf, streambuf->size - 1);
+ memcpy(cbuf + streambuf->size - 1, ((char *)buf), len);
+ /* free old storage */
+ NPN_MemFree((void *) streambuf->buf);
+ } else
+ memcpy(cbuf, ((char *)buf), len);
+ cbuf[size - 1] = '\0';
+ /* store new buffer */
+ streambuf->buf = cbuf;
+ streambuf->size = size;
+#ifdef PLUGIN_TRACE
+ fprintf(stderr, "write %s:\n", PLUGIN_NAME);
+ fwrite(buf, len, 1, stderr);
+ fprintf(stderr, "\n");
+#endif
+ } else {
+ int l = len;
+ if (This->parse_reply == 1) {
+ /* look for status line */
+ char *ptr = strchr(buf, '\n');
+ if (ptr != NULL && isdigit(((char *)buf)[0])) {
+ This->status = (short) atoi((char *)buf);
+ /* skip status line */
+ l -= ptr - (char *)buf + 1;
+ buf = ptr + 1;
+ if (This->status != 0) {
+ fprintf(stderr,
+ "%s: Application failed to start properly\n",
+ PLUGIN_NAME);
+ }
+ }
+ This->parse_reply = 2;
+ }
+ /* simply prints out whatever we get, and let netscape display it
+ in a dialog */
+ fwrite(buf, l, 1, stderr);
+ }
+
+ return len; /* The number of bytes accepted */
+}
+
+void
+StartApplication(PluginInstance* This)
+{
+ NPError err;
+
+#ifndef NO_STARTING_STATE
+ RxpSetStatusWidget(This, STARTING);
+#else
+ RxpSetStatusWidget(This, RUNNING);
+#endif
+
+ /* perform GET request
+ * throwing away the response.
+ */
+ err = NPN_GetURL(This->instance, This->query, NULL);
+ This->parse_reply = 1; /* we want to print out the answer */
+}
+
+void
+StartCB(Widget widget, XtPointer client_data, XtPointer call_data)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+#if 0
+ XtUnmapWidget(widget);
+#endif
+ XtDestroyWidget(widget);
+ StartApplication(This);
+}
+
+#if defined(linux) || (defined(sun) && !defined(SVR4))
+/* deficient linux linker semantics */
+static WidgetClass xmLabelGadgetClass;
+static WidgetClass xmPushButtonGadgetClass;
+#else
+extern WidgetClass xmLabelGadgetClass;
+extern WidgetClass xmPushButtonGadgetClass;
+#endif
+
+void
+RxpSetStatusWidget(PluginInstance* This, PluginState state)
+{
+ Arg args[5];
+ int n;
+ XrmDatabase db;
+ char* return_type;
+ XrmValue return_value;
+
+ if (This->status_widget) {
+ XtDestroyWidget(This->status_widget);
+ This->status_widget = NULL;
+ }
+ if (This->plugin_widget == NULL)
+ return;
+
+ db = XtDatabase (XtDisplay (This->plugin_widget));
+
+ if (!XrmGetResource (db, "RxPlugin_BeenHere", "RxPlugin_BeenHere",
+ &return_type, &return_value)) {
+
+ XrmPutStringResource (&db, "*Rx_Loading.labelString", "Loading...");
+ XrmPutStringResource (&db, "*Rx_Starting.labelString", "Starting...");
+ XrmPutStringResource (&db, "*Rx_Start.labelString", "Start");
+ XrmPutStringResource (&db, "RxPlugin_BeenHere", "YES");
+ }
+#if defined(linux) || (defined(sun) && !defined(SVR4))
+ /*
+ lame loader semantics mean we have to go fishing around to
+ come up with widget class records so we can create some widgets.
+
+ Names of widgets changed in 4.x, so look for those names too
+ for linux.
+
+ If Microsoft ever does IE for Linux we'll have to figure out
+ those names too.
+ */
+ if (xmLabelGadgetClass == NULL) {
+ Widget w;
+
+ w = XtNameToWidget (This->toplevel_widget, "*topLeftArea.urlLabel");
+ if (w == NULL)
+ w = XtNameToWidget (This->toplevel_widget, "*urlBar.urlLocationLabel");
+ xmLabelGadgetClass = XtClass (w);
+ w = XtNameToWidget (This->toplevel_widget, "*toolBar.abort");
+ if (w == NULL)
+ w = XtNameToWidget (This->toplevel_widget, "*PopupMenu.openCustomUrl");
+ xmPushButtonGadgetClass = XtClass (w);
+ }
+#endif
+
+ n = 0;
+ XtSetArg(args[n], "shadowThickness", 1); n++;
+ XtSetArg(args[n], XtNwidth, This->width); n++;
+ XtSetArg(args[n], XtNheight, This->height); n++;
+ if (state == LOADING) {
+ /* create a label */
+ This->status_widget =
+ XtCreateManagedWidget("Rx_Loading", xmLabelGadgetClass,
+ This->plugin_widget, args, n);
+#ifndef NO_STARTING_STATE
+ } else if (state == STARTING) {
+ /* create a label */
+ This->status_widget =
+ XtCreateManagedWidget("Rx_Starting", xmLabelGadgetClass,
+ This->plugin_widget, args, n);
+#endif
+ } else if (state == WAITING) {
+ /* create a push button */
+ This->status_widget =
+ XtCreateManagedWidget("Rx_Start", xmPushButtonGadgetClass,
+ This->plugin_widget, args, n);
+ XtAddCallback(This->status_widget, "activateCallback", StartCB, This);
+ } else if (state == RUNNING) {
+ /* nothing else to be done */
+ }
+ This->state = state;
+}
+
+
+NPError
+NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason)
+{
+ PluginInstance* This;
+ RxStreamBuf *streambuf = (RxStreamBuf *) stream->pdata;
+ char **rx_argn, **rx_argv;
+ int rx_argc;
+ RxParams params;
+ RxReturnParams return_params;
+ NPError status = NPERR_NO_ERROR;
+
+ if (instance == NULL)
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ This = (PluginInstance*) instance->pdata;
+
+ if (This->parse_reply != 0) {
+ fflush(stderr);
+ if (This->status != 0) /* if error occured change widget status */
+ RxpSetStatusWidget(This, WAITING);
+ return NPRES_DONE;
+ }
+
+ memset(&params, 0, sizeof(RxParams));
+ memset(&return_params, 0, sizeof(RxReturnParams));
+ rx_argc = 0;
+
+ if (reason != NPRES_DONE) {
+ status = NPERR_GENERIC_ERROR;
+ goto exit;
+ }
+
+ /* read params from stream */
+ if (RxReadParams(streambuf->buf, &rx_argn, &rx_argv, &rx_argc) != 0) {
+ fprintf(stderr, "%s: invalid file %s\n", PLUGIN_NAME, stream->url);
+ status = NPERR_GENERIC_ERROR;
+ goto exit;
+ }
+
+ RxInitializeParams(&params);
+
+ /* parse RX params */
+ if (RxParseParams(rx_argn, rx_argv, rx_argc, &params, 0) != 0) {
+ fprintf(stderr, "%s: invalid RX params\n", PLUGIN_NAME);
+ status = NPERR_GENERIC_ERROR;
+ goto exit;
+ }
+
+ /* parse HTML params */
+ if (RxParseParams(This->argn, This->argv, This->argc, &params, 0) != 0) {
+ fprintf(stderr, "%s: invalid HTML params\n", PLUGIN_NAME);
+ status = NPERR_GENERIC_ERROR;
+ goto exit;
+ }
+
+ /* set up return parameters */
+ if (RxpProcessParams(This, &params, &return_params) != 0) {
+ fprintf(stderr, "%s: failed to process params\n", PLUGIN_NAME);
+ status = NPERR_GENERIC_ERROR;
+ goto exit;
+ }
+
+ /* make query */
+ This->query = RxBuildRequest(&return_params);
+ if (This->query == NULL) {
+ fprintf(stderr, "%s: failed to make query\n", PLUGIN_NAME);
+ status = NPERR_GENERIC_ERROR;
+ goto exit;
+ }
+
+ if (params.auto_start != RxFalse) /* default is auto start */
+ StartApplication(This);
+ else
+ RxpSetStatusWidget(This, WAITING);
+
+exit:
+ /* free all forms of params */
+ FreeArgs(rx_argn, rx_argv, rx_argc);
+ FreeArgs(This->argn, This->argv, This->argc);
+ This->argc = 0;
+ RxFreeParams(&params);
+ RxFreeReturnParams(&return_params);
+ /* free private storage */
+ if (streambuf->buf != NULL)
+ NPN_MemFree(streambuf->buf);
+ NPN_MemFree(stream->pdata);
+
+ return status;
+}
+
+void
+NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname)
+{
+ PluginInstance* This;
+ if (instance != NULL)
+ This = (PluginInstance*) instance->pdata;
+}
+
+
+void
+NPP_Print(NPP instance, NPPrint* printInfo)
+{
+ if(printInfo == NULL)
+ return;
+
+ if (instance != NULL) {
+ PluginInstance* This = (PluginInstance*) instance->pdata;
+
+ if (printInfo->mode == NP_FULL) {
+ /*
+ * PLUGIN DEVELOPERS:
+ * If your plugin would like to take over
+ * printing completely when it is in full-screen mode,
+ * set printInfo->pluginPrinted to TRUE and print your
+ * plugin as you see fit. If your plugin wants Netscape
+ * to handle printing in this case, set
+ * printInfo->pluginPrinted to FALSE (the default) and
+ * do nothing. If you do want to handle printing
+ * yourself, printOne is true if the print button
+ * (as opposed to the print menu) was clicked.
+ * On the Macintosh, platformPrint is a THPrint; on
+ * Windows, platformPrint is a structure
+ * (defined in npapi.h) containing the printer name, port,
+ * etc.
+ */
+
+ void* platformPrint =
+ printInfo->print.fullPrint.platformPrint;
+ NPBool printOne =
+ printInfo->print.fullPrint.printOne;
+
+ /* Do the default*/
+ printInfo->print.fullPrint.pluginPrinted = FALSE;
+ }
+ else { /* If not fullscreen, we must be embedded */
+ /*
+ * PLUGIN DEVELOPERS:
+ * If your plugin is embedded, or is full-screen
+ * but you returned false in pluginPrinted above, NPP_Print
+ * will be called with mode == NP_EMBED. The NPWindow
+ * in the printInfo gives the location and dimensions of
+ * the embedded plugin on the printed page. On the
+ * Macintosh, platformPrint is the printer port; on
+ * Windows, platformPrint is the handle to the printing
+ * device context.
+ */
+
+ NPWindow* printWindow =
+ &(printInfo->print.embedPrint.window);
+ void* platformPrint =
+ printInfo->print.embedPrint.platformPrint;
+ }
+ }
+}
diff --git a/plugin/NewNDest.c b/plugin/NewNDest.c
new file mode 100644
index 0000000..bee8bf3
--- /dev/null
+++ b/plugin/NewNDest.c
@@ -0,0 +1,71 @@
+/* $Xorg: NewNDest.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+#include "RxPlugin.h"
+
+/***********************************************************************
+ * Functions to init and free private members
+ ***********************************************************************/
+
+void
+RxpNew(PluginInstance *This)
+{
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "RxpNew");
+#endif
+ This->x_ui_auth_id = 0;
+ This->x_print_auth_id = 0;
+ This->app_group = 0;
+ This->toplevel_widget = NULL;
+ This->client_windows = NULL;
+ This->nclient_windows = 0;
+}
+
+void
+RxpDestroy(PluginInstance *This)
+{
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "RxpDestroy");
+#endif
+ if (RxGlobal.dpy != NULL) {
+ RxpWmDelWinHandler (This->toplevel_widget, (XtPointer) This, NULL, NULL);
+ RxpRemoveDestroyCallback(This);
+ if (This->x_ui_auth_id != 0)
+ XSecurityRevokeAuthorization(RxGlobal.dpy, This->x_ui_auth_id);
+ if (This->app_group != None)
+ XagDestroyApplicationGroup (RxGlobal.dpy, This->app_group);
+ RxpTeardown (This);
+ }
+ if (RxGlobal.pdpy != NULL) {
+ if (This->x_print_auth_id != 0)
+ XSecurityRevokeAuthorization(RxGlobal.pdpy, This->x_print_auth_id);
+ }
+ if (This->client_windows) NPN_MemFree (This->client_windows);
+ RxpNew (This);
+}
diff --git a/plugin/PProcess.c b/plugin/PProcess.c
new file mode 100644
index 0000000..d2f2faf
--- /dev/null
+++ b/plugin/PProcess.c
@@ -0,0 +1,1017 @@
+/* $Xorg: PProcess.c,v 1.6 2001/02/09 02:05:57 xorgcvs Exp $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+#include "RxPlugin.h"
+#include "XUrls.h"
+#include "XAuth.h"
+#include "XDpyName.h"
+#include "Prefs.h"
+#include <X11/StringDefs.h>
+
+#include <limits.h> /* for MAXHOSTNAMELEN */
+/* and in case we didn't get it from the headers above */
+#ifndef MAXHOSTNAMELEN
+# define MAXHOSTNAMELEN 256
+#endif
+
+#ifdef XUSE_XTREGISTERWINDOW
+extern void _XtRegisterWindow (Window window, Widget widget);
+#define XtRegisterDrawable(d,win,wid) _XtRegisterWindow(win,wid)
+extern void _XtUnregisterWindow (Window window, Widget widget);
+#define UnregisterDrawable(win,wid) _XtUnregisterWindow(win,wid)
+#else
+#define UnregisterDrawable(win,wid) XtUnregisterDrawable(XtDisplay(wid),win)
+#endif
+
+/* timeout for authorizations */
+#define DEFAULT_TIMEOUT 300
+#define NO_TIMEOUT 0
+
+/***********************************************************************
+ * Try and do something sensible about window geometry
+ ***********************************************************************/
+static void
+GetWindowGeometry(
+ Display* dpy,
+ Window win,
+ Position* x,
+ Position* y,
+ Dimension* width,
+ Dimension* height,
+ Dimension* border_width,
+ /* the following doesn't really belong here but it saves us from doing
+ another XGetWindowAttributes later on */
+ Colormap *cmap)
+{
+ long mask;
+ XSizeHints* sizehints = XAllocSizeHints();
+ XWindowAttributes wattr;
+
+ if (XGetWindowAttributes (dpy, win, &wattr)) {
+ *x = wattr.x;
+ *y = wattr.y;
+ *width = wattr.width;
+ *height = wattr.height;
+ *border_width = wattr.border_width;
+ *cmap = wattr.colormap;
+ }
+ if (sizehints) {
+ XGetWMNormalHints (dpy, win, sizehints, &mask);
+
+ if (mask & USPosition|PPosition) {
+ *x = sizehints->x;
+ *y = sizehints->y;
+ *width = sizehints->width;
+ *height = sizehints->height;
+ XFree ((char*) sizehints);
+ return;
+ }
+ XFree ((char*) sizehints);
+ }
+ *x = 0;
+ *y = 0;
+ *width = 0;
+ *height = 0;
+}
+
+/***********************************************************************
+ * a set of utility functions to manipulate Windows lists
+ ***********************************************************************/
+static Bool
+IsInWinList(Window *list, int count, Window win)
+{
+ int i;
+ for (i = 0; i < count; i++, list++)
+ if (*list == win)
+ return True;
+ return False;
+}
+
+static void
+AppendToWinList(Window **new_list, int *new_count,
+ Window *list, int count, Window win)
+{
+ *new_count = count + 1;
+ *new_list = (Window*) malloc(sizeof(Window) * *new_count);
+ memcpy(*new_list, list, sizeof(Window) * count);
+ (*new_list)[count] = win;
+}
+
+static void
+PrependToWinList(Window **new_list, int *new_count,
+ Window *list, int count, Window win)
+{
+ *new_count = count + 1;
+ *new_list = (Window*) malloc(sizeof(Window) * *new_count);
+ (*new_list)[0] = win;
+ memcpy(*new_list + 1, list, sizeof(Window) * count);
+}
+
+/* rotate the list so the given window is at the beginning of it */
+static void
+SetFirstWinList(Window *list, int count, Window win)
+{
+ int i;
+
+ /* look for the given window starting from the end */
+ list += count - 1;
+ for (i = 0; i < count; i++, list--)
+ if (*list == win)
+ break;
+ if (i < count) { /* when we found it rotate from there */
+ /* shift every element to the right */
+ for (i++; i < count; i++) {
+ list--;
+ list[1] = list[0];
+ }
+ /* and set the first one */
+ *list = win;
+ }
+}
+
+/* rotate the list so the given window which should be the first item is
+ at the end of it */
+static void
+SetLastWinList(Window *list, int count, Window win)
+{
+ if (*list == win) {
+ int i;
+ /* shift every element to the left */
+ for (i = 0; i < count - 1; i++, list++)
+ list[0] = list[1];
+ /* and set the last one */
+ *list = win;
+ }
+}
+
+static void
+RemoveFromWinList(Window **wlist, int *count, Window win)
+{
+ Window *list = *wlist;
+ int i;
+ /* look for the window to remove */
+ for (i = 0; i < *count; i++, list++)
+ if (*list == win) {
+ (*count)--;
+ break;
+ }
+ /* then simply shift following elements to the left */
+ for (; i < *count; i++, list++)
+ list[0] = list[1];
+}
+
+static void
+ConcatWinLists(Window **list, int *count,
+ Window *list1, int count1,
+ Window *list2, int count2)
+{
+ *count = count1 + count2;
+ *list = (Window*) malloc(sizeof(Window) * *count);
+ memcpy(*list, list1, sizeof(Window) * count1);
+ memcpy(*list + count1, list2, sizeof(Window) * count2);
+}
+
+static void
+SubstractWinLists(Window **wlist, int *count,
+ Window *list1, int count1)
+{
+ Window *list = *wlist;
+ int i, j;
+ /* look for the beginning of the list to remove */
+ for (i = 0; i < *count; i++, list++)
+ if (*list == *list1)
+ break;
+ /* skip the list to remove stopping at the end of one of the lists
+ or at the first alien element */
+ for (j = 0; j < count1 && i + j < *count; j++, list1++)
+ if (list[j] != *list1)
+ break;
+ /* then shift following elements */
+ *count -= j;
+ for (; i < *count; i++, list++)
+ list[0] = list[j];
+}
+
+/***********************************************************************
+ * Add window to the WM_COLORMAP_WINDOWS property on the Netscape
+ * toplevel widget if necessary
+ ***********************************************************************/
+static void
+SetWMColormap(PluginInstance* This, Window win)
+{
+ int i;
+ Colormap top_cmap;
+ Arg arg;
+
+ /* get window's record */
+ for (i = 0; i < This->nclient_windows; i++)
+ if ((This->client_windows[i].win = win))
+ break;
+
+ if (i == This->nclient_windows)
+ return;
+
+ /* if window's colormap is different from toplevel's one set property */
+ XtSetArg(arg, XtNcolormap, &top_cmap);
+ XtGetValues(This->toplevel_widget, &arg, 1);
+ if (This->client_windows[i].colormap != top_cmap) {
+ Window *cur_list;
+ int cur_count = 0;
+
+ /* if there is already a non empty list we need to update it */
+ if (XGetWMColormapWindows(RxGlobal.dpy, XtWindow(This->toplevel_widget),
+ &cur_list, &cur_count) == True &&
+ cur_count != 0) {
+
+ if (IsInWinList(cur_list, cur_count, win)) {
+ /* window is already in the list just move it in first place */
+ SetFirstWinList(cur_list, cur_count, win);
+ XSetWMColormapWindows(RxGlobal.dpy,
+ XtWindow(This->toplevel_widget),
+ cur_list, cur_count);
+ } else {
+ /* window is not in the list add it in first place */
+ Window *new_list;
+ int new_count;
+
+ PrependToWinList(&new_list, &new_count,
+ cur_list, cur_count, win);
+ XSetWMColormapWindows(RxGlobal.dpy,
+ XtWindow(This->toplevel_widget),
+ new_list, new_count);
+ free(new_list);
+ }
+ } else { /* no list yet so lets make one */
+ Window list[2];
+
+ list[0] = win;
+ list[1] = XtWindow(This->toplevel_widget);
+ XSetWMColormapWindows(RxGlobal.dpy, XtWindow(This->toplevel_widget),
+ list, 2);
+ }
+ if (cur_count != 0)
+ XFree(cur_list);
+ }
+}
+
+/***********************************************************************
+ * Move window at the end of the WM_COLORMAP_WINDOWS property list on
+ * the Netscape toplevel widget
+ ***********************************************************************/
+static void
+UnsetWMColormap(PluginInstance* This, Window win)
+{
+ Window *list;
+ int count = 0;
+
+ if (XGetWMColormapWindows(RxGlobal.dpy, XtWindow(This->toplevel_widget),
+ &list, &count) == True && count != 0) {
+ SetLastWinList(list, count, win);
+ XSetWMColormapWindows(RxGlobal.dpy, XtWindow(This->toplevel_widget),
+ list, count);
+ }
+ if (count != 0)
+ XFree(list);
+}
+
+/***********************************************************************
+ * Remove window from the WM_COLORMAP_WINDOWS property on the Netscape
+ * toplevel widget
+ ***********************************************************************/
+static void
+ResetWMColormap(PluginInstance* This, Window win)
+{
+ Window *list;
+ int count = 0;
+
+ if (XGetWMColormapWindows(RxGlobal.dpy, XtWindow(This->toplevel_widget),
+ &list, &count) == True && count != 0) {
+ RemoveFromWinList(&list, &count, win);
+
+ if (count > 1)
+ XSetWMColormapWindows(RxGlobal.dpy, XtWindow(This->toplevel_widget),
+ list, count);
+ else { /* remove list when it becomes useless */
+ Atom prop;
+
+ prop = XInternAtom (RxGlobal.dpy, "WM_COLORMAP_WINDOWS", False);
+ XDeleteProperty(RxGlobal.dpy, XtWindow(This->toplevel_widget), prop);
+ }
+ }
+ if (count != 0)
+ XFree(list);
+}
+
+/***********************************************************************
+ * Event Handler to reparent client window under plugin window
+ ***********************************************************************/
+/* static */ void
+SubstructureRedirectHandler (
+ Widget widget,
+ XtPointer client_data,
+ XEvent* event,
+ Boolean* cont)
+{
+ windowrec* new_list;
+ PluginInstance* This = (PluginInstance*) client_data;
+
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "SubstructureRedirectHandler");
+ fprintf (stderr, "This: 0x%x\n", This);
+#endif
+
+ switch (event->type) {
+ case ConfigureRequest:
+ {
+ XWindowChanges config;
+ config.x = event->xconfigurerequest.x;
+ config.y = event->xconfigurerequest.y;
+ config.width = event->xconfigurerequest.width;
+ config.height = event->xconfigurerequest.height;
+ config.border_width = event->xconfigurerequest.border_width;
+ config.sibling = event->xconfigurerequest.above;
+ config.stack_mode = event->xconfigurerequest.detail;
+#if 0
+ fprintf (stderr, "configuring at %dx%d+%d+%d\n",
+ config.width, config.height, config.x, config.y);
+#endif
+ XConfigureWindow (RxGlobal.dpy,
+ event->xconfigurerequest.window,
+ event->xconfigurerequest.value_mask,
+ &config);
+ }
+ break;
+
+ case MapRequest:
+
+ RxpSetStatusWidget(This, RUNNING);
+
+ {
+ Window for_win;
+ int i;
+
+ if (XGetTransientForHint (RxGlobal.dpy, event->xmaprequest.window,
+ &for_win)) {
+ for (i = 0; i < This->nclient_windows; i++)
+ if (for_win == This->client_windows[i].win)
+ XMapWindow (RxGlobal.dpy, event->xmaprequest.window);
+ return;
+ }
+ }
+ new_list = (windowrec*)
+ NPN_MemAlloc (sizeof (windowrec) * (This->nclient_windows + 1));
+ if (new_list) {
+ Position x, y;
+ Dimension width, height;
+ Dimension border_width;
+ Colormap cmap;
+ int n;
+ Atom* wm_proto;
+ windowrec* wp;
+ Window destwin = XtWindow (This->plugin_widget);
+
+ This->nclient_windows++;
+ if (This->nclient_windows > 1)
+ memcpy ((void*) new_list, (void*) This->client_windows,
+ (This->nclient_windows - 1) * sizeof (windowrec));
+ if (This->client_windows)
+ NPN_MemFree (This->client_windows);
+ This->client_windows = new_list;
+
+ x = y = 0;
+ width = height = border_width = 0;
+ GetWindowGeometry (RxGlobal.dpy, event->xmaprequest.window,
+ &x, &y, &width, &height, &border_width, &cmap);
+
+ wp = &This->client_windows[This->nclient_windows - 1];
+ wp->win = event->xmaprequest.window;
+ wp->x = x; wp->y = y;
+ wp->width = width; wp->height = height;
+ wp->border_width = border_width;
+ wp->flags = RxpMapped;
+ wp->colormap = cmap;
+
+ if (XGetWMProtocols (RxGlobal.dpy, wp->win, &wm_proto, &n)) {
+ int i;
+ Atom* ap;
+
+ for (i = 0, ap = wm_proto; i < n; i++, ap++) {
+ if (*ap == RxGlobal.wm_delete_window)
+ wp->flags |= RxpWmDelWin;
+ }
+ if (wm_proto) XFree ((char*) wm_proto);
+ }
+
+ XSelectInput(RxGlobal.dpy, wp->win,
+ EnterWindowMask | LeaveWindowMask);
+ XtRegisterDrawable (RxGlobal.dpy, wp->win, This->plugin_widget);
+ XReparentWindow (RxGlobal.dpy, wp->win, destwin, wp->x, wp->y);
+ XMapWindow (RxGlobal.dpy, wp->win);
+ }
+ break;
+ }
+}
+
+/***********************************************************************
+ * Event Handler to forward WM_DELETE_WINDOW events to the client windows
+ ***********************************************************************/
+void
+RxpWmDelWinHandler (
+ Widget widget,
+ XtPointer client_data,
+ XEvent* event,
+ Boolean* cont)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+ int i;
+
+ if (event == NULL ||
+ (event->type == ClientMessage &&
+ event->xclient.message_type == RxGlobal.wm_protocols &&
+ event->xclient.data.l[0] == RxGlobal.wm_delete_window)) {
+ for (i = 0; i < This->nclient_windows; i++) {
+ if (This->client_windows[i].flags & RxpWmDelWin) {
+ XClientMessageEvent ev;
+
+ ev.type = ClientMessage;
+ ev.window = This->client_windows[i].win;
+ ev.message_type = RxGlobal.wm_protocols;
+ ev.format = 32;
+ ev.data.l[0] = RxGlobal.wm_delete_window;
+ ev.data.l[1] = XtLastTimestampProcessed (XtDisplay (widget));
+ XSendEvent (RxGlobal.dpy, ev.window, FALSE, 0L, (XEvent*) &ev);
+ }
+ }
+ }
+}
+
+/***********************************************************************
+ * Event Handler to forward ConfigureNotify events to the client windows
+ ***********************************************************************/
+static void
+StructureNotifyHandler (
+ Widget widget,
+ XtPointer client_data,
+ XEvent* event,
+ Boolean* cont)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "StructureNotifyHandler");
+#endif
+
+ switch (event->type) {
+
+ /*
+ * For the testplugin, which uses a ScrolledWindow, the clipped
+ * window, i.e. This->plugin, is "configured" when the user pans
+ * around the ScrolledWindow. The Netscape scrolled-window is
+ * different. It moves-and-resizes the clip window, causing the
+ * child, i.e. This->plugin, to be "dragged" up by win-gravity.
+ */
+ case ConfigureNotify:
+ case GravityNotify:
+ if (This->plugin_widget == NULL)
+ return;
+
+ {
+ int i;
+ Position x, y;
+ XConfigureEvent sendev;
+
+ XtTranslateCoords (This->plugin_widget, 0, 0, &x, &y);
+ for (i = 0; i < This->nclient_windows; i++) {
+ sendev.type = ConfigureNotify;
+ sendev.send_event = True;
+ sendev.event = sendev.window = This->client_windows[i].win;
+ sendev.x = x + This->client_windows[i].x;
+ sendev.y = y + This->client_windows[i].y;
+ sendev.width = This->client_windows[i].width;
+ sendev.height = This->client_windows[i].height;
+ sendev.border_width = This->client_windows[i].border_width;
+ sendev.above = None;
+ sendev.override_redirect = False;
+ if (!XSendEvent (RxGlobal.dpy, This->client_windows[i].win,
+ False, StructureNotifyMask,
+ (XEvent*) &sendev))
+ (void) fprintf (stderr, "%s\n", "XSendEvent Failed");
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+/***********************************************************************
+ * Event Handler to detect the destruction of a client window
+ ***********************************************************************/
+static void
+SubstructureNotifyHandler (
+ Widget widget,
+ XtPointer client_data,
+ XEvent* event,
+ Boolean* cont)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "SubstructureNotifyHandler");
+#endif
+
+ if (event->type == DestroyNotify) {
+ int i;
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "DestroyNotify");
+#endif
+ for (i = 0; i < This->nclient_windows; i++)
+ if (This->client_windows[i].win == event->xdestroywindow.window) {
+ This->nclient_windows--;
+ if (This->nclient_windows > 0) {
+ /* remove this window from the list */
+ for (; i < This->nclient_windows; i++)
+ This->client_windows[i] = This->client_windows[i + 1];
+ } else { /* no more client windows! */
+ /* get back to user to restart the application */
+ RxpSetStatusWidget(This, WAITING);
+ }
+ ResetWMColormap(This, event->xdestroywindow.window);
+ UnregisterDrawable(event->xdestroywindow.window,
+ This->plugin_widget);
+ break;
+ }
+
+ }
+}
+
+/***********************************************************************
+ * Arrange to receive (synthetic) ConfigureNotify events on the proper
+ * windows of this instance and relay them to the embedded apps
+ ***********************************************************************/
+static void
+SetupStructureNotify (PluginInstance* This)
+{
+ /* Get ConfigureNotify when the browser is moved */
+ XtAddRawEventHandler (This->toplevel_widget,
+ StructureNotifyMask,
+ False,
+ StructureNotifyHandler,
+ (XtPointer) This);
+
+ XtAddRawEventHandler (This->toplevel_widget,
+ NoEventMask,
+ True,
+ RxpWmDelWinHandler,
+ (XtPointer) This);
+#if 0
+ XmAddWMProtocolCallback (This->toplevel_widget,
+ RxGlobal.wm_delete_window,
+ RxpWmDelWinHandler,
+ (XtPointer) This);
+#endif
+}
+
+/***********************************************************************
+ * Event Handler to deal with colormap settings
+ ***********************************************************************/
+static void
+CrossingHandler (
+ Widget widget,
+ XtPointer client_data,
+ XEvent* event,
+ Boolean* cont)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s: 0x%x\n", "CrossingHandler", event->xany.window);
+#endif
+
+ if (event->xany.window != XtWindow(This->plugin_widget) &&
+ event->xcrossing.detail != NotifyInferior) {
+ if (event->type == EnterNotify) {
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "EnterNotify");
+#endif
+ SetWMColormap(This, event->xany.window);
+ } else if (event->type == LeaveNotify) {
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "LeaveNotify");
+#endif
+ UnsetWMColormap(This, event->xany.window);
+ }
+ }
+}
+
+/***********************************************************************
+ * Setup various event handlers on the plugin widget
+ ***********************************************************************/
+void
+RxpSetupPluginEventHandlers (PluginInstance* This)
+{
+ int i;
+
+ /* Get ConfigureNotify and GravityNotify on the plugin */
+ XtAddEventHandler (This->plugin_widget,
+ StructureNotifyMask,
+ False,
+ StructureNotifyHandler,
+ (XtPointer) This);
+ /* Arrange to receive DestroyNotify events on the clients windows. */
+ XtAddEventHandler (This->plugin_widget,
+ SubstructureNotifyMask,
+ False,
+ SubstructureNotifyHandler,
+ (XtPointer) This);
+ /* Arrange to receive MapRequest and ConfigureRequest events on the
+ * netscape plug-in widget. */
+ XtAddRawEventHandler(This->plugin_widget,
+ SubstructureRedirectMask,
+ False,
+ SubstructureRedirectHandler,
+ (XtPointer) This);
+ XtRegisterDrawable (RxGlobal.dpy, This->app_group, This->plugin_widget);
+
+ /* Arrange to receive Enter and Leave Notify events on application's
+ toplevel windows */
+ XtAddRawEventHandler(This->plugin_widget,
+ EnterWindowMask | LeaveWindowMask,
+ False,
+ CrossingHandler,
+ (XtPointer) This);
+ for (i = 0; i < This->nclient_windows; i++) {
+ XtRegisterDrawable (RxGlobal.dpy,
+ This->client_windows[i].win, This->plugin_widget);
+ }
+}
+
+/***********************************************************************
+ * The instance is gone. Remove Event Handlers so that they aren't
+ * called with a reference to the old instance.
+ ***********************************************************************/
+void
+RxpTeardown (PluginInstance* This)
+{
+ if (This->toplevel_widget != NULL) {
+ /* ConfigureNotify on top level */
+ XtRemoveRawEventHandler (This->toplevel_widget,
+ StructureNotifyMask,
+ False,
+ StructureNotifyHandler,
+ (XtPointer) This);
+ XtRemoveRawEventHandler (This->toplevel_widget,
+ NoEventMask,
+ True,
+ RxpWmDelWinHandler,
+ (XtPointer) This);
+#if 0
+ XmRemoveWMProtocolCallback (This->toplevel_widget,
+ RxGlobal.wm_delete_window,
+ RxpWmDelWinHandler,
+ (XtPointer) This);
+#endif
+ }
+}
+
+/***********************************************************************
+ * Process the given RxParams and make the RxReturnParams
+ ***********************************************************************/
+
+static int
+ProcessUIParams(PluginInstance* This,
+ Boolean trusted, Boolean use_fwp, Boolean use_lbx,
+ RxParams *in, RxReturnParams *out, char **x_ui_auth_ret)
+{
+ XSecurityAuthorization dum;
+ int dummy;
+ char *display_name;
+
+ This->app_group = None;
+ if (out->embedded != RxFalse) { /* default is embedded */
+ /* let's see whether the server supports AppGroups or not */
+ if (RxGlobal.has_appgroup == RxUndef) {
+ if (XQueryExtension(RxGlobal.dpy, "XC-APPGROUP",
+ &dummy, &dummy, &dummy) &&
+ XagQueryVersion (RxGlobal.dpy, &dummy, &dummy))
+ RxGlobal.has_appgroup = RxTrue;
+ else
+ RxGlobal.has_appgroup = RxFalse;
+ }
+ if (RxGlobal.has_appgroup == RxTrue) {
+ Screen *scr;
+ Colormap cmap;
+ Arg arg;
+
+ /* use plugin's colormap as the default colormap */
+ XtSetArg(arg, XtNcolormap, &cmap);
+ XtGetValues(This->plugin_widget, &arg, 1);
+ scr = XtScreen(This->plugin_widget);
+ if (cmap == DefaultColormapOfScreen(scr)) {
+ XagCreateEmbeddedApplicationGroup (RxGlobal.dpy, None,
+ cmap,
+ BlackPixelOfScreen(scr),
+ WhitePixelOfScreen(scr),
+ &This->app_group);
+ } else {
+ XColor black, white;
+ Pixel pixels[2];
+
+ black.red = black.green = black.blue = 0;
+ XAllocColor(RxGlobal.dpy, cmap, &black);
+ white.red = white.green = white.blue = 65535;
+ XAllocColor(RxGlobal.dpy, cmap, &white);
+ XagCreateEmbeddedApplicationGroup (RxGlobal.dpy, None,
+ cmap,
+ pixels[0] = black.pixel,
+ pixels[1] = white.pixel,
+ &This->app_group);
+ XFreeColors(RxGlobal.dpy, cmap, pixels, 2, 0);
+ }
+ SetupStructureNotify (This);
+ RxpSetupPluginEventHandlers (This);
+ } else { /* too bad */
+ out->embedded = RxFalse;
+ fprintf(stderr, "Warning: Cannot perform embedding as \
+requested, APPGROUP extension not supported\n");
+ }
+ }
+
+ if (in->x_ui_auth[0] != 0) {
+ GetXAuth(RxGlobal.dpy, in->x_ui_auth[0], in->x_ui_auth_data[0],
+ trusted, This->app_group, False, DEFAULT_TIMEOUT,
+ x_ui_auth_ret, &This->x_ui_auth_id, &dummy);
+ } else if (in->x_auth[0] != 0)
+ GetXAuth(RxGlobal.dpy, in->x_auth[0], in->x_auth_data[0],
+ trusted, This->app_group, False, DEFAULT_TIMEOUT,
+ x_ui_auth_ret, &This->x_ui_auth_id, &dummy);
+
+ /* make sure we use the server the user wants us to use */
+ if (RxGlobal.has_real_server == RxUndef) {
+ Display *rdpy = RxGlobal.dpy;
+ char *real_display = getenv("XREALDISPLAY");
+ RxGlobal.has_real_server = RxFalse;
+ if (real_display != NULL) {
+ rdpy = XOpenDisplay(real_display);
+ if (rdpy == NULL)
+ rdpy = RxGlobal.dpy;
+ else
+ RxGlobal.has_real_server = RxTrue;
+ }
+ /* let's see now whether the server supports LBX or not */
+ if (XQueryExtension(rdpy, "LBX", &dummy, &dummy, &dummy))
+ RxGlobal.has_ui_lbx = RxTrue;
+ else
+ RxGlobal.has_ui_lbx = RxFalse;
+
+ if (rdpy != RxGlobal.dpy)
+ XCloseDisplay(rdpy);
+ }
+ if (RxGlobal.has_real_server == RxTrue)
+ display_name = getenv("XREALDISPLAY");
+ else
+ display_name = DisplayString(RxGlobal.dpy);
+
+ /* let's see whether we have a firewall proxy */
+ if (use_fwp == True && RxGlobal.has_ui_fwp == RxUndef) {
+ RxGlobal.fwp_dpyname = GetXFwpDisplayName(display_name);
+ if (RxGlobal.fwp_dpyname != NULL)
+ RxGlobal.has_ui_fwp = RxTrue;
+ else {
+ /*
+ * We were supposed to use the firewall proxy but we
+ * couldn't get a connection. There is no need to
+ * continue.
+ */
+ return 1;
+ }
+ }
+ if (use_fwp == True && RxGlobal.has_ui_fwp == RxTrue)
+ out->ui = GetXUrl(RxGlobal.fwp_dpyname, *x_ui_auth_ret, in->action);
+ else
+ out->ui = GetXUrl(display_name, *x_ui_auth_ret, in->action);
+
+ if (in->x_ui_lbx == RxTrue) {
+ if (use_lbx == True) {
+ if (RxGlobal.has_ui_lbx == RxTrue) {
+ out->x_ui_lbx = RxTrue;
+
+ /* let's get a key for the proxy now */
+ if (in->x_ui_lbx_auth[0] != 0) {
+ GetXAuth(RxGlobal.dpy, in->x_ui_lbx_auth[0],
+ in->x_ui_lbx_auth_data[0],
+ trusted, None, False, DEFAULT_TIMEOUT,
+ &out->x_ui_lbx_auth, &dum, &dummy);
+ } else if (in->x_auth[0] != 0)
+ GetXAuth(RxGlobal.dpy, in->x_auth[0], in->x_auth_data[0],
+ trusted, None, False, DEFAULT_TIMEOUT,
+ &out->x_ui_lbx_auth, &dum, &dummy);
+ } else {
+ out->x_ui_lbx = RxFalse;
+ fprintf(stderr, "Warning: Cannot setup LBX as requested, \
+LBX extension not supported\n");
+ }
+ } else
+ out->x_ui_lbx = RxFalse;
+ } else /* it's either RxFalse or RxUndef */
+ out->x_ui_lbx = in->x_ui_lbx;
+
+ return 0;
+}
+
+static int
+ProcessPrintParams(PluginInstance* This,
+ Boolean trusted, Boolean use_fwp, Boolean use_lbx,
+ RxParams *in, RxReturnParams *out, char *x_ui_auth)
+{
+ char *auth = NULL;
+ XSecurityAuthorization dum;
+ int dummy;
+
+ /* let's find out if we have a print server */
+ if (RxGlobal.has_printer == RxUndef) {
+ RxGlobal.pdpy_name = GetXPrintDisplayName(&RxGlobal.printer_name);
+ if (RxGlobal.pdpy_name != NULL) {
+ /* open connection to the print server */
+ RxGlobal.pdpy = XOpenDisplay(RxGlobal.pdpy_name);
+ if (RxGlobal.pdpy != NULL)
+ RxGlobal.has_printer = RxTrue;
+ else
+ RxGlobal.has_printer = RxFalse;
+ } else {
+ /* no server specified,
+ let's see if the video server could do it */
+ if (XQueryExtension(RxGlobal.dpy, "XpExtension",
+ &dummy, &dummy, &dummy)) {
+ RxGlobal.has_printer = RxTrue;
+ RxGlobal.pdpy = RxGlobal.dpy;
+ } else
+ RxGlobal.has_printer = RxFalse;
+ }
+ }
+ if (RxGlobal.has_printer == RxFalse) {
+ fprintf(stderr, "Warning: Cannot setup X printer as requested, \
+no server found\n");
+ return 0;
+ }
+
+ /* create a key only when the video server is not the print
+ server or when we didn't create a key yet */
+ if (RxGlobal.pdpy != RxGlobal.dpy || x_ui_auth == NULL) {
+ if (in->x_print_auth[0] != 0)
+ GetXAuth(RxGlobal.pdpy, in->x_print_auth[0],
+ in->x_print_auth_data[0],
+ trusted, None, False, NO_TIMEOUT,
+ &auth, &This->x_print_auth_id, &dummy);
+ else if (in->x_auth[0] != 0)
+ GetXAuth(RxGlobal.pdpy, in->x_auth[0], in->x_auth_data[0],
+ trusted, None, False, NO_TIMEOUT,
+ &auth, &This->x_print_auth_id, &dummy);
+ }
+
+ /* let's see whether we have a firewall proxy */
+ if (use_fwp == True && RxGlobal.has_print_fwp == RxUndef) {
+ RxGlobal.pfwp_dpyname = GetXFwpDisplayName(DisplayString(RxGlobal.pdpy));
+ if (RxGlobal.pfwp_dpyname != NULL)
+ RxGlobal.has_print_fwp = RxTrue;
+ else {
+ /*
+ * We were supposed to use the firewall proxy but we
+ * couldn't get a connection. There is no need to
+ * continue.
+ */
+ return 1;
+ }
+ }
+ if (use_fwp == True && RxGlobal.has_print_fwp == RxTrue)
+ out->print = GetXPrintUrl(RxGlobal.pfwp_dpyname,
+ RxGlobal.printer_name, auth,
+ in->action);
+ else
+ out->print = GetXPrintUrl(DisplayString(RxGlobal.pdpy),
+ RxGlobal.printer_name, auth,
+ in->action);
+
+ if (auth != NULL)
+ NPN_MemFree(auth);
+
+ if (in->x_print_lbx == RxTrue) {
+ if (use_lbx == True) {
+ /* let's see whether the server supports LBX or not */
+ if (RxGlobal.has_print_lbx == RxUndef) {
+ if (RxGlobal.pdpy == RxGlobal.dpy &&
+ RxGlobal.has_ui_lbx != RxUndef) {
+ /* the video server is the print server and we already
+ know whether it supports LBX or not */
+ RxGlobal.has_print_lbx = RxGlobal.has_ui_lbx;
+ } else {
+ if (XQueryExtension(RxGlobal.pdpy, "LBX",
+ &dummy, &dummy, &dummy))
+ RxGlobal.has_print_lbx = RxTrue;
+ else
+ RxGlobal.has_print_lbx = RxFalse;
+ }
+ }
+ if (RxGlobal.has_print_lbx == RxTrue) {
+ out->x_print_lbx = RxTrue;
+ if (RxGlobal.pdpy != RxGlobal.dpy) {
+ /* let's get a key for the proxy now */
+ if (in->x_print_lbx_auth[0] != 0) {
+ GetXAuth(RxGlobal.pdpy, in->x_print_lbx_auth[0],
+ in->x_print_lbx_auth_data[0],
+ trusted, None, False, DEFAULT_TIMEOUT,
+ &out->x_print_lbx_auth, &dum, &dummy);
+ } else if (in->x_auth[0] != 0)
+ GetXAuth(RxGlobal.pdpy, in->x_auth[0],
+ in->x_auth_data[0],
+ trusted, None, False, DEFAULT_TIMEOUT,
+ &out->x_print_lbx_auth, &dum, &dummy);
+ }
+ } else {
+ out->x_print_lbx = RxFalse;
+ fprintf(stderr, "Warning: Cannot setup LBX as \
+requested, LBX extension not supported\n");
+ }
+ } else
+ out->x_print_lbx = RxFalse;
+ } else /* it's either RxFalse or RxUndef */
+ out->x_print_lbx = in->x_print_lbx;
+
+ return 0;
+}
+
+int
+RxpProcessParams(PluginInstance* This, RxParams *in, RxReturnParams *out)
+{
+ char *x_ui_auth = NULL;
+ char webserver[MAXHOSTNAMELEN];
+ Boolean trusted, use_fwp, use_lbx;
+ int return_value = 0;
+
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "%s\n", "RxpProcessParams");
+ fprintf (stderr, "This: 0x%x\n", This);
+#endif
+
+ /* init return struture */
+ memset(out, 0, sizeof(RxReturnParams));
+ out->x_ui_lbx = RxUndef;
+ out->x_print_lbx = RxUndef;
+ out->action = in->action;
+
+ if (in->embedded != RxUndef)
+ out->embedded = in->embedded;
+ else
+ out->embedded = RxUndef;
+
+ out->width = in->width;
+ out->height = in->height;
+
+ if (RxGlobal.get_prefs == True) {
+ GetPreferences(This->toplevel_widget, &RxGlobal.prefs);
+ RxGlobal.get_prefs = False;
+ }
+ ComputePreferences(&RxGlobal.prefs,
+ ParseHostname(in->action, webserver, MAXHOSTNAMELEN) ? webserver : NULL,
+ &trusted, &use_fwp, &use_lbx);
+
+ if (in->ui[0] == XUI) /* X display needed */
+ return_value = ProcessUIParams(This, trusted, use_fwp, use_lbx,
+ in, out, &x_ui_auth);
+
+ if (in->print[0] == XPrint) /* XPrint server needed */
+ return_value = ProcessPrintParams(This, trusted, use_fwp, use_lbx,
+ in, out, x_ui_auth);
+
+ if (x_ui_auth != NULL)
+ NPN_MemFree(x_ui_auth);
+
+ return return_value;
+}
diff --git a/plugin/RxPlugin.h b/plugin/RxPlugin.h
new file mode 100644
index 0000000..9b97789
--- /dev/null
+++ b/plugin/RxPlugin.h
@@ -0,0 +1,171 @@
+/* $Xorg: RxPlugin.h,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+/*
+ * RX plug-in header file, based on the UnixTemplate file provided by Netcape.
+ */
+
+/* -*- Mode: C; tab-width: 4; -*- */
+/******************************************************************************
+ * Copyright 1996 Netscape Communications. All rights reserved.
+ ******************************************************************************/
+/*
+ * UnixShell.c
+ *
+ * Netscape Client Plugin API
+ * - Function that need to be implemented by plugin developers
+ *
+ * This file defines a "Template" plugin that plugin developers can use
+ * as the basis for a real plugin. This shell just provides empty
+ * implementations of all functions that the plugin can implement
+ * that will be called by Netscape (the NPP_xxx methods defined in
+ * npapi.h).
+ *
+ * dp Suresh <dp@netscape.com>
+ *
+ */
+
+#ifndef _RxPlugin_h
+#define _RxPLugin_h
+
+#include "npapi.h"
+#include <X11/Xos.h>
+#include <X11/Intrinsic.h>
+#include <X11/extensions/Xag.h>
+#include <X11/extensions/security.h>
+#include <X11/ICE/ICElib.h>
+#include <stdio.h>
+#include "Rx.h"
+#include "Prefs.h"
+
+/***********************************************************************
+ * Instance state information about the plugin.
+ *
+ * PLUGIN DEVELOPERS:
+ * Use this struct to hold per-instance information that you'll
+ * need in the various functions in this file.
+ ***********************************************************************/
+
+typedef enum {
+ RxpNoflags = 0,
+ RxpWmDelWin = (1 << 0),
+ RxpMapped = (1 << 4)
+} WindowFlags;
+
+typedef struct {
+ Window win;
+ Position x,y;
+ Dimension width,height;
+ Dimension border_width;
+ WindowFlags flags;
+ Colormap colormap;
+} windowrec;
+
+typedef enum { LOADING, STARTING, WAITING, RUNNING } PluginState;
+
+typedef struct _PluginInstance
+{
+ NPP instance;
+ int16 argc; /* HTML arguments given by Netscape */
+ char **argn;
+ char **argv;
+ short parse_reply; /* 0 - no
+ 1 - look for status line
+ 2 - done */
+ short status; /* returned application status */
+ RxBool dont_reparent; /* whether client windows need reparent*/
+ char *query;
+ PluginState state;
+ Widget status_widget;
+ Widget plugin_widget;
+ Dimension width, height;
+ /* The following fields need to be taken care by RxpNew & RxpDestroy */
+ XSecurityAuthorization x_ui_auth_id;
+ XSecurityAuthorization x_print_auth_id;
+ XAppGroup app_group;
+ Widget toplevel_widget;
+ windowrec *client_windows;
+ int nclient_windows;
+} PluginInstance;
+
+typedef struct _PluginGlobal {
+ Boolean inited;
+ RxBool has_appgroup;
+ RxBool has_real_server;
+ RxBool has_ui_lbx;
+ RxBool has_print_lbx;
+ RxBool has_printer;
+ RxBool has_ui_fwp;
+ RxBool has_print_fwp;
+ char *pdpy_name;
+ char *printer_name;
+ char *fwp_dpyname;
+ char *pfwp_dpyname;
+ struct _IceConn* ice_conn;
+ int pm_opcode;
+ Preferences prefs;
+ Boolean get_prefs;
+ Display* dpy;
+ Display* pdpy;
+ Atom wm_delete_window;
+ Atom wm_protocols;
+} PluginGlobal;
+
+extern PluginGlobal RxGlobal;
+
+
+#define PLUGIN_NAME "RX Plug-in"
+#define PLUGIN_DESCRIPTION "X Remote Activation Plug-in"
+#define PLUGIN_MIME_DESCRIPTION \
+ "application/x-rx:xrx:X Remote Activation Plug-in"
+
+
+/* functions to init and free private members */
+extern void RxpNew(PluginInstance*);
+extern void RxpDestroy(PluginInstance*);
+
+extern int
+RxpProcessParams(PluginInstance*, RxParams*, RxReturnParams*);
+
+extern void
+RxpSetStatusWidget(PluginInstance*, PluginState);
+
+extern void
+RxpSetupPluginEventHandlers(PluginInstance*);
+
+extern void
+RxpTeardown (PluginInstance*);
+
+extern void
+RxpWmDelWinHandler (Widget, XtPointer, XEvent*, Boolean*);
+
+extern void
+RxpRemoveDestroyCallback (PluginInstance*);
+
+#endif
diff --git a/plugin/SetWin.c b/plugin/SetWin.c
new file mode 100644
index 0000000..3e60f75
--- /dev/null
+++ b/plugin/SetWin.c
@@ -0,0 +1,213 @@
+/* $Xorg: SetWin.c,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $ */
+/*
+
+Copyright 1996, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
+ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABIL-
+ITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization from
+The Open Group.
+
+*/
+
+/*
+ * RX plug-in module based on the UnixTemplate file provided by Netcape.
+ */
+
+/* -*- Mode: C; tab-width: 4; -*- */
+/******************************************************************************
+ * Copyright 1996 Netscape Communications. All rights reserved.
+ ******************************************************************************/
+/*
+ * UnixShell.c
+ *
+ * Netscape Client Plugin API
+ * - Function that need to be implemented by plugin developers
+ *
+ * This file defines a "Template" plugin that plugin developers can use
+ * as the basis for a real plugin. This shell just provides empty
+ * implementations of all functions that the plugin can implement
+ * that will be called by Netscape (the NPP_xxx methods defined in
+ * npapi.h).
+ *
+ * dp Suresh <dp@netscape.com>
+ *
+ */
+
+#include "RxPlugin.h"
+#include <X11/StringDefs.h>
+
+/***********************************************************************
+ * Sometimes the plugin widget gets stupidly destroyed, that is whenever
+ * Netscape relayouts the page. This callback reparents the client
+ * windows to the root window so they do not get destroyed as well.
+ * Eventually the NPP_SetWindow function should be called and we'll
+ * reparent them back under the plugin.
+ ***********************************************************************/
+static void
+DestroyCB (Widget widget, XtPointer client_data, XtPointer call_data)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+ int i;
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "DestroyCB, This: 0x%x\n", This);
+#endif
+ if (widget == This->plugin_widget) {
+ This->plugin_widget = NULL;
+ This->status_widget = NULL;
+ }
+ if (This->dont_reparent == RxFalse) {
+ for (i = 0; i < This->nclient_windows; i++) {
+ XUnmapWindow (RxGlobal.dpy, This->client_windows[i].win);
+ This->client_windows[i].flags &= ~RxpMapped;
+
+ XReparentWindow (RxGlobal.dpy, This->client_windows[i].win,
+ (XtScreen (widget))->root, 0, 0);
+ }
+ This->dont_reparent = RxTrue;
+ } else
+ This->dont_reparent = RxFalse;
+ /*
+ * not worth removing event handlers on this widget since it's
+ * about to be destroyed anyway.
+ */
+}
+
+
+/***********************************************************************
+ * Sometimes the plugin widget gets stupidly resized, because of poor
+ * geometry when its child (that is the status widget) gets destroyed.
+ * So this callback resizes it back to the right size.
+ * Note that this could lead to an endless battle, but it appears that
+ * it doesn't so far...
+ ***********************************************************************/
+static void
+ResizeCB (Widget widget, XtPointer client_data, XtPointer call_data)
+{
+ PluginInstance* This = (PluginInstance*) client_data;
+ Arg args[5];
+ int n;
+
+#ifdef PLUGIN_TRACE
+ fprintf (stderr, "ResizeCB, This: 0x%x\n", This);
+#endif
+ /* make sure plugin widget gets the same size back */
+ n = 0;
+ XtSetArg(args[n], XtNwidth, This->width); n++;
+ XtSetArg(args[n], XtNheight, This->height); n++;
+ XtSetValues(This->plugin_widget, args, n);
+}
+
+static Widget
+FindToplevel(Widget widget)
+{
+ while (XtParent(widget) != NULL && !XtIsTopLevelShell(widget))
+ widget = XtParent(widget);
+
+ return widget;
+}
+
+/***********************************************************************
+ * This function gets called first when the plugin widget is created and
+ * then whenever the plugin is changed.
+ ***********************************************************************/
+NPError
+NPP_SetWindow(NPP instance, NPWindow* window)
+{
+ PluginInstance* This;
+ Widget netscape_widget;
+
+ if (instance == NULL)
+ return NPERR_INVALID_INSTANCE_ERROR;
+
+ if (window == NULL)
+ return NPERR_NO_ERROR;
+
+ /*
+ * PLUGIN DEVELOPERS:
+ * Before setting window to point to the
+ * new window, you may wish to compare the new window
+ * info to the previous window (if any) to note window
+ * size changes, etc.
+ */
+ This = (PluginInstance*) instance->pdata;
+#ifdef PLUGIN_TRACE
+ fprintf(stderr, "SetWindow 0x%x.\n", (Window) window->window);
+ fprintf(stderr, "This: 0x%x\n", This);
+ if (This->plugin_widget)
+ fprintf(stderr, "This->plugin_widget: 0x%x\n", This->plugin_widget);
+#endif
+ if (RxGlobal.dpy == NULL) {
+ RxGlobal.dpy = ((NPSetWindowCallbackStruct *)window->ws_info)->display;
+ RxGlobal.wm_delete_window =
+ XInternAtom (RxGlobal.dpy, "WM_DELETE_WINDOW", TRUE);
+ RxGlobal.wm_protocols = XInternAtom (RxGlobal.dpy, "WM_PROTOCOLS", TRUE);
+ }
+ netscape_widget = XtWindowToWidget(RxGlobal.dpy, (Window) window->window);
+ if (This->toplevel_widget == NULL)
+ This->toplevel_widget = FindToplevel(netscape_widget);
+
+ if (This->plugin_widget != netscape_widget) {
+
+ /* We have a new widget store it */
+ This->plugin_widget = netscape_widget;
+ This->width = window->width;
+ This->height = window->height;
+
+ XtAddCallback (This->plugin_widget, XtNdestroyCallback,
+ DestroyCB, (XtPointer) This);
+ XtAddCallback (This->plugin_widget, "resizeCallback",
+ ResizeCB, (XtPointer) This);
+
+ if (This->app_group)
+ RxpSetupPluginEventHandlers (This);
+
+ if (This->nclient_windows > 0) {
+ int i;
+
+ /* We already have the client, so we need to reparent it to the
+ new window */
+ for (i = 0; i < This->nclient_windows; i++) {
+ XReparentWindow(RxGlobal.dpy, This->client_windows[i].win,
+ XtWindow(netscape_widget),
+ This->client_windows[i].x,
+ This->client_windows[i].y);
+ if (This->dont_reparent == RxTrue) {
+ XMapWindow (RxGlobal.dpy, This->client_windows[i].win);
+ This->client_windows[i].flags |= RxpMapped;
+ }
+ }
+ } else /* no client window, display status widget */
+ RxpSetStatusWidget(This, This->state);
+ if (This->dont_reparent != RxFalse) /* can be True or Undef */
+ This->dont_reparent = RxFalse;
+ else
+ This->dont_reparent = RxTrue;
+ }
+ return NPERR_NO_ERROR;
+}
+
+void
+RxpRemoveDestroyCallback(PluginInstance *This)
+{
+ if (This->plugin_widget != NULL)
+ XtRemoveCallback(This->plugin_widget, XtNdestroyCallback,
+ DestroyCB, (XtPointer) This);
+}
diff --git a/plugin/common/npunix.c b/plugin/common/npunix.c
new file mode 100644
index 0000000..bedd861
--- /dev/null
+++ b/plugin/common/npunix.c
@@ -0,0 +1,407 @@
+/* $Xorg: npunix.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */
+/*
+ * npunix.c
+ *
+ * Netscape Client Plugin API
+ * - Wrapper function to interface with the Netscape Navigator
+ *
+ * dp Suresh <dp@netscape.com>
+ *
+ *----------------------------------------------------------------------
+ * PLUGIN DEVELOPERS:
+ * YOU WILL NOT NEED TO EDIT THIS FILE.
+ *----------------------------------------------------------------------
+ */
+
+#define XP_UNIX 1
+
+#include <stdio.h>
+#include "npapi.h"
+#include "npupp.h"
+
+/*
+ * Define PLUGIN_TRACE to have the wrapper functions print
+ * messages to stderr whenever they are called.
+ */
+
+#ifdef PLUGIN_TRACE
+#include <stdio.h>
+#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg)
+#else
+#define PLUGINDEBUGSTR(msg)
+#endif
+
+
+/***********************************************************************
+ *
+ * Globals
+ *
+ ***********************************************************************/
+
+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.
+ *
+ ***********************************************************************/
+
+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;
+
+ /* Major version is in high byte */
+ *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);
+}
+
+NPError
+NPN_GetURL(NPP instance, const char* url, const char* window)
+{
+ return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
+}
+
+NPError
+NPN_PostURL(NPP instance, const char* url, const char* window,
+ uint32 len, const char* buf, NPBool file)
+{
+ return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
+ url, window, len, buf, file);
+}
+
+NPError
+NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
+{
+ return CallNPN_RequestReadProc(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);
+}
+
+int32
+NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
+{
+ return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
+ stream, len, buffer);
+}
+
+NPError
+NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
+{
+ return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream,
+ instance, stream, reason);
+}
+
+void
+NPN_Status(NPP instance, const char* message)
+{
+ CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
+}
+
+const char*
+NPN_UserAgent(NPP instance)
+{
+ return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
+}
+
+void*
+NPN_MemAlloc(uint32 size)
+{
+ return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
+}
+
+void NPN_MemFree(void* ptr)
+{
+ CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
+}
+
+uint32 NPN_MemFlush(uint32 size)
+{
+ return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
+}
+
+void NPN_ReloadPlugins(NPBool reloadPages)
+{
+ CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
+}
+
+JRIEnv* NPN_GetJavaEnv()
+{
+ return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv);
+}
+
+jref NPN_GetJavaPeer(NPP instance)
+{
+ return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer,
+ instance);
+}
+
+
+/***********************************************************************
+ *
+ * Wrapper functions : Netscape Navigator -> plugin
+ *
+ * These functions let the plugin developer just create the APIs
+ * as documented and defined in npapi.h, without needing to
+ * install those functions in the function table or worry about
+ * setting up globals for 68K plugins.
+ *
+ ***********************************************************************/
+
+NPError
+Private_New(NPMIMEType pluginType, NPP instance, uint16 mode,
+ int16 argc, char* argn[], char* argv[], NPSavedData* saved)
+{
+ NPError ret;
+ PLUGINDEBUGSTR("New");
+ ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
+ return ret;
+}
+
+NPError
+Private_Destroy(NPP instance, NPSavedData** save)
+{
+ PLUGINDEBUGSTR("Destroy");
+ return NPP_Destroy(instance, save);
+}
+
+NPError
+Private_SetWindow(NPP instance, NPWindow* window)
+{
+ NPError err;
+ PLUGINDEBUGSTR("SetWindow");
+ err = NPP_SetWindow(instance, window);
+ return err;
+}
+
+NPError
+Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
+ NPBool seekable, uint16* stype)
+{
+ NPError err;
+ PLUGINDEBUGSTR("NewStream");
+ err = NPP_NewStream(instance, type, stream, seekable, stype);
+ return err;
+}
+
+int32
+Private_WriteReady(NPP instance, NPStream* stream)
+{
+ unsigned int result;
+ PLUGINDEBUGSTR("WriteReady");
+ result = NPP_WriteReady(instance, stream);
+ return result;
+}
+
+int32
+Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
+ void* buffer)
+{
+ unsigned int result;
+ PLUGINDEBUGSTR("Write");
+ result = NPP_Write(instance, stream, offset, len, buffer);
+ return result;
+}
+
+void
+Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
+{
+ PLUGINDEBUGSTR("StreamAsFile");
+ NPP_StreamAsFile(instance, stream, fname);
+}
+
+
+NPError
+Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
+{
+ NPError err;
+ PLUGINDEBUGSTR("DestroyStream");
+ err = NPP_DestroyStream(instance, stream, reason);
+ return err;
+}
+
+
+void
+Private_Print(NPP instance, NPPrint* platformPrint)
+{
+ PLUGINDEBUGSTR("Print");
+ NPP_Print(instance, platformPrint);
+}
+
+JRIGlobalRef
+Private_GetJavaClass(void)
+{
+ jref clazz = NPP_GetJavaClass();
+ if (clazz) {
+ JRIEnv* env = NPN_GetJavaEnv();
+ return JRI_NewGlobalRef(env, clazz);
+ }
+ return NULL;
+}
+
+/***********************************************************************
+ *
+ * These functions are located automagically by netscape.
+ *
+ ***********************************************************************/
+
+/*
+ * NP_GetMIMEDescription
+ * - Netscape needs to know about this symbol
+ * - Netscape uses the return value to identify when an object instance
+ * of this plugin should be created.
+ */
+char *
+NP_GetMIMEDescription(void)
+{
+ return NPP_GetMIMEDescription();
+}
+
+/*
+ * NP_GetValue [optional]
+ * - Netscape needs to know about this symbol.
+ * - Interfaces with plugin to get values for predefined variables
+ * that the navigator needs.
+ */
+NPError
+NP_GetValue(void *future, NPPVariable variable, void *value)
+{
+ return NPP_GetValue(future, variable, value);
+}
+
+/*
+ * NP_Initialize
+ * - Netscape needs to know about this symbol.
+ * - It calls this function after looking up its symbol before it
+ * is about to create the first ever object of this kind.
+ *
+ * PARAMETERS
+ * nsTable - The netscape function table. If developers just use these
+ * wrappers, they dont need to worry about all these function
+ * tables.
+ * RETURN
+ * pluginFuncs
+ * - This functions needs to fill the plugin function table
+ * pluginFuncs and return it. Netscape Navigator plugin
+ * library will use this function table to call the plugin.
+ *
+ */
+NPError
+NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
+{
+ NPError err = NPERR_NO_ERROR;
+
+ PLUGINDEBUGSTR("NP_Initialize");
+
+ /* validate input parameters */
+
+ if ((nsTable == NULL) || (pluginFuncs == 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).
+ *
+ */
+
+ if (err == NPERR_NO_ERROR) {
+ if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
+ err = NPERR_INCOMPATIBLE_VERSION_ERROR;
+ if (nsTable->size < sizeof(NPNetscapeFuncs))
+ err = NPERR_INVALID_FUNCTABLE_ERROR;
+ if (pluginFuncs->size < sizeof(NPPluginFuncs))
+ err = NPERR_INVALID_FUNCTABLE_ERROR;
+ }
+
+
+ if (err == NPERR_NO_ERROR) {
+ /*
+ * Copy all the fields of Netscape function table into our
+ * copy so we can call back into Netscape later. Note that
+ * we need to copy the fields one by one, rather than assigning
+ * the whole structure, because the Netscape function table
+ * could actually be bigger than what we expect.
+ */
+ gNetscapeFuncs.version = nsTable->version;
+ gNetscapeFuncs.size = nsTable->size;
+ gNetscapeFuncs.posturl = nsTable->posturl;
+ gNetscapeFuncs.geturl = nsTable->geturl;
+ gNetscapeFuncs.requestread = nsTable->requestread;
+ gNetscapeFuncs.newstream = nsTable->newstream;
+ gNetscapeFuncs.write = nsTable->write;
+ gNetscapeFuncs.destroystream = nsTable->destroystream;
+ gNetscapeFuncs.status = nsTable->status;
+ gNetscapeFuncs.uagent = nsTable->uagent;
+ gNetscapeFuncs.memalloc = nsTable->memalloc;
+ gNetscapeFuncs.memfree = nsTable->memfree;
+ gNetscapeFuncs.memflush = nsTable->memflush;
+ gNetscapeFuncs.reloadplugins = nsTable->reloadplugins;
+ gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv;
+ gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer;
+ gNetscapeFuncs.getvalue = nsTable->getvalue;
+
+ /*
+ * 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->event = NULL;
+ pluginFuncs->javaClass = Private_GetJavaClass();
+
+ err = NPP_Initialize();
+ }
+
+ return err;
+}
+
+/*
+ * NP_Shutdown [optional]
+ * - Netscape needs to know about this symbol.
+ * - It calls this function after looking up its symbol after
+ * the last object of this kind has been destroyed.
+ *
+ */
+NPError
+NP_Shutdown(void)
+{
+ PLUGINDEBUGSTR("NP_Shutdown");
+ NPP_Shutdown();
+ return NPERR_NO_ERROR;
+}
diff --git a/plugin/include/jri.h b/plugin/include/jri.h
new file mode 100644
index 0000000..4391455
--- /dev/null
+++ b/plugin/include/jri.h
@@ -0,0 +1,639 @@
+/* $Xorg: jri.h,v 1.3 2000/08/17 19:55:00 cpqbld Exp $ */
+/* -*- Mode: C; tab-width: 4; -*- */
+/*******************************************************************************
+ * Java Runtime Interface
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ ******************************************************************************/
+
+#ifndef JRI_H
+#define JRI_H
+
+#include "jritypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*******************************************************************************
+ * JRIEnv
+ ******************************************************************************/
+
+/* The type of the JRIEnv interface. */
+typedef struct JRIEnvInterface JRIEnvInterface;
+
+/* The type of a JRIEnv instance. */
+typedef const JRIEnvInterface* JRIEnv;
+
+/*******************************************************************************
+ * JRIEnv Operations
+ ******************************************************************************/
+
+#define JRI_LoadClass(env, buf, bufLen) \
+ (((*(env))->LoadClass)(env, JRI_LoadClass_op, buf, bufLen))
+
+#define JRI_FindClass(env, name) \
+ (((*(env))->FindClass)(env, JRI_FindClass_op, name))
+
+#define JRI_Throw(env, obj) \
+ (((*(env))->Throw)(env, JRI_Throw_op, obj))
+
+#define JRI_ThrowNew(env, clazz, message) \
+ (((*(env))->ThrowNew)(env, JRI_ThrowNew_op, clazz, message))
+
+#define JRI_ExceptionOccurred(env) \
+ (((*(env))->ExceptionOccurred)(env, JRI_ExceptionOccurred_op))
+
+#define JRI_ExceptionDescribe(env) \
+ (((*(env))->ExceptionDescribe)(env, JRI_ExceptionDescribe_op))
+
+#define JRI_ExceptionClear(env) \
+ (((*(env))->ExceptionClear)(env, JRI_ExceptionClear_op))
+
+#define JRI_NewGlobalRef(env, ref) \
+ (((*(env))->NewGlobalRef)(env, JRI_NewGlobalRef_op, ref))
+
+#define JRI_DisposeGlobalRef(env, gref) \
+ (((*(env))->DisposeGlobalRef)(env, JRI_DisposeGlobalRef_op, gref))
+
+#define JRI_GetGlobalRef(env, gref) \
+ (((*(env))->GetGlobalRef)(env, JRI_GetGlobalRef_op, gref))
+
+#define JRI_SetGlobalRef(env, gref, ref) \
+ (((*(env))->SetGlobalRef)(env, JRI_SetGlobalRef_op, gref, ref))
+
+#define JRI_IsSameObject(env, a, b) \
+ (((*(env))->IsSameObject)(env, JRI_IsSameObject_op, a, b))
+
+#define JRI_NewObject(env) ((*(env))->NewObject)
+#define JRI_NewObjectV(env, clazz, methodID, args) \
+ (((*(env))->NewObjectV)(env, JRI_NewObject_op_va_list, clazz, methodID, args))
+#define JRI_NewObjectA(env, clazz, method, args) \
+ (((*(env))->NewObjectA)(env, JRI_NewObject_op_array, clazz, methodID, args))
+
+#define JRI_GetObjectClass(env, obj) \
+ (((*(env))->GetObjectClass)(env, JRI_GetObjectClass_op, obj))
+
+#define JRI_IsInstanceOf(env, obj, clazz) \
+ (((*(env))->IsInstanceOf)(env, JRI_IsInstanceOf_op, obj, clazz))
+
+#define JRI_GetMethodID(env, clazz, name, sig) \
+ (((*(env))->GetMethodID)(env, JRI_GetMethodID_op, clazz, name, sig))
+
+#define JRI_CallMethod(env) ((*(env))->CallMethod)
+#define JRI_CallMethodV(env, obj, methodID, args) \
+ (((*(env))->CallMethodV)(env, JRI_CallMethod_op_va_list, obj, methodID, args))
+#define JRI_CallMethodA(env, obj, methodID, args) \
+ (((*(env))->CallMethodA)(env, JRI_CallMethod_op_array, obj, methodID, args))
+
+#define JRI_CallMethodBoolean(env) ((*(env))->CallMethodBoolean)
+#define JRI_CallMethodBooleanV(env, obj, methodID, args) \
+ (((*(env))->CallMethodBooleanV)(env, JRI_CallMethodBoolean_op_va_list, obj, methodID, args))
+#define JRI_CallMethodBooleanA(env, obj, methodID, args) \
+ (((*(env))->CallMethodBooleanA)(env, JRI_CallMethodBoolean_op_array, obj, methodID, args))
+
+#define JRI_CallMethodByte(env) ((*(env))->CallMethodByte)
+#define JRI_CallMethodByteV(env, obj, methodID, args) \
+ (((*(env))->CallMethodByteV)(env, JRI_CallMethodByte_op_va_list, obj, methodID, args))
+#define JRI_CallMethodByteA(env, obj, methodID, args) \
+ (((*(env))->CallMethodByteA)(env, JRI_CallMethodByte_op_array, obj, methodID, args))
+
+#define JRI_CallMethodChar(env) ((*(env))->CallMethodChar)
+#define JRI_CallMethodCharV(env, obj, methodID, args) \
+ (((*(env))->CallMethodCharV)(env, JRI_CallMethodChar_op_va_list, obj, methodID, args))
+#define JRI_CallMethodCharA(env, obj, methodID, args) \
+ (((*(env))->CallMethodCharA)(env, JRI_CallMethodChar_op_array, obj, methodID, args))
+
+#define JRI_CallMethodShort(env) ((*(env))->CallMethodShort)
+#define JRI_CallMethodShortV(env, obj, methodID, args) \
+ (((*(env))->CallMethodShortV)(env, JRI_CallMethodShort_op_va_list, obj, methodID, args))
+#define JRI_CallMethodShortA(env, obj, methodID, args) \
+ (((*(env))->CallMethodShortA)(env, JRI_CallMethodShort_op_array, obj, methodID, args))
+
+#define JRI_CallMethodInt(env) ((*(env))->CallMethodInt)
+#define JRI_CallMethodIntV(env, obj, methodID, args) \
+ (((*(env))->CallMethodIntV)(env, JRI_CallMethodInt_op_va_list, obj, methodID, args))
+#define JRI_CallMethodIntA(env, obj, methodID, args) \
+ (((*(env))->CallMethodIntA)(env, JRI_CallMethodInt_op_array, obj, methodID, args))
+
+#define JRI_CallMethodLong(env) ((*(env))->CallMethodLong)
+#define JRI_CallMethodLongV(env, obj, methodID, args) \
+ (((*(env))->CallMethodLongV)(env, JRI_CallMethodLong_op_va_list, obj, methodID, args))
+#define JRI_CallMethodLongA(env, obj, methodID, args) \
+ (((*(env))->CallMethodLongA)(env, JRI_CallMethodLong_op_array, obj, methodID, args))
+
+#define JRI_CallMethodFloat(env) ((*(env))->CallMethodFloat)
+#define JRI_CallMethodFloatV(env, obj, methodID, args) \
+ (((*(env))->CallMethodFloatV)(env, JRI_CallMethodFloat_op_va_list, obj, methodID, args))
+#define JRI_CallMethodFloatA(env, obj, methodID, args) \
+ (((*(env))->CallMethodFloatA)(env, JRI_CallMethodFloat_op_array, obj, methodID, args))
+
+#define JRI_CallMethodDouble(env) ((*(env))->CallMethodDouble)
+#define JRI_CallMethodDoubleV(env, obj, methodID, args) \
+ (((*(env))->CallMethodDoubleV)(env, JRI_CallMethodDouble_op_va_list, obj, methodID, args))
+#define JRI_CallMethodDoubleA(env, obj, methodID, args) \
+ (((*(env))->CallMethodDoubleA)(env, JRI_CallMethodDouble_op_array, obj, methodID, args))
+
+#define JRI_GetFieldID(env, clazz, name, sig) \
+ (((*(env))->GetFieldID)(env, JRI_GetFieldID_op, clazz, name, sig))
+
+#define JRI_GetField(env, obj, fieldID) \
+ (((*(env))->GetField)(env, JRI_GetField_op, obj, fieldID))
+
+#define JRI_GetFieldBoolean(env, obj, fieldID) \
+ (((*(env))->GetFieldBoolean)(env, JRI_GetFieldBoolean_op, obj, fieldID))
+
+#define JRI_GetFieldByte(env, obj, fieldID) \
+ (((*(env))->GetFieldByte)(env, JRI_GetFieldByte_op, obj, fieldID))
+
+#define JRI_GetFieldChar(env, obj, fieldID) \
+ (((*(env))->GetFieldChar)(env, JRI_GetFieldChar_op, obj, fieldID))
+
+#define JRI_GetFieldShort(env, obj, fieldID) \
+ (((*(env))->GetFieldShort)(env, JRI_GetFieldShort_op, obj, fieldID))
+
+#define JRI_GetFieldInt(env, obj, fieldID) \
+ (((*(env))->GetFieldInt)(env, JRI_GetFieldInt_op, obj, fieldID))
+
+#define JRI_GetFieldLong(env, obj, fieldID) \
+ (((*(env))->GetFieldLong)(env, JRI_GetFieldLong_op, obj, fieldID))
+
+#define JRI_GetFieldFloat(env, obj, fieldID) \
+ (((*(env))->GetFieldFloat)(env, JRI_GetFieldFloat_op, obj, fieldID))
+
+#define JRI_GetFieldDouble(env, obj, fieldID) \
+ (((*(env))->GetFieldDouble)(env, JRI_GetFieldDouble_op, obj, fieldID))
+
+#define JRI_SetField(env, obj, fieldID, value) \
+ (((*(env))->SetField)(env, JRI_SetField_op, obj, fieldID, value))
+
+#define JRI_SetFieldBoolean(env, obj, fieldID, value) \
+ (((*(env))->SetFieldBoolean)(env, JRI_SetFieldBoolean_op, obj, fieldID, value))
+
+#define JRI_SetFieldByte(env, obj, fieldID, value) \
+ (((*(env))->SetFieldByte)(env, JRI_SetFieldByte_op, obj, fieldID, value))
+
+#define JRI_SetFieldChar(env, obj, fieldID, value) \
+ (((*(env))->SetFieldChar)(env, JRI_SetFieldChar_op, obj, fieldID, value))
+
+#define JRI_SetFieldShort(env, obj, fieldID, value) \
+ (((*(env))->SetFieldShort)(env, JRI_SetFieldShort_op, obj, fieldID, value))
+
+#define JRI_SetFieldInt(env, obj, fieldID, value) \
+ (((*(env))->SetFieldInt)(env, JRI_SetFieldInt_op, obj, fieldID, value))
+
+#define JRI_SetFieldLong(env, obj, fieldID, value) \
+ (((*(env))->SetFieldLong)(env, JRI_SetFieldLong_op, obj, fieldID, value))
+
+#define JRI_SetFieldFloat(env, obj, fieldID, value) \
+ (((*(env))->SetFieldFloat)(env, JRI_SetFieldFloat_op, obj, fieldID, value))
+
+#define JRI_SetFieldDouble(env, obj, fieldID, value) \
+ (((*(env))->SetFieldDouble)(env, JRI_SetFieldDouble_op, obj, fieldID, value))
+
+#define JRI_IsSubclassOf(env, a, b) \
+ (((*(env))->IsSubclassOf)(env, JRI_IsSubclassOf_op, a, b))
+
+#define JRI_GetStaticMethodID(env, clazz, name, sig) \
+ (((*(env))->GetStaticMethodID)(env, JRI_GetStaticMethodID_op, clazz, name, sig))
+
+#define JRI_CallStaticMethod(env) ((*(env))->CallStaticMethod)
+#define JRI_CallStaticMethodV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodV)(env, JRI_CallStaticMethod_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodA)(env, JRI_CallStaticMethod_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodBoolean(env) ((*(env))->CallStaticMethodBoolean)
+#define JRI_CallStaticMethodBooleanV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodBooleanV)(env, JRI_CallStaticMethodBoolean_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodBooleanA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodBooleanA)(env, JRI_CallStaticMethodBoolean_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodByte(env) ((*(env))->CallStaticMethodByte)
+#define JRI_CallStaticMethodByteV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodByteV)(env, JRI_CallStaticMethodByte_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodByteA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodByteA)(env, JRI_CallStaticMethodByte_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodChar(env) ((*(env))->CallStaticMethodChar)
+#define JRI_CallStaticMethodCharV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodCharV)(env, JRI_CallStaticMethodChar_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodCharA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodCharA)(env, JRI_CallStaticMethodChar_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodShort(env) ((*(env))->CallStaticMethodShort)
+#define JRI_CallStaticMethodShortV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodShortV)(env, JRI_CallStaticMethodShort_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodShortA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodShortA)(env, JRI_CallStaticMethodShort_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodInt(env) ((*(env))->CallStaticMethodInt)
+#define JRI_CallStaticMethodIntV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodIntV)(env, JRI_CallStaticMethodInt_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodIntA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodIntA)(env, JRI_CallStaticMethodInt_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodLong(env) ((*(env))->CallStaticMethodLong)
+#define JRI_CallStaticMethodLongV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodLongV)(env, JRI_CallStaticMethodLong_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodLongA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodLongA)(env, JRI_CallStaticMethodLong_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodFloat(env) ((*(env))->CallStaticMethodFloat)
+#define JRI_CallStaticMethodFloatV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodFloatV)(env, JRI_CallStaticMethodFloat_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodFloatA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodFloatA)(env, JRI_CallStaticMethodFloat_op_array, clazz, methodID, args))
+
+#define JRI_CallStaticMethodDouble(env) ((*(env))->CallStaticMethodDouble)
+#define JRI_CallStaticMethodDoubleV(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodDoubleV)(env, JRI_CallStaticMethodDouble_op_va_list, clazz, methodID, args))
+#define JRI_CallStaticMethodDoubleA(env, clazz, methodID, args) \
+ (((*(env))->CallStaticMethodDoubleA)(env, JRI_CallStaticMethodDouble_op_array, clazz, methodID, args))
+
+#define JRI_GetStaticFieldID(env, clazz, name, sig) \
+ (((*(env))->GetStaticFieldID)(env, JRI_GetStaticFieldID_op, clazz, name, sig))
+
+#define JRI_GetStaticField(env, clazz, fieldID) \
+ (((*(env))->GetStaticField)(env, JRI_GetStaticField_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldBoolean(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldBoolean)(env, JRI_GetStaticFieldBoolean_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldByte(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldByte)(env, JRI_GetStaticFieldByte_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldChar(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldChar)(env, JRI_GetStaticFieldChar_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldShort(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldShort)(env, JRI_GetStaticFieldShort_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldInt(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldInt)(env, JRI_GetStaticFieldInt_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldLong(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldLong)(env, JRI_GetStaticFieldLong_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldFloat(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldFloat)(env, JRI_GetStaticFieldFloat_op, clazz, fieldID))
+
+#define JRI_GetStaticFieldDouble(env, clazz, fieldID) \
+ (((*(env))->GetStaticFieldDouble)(env, JRI_GetStaticFieldDouble_op, clazz, fieldID))
+
+#define JRI_SetStaticField(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticField)(env, JRI_SetStaticField_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldBoolean(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldBoolean)(env, JRI_SetStaticFieldBoolean_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldByte(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldByte)(env, JRI_SetStaticFieldByte_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldChar(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldChar)(env, JRI_SetStaticFieldChar_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldShort(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldShort)(env, JRI_SetStaticFieldShort_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldInt(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldInt)(env, JRI_SetStaticFieldInt_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldLong(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldLong)(env, JRI_SetStaticFieldLong_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldFloat(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldFloat)(env, JRI_SetStaticFieldFloat_op, clazz, fieldID, value))
+
+#define JRI_SetStaticFieldDouble(env, clazz, fieldID, value) \
+ (((*(env))->SetStaticFieldDouble)(env, JRI_SetStaticFieldDouble_op, clazz, fieldID, value))
+
+#define JRI_NewString(env, unicode, len) \
+ (((*(env))->NewString)(env, JRI_NewString_op, unicode, len))
+
+#define JRI_GetStringLength(env, string) \
+ (((*(env))->GetStringLength)(env, JRI_GetStringLength_op, string))
+
+#define JRI_GetStringChars(env, string) \
+ (((*(env))->GetStringChars)(env, JRI_GetStringChars_op, string))
+
+#define JRI_NewStringUTF(env, utf, len) \
+ (((*(env))->NewStringUTF)(env, JRI_NewStringUTF_op, utf, len))
+
+#define JRI_GetStringUTFLength(env, string) \
+ (((*(env))->GetStringUTFLength)(env, JRI_GetStringUTFLength_op, string))
+
+#define JRI_GetStringUTFChars(env, string) \
+ (((*(env))->GetStringUTFChars)(env, JRI_GetStringUTFChars_op, string))
+
+#define JRI_NewScalarArray(env, length, elementSig, initialElements) \
+ (((*(env))->NewScalarArray)(env, JRI_NewScalarArray_op, length, elementSig, initialElements))
+
+#define JRI_GetScalarArrayLength(env, array) \
+ (((*(env))->GetScalarArrayLength)(env, JRI_GetScalarArrayLength_op, array))
+
+#define JRI_GetScalarArrayElements(env, array) \
+ (((*(env))->GetScalarArrayElements)(env, JRI_GetScalarArrayElements_op, array))
+
+#define JRI_NewObjectArray(env, length, elementClass, initialElement) \
+ (((*(env))->NewObjectArray)(env, JRI_NewObjectArray_op, length, elementClass, initialElement))
+
+#define JRI_GetObjectArrayLength(env, array) \
+ (((*(env))->GetObjectArrayLength)(env, JRI_GetObjectArrayLength_op, array))
+
+#define JRI_GetObjectArrayElement(env, array, index) \
+ (((*(env))->GetObjectArrayElement)(env, JRI_GetObjectArrayElement_op, array, index))
+
+#define JRI_SetObjectArrayElement(env, array, index, value) \
+ (((*(env))->SetObjectArrayElement)(env, JRI_SetObjectArrayElement_op, array, index, value))
+
+#define JRI_RegisterNatives(env, clazz, nameAndSigArray, nativeProcArray) \
+ (((*(env))->RegisterNatives)(env, JRI_RegisterNatives_op, clazz, nameAndSigArray, nativeProcArray))
+
+#define JRI_UnregisterNatives(env, clazz) \
+ (((*(env))->UnregisterNatives)(env, JRI_UnregisterNatives_op, clazz))
+
+/*******************************************************************************
+ * JRIEnv Interface
+ ******************************************************************************/
+
+struct java_lang_Class;
+struct java_lang_Throwable;
+struct java_lang_Object;
+struct java_lang_String;
+
+struct JRIEnvInterface {
+ void* reserved0;
+ void* reserved1;
+ void* reserved2;
+ struct java_lang_Class* (*LoadClass)(JRIEnv* env, jint op, jbyte* a, jsize aLen);
+ struct java_lang_Class* (*FindClass)(JRIEnv* env, jint op, const char* a);
+ void (*Throw)(JRIEnv* env, jint op, struct java_lang_Throwable* a);
+ void (*ThrowNew)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b);
+ struct java_lang_Throwable* (*ExceptionOccurred)(JRIEnv* env, jint op);
+ void (*ExceptionDescribe)(JRIEnv* env, jint op);
+ void (*ExceptionClear)(JRIEnv* env, jint op);
+ jglobal (*NewGlobalRef)(JRIEnv* env, jint op, void* a);
+ void (*DisposeGlobalRef)(JRIEnv* env, jint op, jglobal a);
+ void* (*GetGlobalRef)(JRIEnv* env, jint op, jglobal a);
+ void (*SetGlobalRef)(JRIEnv* env, jint op, jglobal a, void* b);
+ jbool (*IsSameObject)(JRIEnv* env, jint op, void* a, void* b);
+ void* (*NewObject)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ void* (*NewObjectV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ void* (*NewObjectA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ struct java_lang_Class* (*GetObjectClass)(JRIEnv* env, jint op, void* a);
+ jbool (*IsInstanceOf)(JRIEnv* env, jint op, void* a, struct java_lang_Class* b);
+ jint (*GetMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
+ void* (*CallMethod)(JRIEnv* env, jint op, void* a, jint b, ...);
+ void* (*CallMethodV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ void* (*CallMethodA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jbool (*CallMethodBoolean)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jbool (*CallMethodBooleanV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jbool (*CallMethodBooleanA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jbyte (*CallMethodByte)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jbyte (*CallMethodByteV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jbyte (*CallMethodByteA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jchar (*CallMethodChar)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jchar (*CallMethodCharV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jchar (*CallMethodCharA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jshort (*CallMethodShort)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jshort (*CallMethodShortV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jshort (*CallMethodShortA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jint (*CallMethodInt)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jint (*CallMethodIntV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jint (*CallMethodIntA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jlong (*CallMethodLong)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jlong (*CallMethodLongV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jlong (*CallMethodLongA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jfloat (*CallMethodFloat)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jfloat (*CallMethodFloatV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jfloat (*CallMethodFloatA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jdouble (*CallMethodDouble)(JRIEnv* env, jint op, void* a, jint b, ...);
+ jdouble (*CallMethodDoubleV)(JRIEnv* env, jint op, void* a, jint b, va_list c);
+ jdouble (*CallMethodDoubleA)(JRIEnv* env, jint op, void* a, jint b, JRIValue* c);
+ jint (*GetFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
+ void* (*GetField)(JRIEnv* env, jint op, void* a, jint b);
+ jbool (*GetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b);
+ jbyte (*GetFieldByte)(JRIEnv* env, jint op, void* a, jint b);
+ jchar (*GetFieldChar)(JRIEnv* env, jint op, void* a, jint b);
+ jshort (*GetFieldShort)(JRIEnv* env, jint op, void* a, jint b);
+ jint (*GetFieldInt)(JRIEnv* env, jint op, void* a, jint b);
+ jlong (*GetFieldLong)(JRIEnv* env, jint op, void* a, jint b);
+ jfloat (*GetFieldFloat)(JRIEnv* env, jint op, void* a, jint b);
+ jdouble (*GetFieldDouble)(JRIEnv* env, jint op, void* a, jint b);
+ void (*SetField)(JRIEnv* env, jint op, void* a, jint b, void* c);
+ void (*SetFieldBoolean)(JRIEnv* env, jint op, void* a, jint b, jbool c);
+ void (*SetFieldByte)(JRIEnv* env, jint op, void* a, jint b, jbyte c);
+ void (*SetFieldChar)(JRIEnv* env, jint op, void* a, jint b, jchar c);
+ void (*SetFieldShort)(JRIEnv* env, jint op, void* a, jint b, jshort c);
+ void (*SetFieldInt)(JRIEnv* env, jint op, void* a, jint b, jint c);
+ void (*SetFieldLong)(JRIEnv* env, jint op, void* a, jint b, jlong c);
+ void (*SetFieldFloat)(JRIEnv* env, jint op, void* a, jint b, jfloat c);
+ void (*SetFieldDouble)(JRIEnv* env, jint op, void* a, jint b, jdouble c);
+ jbool (*IsSubclassOf)(JRIEnv* env, jint op, struct java_lang_Class* a, struct java_lang_Class* b);
+ jint (*GetStaticMethodID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
+ void* (*CallStaticMethod)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ void* (*CallStaticMethodV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ void* (*CallStaticMethodA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jbool (*CallStaticMethodBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jbool (*CallStaticMethodBooleanV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jbool (*CallStaticMethodBooleanA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jbyte (*CallStaticMethodByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jbyte (*CallStaticMethodByteV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jbyte (*CallStaticMethodByteA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jchar (*CallStaticMethodChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jchar (*CallStaticMethodCharV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jchar (*CallStaticMethodCharA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jshort (*CallStaticMethodShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jshort (*CallStaticMethodShortV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jshort (*CallStaticMethodShortA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jint (*CallStaticMethodInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jint (*CallStaticMethodIntV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jint (*CallStaticMethodIntA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jlong (*CallStaticMethodLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jlong (*CallStaticMethodLongV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jlong (*CallStaticMethodLongA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jfloat (*CallStaticMethodFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jfloat (*CallStaticMethodFloatV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jfloat (*CallStaticMethodFloatA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jdouble (*CallStaticMethodDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, ...);
+ jdouble (*CallStaticMethodDoubleV)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, va_list c);
+ jdouble (*CallStaticMethodDoubleA)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, JRIValue* c);
+ jint (*GetStaticFieldID)(JRIEnv* env, jint op, struct java_lang_Class* a, const char* b, const char* c);
+ void* (*GetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jbool (*GetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jbyte (*GetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jchar (*GetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jshort (*GetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jint (*GetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jlong (*GetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jfloat (*GetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ jdouble (*GetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b);
+ void (*SetStaticField)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, void* c);
+ void (*SetStaticFieldBoolean)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbool c);
+ void (*SetStaticFieldByte)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jbyte c);
+ void (*SetStaticFieldChar)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jchar c);
+ void (*SetStaticFieldShort)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jshort c);
+ void (*SetStaticFieldInt)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jint c);
+ void (*SetStaticFieldLong)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jlong c);
+ void (*SetStaticFieldFloat)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jfloat c);
+ void (*SetStaticFieldDouble)(JRIEnv* env, jint op, struct java_lang_Class* a, jint b, jdouble c);
+ struct java_lang_String* (*NewString)(JRIEnv* env, jint op, const jchar* a, jint b);
+ jint (*GetStringLength)(JRIEnv* env, jint op, struct java_lang_String* a);
+ const jchar* (*GetStringChars)(JRIEnv* env, jint op, struct java_lang_String* a);
+ struct java_lang_String* (*NewStringUTF)(JRIEnv* env, jint op, const jbyte* a, jint b);
+ jint (*GetStringUTFLength)(JRIEnv* env, jint op, struct java_lang_String* a);
+ const jbyte* (*GetStringUTFChars)(JRIEnv* env, jint op, struct java_lang_String* a);
+ void* (*NewScalarArray)(JRIEnv* env, jint op, jint a, const char* b, const jbyte* c);
+ jint (*GetScalarArrayLength)(JRIEnv* env, jint op, void* a);
+ jbyte* (*GetScalarArrayElements)(JRIEnv* env, jint op, void* a);
+ void* (*NewObjectArray)(JRIEnv* env, jint op, jint a, struct java_lang_Class* b, void* c);
+ jint (*GetObjectArrayLength)(JRIEnv* env, jint op, void* a);
+ void* (*GetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b);
+ void (*SetObjectArrayElement)(JRIEnv* env, jint op, void* a, jint b, void* c);
+ void (*RegisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a, char** b, void** c);
+ void (*UnregisterNatives)(JRIEnv* env, jint op, struct java_lang_Class* a);
+};
+
+/*******************************************************************************
+ * JRIEnv Operation IDs
+ ******************************************************************************/
+
+typedef enum JRIEnvOperations {
+ JRI_Reserved0_op,
+ JRI_Reserved1_op,
+ JRI_Reserved2_op,
+ JRI_LoadClass_op,
+ JRI_FindClass_op,
+ JRI_Throw_op,
+ JRI_ThrowNew_op,
+ JRI_ExceptionOccurred_op,
+ JRI_ExceptionDescribe_op,
+ JRI_ExceptionClear_op,
+ JRI_NewGlobalRef_op,
+ JRI_DisposeGlobalRef_op,
+ JRI_GetGlobalRef_op,
+ JRI_SetGlobalRef_op,
+ JRI_IsSameObject_op,
+ JRI_NewObject_op,
+ JRI_NewObject_op_va_list,
+ JRI_NewObject_op_array,
+ JRI_GetObjectClass_op,
+ JRI_IsInstanceOf_op,
+ JRI_GetMethodID_op,
+ JRI_CallMethod_op,
+ JRI_CallMethod_op_va_list,
+ JRI_CallMethod_op_array,
+ JRI_CallMethodBoolean_op,
+ JRI_CallMethodBoolean_op_va_list,
+ JRI_CallMethodBoolean_op_array,
+ JRI_CallMethodByte_op,
+ JRI_CallMethodByte_op_va_list,
+ JRI_CallMethodByte_op_array,
+ JRI_CallMethodChar_op,
+ JRI_CallMethodChar_op_va_list,
+ JRI_CallMethodChar_op_array,
+ JRI_CallMethodShort_op,
+ JRI_CallMethodShort_op_va_list,
+ JRI_CallMethodShort_op_array,
+ JRI_CallMethodInt_op,
+ JRI_CallMethodInt_op_va_list,
+ JRI_CallMethodInt_op_array,
+ JRI_CallMethodLong_op,
+ JRI_CallMethodLong_op_va_list,
+ JRI_CallMethodLong_op_array,
+ JRI_CallMethodFloat_op,
+ JRI_CallMethodFloat_op_va_list,
+ JRI_CallMethodFloat_op_array,
+ JRI_CallMethodDouble_op,
+ JRI_CallMethodDouble_op_va_list,
+ JRI_CallMethodDouble_op_array,
+ JRI_GetFieldID_op,
+ JRI_GetField_op,
+ JRI_GetFieldBoolean_op,
+ JRI_GetFieldByte_op,
+ JRI_GetFieldChar_op,
+ JRI_GetFieldShort_op,
+ JRI_GetFieldInt_op,
+ JRI_GetFieldLong_op,
+ JRI_GetFieldFloat_op,
+ JRI_GetFieldDouble_op,
+ JRI_SetField_op,
+ JRI_SetFieldBoolean_op,
+ JRI_SetFieldByte_op,
+ JRI_SetFieldChar_op,
+ JRI_SetFieldShort_op,
+ JRI_SetFieldInt_op,
+ JRI_SetFieldLong_op,
+ JRI_SetFieldFloat_op,
+ JRI_SetFieldDouble_op,
+ JRI_IsSubclassOf_op,
+ JRI_GetStaticMethodID_op,
+ JRI_CallStaticMethod_op,
+ JRI_CallStaticMethod_op_va_list,
+ JRI_CallStaticMethod_op_array,
+ JRI_CallStaticMethodBoolean_op,
+ JRI_CallStaticMethodBoolean_op_va_list,
+ JRI_CallStaticMethodBoolean_op_array,
+ JRI_CallStaticMethodByte_op,
+ JRI_CallStaticMethodByte_op_va_list,
+ JRI_CallStaticMethodByte_op_array,
+ JRI_CallStaticMethodChar_op,
+ JRI_CallStaticMethodChar_op_va_list,
+ JRI_CallStaticMethodChar_op_array,
+ JRI_CallStaticMethodShort_op,
+ JRI_CallStaticMethodShort_op_va_list,
+ JRI_CallStaticMethodShort_op_array,
+ JRI_CallStaticMethodInt_op,
+ JRI_CallStaticMethodInt_op_va_list,
+ JRI_CallStaticMethodInt_op_array,
+ JRI_CallStaticMethodLong_op,
+ JRI_CallStaticMethodLong_op_va_list,
+ JRI_CallStaticMethodLong_op_array,
+ JRI_CallStaticMethodFloat_op,
+ JRI_CallStaticMethodFloat_op_va_list,
+ JRI_CallStaticMethodFloat_op_array,
+ JRI_CallStaticMethodDouble_op,
+ JRI_CallStaticMethodDouble_op_va_list,
+ JRI_CallStaticMethodDouble_op_array,
+ JRI_GetStaticFieldID_op,
+ JRI_GetStaticField_op,
+ JRI_GetStaticFieldBoolean_op,
+ JRI_GetStaticFieldByte_op,
+ JRI_GetStaticFieldChar_op,
+ JRI_GetStaticFieldShort_op,
+ JRI_GetStaticFieldInt_op,
+ JRI_GetStaticFieldLong_op,
+ JRI_GetStaticFieldFloat_op,
+ JRI_GetStaticFieldDouble_op,
+ JRI_SetStaticField_op,
+ JRI_SetStaticFieldBoolean_op,
+ JRI_SetStaticFieldByte_op,
+ JRI_SetStaticFieldChar_op,
+ JRI_SetStaticFieldShort_op,
+ JRI_SetStaticFieldInt_op,
+ JRI_SetStaticFieldLong_op,
+ JRI_SetStaticFieldFloat_op,
+ JRI_SetStaticFieldDouble_op,
+ JRI_NewString_op,
+ JRI_GetStringLength_op,
+ JRI_GetStringChars_op,
+ JRI_NewStringUTF_op,
+ JRI_GetStringUTFLength_op,
+ JRI_GetStringUTFChars_op,
+ JRI_NewScalarArray_op,
+ JRI_GetScalarArrayLength_op,
+ JRI_GetScalarArrayElements_op,
+ JRI_NewObjectArray_op,
+ JRI_GetObjectArrayLength_op,
+ JRI_GetObjectArrayElement_op,
+ JRI_SetObjectArrayElement_op,
+ JRI_RegisterNatives_op,
+ JRI_UnregisterNatives_op
+} JRIEnvOperations;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
+
+#endif /* JRI_H */
+/******************************************************************************/
diff --git a/plugin/include/jri_md.h b/plugin/include/jri_md.h
new file mode 100644
index 0000000..1ba1c64
--- /dev/null
+++ b/plugin/include/jri_md.h
@@ -0,0 +1,501 @@
+/* $Xorg: jri_md.h,v 1.3 2000/08/17 19:55:01 cpqbld Exp $ */
+/* -*- Mode: C; tab-width: 4; -*- */
+/*******************************************************************************
+ * Java Runtime Interface - Machine Dependent Types
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ ******************************************************************************/
+
+#ifndef JRI_MD_H
+#define JRI_MD_H
+
+#include <assert.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*******************************************************************************
+ * WHAT'S UP WITH THIS FILE?
+ *
+ * This is where we define the mystical JRI_PUBLIC_API macro that works on all
+ * platforms. If you're running with Visual C++, Symantec C, or Borland's
+ * development environment on the PC, you're all set. Or if you're on the Mac
+ * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
+ * matter.
+ *
+ * On UNIX though you probably care about a couple of other symbols though:
+ * IS_LITTLE_ENDIAN must be defined for little-endian systems
+ * HAVE_LONG_LONG must be defined on systems that have 'long long' integers
+ * HAVE_ALIGNED_LONGLONGS must be defined if long-longs must be 8 byte aligned
+ * HAVE_ALIGNED_DOUBLES must be defined if doubles must be 8 byte aligned
+ * IS_64 must be defined on 64-bit machines (like Dec Alpha)
+ ******************************************************************************/
+
+/* DLL Entry modifiers... */
+
+/* PC */
+#if defined(XP_PC) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
+# include <windows.h>
+# if defined(_MSC_VER)
+# if defined(WIN32) || defined(_WIN32)
+# define JRI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType
+# define JRI_CALLBACK
+# else /* !_WIN32 */
+# if defined(_WINDLL)
+# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
+# define JRI_CALLBACK __loadds
+# else /* !WINDLL */
+# define JRI_PUBLIC_API(ResultType) ResultType __cdecl __export
+# define JRI_CALLBACK __export
+# endif /* !WINDLL */
+# endif /* !_WIN32 */
+# elif defined(__BORLANDC__)
+# if defined(WIN32) || defined(_WIN32)
+# define JRI_PUBLIC_API(ResultType) __export ResultType
+# define JRI_CALLBACK
+# else /* !_WIN32 */
+# define JRI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
+# define JRI_CALLBACK _loadds
+# endif
+# else
+# error Unsupported PC development environment.
+# endif
+# ifndef IS_LITTLE_ENDIAN
+# define IS_LITTLE_ENDIAN
+# endif
+
+/* Mac */
+#elif macintosh || Macintosh || THINK_C
+# if defined(__MWERKS__) /* Metrowerks */
+# if !__option(enumsalwaysint)
+# error You need to define 'Enums Always Int' for your project.
+# endif
+# if defined(GENERATING68K) && !GENERATINGCFM
+# if !__option(fourbyteints)
+# error You need to define 'Struct Alignment: 68k' for your project.
+# endif
+# endif /* !GENERATINGCFM */
+# elif defined(__SC__) /* Symantec */
+# error What are the Symantec defines? (warren@netscape.com)
+# elif macintosh && applec /* MPW */
+# error Please upgrade to the latest MPW compiler (SC).
+# else
+# error Unsupported Mac development environment.
+# endif
+# define JRI_PUBLIC_API(ResultType) ResultType
+# define JRI_CALLBACK
+
+/* Unix or else */
+#else
+# define JRI_PUBLIC_API(ResultType) ResultType
+# define JRI_CALLBACK
+#endif
+
+#ifndef FAR /* for non-Win16 */
+#define FAR
+#endif
+
+/******************************************************************************/
+
+/* Java Scalar Types */
+
+typedef unsigned char jbool;
+typedef char jbyte;
+typedef short jchar;
+typedef short jshort;
+#ifdef IS_64 /* XXX ok for alpha, but not right on all 64-bit architectures */
+typedef unsigned int juint;
+typedef int jint;
+#else
+typedef unsigned long juint;
+typedef long jint;
+#endif
+typedef float jfloat;
+typedef double jdouble;
+
+typedef juint jsize;
+
+/*******************************************************************************
+ * jlong : long long (64-bit signed integer type) support.
+ ******************************************************************************/
+
+/*
+** Bit masking macros. (n must be <= 31 to be portable)
+*/
+#define JRI_BIT(n) ((juint)1 << (n))
+#define JRI_BITMASK(n) (JRI_BIT(n) - 1)
+
+#ifdef HAVE_LONG_LONG
+
+#if !(defined(WIN32) || defined(_WIN32))
+typedef long long jlong;
+typedef unsigned long long julong;
+
+#define jlong_MAXINT 0x7fffffffffffffffLL
+#define jlong_MININT 0x8000000000000000LL
+#define jlong_ZERO 0x0LL
+
+#else
+typedef LONGLONG jlong;
+typedef DWORDLONG julong;
+
+#define jlong_MAXINT 0x7fffffffffffffffi64
+#define jlong_MININT 0x8000000000000000i64
+#define jlong_ZERO 0x0i64
+
+#endif
+
+#define jlong_IS_ZERO(a) ((a) == 0)
+#define jlong_EQ(a, b) ((a) == (b))
+#define jlong_NE(a, b) ((a) != (b))
+#define jlong_GE_ZERO(a) ((a) >= 0)
+#define jlong_CMP(a, op, b) ((a) op (b))
+
+#define jlong_AND(r, a, b) ((r) = (a) & (b))
+#define jlong_OR(r, a, b) ((r) = (a) | (b))
+#define jlong_XOR(r, a, b) ((r) = (a) ^ (b))
+#define jlong_OR2(r, a) ((r) = (r) | (a))
+#define jlong_NOT(r, a) ((r) = ~(a))
+
+#define jlong_NEG(r, a) ((r) = -(a))
+#define jlong_ADD(r, a, b) ((r) = (a) + (b))
+#define jlong_SUB(r, a, b) ((r) = (a) - (b))
+
+#define jlong_MUL(r, a, b) ((r) = (a) * (b))
+#define jlong_DIV(r, a, b) ((r) = (a) / (b))
+#define jlong_MOD(r, a, b) ((r) = (a) % (b))
+
+#define jlong_SHL(r, a, b) ((r) = (a) << (b))
+#define jlong_SHR(r, a, b) ((r) = (a) >> (b))
+#define jlong_USHR(r, a, b) ((r) = (julong)(a) >> (b))
+#define jlong_ISHL(r, a, b) ((r) = ((jlong)(a)) << (b))
+
+#define jlong_L2I(i, l) ((i) = (int)(l))
+#define jlong_L2UI(ui, l) ((ui) =(unsigned int)(l))
+#define jlong_L2F(f, l) ((f) = (l))
+#define jlong_L2D(d, l) ((d) = (l))
+
+#define jlong_I2L(l, i) ((l) = (i))
+#define jlong_UI2L(l, ui) ((l) = (ui))
+#define jlong_F2L(l, f) ((l) = (f))
+#define jlong_D2L(l, d) ((l) = (d))
+
+#define jlong_UDIVMOD(qp, rp, a, b) \
+ (*(qp) = ((julong)(a) / (b)), \
+ *(rp) = ((julong)(a) % (b)))
+
+#else /* !HAVE_LONG_LONG */
+
+typedef struct {
+#ifdef IS_LITTLE_ENDIAN
+ juint lo, hi;
+#else
+ juint hi, lo;
+#endif
+} jlong;
+typedef jlong julong;
+
+extern jlong jlong_MAXINT, jlong_MININT, jlong_ZERO;
+
+#define jlong_IS_ZERO(a) (((a).hi == 0) && ((a).lo == 0))
+#define jlong_EQ(a, b) (((a).hi == (b).hi) && ((a).lo == (b).lo))
+#define jlong_NE(a, b) (((a).hi != (b).hi) || ((a).lo != (b).lo))
+#define jlong_GE_ZERO(a) (((a).hi >> 31) == 0)
+
+/*
+ * NB: jlong_CMP and jlong_UCMP work only for strict relationals (<, >).
+ */
+#define jlong_CMP(a, op, b) (((int32)(a).hi op (int32)(b).hi) || \
+ (((a).hi == (b).hi) && ((a).lo op (b).lo)))
+#define jlong_UCMP(a, op, b) (((a).hi op (b).hi) || \
+ (((a).hi == (b).hi) && ((a).lo op (b).lo)))
+
+#define jlong_AND(r, a, b) ((r).lo = (a).lo & (b).lo, \
+ (r).hi = (a).hi & (b).hi)
+#define jlong_OR(r, a, b) ((r).lo = (a).lo | (b).lo, \
+ (r).hi = (a).hi | (b).hi)
+#define jlong_XOR(r, a, b) ((r).lo = (a).lo ^ (b).lo, \
+ (r).hi = (a).hi ^ (b).hi)
+#define jlong_OR2(r, a) ((r).lo = (r).lo | (a).lo, \
+ (r).hi = (r).hi | (a).hi)
+#define jlong_NOT(r, a) ((r).lo = ~(a).lo, \
+ (r).hi = ~(a).hi)
+
+#define jlong_NEG(r, a) ((r).lo = -(int32)(a).lo, \
+ (r).hi = -(int32)(a).hi - ((r).lo != 0))
+#define jlong_ADD(r, a, b) { \
+ jlong _a, _b; \
+ _a = a; _b = b; \
+ (r).lo = _a.lo + _b.lo; \
+ (r).hi = _a.hi + _b.hi + ((r).lo < _b.lo); \
+}
+
+#define jlong_SUB(r, a, b) { \
+ jlong _a, _b; \
+ _a = a; _b = b; \
+ (r).lo = _a.lo - _b.lo; \
+ (r).hi = _a.hi - _b.hi - (_a.lo < _b.lo); \
+} \
+
+/*
+ * Multiply 64-bit operands a and b to get 64-bit result r.
+ * First multiply the low 32 bits of a and b to get a 64-bit result in r.
+ * Then add the outer and inner products to r.hi.
+ */
+#define jlong_MUL(r, a, b) { \
+ jlong _a, _b; \
+ _a = a; _b = b; \
+ jlong_MUL32(r, _a.lo, _b.lo); \
+ (r).hi += _a.hi * _b.lo + _a.lo * _b.hi; \
+}
+
+/* XXX _jlong_lo16(a) = ((a) << 16 >> 16) is better on some archs (not on mips) */
+#define _jlong_lo16(a) ((a) & JRI_BITMASK(16))
+#define _jlong_hi16(a) ((a) >> 16)
+
+/*
+ * Multiply 32-bit operands a and b to get 64-bit result r.
+ * Use polynomial expansion based on primitive field element (1 << 16).
+ */
+#define jlong_MUL32(r, a, b) { \
+ juint _a1, _a0, _b1, _b0, _y0, _y1, _y2, _y3; \
+ _a1 = _jlong_hi16(a), _a0 = _jlong_lo16(a); \
+ _b1 = _jlong_hi16(b), _b0 = _jlong_lo16(b); \
+ _y0 = _a0 * _b0; \
+ _y1 = _a0 * _b1; \
+ _y2 = _a1 * _b0; \
+ _y3 = _a1 * _b1; \
+ _y1 += _jlong_hi16(_y0); /* can't carry */ \
+ _y1 += _y2; /* might carry */ \
+ if (_y1 < _y2) _y3 += 1 << 16; /* propagate */ \
+ (r).lo = (_jlong_lo16(_y1) << 16) + _jlong_lo16(_y0); \
+ (r).hi = _y3 + _jlong_hi16(_y1); \
+}
+
+/*
+ * Divide 64-bit unsigned operand a by 64-bit unsigned operand b, setting *qp
+ * to the 64-bit unsigned quotient, and *rp to the 64-bit unsigned remainder.
+ * Minimize effort if one of qp and rp is null.
+ */
+#define jlong_UDIVMOD(qp, rp, a, b) jlong_udivmod(qp, rp, a, b)
+
+extern JRI_PUBLIC_API(void)
+jlong_udivmod(julong *qp, julong *rp, julong a, julong b);
+
+#define jlong_DIV(r, a, b) { \
+ jlong _a, _b; \
+ juint _negative = (int32)(a).hi < 0; \
+ if (_negative) { \
+ jlong_NEG(_a, a); \
+ } else { \
+ _a = a; \
+ } \
+ if ((int32)(b).hi < 0) { \
+ _negative ^= 1; \
+ jlong_NEG(_b, b); \
+ } else { \
+ _b = b; \
+ } \
+ jlong_UDIVMOD(&(r), 0, _a, _b); \
+ if (_negative) \
+ jlong_NEG(r, r); \
+}
+
+#define jlong_MOD(r, a, b) { \
+ jlong _a, _b; \
+ juint _negative = (int32)(a).hi < 0; \
+ if (_negative) { \
+ jlong_NEG(_a, a); \
+ } else { \
+ _a = a; \
+ } \
+ if ((int32)(b).hi < 0) { \
+ jlong_NEG(_b, b); \
+ } else { \
+ _b = b; \
+ } \
+ jlong_UDIVMOD(0, &(r), _a, _b); \
+ if (_negative) \
+ jlong_NEG(r, r); \
+}
+
+/*
+ * NB: b is a juint, not jlong or julong, for the shift ops.
+ */
+#define jlong_SHL(r, a, b) { \
+ if (b) { \
+ jlong _a; \
+ _a = a; \
+ if ((b) < 32) { \
+ (r).lo = _a.lo << (b); \
+ (r).hi = (_a.hi << (b)) | (_a.lo >> (32 - (b))); \
+ } else { \
+ (r).lo = 0; \
+ (r).hi = _a.lo << ((b) & 31); \
+ } \
+ } else { \
+ (r) = (a); \
+ } \
+}
+
+/* a is an int32, b is int32, r is jlong */
+#define jlong_ISHL(r, a, b) { \
+ if (b) { \
+ jlong _a; \
+ _a.lo = (a); \
+ _a.hi = 0; \
+ if ((b) < 32) { \
+ (r).lo = (a) << (b); \
+ (r).hi = ((a) >> (32 - (b))); \
+ } else { \
+ (r).lo = 0; \
+ (r).hi = (a) << ((b) & 31); \
+ } \
+ } else { \
+ (r).lo = (a); \
+ (r).hi = 0; \
+ } \
+}
+
+#define jlong_SHR(r, a, b) { \
+ if (b) { \
+ jlong _a; \
+ _a = a; \
+ if ((b) < 32) { \
+ (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \
+ (r).hi = (int32)_a.hi >> (b); \
+ } else { \
+ (r).lo = (int32)_a.hi >> ((b) & 31); \
+ (r).hi = (int32)_a.hi >> 31; \
+ } \
+ } else { \
+ (r) = (a); \
+ } \
+}
+
+#define jlong_USHR(r, a, b) { \
+ if (b) { \
+ jlong _a; \
+ _a = a; \
+ if ((b) < 32) { \
+ (r).lo = (_a.hi << (32 - (b))) | (_a.lo >> (b)); \
+ (r).hi = _a.hi >> (b); \
+ } else { \
+ (r).lo = _a.hi >> ((b) & 31); \
+ (r).hi = 0; \
+ } \
+ } else { \
+ (r) = (a); \
+ } \
+}
+
+#define jlong_L2I(i, l) ((i) = (l).lo)
+#define jlong_L2UI(ui, l) ((ui) = (l).lo)
+#define jlong_L2F(f, l) { double _d; jlong_L2D(_d, l); (f) = (float) _d; }
+
+#define jlong_L2D(d, l) { \
+ int32 _negative; \
+ jlong _absval; \
+ \
+ _negative = (l).hi >> 31; \
+ if (_negative) { \
+ jlong_NEG(_absval, l); \
+ } else { \
+ _absval = l; \
+ } \
+ (d) = (double)_absval.hi * 4.294967296e9 + _absval.lo; \
+ if (_negative) \
+ (d) = -(d); \
+}
+
+#define jlong_I2L(l, i) ((l).hi = (i) >> 31, (l).lo = (i))
+#define jlong_UI2L(l, ui) ((l).hi = 0, (l).lo = (ui))
+#define jlong_F2L(l, f) { double _d = (double) f; jlong_D2L(l, _d); }
+
+#define jlong_D2L(l, d) { \
+ int _negative; \
+ double _absval, _d_hi; \
+ jlong _lo_d; \
+ \
+ _negative = ((d) < 0); \
+ _absval = _negative ? -(d) : (d); \
+ \
+ (l).hi = (juint)(_absval / 4.294967296e9); \
+ (l).lo = 0; \
+ jlong_L2D(_d_hi, l); \
+ _absval -= _d_hi; \
+ _lo_d.hi = 0; \
+ if (_absval < 0) { \
+ _lo_d.lo = (juint) -_absval; \
+ jlong_SUB(l, l, _lo_d); \
+ } else { \
+ _lo_d.lo = (juint) _absval; \
+ jlong_ADD(l, l, _lo_d); \
+ } \
+ \
+ if (_negative) \
+ jlong_NEG(l, l); \
+}
+
+#endif /* !HAVE_LONG_LONG */
+
+/******************************************************************************/
+/*
+** JDK Stuff -- This stuff is still needed while we're using the JDK
+** dynamic linking strategy to call native methods.
+*/
+
+typedef union JRI_JDK_stack_item {
+ /* Non pointer items */
+ jint i;
+ jfloat f;
+ jint o;
+ /* Pointer items */
+ void *h;
+ void *p;
+ unsigned char *addr;
+#ifdef IS_64
+ double d;
+ long l; /* == 64bits! */
+#endif
+} JRI_JDK_stack_item;
+
+typedef union JRI_JDK_Java8Str {
+ jint x[2];
+ jdouble d;
+ jlong l;
+ void *p;
+ float f;
+} JRI_JDK_Java8;
+
+#ifdef HAVE_ALIGNED_LONGLONGS
+#define JRI_GET_INT64(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
+ ((_t).x[1] = ((jint*)(_addr))[1]), \
+ (_t).l )
+#define JRI_SET_INT64(_t, _addr, _v) ( (_t).l = (_v), \
+ ((jint*)(_addr))[0] = (_t).x[0], \
+ ((jint*)(_addr))[1] = (_t).x[1] )
+#else
+#define JRI_GET_INT64(_t,_addr) (*(jlong*)(_addr))
+#define JRI_SET_INT64(_t, _addr, _v) (*(jlong*)(_addr) = (_v))
+#endif
+
+/* If double's must be aligned on doubleword boundaries then define this */
+#ifdef HAVE_ALIGNED_DOUBLES
+#define JRI_GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((jint*)(_addr))[0]), \
+ ((_t).x[1] = ((jint*)(_addr))[1]), \
+ (_t).d )
+#define JRI_SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v), \
+ ((jint*)(_addr))[0] = (_t).x[0], \
+ ((jint*)(_addr))[1] = (_t).x[1] )
+#else
+#define JRI_GET_DOUBLE(_t,_addr) (*(jdouble*)(_addr))
+#define JRI_SET_DOUBLE(_t, _addr, _v) (*(jdouble*)(_addr) = (_v))
+#endif
+
+/******************************************************************************/
+#ifdef __cplusplus
+}
+#endif
+#endif /* JRI_MD_H */
+/******************************************************************************/
diff --git a/plugin/include/jritypes.h b/plugin/include/jritypes.h
new file mode 100644
index 0000000..3b84641
--- /dev/null
+++ b/plugin/include/jritypes.h
@@ -0,0 +1,181 @@
+/* $Xorg: jritypes.h,v 1.3 2000/08/17 19:55:01 cpqbld Exp $ */
+/* -*- Mode: C; tab-width: 4; -*- */
+/*******************************************************************************
+ * Java Runtime Interface
+ * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved.
+ ******************************************************************************/
+
+#ifndef JRITYPES_H
+#define JRITYPES_H
+
+#include "jri_md.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*******************************************************************************
+ * Types
+ ******************************************************************************/
+
+struct JRIEnvInterface;
+
+typedef void* JRIRef;
+typedef void* JRIGlobalRef;
+
+typedef jint JRIInterfaceID[4];
+typedef jint JRIFieldID;
+typedef jint JRIMethodID;
+
+/* synonyms: */
+typedef JRIGlobalRef jglobal;
+typedef JRIRef jref;
+
+typedef union JRIValue {
+ jbool z;
+ jbyte b;
+ jchar c;
+ jshort s;
+ jint i;
+ jlong l;
+ jfloat f;
+ jdouble d;
+ jref r;
+} JRIValue;
+
+typedef JRIValue jvalue;
+
+typedef enum JRIBoolean {
+ JRIFalse = 0,
+ JRITrue = 1
+} JRIBoolean;
+
+typedef enum JRIConstant {
+ JRIUninitialized = -1
+} JRIConstant;
+
+/* convenience types: */
+typedef JRIRef jbooleanArray;
+typedef JRIRef jbyteArray;
+typedef JRIRef jcharArray;
+typedef JRIRef jshortArray;
+typedef JRIRef jintArray;
+typedef JRIRef jlongArray;
+typedef JRIRef jfloatArray;
+typedef JRIRef jdoubleArray;
+typedef JRIRef jobjectArray;
+typedef JRIRef jstringArray;
+typedef JRIRef jarrayArray;
+
+#define JRIConstructorMethodName "<init>"
+
+/*******************************************************************************
+ * Signature Construction Macros
+ ******************************************************************************/
+
+/*
+** These macros can be used to construct signature strings. Hopefully their names
+** are a little easier to remember than the single character they correspond to.
+** For example, to specify the signature of the method:
+**
+** public int read(byte b[], int off, int len);
+**
+** you could write something like this in C:
+**
+** char* readSig = JRISigMethod(JRISigArray(JRISigByte)
+** JRISigInt
+** JRISigInt) JRISigInt;
+**
+** Of course, don't put commas between the types.
+*/
+#define JRISigArray(T) "[" T
+#define JRISigByte "B"
+#define JRISigChar "C"
+#define JRISigClass(name) "L" name ";"
+#define JRISigFloat "F"
+#define JRISigDouble "D"
+#define JRISigMethod(args) "(" args ")"
+#define JRISigNoArgs ""
+#define JRISigInt "I"
+#define JRISigLong "J"
+#define JRISigShort "S"
+#define JRISigVoid "V"
+#define JRISigBoolean "Z"
+
+/*******************************************************************************
+ * Environments
+ ******************************************************************************/
+
+extern JRI_PUBLIC_API(const struct JRIEnvInterface**)
+JRI_GetCurrentEnv(void);
+
+/*******************************************************************************
+ * Specific Scalar Array Types
+ ******************************************************************************/
+
+/*
+** The JRI Native Method Interface does not support boolean arrays. This
+** is to allow Java runtime implementations to optimize boolean array
+** storage. Using the ScalarArray operations on boolean arrays is bound
+** to fail, so convert any boolean arrays to byte arrays in Java before
+** passing them to a native method.
+*/
+
+#define JRI_NewByteArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, length, JRISigByte, (jbyte*)(initialValues))
+#define JRI_GetByteArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetByteArrayElements(env, array) \
+ JRI_GetScalarArrayElements(env, array)
+
+#define JRI_NewCharArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, ((length) * sizeof(jchar)), JRISigChar, (jbyte*)(initialValues))
+#define JRI_GetCharArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetCharArrayElements(env, array) \
+ ((jchar*)JRI_GetScalarArrayElements(env, array))
+
+#define JRI_NewShortArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, ((length) * sizeof(jshort)), JRISigShort, (jbyte*)(initialValues))
+#define JRI_GetShortArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetShortArrayElements(env, array) \
+ ((jshort*)JRI_GetScalarArrayElements(env, array))
+
+#define JRI_NewIntArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, ((length) * sizeof(jint)), JRISigInt, (jbyte*)(initialValues))
+#define JRI_GetIntArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetIntArrayElements(env, array) \
+ ((jint*)JRI_GetScalarArrayElements(env, array))
+
+#define JRI_NewLongArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, ((length) * sizeof(jlong)), JRISigLong, (jbyte*)(initialValues))
+#define JRI_GetLongArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetLongArrayElements(env, array) \
+ ((jlong*)JRI_GetScalarArrayElements(env, array))
+
+#define JRI_NewFloatArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, ((length) * sizeof(jfloat)), JRISigFloat, (jbyte*)(initialValues))
+#define JRI_GetFloatArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetFloatArrayElements(env, array) \
+ ((jfloat*)JRI_GetScalarArrayElements(env, array))
+
+#define JRI_NewDoubleArray(env, length, initialValues) \
+ JRI_NewScalarArray(env, ((length) * sizeof(jdouble)), JRISigDouble, (jbyte*)(initialValues))
+#define JRI_GetDoubleArrayLength(env, array) \
+ JRI_GetScalarArrayLength(env, array)
+#define JRI_GetDoubleArrayElements(env, array) \
+ ((jdouble*)JRI_GetScalarArrayElements(env, array))
+
+/******************************************************************************/
+#ifdef __cplusplus
+}
+#endif
+#endif /* JRITYPES_H */
+/******************************************************************************/
diff --git a/plugin/include/npapi.h b/plugin/include/npapi.h
new file mode 100644
index 0000000..598faa1
--- /dev/null
+++ b/plugin/include/npapi.h
@@ -0,0 +1,393 @@
+/* $Xorg: npapi.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */
+/* -*- Mode: C; tab-width: 4; -*- */
+/*
+ * npapi.h Revision: 1.76
+ * Netscape client plug-in API spec
+ */
+
+#ifndef _NPAPI_H_
+#define _NPAPI_H_
+
+#include "jri.h" /* Java Runtime Interface */
+
+
+/* XXX this needs to get out of here */
+#if defined(__MWERKS__)
+#ifndef XP_MAC
+#define XP_MAC
+#endif
+#endif
+
+
+
+/*----------------------------------------------------------------------*/
+/* Plugin Version Constants */
+/*----------------------------------------------------------------------*/
+
+#define NP_VERSION_MAJOR 0
+#define NP_VERSION_MINOR 9
+
+
+
+/*----------------------------------------------------------------------*/
+/* Definition of Basic Types */
+/*----------------------------------------------------------------------*/
+
+#ifndef _UINT16
+typedef unsigned short uint16;
+#endif
+#ifndef _UINT32
+#if defined(__alpha)
+typedef unsigned int uint32;
+#else /* __alpha */
+typedef unsigned long uint32;
+#endif /* __alpha */
+#endif
+#ifndef _INT16
+typedef short int16;
+#endif
+#ifndef _INT32
+#if defined(__alpha)
+typedef int int32;
+#else /* __alpha */
+typedef long int32;
+#endif /* __alpha */
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+#ifndef TRUE
+#define TRUE (1)
+#endif
+#ifndef NULL
+#define NULL (0L)
+#endif
+
+typedef unsigned char NPBool;
+typedef void* NPEvent;
+typedef int16 NPError;
+typedef int16 NPReason;
+typedef char* NPMIMEType;
+
+
+
+/*----------------------------------------------------------------------*/
+/* Structures and definitions */
+/*----------------------------------------------------------------------*/
+
+/*
+ * NPP is a plug-in's opaque instance handle
+ */
+typedef struct _NPP
+{
+ void* pdata; /* plug-in private data */
+ void* ndata; /* netscape private data */
+} NPP_t;
+
+typedef NPP_t* NPP;
+
+
+typedef struct _NPStream
+{
+ void* pdata; /* plug-in private data */
+ void* ndata; /* netscape private data */
+ const char* url;
+ uint32 end;
+ uint32 lastmodified;
+ void* notifyData;
+} NPStream;
+
+
+typedef struct _NPByteRange
+{
+ int32 offset; /* negative offset means from the end */
+ uint32 length;
+ struct _NPByteRange* next;
+} NPByteRange;
+
+
+typedef struct _NPSavedData
+{
+ int32 len;
+ void* buf;
+} NPSavedData;
+
+
+typedef struct _NPRect
+{
+ uint16 top;
+ uint16 left;
+ uint16 bottom;
+ uint16 right;
+} NPRect;
+
+
+#ifdef XP_UNIX
+/*
+ * Unix specific structures and definitions
+ */
+#include <X11/Xlib.h>
+
+/*
+ * Callback Structures.
+ *
+ * These are used to pass additional platform specific information.
+ */
+enum {
+ NP_SETWINDOW = 1
+};
+
+typedef struct
+{
+ int32 type;
+} NPAnyCallbackStruct;
+
+typedef struct
+{
+ int32 type;
+ Display* display;
+ Visual* visual;
+ Colormap colormap;
+ unsigned int depth;
+} NPSetWindowCallbackStruct;
+
+/*
+ * List of variable names for which NPP_GetValue shall be implemented
+ */
+typedef enum {
+ NPPVpluginNameString = 1,
+ NPPVpluginDescriptionString
+} NPPVariable;
+
+/*
+ * List of variable names for which NPN_GetValue is implemented by Mozilla
+ */
+typedef enum {
+ NPNVxDisplay = 1,
+ NPNVxtAppContext
+} NPNVariable;
+
+#endif /* XP_UNIX */
+
+
+typedef struct _NPWindow
+{
+ void* window; /* Platform specific window handle */
+ uint32 x; /* Position of top left corner relative */
+ uint32 y; /* to a netscape page. */
+ uint32 width; /* Maximum window size */
+ uint32 height;
+ NPRect clipRect; /* Clipping rectangle in port coordinates */
+ /* Used by MAC only. */
+#ifdef XP_UNIX
+ void * ws_info; /* Platform-dependent additonal data */
+#endif /* XP_UNIX */
+} 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 */
+ void* platformPrint; /* Platform-specific printing info */
+} NPFullPrint;
+
+typedef struct _NPEmbedPrint
+{
+ NPWindow window;
+ void* platformPrint; /* Platform-specific printing info */
+} NPEmbedPrint;
+
+typedef struct _NPPrint
+{
+ uint16 mode; /* NP_FULL or NP_EMBED */
+ union
+ {
+ NPFullPrint fullPrint; /* if mode is NP_FULL */
+ NPEmbedPrint embedPrint; /* if mode is NP_EMBED */
+ } print;
+} NPPrint;
+
+
+#ifdef XP_MAC
+/*
+ * Mac-specific structures and definitions.
+ */
+
+#include <Quickdraw.h>
+#include <Events.h>
+
+typedef struct NP_Port
+{
+ CGrafPtr port; /* Grafport */
+ int32 portx; /* position inside the topmost window */
+ int32 porty;
+} NP_Port;
+
+/*
+ * Non-standard event types that can be passed to HandleEvent
+ */
+#define getFocusEvent (osEvt + 16)
+#define loseFocusEvent (osEvt + 17)
+#define adjustCursorEvent (osEvt + 18)
+
+#endif /* XP_MAC */
+
+
+/*
+ * Values for mode passed to NPP_New:
+ */
+#define NP_EMBED 1
+#define NP_FULL 2
+
+/*
+ * Values for stream type passed to NPP_NewStream:
+ */
+#define NP_NORMAL 1
+#define NP_SEEK 2
+#define NP_ASFILE 3
+#define NP_ASFILEONLY 4
+
+#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
+
+
+
+/*----------------------------------------------------------------------*/
+/* Error and Reason Code definitions */
+/*----------------------------------------------------------------------*/
+
+/*
+ * Values of type NPError:
+ */
+#define NPERR_BASE 0
+#define NPERR_NO_ERROR (NPERR_BASE + 0)
+#define NPERR_GENERIC_ERROR (NPERR_BASE + 1)
+#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2)
+#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3)
+#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4)
+#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5)
+#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6)
+#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7)
+#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8)
+#define NPERR_INVALID_PARAM (NPERR_BASE + 9)
+#define NPERR_INVALID_URL (NPERR_BASE + 10)
+#define NPERR_FILE_NOT_FOUND (NPERR_BASE + 11)
+#define NPERR_NO_DATA (NPERR_BASE + 12)
+#define NPERR_STREAM_NOT_SEEKABLE (NPERR_BASE + 13)
+
+/*
+ * Values of type NPReason:
+ */
+#define NPRES_BASE 0
+#define NPRES_DONE (NPRES_BASE + 0)
+#define NPRES_NETWORK_ERR (NPRES_BASE + 1)
+#define NPRES_USER_BREAK (NPRES_BASE + 2)
+
+/*
+ * Don't use these obsolete error codes any more.
+ */
+#define NP_NOERR NP_NOERR_is_obsolete_use_NPERR_NO_ERROR
+#define NP_EINVAL NP_EINVAL_is_obsolete_use_NPERR_GENERIC_ERROR
+#define NP_EABORT NP_EABORT_is_obsolete_use_NPRES_USER_BREAK
+
+/*
+ * Version feature information
+ */
+#define NPVERS_HAS_STREAMOUTPUT 8
+#define NPVERS_HAS_NOTIFICATION 9
+#define NPVERS_HAS_LIVECONNECT 9
+
+
+/*----------------------------------------------------------------------*/
+/* Function Prototypes */
+/*----------------------------------------------------------------------*/
+
+#if defined(_WINDOWS) && !defined(WIN32)
+#define NP_LOADDS _loadds
+#else
+#define NP_LOADDS
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * NPP_* functions are provided by the plugin and called by the navigator.
+ */
+
+#ifdef XP_UNIX
+char* NPP_GetMIMEDescription(void);
+NPError NPP_GetValue(void *instance, NPPVariable variable,
+ void *value);
+#endif /* XP_UNIX */
+NPError NPP_Initialize(void);
+void NPP_Shutdown(void);
+NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
+ uint16 mode, int16 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);
+NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
+ NPStream* stream, NPBool seekable,
+ uint16* stype);
+NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
+ NPReason reason);
+int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
+int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset,
+ int32 len, void* buffer);
+void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
+ const char* fname);
+void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
+int16 NPP_HandleEvent(NPP instance, void* event);
+void NPP_URLNotify(NPP instance, const char* url,
+ NPReason reason, void* notifyData);
+jref NPP_GetJavaClass(void);
+
+
+/*
+ * NPN_* functions are provided by the navigator and called by the plugin.
+ */
+
+#ifdef XP_UNIX
+NPError NPN_GetValue(NPP instance, NPNVariable variable,
+ void *value);
+#endif /* XP_UNIX */
+void NPN_Version(int* plugin_major, int* plugin_minor,
+ int* netscape_major, int* netscape_minor);
+NPError NPN_GetURLNotify(NPP instance, const char* url,
+ const char* target, void* notifyData);
+NPError NPN_GetURL(NPP instance, const char* url,
+ const char* target);
+NPError NPN_PostURLNotify(NPP instance, const char* url,
+ const char* target, uint32 len,
+ const char* buf, NPBool file,
+ void* notifyData);
+NPError NPN_PostURL(NPP instance, const char* url,
+ const char* target, uint32 len,
+ const char* buf, NPBool file);
+NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
+NPError NPN_NewStream(NPP instance, NPMIMEType type,
+ const char* target, NPStream** stream);
+int32 NPN_Write(NPP instance, NPStream* stream, int32 len,
+ void* buffer);
+NPError NPN_DestroyStream(NPP instance, NPStream* stream,
+ NPReason reason);
+void NPN_Status(NPP instance, const char* message);
+const char* NPN_UserAgent(NPP instance);
+void* NPN_MemAlloc(uint32 size);
+void NPN_MemFree(void* ptr);
+uint32 NPN_MemFlush(uint32 size);
+void NPN_ReloadPlugins(NPBool reloadPages);
+JRIEnv* NPN_GetJavaEnv(void);
+jref NPN_GetJavaPeer(NPP instance);
+
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif
+
+#endif /* _NPAPI_H_ */
diff --git a/plugin/include/npupp.h b/plugin/include/npupp.h
new file mode 100644
index 0000000..dfd4974
--- /dev/null
+++ b/plugin/include/npupp.h
@@ -0,0 +1,996 @@
+/* $Xorg: npupp.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */
+/* -*- Mode: C; tab-width: 4; -*- */
+/*
+ * npupp.h Revision: 1.37
+ * function call mecahnics needed by platform specific glue code.
+ */
+
+
+#ifndef _NPUPP_H_
+#define _NPUPP_H_
+
+#ifndef GENERATINGCFM
+#define GENERATINGCFM 0
+#endif
+
+#ifndef _NPAPI_H_
+#include "npapi.h"
+#endif
+
+#include "jri.h"
+
+/******************************************************************************************
+ plug-in function table macros
+ for each function in and out of the plugin API we define
+ typedef NPP_FooUPP
+ #define NewNPP_FooProc
+ #define CallNPP_FooProc
+ for mac, define the UPP magic for PPC/68K calling
+ *******************************************************************************************/
+
+
+/* NPP_Initialize */
+
+#if GENERATINGCFM
+typedef UniversalProcPtr NPP_InitializeUPP;
+
+enum {
+ uppNPP_InitializeProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
+ | RESULT_SIZE(SIZE_CODE(0))
+};
+
+#define NewNPP_InitializeProc(FUNC) \
+ (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
+#define CallNPP_InitializeProc(FUNC) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
+
+#else
+
+typedef void (*NPP_InitializeUPP)(void);
+#define NewNPP_InitializeProc(FUNC) \
+ ((NPP_InitializeUPP) (FUNC))
+#define CallNPP_InitializeProc(FUNC) \
+ (*(FUNC))()
+
+#endif
+
+
+/* NPP_Shutdown */
+
+#if GENERATINGCFM
+typedef UniversalProcPtr NPP_ShutdownUPP;
+
+enum {
+ uppNPP_ShutdownProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
+ | RESULT_SIZE(SIZE_CODE(0))
+};
+
+#define NewNPP_ShutdownProc(FUNC) \
+ (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
+#define CallNPP_ShutdownProc(FUNC) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
+
+#else
+
+typedef void (*NPP_ShutdownUPP)(void);
+#define NewNPP_ShutdownProc(FUNC) \
+ ((NPP_ShutdownUPP) (FUNC))
+#define CallNPP_ShutdownProc(FUNC) \
+ (*(FUNC))()
+
+#endif
+
+
+/* NPP_New */
+
+#if GENERATINGCFM
+typedef UniversalProcPtr NPP_NewUPP;
+
+enum {
+ uppNPP_NewProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
+ | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
+ | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+
+#define NewNPP_NewProc(FUNC) \
+ (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
+#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
+ (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+#else
+
+typedef NPError (*NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
+#define NewNPP_NewProc(FUNC) \
+ ((NPP_NewUPP) (FUNC))
+#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+
+#endif
+
+
+/* NPP_Destroy */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_DestroyUPP;
+enum {
+ uppNPP_DestroyProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_DestroyProc(FUNC) \
+ (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
+#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
+#else
+
+typedef NPError (*NPP_DestroyUPP)(NPP instance, NPSavedData** save);
+#define NewNPP_DestroyProc(FUNC) \
+ ((NPP_DestroyUPP) (FUNC))
+#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
+ (*(FUNC))((ARG1), (ARG2))
+
+#endif
+
+
+/* NPP_SetWindow */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_SetWindowUPP;
+enum {
+ uppNPP_SetWindowProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_SetWindowProc(FUNC) \
+ (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
+#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
+
+#else
+
+typedef NPError (*NPP_SetWindowUPP)(NPP instance, NPWindow* window);
+#define NewNPP_SetWindowProc(FUNC) \
+ ((NPP_SetWindowUPP) (FUNC))
+#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
+ (*(FUNC))((ARG1), (ARG2))
+
+#endif
+
+
+/* NPP_NewStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_NewStreamUPP;
+enum {
+ uppNPP_NewStreamProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_NewStreamProc(FUNC) \
+ (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
+#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
+#else
+
+typedef NPError (*NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
+#define NewNPP_NewStreamProc(FUNC) \
+ ((NPP_NewStreamUPP) (FUNC))
+#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
+#endif
+
+
+/* NPP_DestroyStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_DestroyStreamUPP;
+enum {
+ uppNPP_DestroyStreamProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_DestroyStreamProc(FUNC) \
+ (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
+#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg))
+
+#else
+
+typedef NPError (*NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
+#define NewNPP_DestroyStreamProc(FUNC) \
+ ((NPP_DestroyStreamUPP) (FUNC))
+#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
+ (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
+
+#endif
+
+
+/* NPP_WriteReady */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_WriteReadyUPP;
+enum {
+ uppNPP_WriteReadyProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
+};
+#define NewNPP_WriteReadyProc(FUNC) \
+ (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
+#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
+ (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
+
+#else
+
+typedef int32 (*NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
+#define NewNPP_WriteReadyProc(FUNC) \
+ ((NPP_WriteReadyUPP) (FUNC))
+#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
+ (*(FUNC))((NPParg), (NPStreamPtr))
+
+#endif
+
+
+/* NPP_Write */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_WriteUPP;
+enum {
+ uppNPP_WriteProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
+};
+#define NewNPP_WriteProc(FUNC) \
+ (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
+#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
+ (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
+
+#else
+
+typedef int32 (*NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
+#define NewNPP_WriteProc(FUNC) \
+ ((NPP_WriteUPP) (FUNC))
+#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
+ (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
+
+#endif
+
+
+/* NPP_StreamAsFile */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_StreamAsFileUPP;
+enum {
+ uppNPP_StreamAsFileProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
+ | RESULT_SIZE(SIZE_CODE(0))
+};
+#define NewNPP_StreamAsFileProc(FUNC) \
+ (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
+#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
+
+#else
+
+typedef void (*NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
+#define NewNPP_StreamAsFileProc(FUNC) \
+ ((NPP_StreamAsFileUPP) (FUNC))
+#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
+#endif
+
+
+/* NPP_Print */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_PrintUPP;
+enum {
+ uppNPP_PrintProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *)))
+ | RESULT_SIZE(SIZE_CODE(0))
+};
+#define NewNPP_PrintProc(FUNC) \
+ (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
+#define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
+
+#else
+
+typedef void (*NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
+#define NewNPP_PrintProc(FUNC) \
+ ((NPP_PrintUPP) (FUNC))
+#define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
+ (*(FUNC))((NPParg), (NPPrintArg))
+
+#endif
+
+
+/* NPP_HandleEvent */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_HandleEventUPP;
+enum {
+ uppNPP_HandleEventProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(int16)))
+};
+#define NewNPP_HandleEventProc(FUNC) \
+ (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
+#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
+ (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
+
+#else
+
+typedef int16 (*NPP_HandleEventUPP)(NPP instance, void* event);
+#define NewNPP_HandleEventProc(FUNC) \
+ ((NPP_HandleEventUPP) (FUNC))
+#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
+ (*(FUNC))((NPParg), (voidPtr))
+
+#endif
+
+
+/* NPP_URLNotify */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_URLNotifyUPP;
+enum {
+ uppNPP_URLNotifyProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
+ | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0)))
+};
+#define NewNPP_URLNotifyProc(FUNC) \
+ (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture())
+#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
+
+#else
+
+typedef void (*NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
+#define NewNPP_URLNotifyProc(FUNC) \
+ ((NPP_URLNotifyUPP) (FUNC))
+#define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
+
+#endif
+
+
+
+
+/*
+ * Netscape entry points
+ */
+
+#ifdef XP_UNIX
+
+/* NPN_GetValue */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_GetValueUPP;
+enum {
+ uppNPN_GetValueProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_GetValueProc(FUNC) \
+ (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture())
+#define CallNPN_GetURNotifyLProc(FUNC, ARG1, ARG2, ARG3) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
+#else
+
+typedef NPError (*NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
+#define NewNPN_GetValueProc(FUNC) \
+ ((NPN_GetValueUPP) (FUNC))
+#define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
+#endif
+
+#endif /* XP_UNIX */
+
+
+
+/* NPN_GetUrlNotify */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_GetURLNotifyUPP;
+enum {
+ uppNPN_GetURLNotifyProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_GetURLNotifyProc(FUNC) \
+ (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture())
+#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
+#else
+
+typedef NPError (*NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
+#define NewNPN_GetURLNotifyProc(FUNC) \
+ ((NPN_GetURLNotifyUPP) (FUNC))
+#define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
+#endif
+
+
+/* NPN_PostUrlNotify */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_PostURLNotifyUPP;
+enum {
+ uppNPN_PostURLNotifyProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
+ | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_PostURLNotifyProc(FUNC) \
+ (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture())
+#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+#else
+
+typedef NPError (*NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
+#define NewNPN_PostURLNotifyProc(FUNC) \
+ ((NPN_PostURLNotifyUPP) (FUNC))
+#define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
+#endif
+
+
+/* NPN_GetUrl */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_GetURLUPP;
+enum {
+ uppNPN_GetURLProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_GetURLProc(FUNC) \
+ (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
+#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
+#else
+
+typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
+#define NewNPN_GetURLProc(FUNC) \
+ ((NPN_GetURLUPP) (FUNC))
+#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3))
+#endif
+
+
+/* NPN_PostUrl */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_PostURLUPP;
+enum {
+ uppNPN_PostURLProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
+ | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
+ | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_PostURLProc(FUNC) \
+ (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
+#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
+#else
+
+typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
+#define NewNPN_PostURLProc(FUNC) \
+ ((NPN_PostURLUPP) (FUNC))
+#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
+ (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
+#endif
+
+
+/* NPN_RequestRead */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_RequestReadUPP;
+enum {
+ uppNPN_RequestReadProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_RequestReadProc(FUNC) \
+ (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
+#define CallNPN_RequestReadProc(FUNC, stream, range) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
+
+#else
+
+typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
+#define NewNPN_RequestReadProc(FUNC) \
+ ((NPN_RequestReadUPP) (FUNC))
+#define CallNPN_RequestReadProc(FUNC, stream, range) \
+ (*(FUNC))((stream), (range))
+
+#endif
+
+
+/* NPN_NewStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_NewStreamUPP;
+enum {
+ uppNPN_NewStreamProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_NewStreamProc(FUNC) \
+ (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
+#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream))
+
+#else
+
+typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
+#define NewNPN_NewStreamProc(FUNC) \
+ ((NPN_NewStreamUPP) (FUNC))
+#define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
+ (*(FUNC))((npp), (type), (window), (stream))
+
+#endif
+
+
+/* NPN_Write */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_WriteUPP;
+enum {
+ uppNPN_WriteProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
+ | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
+};
+#define NewNPN_WriteProc(FUNC) \
+ (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
+#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
+ (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))
+
+#else
+
+typedef int32 (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
+#define NewNPN_WriteProc(FUNC) \
+ ((NPN_WriteUPP) (FUNC))
+#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
+ (*(FUNC))((npp), (stream), (len), (buffer))
+
+#endif
+
+
+/* NPN_DestroyStream */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_DestroyStreamUPP;
+enum {
+ uppNPN_DestroyStreamProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPN_DestroyStreamProc(FUNC) \
+ (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
+#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
+ (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason))
+
+#else
+
+typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
+#define NewNPN_DestroyStreamProc(FUNC) \
+ ((NPN_DestroyStreamUPP) (FUNC))
+#define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
+ (*(FUNC))((npp), (stream), (reason))
+
+#endif
+
+
+/* NPN_Status */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_StatusUPP;
+enum {
+ uppNPN_StatusProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
+};
+
+#define NewNPN_StatusProc(FUNC) \
+ (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
+#define CallNPN_StatusProc(FUNC, npp, msg) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))
+
+#else
+
+typedef void (*NPN_StatusUPP)(NPP instance, const char* message);
+#define NewNPN_StatusProc(FUNC) \
+ ((NPN_StatusUPP) (FUNC))
+#define CallNPN_StatusProc(FUNC, npp, msg) \
+ (*(FUNC))((npp), (msg))
+
+#endif
+
+
+/* NPN_UserAgent */
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_UserAgentUPP;
+enum {
+ uppNPN_UserAgentProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
+};
+
+#define NewNPN_UserAgentProc(FUNC) \
+ (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
+#define CallNPN_UserAgentProc(FUNC, ARG1) \
+ (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
+
+#else
+
+typedef const char* (*NPN_UserAgentUPP)(NPP instance);
+#define NewNPN_UserAgentProc(FUNC) \
+ ((NPN_UserAgentUPP) (FUNC))
+#define CallNPN_UserAgentProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
+
+
+/* NPN_MemAlloc */
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_MemAllocUPP;
+enum {
+ uppNPN_MemAllocProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
+};
+
+#define NewNPN_MemAllocProc(FUNC) \
+ (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
+#define CallNPN_MemAllocProc(FUNC, ARG1) \
+ (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1))
+
+#else
+
+typedef void* (*NPN_MemAllocUPP)(uint32 size);
+#define NewNPN_MemAllocProc(FUNC) \
+ ((NPN_MemAllocUPP) (FUNC))
+#define CallNPN_MemAllocProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
+
+
+/* NPN__MemFree */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_MemFreeUPP;
+enum {
+ uppNPN_MemFreeProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
+};
+
+#define NewNPN_MemFreeProc(FUNC) \
+ (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
+#define CallNPN_MemFreeProc(FUNC, ARG1) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
+
+#else
+
+typedef void (*NPN_MemFreeUPP)(void* ptr);
+#define NewNPN_MemFreeProc(FUNC) \
+ ((NPN_MemFreeUPP) (FUNC))
+#define CallNPN_MemFreeProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
+
+
+/* NPN_MemFlush */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_MemFlushUPP;
+enum {
+ uppNPN_MemFlushProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(uint32)))
+};
+
+#define NewNPN_MemFlushProc(FUNC) \
+ (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
+#define CallNPN_MemFlushProc(FUNC, ARG1) \
+ (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))
+
+#else
+
+typedef uint32 (*NPN_MemFlushUPP)(uint32 size);
+#define NewNPN_MemFlushProc(FUNC) \
+ ((NPN_MemFlushUPP) (FUNC))
+#define CallNPN_MemFlushProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
+
+
+
+/* NPN_ReloadPlugins */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_ReloadPluginsUPP;
+enum {
+ uppNPN_ReloadPluginsProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool)))
+ | RESULT_SIZE(SIZE_CODE(0))
+};
+
+#define NewNPN_ReloadPluginsProc(FUNC) \
+ (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
+#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
+ (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1))
+
+#else
+
+typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages);
+#define NewNPN_ReloadPluginsProc(FUNC) \
+ ((NPN_ReloadPluginsUPP) (FUNC))
+#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
+
+
+/* NPN_GetJavaEnv */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_GetJavaEnvUPP;
+enum {
+ uppNPN_GetJavaEnvProcInfo = kThinkCStackBased
+ | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*)))
+};
+
+#define NewNPN_GetJavaEnvProc(FUNC) \
+ (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture())
+#define CallNPN_GetJavaEnvProc(FUNC) \
+ (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo)
+
+#else
+
+typedef JRIEnv* (*NPN_GetJavaEnvUPP)(void);
+#define NewNPN_GetJavaEnvProc(FUNC) \
+ ((NPN_GetJavaEnvUPP) (FUNC))
+#define CallNPN_GetJavaEnvProc(FUNC) \
+ (*(FUNC))()
+
+#endif
+
+
+/* NPN_GetJavaPeer */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPN_GetJavaPeerUPP;
+enum {
+ uppNPN_GetJavaPeerProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(jref)))
+};
+
+#define NewNPN_GetJavaPeerProc(FUNC) \
+ (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture())
+#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
+ (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1))
+
+#else
+
+typedef jref (*NPN_GetJavaPeerUPP)(NPP instance);
+#define NewNPN_GetJavaPeerProc(FUNC) \
+ ((NPN_GetJavaPeerUPP) (FUNC))
+#define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
+ (*(FUNC))((ARG1))
+
+#endif
+
+
+
+
+/******************************************************************************************
+ * The actual plugin function table definitions
+ *******************************************************************************************/
+
+typedef struct _NPPluginFuncs {
+ uint16 size;
+ uint16 version;
+ NPP_NewUPP newp;
+ NPP_DestroyUPP destroy;
+ NPP_SetWindowUPP setwindow;
+ NPP_NewStreamUPP newstream;
+ NPP_DestroyStreamUPP destroystream;
+ NPP_StreamAsFileUPP asfile;
+ NPP_WriteReadyUPP writeready;
+ NPP_WriteUPP write;
+ NPP_PrintUPP print;
+ NPP_HandleEventUPP event;
+ NPP_URLNotifyUPP urlnotify;
+ JRIGlobalRef javaClass;
+} NPPluginFuncs;
+
+typedef struct _NPNetscapeFuncs {
+ uint16 size;
+ uint16 version;
+ NPN_GetURLUPP geturl;
+ NPN_PostURLUPP posturl;
+ NPN_RequestReadUPP requestread;
+ NPN_NewStreamUPP newstream;
+ NPN_WriteUPP write;
+ NPN_DestroyStreamUPP destroystream;
+ NPN_StatusUPP status;
+ NPN_UserAgentUPP uagent;
+ NPN_MemAllocUPP memalloc;
+ NPN_MemFreeUPP memfree;
+ NPN_MemFlushUPP memflush;
+ NPN_ReloadPluginsUPP reloadplugins;
+ NPN_GetJavaEnvUPP getJavaEnv;
+ NPN_GetJavaPeerUPP getJavaPeer;
+ NPN_GetURLNotifyUPP geturlnotify;
+ NPN_PostURLNotifyUPP posturlnotify;
+#ifdef XP_UNIX
+ NPN_GetValueUPP getvalue;
+#endif /* XP_UNIX */
+} NPNetscapeFuncs;
+
+
+
+#ifdef XP_MAC
+/******************************************************************************************
+ * Mac platform-specific plugin glue stuff
+ *******************************************************************************************/
+
+/*
+ * Main entry point of the plugin.
+ * This routine will be called when the plugin is loaded. The function
+ * tables are passed in and the plugin fills in the NPPluginFuncs table
+ * and NPPShutdownUPP for Netscape's use.
+ */
+
+#if GENERATINGCFM
+
+typedef UniversalProcPtr NPP_MainEntryUPP;
+enum {
+ uppNPP_MainEntryProcInfo = kThinkCStackBased
+ | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*)))
+ | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*)))
+ | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*)))
+ | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
+};
+#define NewNPP_MainEntryProc(FUNC) \
+ (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
+#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
+ CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
+
+#else
+
+typedef NPError (*NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
+#define NewNPP_MainEntryProc(FUNC) \
+ ((NPP_MainEntryUPP) (FUNC))
+#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
+ (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
+
+#endif
+#endif /* MAC */
+
+
+#ifdef _WINDOWS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* plugin meta member functions */
+
+NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs);
+
+NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs);
+
+NPError WINAPI NP_Shutdown();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINDOWS */
+
+#ifdef XP_UNIX
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* plugin meta member functions */
+
+char* NP_GetMIMEDescription(void);
+NPError NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
+NPError NP_Shutdown(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* XP_UNIX */
+
+#endif /* _NPUPP_H_ */
diff --git a/plugin/libxrx.man b/plugin/libxrx.man
new file mode 100644
index 0000000..6ceca60
--- /dev/null
+++ b/plugin/libxrx.man
@@ -0,0 +1,152 @@
+.\" $Xorg: libxrx.man,v 1.4 2001/02/09 02:05:57 xorgcvs Exp $
+.\" Copyright 1996, 1998 The Open Group
+.\"
+.\" Permission to use, copy, modify, distribute, and sell this software and its
+.\" documentation for any purpose is hereby granted without fee, provided that
+.\" the above copyright notice appear in all copies and that both that
+.\" copyright notice and this permission notice appear in supporting
+.\" documentation.
+.\"
+.\" The above copyright notice and this permission notice shall be included
+.\" in all copies or substantial portions of the Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+.\" OTHER DEALINGS IN THE SOFTWARE.
+.\"
+.\" Except as contained in this notice, the name of The Open Group shall
+.\" not be used in advertising or otherwise to promote the sale, use or
+.\" other dealings in this Software without prior written authorization
+.\" from The Open Group.
+.\"
+.TH LIBXRX 1 "Release 6.4" "X Version 11"
+.SH NAME
+libxrx - RX Netscape Navigator Plug-in
+.SH DESCRIPTION
+The \fBRX Plug-in\fP may be used with Netscape Navigator (3.0 or later) to
+interpret documents in the RX MIME type format and start remote
+applications.
+.PP
+The \fBRX Plug-in\fP reads an RX document, from which it gets the list
+of services the application wants to use. Based on this information, the
+\fBRX Plug-in\fP sets the various requested services, including creating
+authorization keys if your X server supports the SECURITY extension. It
+then passes the relevant data, such as the X display name, to the
+application through an HTTP GET request of the associated CGI script. The
+Web server then executes the CGI script to start the application. The
+client runs on the web server host connected to your X server. In
+addition when the RX document is used within the EMBED tag (a Netscape
+extension to HTML), the \fBRX Plug-in\fP uses the XC-APPGROUP extension, if
+it is supported by your X server, to cause the remote application to be
+embedded within the browser page from which it was launched.
+.PP
+.SH INSTALLATION
+To install the \fBRX Plug-in\fP so that Netscape Navigator can use it, find
+the file named libxrx.so.6.3 or libxrx.sl.6.3 (or similar, depending on
+your platform) in <ProjectRoot>/lib (e.g. /usr/X11R6.4/lib) and copy it to
+either /usr/local/lib/netscape/plugins or $HOME/.netscape/plugins. Do
+not install the symlinks libxrx.so or libxrx.sl; they would confuse
+Netscape.
+.PP
+If you have configured Netscape Navigator to use the RX helper program
+(\fBxrx\fP), you must reconfigure it. Generally you simply need to remove
+or comment out the line you may have previously added in your mailcap file
+to use the RX helper program.
+Otherwise the plug-in will not be enabled. (The usual comment character for
+mailcap is ``#''.)
+.PP
+If you are already running Netscape Navigator, you need to exit and restart
+it after copying the plug-in library so the new plug-in will be found.
+Once this is done you can check that Navigator has successfully loaded the
+plug-in by checking the ``About Plug-ins'' page from the Help menu. This
+should show something like:
+
+ RX Plug-in
+
+ File name: /usr/local/lib/netscape/plugins/libxrx.sl.6.3
+
+ X Remote Activation Plug-in
+
+ Mime Type Description Suffixes Enabled
+ application/x-rx X Remote Activation Plug-in xrx Yes
+
+.PP
+Once correctly configured, Netscape Navigator will activate the \fBRX
+Plug-in\fP whenever you retrieve any document of the MIME type
+\fIapplication/x-rx\fP.
+.PP
+.SH RESOURCES
+The \fBRX Plug-in\fP looks for resources associated with the widget
+\fBnetscape.Navigator (\fPclass\fB Netscape.TopLevelShell)\fP and
+understands the following resource names and classes:
+.\".in +1in
+.TP 8
+.B "xrxHasFirewallProxy (\fPclass\fB XrxHasFirewallProxy)"
+Specifies whether an X server firewall proxy (see xfwp) is running and
+should be used. Default is ``False.'' The X firewall proxy uses
+the X Security Extension and this extension will only allow clients
+to connect to the X server if host-based authentication is turned
+on. See \fBxfwp(1)\fP for more information.
+.TP 8
+.B "xrxInternalWebServers (\fPclass\fB XrxInternalWebServers)"
+The web servers for which the X server firewall proxy should not be used
+(only relevant when \fBxrxHasFirewallProxy\fP is ``True''). Its value is a
+comma separated list of mask/value pairs to be used to filter internal
+web servers, based on their address. The mask part specifies which segments
+of the address are to be considered and the value part specifies what the
+result should match. For instance the following list:
+
+ 255.255.255.0/198.112.45.0, 255.255.255.0/198.112.46.0
+
+matches the address sets: 198.112.45.* and 198.112.46.*. More precisely,
+the test is (address & mask) == value.
+.TP 8
+.B "xrxFastWebServers (\fPclass\fB XrxFastWebServers)"
+The web servers for which LBX should not be used. The resource value is a
+list of address mask/value pairs, as previously described.
+.TP 8
+.B "xrxTrustedWebServers (\fPclass\fB XrxTrustedWebServers)"
+The web servers from which remote applications should be run as trusted
+clients. The default is to run remote applications as untrusted
+clients. The resource value is a list of address mask/value pairs, as
+previously described.
+.PP
+.SH ENVIRONMENT
+If the RX document requests X-UI-LBX service and the default X server does
+not advertise the LBX extension, the \fIRX Plug-in\fP will look for the
+environment variable ``XREALDISPLAY'' to get a second address for your X
+server and look for the LBX extension there. When running your browser
+through \fIlbxproxy\fP you will need to set XREALDISPLAY to the actual
+address of your server if you wish remote applications to be able to use
+LBX across the Internet.
+.PP
+If the RX document requests XPRINT service, \fIRX Plug-in\fP looks for the
+variable ``XPRINTER'' to get the printer name and X Print server address to
+use. If the server address is not specified as part of XPRINTER, \fIRX
+Plug-in\fP uses the first one specified through the variable
+``XPSERVERLIST'' when it is set. When it is not \fIRX Plug-in\fP then tries
+to use the video server as the print server. If the printer name is not
+specified via XPRINTER, \fIRX Plug-in\fP looks for it in the variables
+``PDPRINTER'', then ``LPDEST'', and finally ``PRINTER'',
+.PP
+Finally, if you are using a firewall proxy, \fIRX Plug-in\fP will look for
+``PROXY_MANAGER'' to get the address of your proxy manager (see
+proxymngr). When not specified it will use ":6500" as the default.
+.PP
+.SH KNOWN BUG
+When an authorization key is created for a remote application to use the X
+Print service, the \fBRX Plug-in\fP has to create the key with an infinite
+timeout since nobody knows when the application will actually connect to
+the X Print server. It then revokes the key when its instance is destroyed
+(that is when you go to another page). However, if the Plug-in does not get
+destroyed properly, which happens when Netscape Navigator dies
+unexpectedly, the print authorization key will never get revoked.
+.PP
+.SH SEE ALSO
+xrx (1), xfwp (1), lbxproxy (1), proxymngr (1), The RX Document specification
+.SH AUTHORS
+Arnaud Le Hors and Kaleb Keithley, X Consortium
diff --git a/plugin/stubs.c b/plugin/stubs.c
new file mode 100644
index 0000000..4aab758
--- /dev/null
+++ b/plugin/stubs.c
@@ -0,0 +1,15 @@
+/* $Xorg: stubs.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */
+/* -*- Mode: C; tab-width: 4; -*- */
+/*******************************************************************************
+ * Simple LiveConnect Sample Plugin
+ * Copyright (c) 1996 Netscape Communications. All rights reserved.
+ ******************************************************************************/
+
+/*
+** Ok, so we don't usually include .c files (only .h files) but we're
+** doing it here to avoid some fancy make rules. First pull in the common
+** glue code:
+*/
+#ifdef XP_UNIX
+#include "common/npunix.c"
+#endif