front_idill/extern/fajran-npTuioClient/src/np_entry.cpp
author bastiena
Thu, 19 Apr 2012 11:53:06 +0200
changeset 29 fcf435874395
parent 28 9ccef81f02ab
permissions -rw-r--r--
Middleware : Connection between middleware and front idill established with websockets.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     1
// 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     2
//   Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     3
// 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     4
// This program is free software; you can redistribute it and/or modify
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     5
// it under the terms of the GNU General Public License as published by
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     6
// the Free Software Foundation; either version 3 of the License, or
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     7
// (at your option) any later version.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     8
// 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
     9
// This program is distributed in the hope that it will be useful,
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    12
// GNU General Public License for more details.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    13
// 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    14
// You should have received a copy of the GNU General Public License
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    15
// along with this program; if not, write to the Free Software
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    16
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    17
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    18
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    19
//////////////////////////////////////////////////////////////
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    20
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    21
// Main plugin entry point implementation -- exports from the 
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    22
// plugin library
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    23
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    24
#include "npplat.h"
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    25
#include "pluginbase.h"
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    26
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    27
NPNetscapeFuncs NPNFuncs;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    28
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    29
#ifdef XP_MAC
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    30
void OSCALL NP_Shutdown()
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    31
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    32
  NS_PluginShutdown();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    33
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    34
#else
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    35
NPError OSCALL NP_Shutdown()
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    36
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    37
  NS_PluginShutdown();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    38
  return NPERR_NO_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    39
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    40
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    41
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    42
static NPError fillPluginFunctionTable(NPPluginFuncs* aNPPFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    43
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    44
  if(aNPPFuncs == NULL)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    45
    return NPERR_INVALID_FUNCTABLE_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    46
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    47
  // Set up the plugin function table that Netscape will use to
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    48
  // call us. Netscape needs to know about our version and size   
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    49
  // and have a UniversalProcPointer for every function we implement.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    50
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    51
  aNPPFuncs->version       = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    52
#ifdef XP_MAC
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    53
  aNPPFuncs->newp          = NewNPP_NewProc(Private_New);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    54
  aNPPFuncs->destroy       = NewNPP_DestroyProc(Private_Destroy);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    55
  aNPPFuncs->setwindow     = NewNPP_SetWindowProc(Private_SetWindow);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    56
  aNPPFuncs->newstream     = NewNPP_NewStreamProc(Private_NewStream);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    57
  aNPPFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    58
  aNPPFuncs->asfile        = NewNPP_StreamAsFileProc(Private_StreamAsFile);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    59
  aNPPFuncs->writeready    = NewNPP_WriteReadyProc(Private_WriteReady);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    60
  aNPPFuncs->write         = NewNPP_WriteProc(Private_Write);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    61
  aNPPFuncs->print         = NewNPP_PrintProc(Private_Print);
28
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    62
  aNPPFuncs->event         = NewNPP_HandleEventProc(Private_HandleEvent);    
9ccef81f02ab Charset set to UTF-8 without bom
bastiena
parents: 21
diff changeset
    63
  aNPPFuncs->urlnotify     = NewNPP_URLNotifyProc(Private_URLNotify);            
21
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    64
  aNPPFuncs->getvalue      = NewNPP_GetValueProc(Private_GetValue);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    65
  aNPPFuncs->setvalue      = NewNPP_SetValueProc(Private_SetValue);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    66
#else
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    67
  aNPPFuncs->newp          = NPP_New;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    68
  aNPPFuncs->destroy       = NPP_Destroy;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    69
  aNPPFuncs->setwindow     = NPP_SetWindow;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    70
  aNPPFuncs->newstream     = NPP_NewStream;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    71
  aNPPFuncs->destroystream = NPP_DestroyStream;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    72
  aNPPFuncs->asfile        = NPP_StreamAsFile;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    73
  aNPPFuncs->writeready    = NPP_WriteReady;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    74
  aNPPFuncs->write         = NPP_Write;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    75
  aNPPFuncs->print         = NPP_Print;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    76
  aNPPFuncs->event         = NPP_HandleEvent;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    77
  aNPPFuncs->urlnotify     = NPP_URLNotify;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    78
  aNPPFuncs->getvalue      = NPP_GetValue;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    79
  aNPPFuncs->setvalue      = NPP_SetValue;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    80
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    81
#ifdef OJI
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    82
  aNPPFuncs->javaClass     = NULL;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    83
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    84
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    85
  return NPERR_NO_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    86
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    87
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    88
static NPError fillNetscapeFunctionTable(NPNetscapeFuncs* aNPNFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    89
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    90
  int i = 0, n;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    91
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    92
  if(aNPNFuncs == NULL)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    93
    return NPERR_INVALID_FUNCTABLE_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    94
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    95
  if(HIBYTE(aNPNFuncs->version) > NP_VERSION_MAJOR)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    96
    return NPERR_INCOMPATIBLE_VERSION_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    97
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    98
#if 0
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
    99
  if(aNPNFuncs->size < sizeof(NPNetscapeFuncs))
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   100
    return NPERR_INVALID_FUNCTABLE_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   101
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   102
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   103
  // Number of function pointers in aNPNFuncs.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   104
  n = (aNPNFuncs->size - (2 * sizeof(uint16))) / sizeof(void *);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   105
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   106
  NPNFuncs.size             = aNPNFuncs->size;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   107
  NPNFuncs.version          = aNPNFuncs->version;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   108
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   109
  /*
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   110
   * BEWARE!  The following is order-sensitive and needs to be in the
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   111
   * same order as the structure definition from npupp.h.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   112
   */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   113
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   114
  if (++i <= n) NPNFuncs.geturl = aNPNFuncs->geturl;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   115
  if (++i <= n) NPNFuncs.posturl = aNPNFuncs->posturl;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   116
  if (++i <= n) NPNFuncs.requestread = aNPNFuncs->requestread;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   117
  if (++i <= n) NPNFuncs.newstream = aNPNFuncs->newstream;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   118
  if (++i <= n) NPNFuncs.write = aNPNFuncs->write;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   119
  if (++i <= n) NPNFuncs.destroystream = aNPNFuncs->destroystream;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   120
  if (++i <= n) NPNFuncs.status = aNPNFuncs->status;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   121
  if (++i <= n) NPNFuncs.uagent = aNPNFuncs->uagent;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   122
  if (++i <= n) NPNFuncs.memalloc = aNPNFuncs->memalloc;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   123
  if (++i <= n) NPNFuncs.memfree = aNPNFuncs->memfree;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   124
  if (++i <= n) NPNFuncs.memflush = aNPNFuncs->memflush;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   125
  if (++i <= n) NPNFuncs.reloadplugins = aNPNFuncs->reloadplugins;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   126
  if (++i <= n) NPNFuncs.getJavaEnv = aNPNFuncs->getJavaEnv;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   127
  if (++i <= n) NPNFuncs.getJavaPeer = aNPNFuncs->getJavaPeer;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   128
  if (++i <= n) NPNFuncs.geturlnotify = aNPNFuncs->geturlnotify;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   129
  if (++i <= n) NPNFuncs.posturlnotify = aNPNFuncs->posturlnotify;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   130
  if (++i <= n) NPNFuncs.getvalue = aNPNFuncs->getvalue;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   131
  if (++i <= n) NPNFuncs.setvalue = aNPNFuncs->setvalue;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   132
  if (++i <= n) NPNFuncs.invalidaterect = aNPNFuncs->invalidaterect;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   133
  if (++i <= n) NPNFuncs.invalidateregion = aNPNFuncs->invalidateregion;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   134
  if (++i <= n) NPNFuncs.forceredraw = aNPNFuncs->forceredraw;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   135
  if (++i <= n) NPNFuncs.getstringidentifier = aNPNFuncs->getstringidentifier;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   136
  if (++i <= n) NPNFuncs.getstringidentifiers = aNPNFuncs->getstringidentifiers;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   137
  if (++i <= n) NPNFuncs.getintidentifier = aNPNFuncs->getintidentifier;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   138
  if (++i <= n) NPNFuncs.identifierisstring = aNPNFuncs->identifierisstring;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   139
  if (++i <= n) NPNFuncs.utf8fromidentifier = aNPNFuncs->utf8fromidentifier;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   140
  if (++i <= n) NPNFuncs.intfromidentifier = aNPNFuncs->intfromidentifier;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   141
  if (++i <= n) NPNFuncs.createobject = aNPNFuncs->createobject;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   142
  if (++i <= n) NPNFuncs.retainobject = aNPNFuncs->retainobject;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   143
  if (++i <= n) NPNFuncs.releaseobject = aNPNFuncs->releaseobject;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   144
  if (++i <= n) NPNFuncs.invoke = aNPNFuncs->invoke;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   145
  if (++i <= n) NPNFuncs.invokeDefault = aNPNFuncs->invokeDefault;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   146
  if (++i <= n) NPNFuncs.evaluate = aNPNFuncs->evaluate;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   147
  if (++i <= n) NPNFuncs.getproperty = aNPNFuncs->getproperty;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   148
  if (++i <= n) NPNFuncs.setproperty = aNPNFuncs->setproperty;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   149
  if (++i <= n) NPNFuncs.removeproperty = aNPNFuncs->removeproperty;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   150
  if (++i <= n) NPNFuncs.hasproperty = aNPNFuncs->hasproperty;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   151
  if (++i <= n) NPNFuncs.hasmethod = aNPNFuncs->hasmethod;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   152
  if (++i <= n) NPNFuncs.releasevariantvalue = aNPNFuncs->releasevariantvalue;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   153
  if (++i <= n) NPNFuncs.setexception = aNPNFuncs->setexception;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   154
  if (++i <= n) NPNFuncs.pushpopupsenabledstate = aNPNFuncs->pushpopupsenabledstate;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   155
  if (++i <= n) NPNFuncs.poppopupsenabledstate = aNPNFuncs->poppopupsenabledstate;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   156
  if (++i <= n) NPNFuncs.enumerate = aNPNFuncs->enumerate;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   157
  if (++i <= n) NPNFuncs.pluginthreadasynccall = aNPNFuncs->pluginthreadasynccall;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   158
  if (++i <= n) NPNFuncs.construct = aNPNFuncs->construct;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   159
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   160
  return NPERR_NO_ERROR;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   161
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   162
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   163
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   164
// Some exports are different on different platforms
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   165
//
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   166
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   167
/**************************************************/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   168
/*                                                */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   169
/*                   Windows                      */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   170
/*                                                */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   171
/**************************************************/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   172
#ifdef XP_WIN
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   173
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   174
NPError OSCALL NP_Initialize(NPNetscapeFuncs* aNPNFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   175
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   176
  /*
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   177
   * N.B.  On Firefox 2.0.0.12/WinXP, aNPNFuncs->size is 172 while
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   178
   * sizeof(NPNetscapeFuncs) is 184.  However, npgnash.dll continues to
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   179
   * work fine even though NPNFuncs isn't populated (!), and as a matter
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   180
   * of fact, Firefox seems to ignore the NPERR_INVALID_FUNCTABLE_ERROR
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   181
   * return from NP_Initialize and continues to load and execute
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   182
   * npgnash.dll, anyway.  Therefore, we should continue and execute
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   183
   * NS_PluginInitialize anyway, too.
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   184
   */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   185
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   186
  NPError rv = fillNetscapeFunctionTable(aNPNFuncs);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   187
#if 0
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   188
  if(rv != NPERR_NO_ERROR)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   189
    return rv;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   190
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   191
  NPError rv2 = NS_PluginInitialize();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   192
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   193
  return rv2 != NPERR_NO_ERROR ? rv2 : rv;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   194
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   195
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   196
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* aNPPFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   197
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   198
  return fillPluginFunctionTable(aNPPFuncs);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   199
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   200
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   201
#endif //XP_WIN
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   202
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   203
/**************************************************/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   204
/*                                                */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   205
/*                    Unix                        */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   206
/*                                                */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   207
/**************************************************/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   208
#ifdef XP_UNIX
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   209
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   210
#ifdef XP_MAC
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   211
NPError NP_Initialize(NPNetscapeFuncs* aNPNFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   212
#else
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   213
NPError NP_Initialize(NPNetscapeFuncs* aNPNFuncs, NPPluginFuncs* aNPPFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   214
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   215
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   216
  NPError rv = fillNetscapeFunctionTable(aNPNFuncs);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   217
  if(rv != NPERR_NO_ERROR)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   218
    return rv;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   219
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   220
#ifndef XP_MAC
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   221
  rv = fillPluginFunctionTable(aNPPFuncs);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   222
  if(rv != NPERR_NO_ERROR)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   223
    return rv;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   224
#endif
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   225
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   226
  return NS_PluginInitialize();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   227
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   228
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   229
char * NP_GetMIMEDescription(void)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   230
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   231
  return NPP_GetMIMEDescription();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   232
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   233
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   234
NPError NP_GetValue(void* /*future*/, NPPVariable aVariable, void *aValue)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   235
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   236
  return NS_PluginGetValue(aVariable, aValue);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   237
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   238
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   239
#endif //XP_UNIX
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   240
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   241
/**************************************************/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   242
/*                                                */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   243
/*                     Mac                        */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   244
/*                                                */
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   245
/**************************************************/
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   246
#ifdef XP_MAC
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   247
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   248
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* aNPPFuncs)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   249
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   250
  return fillPluginFunctionTable(aNPPFuncs);
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   251
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   252
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   253
NPError Private_Initialize(void)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   254
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   255
  NPError rv = NS_PluginInitialize();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   256
  return rv;
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   257
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   258
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   259
void Private_Shutdown(void)
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   260
{
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   261
  NS_PluginShutdown();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   262
//  __destroy_global_chain();
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   263
}
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   264
e4e5f02787a1 Front IDILL :
bastiena
parents:
diff changeset
   265
#endif //XP_MAC