-
Notifications
You must be signed in to change notification settings - Fork 0
/
scrext.h
93 lines (62 loc) · 3.45 KB
/
scrext.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*************************************************************************************************
* Scripting language extension of Tokyo Promenade
* Copyright (C) 2008-2010 Mikio Hirabayashi
* This file is part of Tokyo Promenade.
* This program is free software: you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation, either version
* 3 of the License, or any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*************************************************************************************************/
#ifndef _SCREXT_H // duplication check
#define _SCREXT_H
/*************************************************************************************************
* configuration
*************************************************************************************************/
#include "common.h"
#if defined(_MYLUA)
#define TTLUAEXT
#else
#define TTNOEXT
#endif
/*************************************************************************************************
* pseudo API
*************************************************************************************************/
/* Initialize the scripting language extension.
The return value is the scripting object or `NULL' on failure. */
void *scrextnew(void);
/* Destroy the scripting language extension.
`scr' specifies the scripting object. */
void scrextdel(void *scr);
/* Load a script file of the scripting language extension.
`scr' specifies the scripting object.
`path' specifies the path of the initilizing script.
If successful, the return value is true, else, it is false. */
bool scrextload(void *scr, const char *path);
/* Check a function is implemented by the scripting language extension.
`scr' specifies the scripting object.
`name' specifies the name of the function to be called.
The return value is true if the function is implemented or false if not. */
bool scrextcheckfunc(void *scr, const char *name);
/* Call a function of the scripting language extension.
`scr' specifies the scripting object.
`name' specifies the name of the function to be called.
`param' specifies the paramter string.
The return value is the string of the return value or `NULL' on error.
Because the region of the return value is allocated with the `malloc' call, it should be
released with the `free' call when it is no longer in use. */
char *scrextcallfunc(void *scr, const char *name, const char *param);
/* Get the error message of the last operation of scripting language extension.
`scr' specifies the scripting object.
The return value is the error message or `NULL' if there is no error. */
const char *screxterrmsg(void *scr);
/* Set a table variable of scripting language extension.
`scr' specifies the scripting object.
`name' specifies the name of the variable.
`param' specifies the records of the table. */
void scrextsetmapvar(void *scr, const char *name, const TCMAP *params);
#endif // duplication check
// END OF FILE