summaryrefslogtreecommitdiff
path: root/src/perl/perl-core.h
blob: db607031e2fcdce441179c9c6edd392e6c61759e (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
30
31
32
33
34
35
36
37
38
#ifndef __PERL_CORE_H
#define __PERL_CORE_H

typedef struct {
	char *name; /* unique name */
        char *package; /* package name */

        /* Script can be loaded from a file, or from some data in memory */
	char *path; /* FILE: full path for file */
	char *data; /* DATA: data used for the script */
} PERL_SCRIPT_REC;

extern GSList *perl_scripts;

/* Initialize perl interpreter */
void perl_scripts_init(void);
/* Destroy all perl scripts and deinitialize perl interpreter */
void perl_scripts_deinit(void);

/* Load a perl script, path must be a full path. */
PERL_SCRIPT_REC *perl_script_load_file(const char *path);
/* Load a perl script from given data */
PERL_SCRIPT_REC *perl_script_load_data(const char *data);
/* Unload perl script */
void perl_script_unload(PERL_SCRIPT_REC *script);

/* Find loaded script by name */
PERL_SCRIPT_REC *perl_script_find(const char *name);
/* Find loaded script by package */
PERL_SCRIPT_REC *perl_script_find_package(const char *package);

/* Returns full path for the script */
char *perl_script_get_path(const char *name);

void perl_core_init(void);
void perl_core_deinit(void);

#endif