summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-07-28 18:46:26 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-07-29 17:28:02 +0200
commit69da8b62c52bd7cfdecbc000e0d6c139ff2d299e (patch)
tree08ce0bf9d84eae42f0181963756c51e126f7bc27
parent84246365cfa08717f4d9030590ecea4fb80f99c2 (diff)
downloadkaffeine-mozilla-69da8b62c52bd7cfdecbc000e0d6c139ff2d299e.tar.gz
kaffeine-mozilla-69da8b62c52bd7cfdecbc000e0d6c139ff2d299e.zip
Export public plugin functions.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz> (cherry picked from commit 326fe7986c94289be997db80cb38da95145021dd)
-rw-r--r--src/npunix.c13
-rw-r--r--src/plugin-exports.h34
-rw-r--r--src/plugin.c21
3 files changed, 62 insertions, 6 deletions
diff --git a/src/npunix.c b/src/npunix.c
index 6de0188..2c43fd7 100644
--- a/src/npunix.c
+++ b/src/npunix.c
@@ -14,9 +14,14 @@
#define XP_UNIX 1
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include "npapi.h"
#include "npupp.h"
+#include "plugin-exports.h"
/*
* Define PLUGIN_TRACE to have the wrapper functions print
@@ -251,7 +256,7 @@ Private_Print(NPP instance, NPPrint* platformPrint)
* - Netscape uses the return value to identify when an object instance
* of this plugin should be created.
*/
-char *
+PLUGIN_EXPORT char *
NP_GetMIMEDescription(void)
{
return NPP_GetMIMEDescription();
@@ -263,7 +268,7 @@ NP_GetMIMEDescription(void)
* - Interfaces with plugin to get values for predefined variables
* that the navigator needs.
*/
-NPError
+PLUGIN_EXPORT NPError
NP_GetValue(void *future, NPPVariable variable, void *value)
{
return NPP_GetValue(future, variable, value);
@@ -286,7 +291,7 @@ NP_GetValue(void *future, NPPVariable variable, void *value)
* library will use this function table to call the plugin.
*
*/
-NPError
+PLUGIN_EXPORT NPError
NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
{
NPError err = NPERR_NO_ERROR;
@@ -376,7 +381,7 @@ NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
* the last object of this kind has been destroyed.
*
*/
-NPError
+PLUGIN_EXPORT NPError
NP_Shutdown(void)
{
PLUGINDEBUGSTR("NP_Shutdown");
diff --git a/src/plugin-exports.h b/src/plugin-exports.h
new file mode 100644
index 0000000..864b133
--- /dev/null
+++ b/src/plugin-exports.h
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 2020 TDE Team
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef _PLUGIN_EXPORTS_H_
+#define _PLUGIN_EXPORTS_H_
+
+#ifdef __KDE_HAVE_GCC_VISIBILITY
+#define PLUGIN_NO_EXPORT __attribute__ ((visibility("hidden")))
+#define PLUGIN_EXPORT __attribute__ ((visibility("default")))
+#elif defined(Q_WS_WIN)
+#define PLUGIN_NO_EXPORT
+#define PLUGIN_EXPORT __declspec(dllexport)
+#else
+#define PLUGIN_NO_EXPORT
+#define PLUGIN_EXPORT
+#endif
+
+#endif /* _PLUGIN_EXPORTS_H_ */
diff --git a/src/plugin.c b/src/plugin.c
index 6e49a7d..f3715c7 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -36,8 +36,9 @@
*
*/
-
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <sys/types.h>
#include <sys/wait.h>
@@ -69,6 +70,7 @@
#include "npapi.h"
#include "plugin.h"
+#include "plugin-exports.h"
/* define LOG to write debug messages to /tmp/kaffeine_plugin.log */
@@ -139,6 +141,7 @@ static void xprintf (const char *format, ...) {
#endif
}
+PLUGIN_EXPORT
char *NPP_GetMIMEDescription(void) {
xprintf("NPP_GetMIMEDescription:\n");
@@ -166,6 +169,7 @@ char *NPP_GetMIMEDescription(void) {
;
}
+PLUGIN_EXPORT
NPError NPP_GetValue(void *future, NPPVariable variable, void *value){
NPError err = NPERR_NO_ERROR;
@@ -185,6 +189,7 @@ NPError NPP_GetValue(void *future, NPPVariable variable, void *value){
return err;
}
+PLUGIN_EXPORT
NPError NPP_Initialize(void) {
xprintf("NPP_Initialize:\n");
@@ -200,11 +205,13 @@ NPError NPP_Initialize(void) {
}
+PLUGIN_EXPORT
void * NPP_GetJavaClass() {
xprintf("NPP_GetJavaClass:\n");
return NULL;
}
+PLUGIN_EXPORT
void NPP_Shutdown(void) {
xprintf("NPP_Shutdown:\n");
}
@@ -317,6 +324,7 @@ static void got_url (const char *url_) {
}
+PLUGIN_EXPORT
NPError NPP_New(NPMIMEType pluginType, NPP instance,
uint16 mode,
int16 argc, char* argn[], char* argv[],
@@ -378,6 +386,7 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance,
}
+PLUGIN_EXPORT
NPError NPP_SetWindow(NPP instance, NPWindow* window) {
plugin_instance_t* this;
@@ -438,6 +447,7 @@ NPError NPP_SetWindow(NPP instance, NPWindow* window) {
return NPERR_NO_ERROR;
}
+PLUGIN_EXPORT
NPError NPP_Destroy(NPP instance, NPSavedData** save) {
plugin_instance_t* this;
@@ -463,6 +473,7 @@ NPError NPP_Destroy(NPP instance, NPSavedData** save) {
}
+PLUGIN_EXPORT
NPError NPP_NewStream (NPP instance,
NPMIMEType type,
NPStream *stream,
@@ -516,6 +527,7 @@ 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) */
+PLUGIN_EXPORT
int32 NPP_WriteReady(NPP instance, NPStream *stream) {
plugin_instance_t* this;
@@ -527,6 +539,7 @@ int32 NPP_WriteReady(NPP instance, NPStream *stream) {
}
+PLUGIN_EXPORT
int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) {
xprintf("NPP_Write:\n");
@@ -540,6 +553,7 @@ int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *b
}
+PLUGIN_EXPORT
NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) {
plugin_instance_t* this;
@@ -553,6 +567,7 @@ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) {
}
+PLUGIN_EXPORT
void NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) {
plugin_instance_t* this;
@@ -563,6 +578,7 @@ void NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) {
}
+PLUGIN_EXPORT
void NPP_Print(NPP instance, NPPrint* printInfo) {
xprintf("NPP_Print:\n");
@@ -572,6 +588,7 @@ void NPP_Print(NPP instance, NPPrint* printInfo) {
xprintf("NPP_Print: Not implemented. \n");
}
+PLUGIN_EXPORT
int16 NPP_HandleEvent(NPP instance, void* ev) {
xprintf("NPP_HandleEvent\n");