Added SILC Thread Queue API
[crypto.git] / apps / irssi / src / perl / perl-core.h
1 #ifndef __PERL_CORE_H
2 #define __PERL_CORE_H
3
4 typedef struct {
5         char *name; /* unique name */
6         char *package; /* package name */
7
8         /* Script can be loaded from a file, or from some data in memory */
9         char *path; /* FILE: full path for file */
10         char *data; /* DATA: data used for the script */
11 } PERL_SCRIPT_REC;
12
13 extern GSList *perl_scripts;
14
15 /* Initialize perl interpreter */
16 void perl_scripts_init(void);
17 /* Destroy all perl scripts and deinitialize perl interpreter */
18 void perl_scripts_deinit(void);
19
20 /* Load a perl script, path must be a full path. */
21 PERL_SCRIPT_REC *perl_script_load_file(const char *path);
22 /* Load a perl script from given data */
23 PERL_SCRIPT_REC *perl_script_load_data(const char *data);
24 /* Unload perl script */
25 void perl_script_unload(PERL_SCRIPT_REC *script);
26
27 /* Find loaded script by name */
28 PERL_SCRIPT_REC *perl_script_find(const char *name);
29 /* Find loaded script by package */
30 PERL_SCRIPT_REC *perl_script_find_package(const char *package);
31
32 /* Returns full path for the script */
33 char *perl_script_get_path(const char *name);
34 /* Modify the script name so that all non-alphanumeric characters are
35    translated to '_' */
36 void script_fix_name(char *name);
37
38 /* If core should handle printing script errors */
39 void perl_core_print_script_error(int print);
40
41 /* Returns the perl module's API version. */
42 int perl_get_api_version(void);
43
44 /* Checks that the API version is correct. */
45 #define perl_api_version_check(library) \
46         if (perl_get_api_version() != IRSSI_PERL_API_VERSION) { \
47                 die("Version of perl module (%d) doesn't match the " \
48                     "version of "library" library (%d)", \
49                     perl_get_api_version(), IRSSI_PERL_API_VERSION); \
50                 return; \
51         }
52
53 void perl_core_init(void);
54 void perl_core_deinit(void);
55
56 #endif