summaryrefslogtreecommitdiffhomepage
path: root/plugin/pluginutil.h
blob: fdfabe8530c017ca68c48ca5e45c4dc5ceea7b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#ifndef PLUGINUTIL_H
#define PLUGINUTIL_H

#include <stdint.h>

#include <npapi.h>
#include <npruntime.h>

#include <X11/X.h>


char *variantToStringZ(const NPVariant *variant);
bool convertStringZToVariant(char *string, NPVariant *result);
char *getDocumentURL(NPP instance);
char *getDocumentHostname(NPP instance);
char *getDocumentIP(NPP instance);
Window getWindowId(NPP instance);
bool copyIdentifierName(NPIdentifier ident, char *name, size_t maxLength);


#define IS_CALL(NAME, ARGCOUNT) (!strcmp(name, (NAME)) && (argCount == (ARGCOUNT)))
#define ARG(N, TYPE) NPVARIANT_IS_##TYPE(args[N])

#define IS_CALL_0(NAME) IS_CALL((NAME), 0)
#define IS_CALL_1(NAME, T1) (IS_CALL((NAME), 1) && ARG(0, T1))
#define IS_CALL_2(NAME, T1, T2) (IS_CALL((NAME), 2) && ARG(0, T1) && ARG(1, T2))

#endif