- Popups added to nxuilib
[public/netxms.git] / include / nxsl.h
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2005 Victor Kirhenshtein
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 **
19 ** $module: nxsl.h
20 **
21 **/
22
23 #ifndef _nxsl_h_
24 #define _nxsl_h_
25
26 #ifdef _WIN32
27 #ifdef LIBNXSL_EXPORTS
28 #define LIBNXSL_EXPORTABLE __declspec(dllexport)
29 #else
30 #define LIBNXSL_EXPORTABLE __declspec(dllimport)
31 #endif
32 #else /* _WIN32 */
33 #define LIBNXSL_EXPORTABLE
34 #endif
35
36
37 //
38 // Various defines
39 //
40
41 #define MAX_FUNCTION_NAME 64
42
43
44 //
45 // Script execution errors
46 //
47
48 #define NXSL_ERR_DATA_STACK_UNDERFLOW 1
49 #define NXSL_ERR_CONTROL_STACK_UNDERFLOW 2
50 #define NXSL_ERR_BAD_CONDITION 3
51 #define NXSL_ERR_NOT_NUMBER 4
52 #define NXSL_ERR_NULL_VALUE 5
53 #define NXSL_ERR_INTERNAL 6
54 #define NXSL_ERR_NO_MAIN 7
55 #define NXSL_ERR_CONTROL_STACK_OVERFLOW 8
56 #define NXSL_ERR_DIVIDE_BY_ZERO 9
57 #define NXSL_ERR_REAL_VALUE 10
58 #define NXSL_ERR_NO_FUNCTION 11
59 #define NXSL_ERR_INVALID_ARGUMENT_COUNT 12
60 #define NXSL_ERR_TYPE_CAST 13
61 #define NXSL_ERR_NOT_OBJECT 14
62 #define NXSL_ERR_NO_SUCH_ATTRIBUTE 15
63 #define NXSL_ERR_MODULE_NOT_FOUND 16
64 #define NXSL_ERR_NOT_STRING 17
65
66
67 //
68 // Exportable classes
69 //
70
71 #ifdef __cplusplus
72 #include <nxsl_classes.h>
73 #endif
74
75
76 //
77 // Script handle
78 //
79
80 typedef void * NXSL_SCRIPT;
81
82
83 //
84 // Functions
85 //
86
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90
91 NXSL_SCRIPT LIBNXSL_EXPORTABLE NXSLCompile(TCHAR *pszSource,
92 TCHAR *pszError, int nBufSize);
93 int LIBNXSL_EXPORTABLE NXSLRun(NXSL_SCRIPT hScript);
94 TCHAR LIBNXSL_EXPORTABLE *NXSLGetRuntimeError(NXSL_SCRIPT hScript);
95 void LIBNXSL_EXPORTABLE NXSLDestroy(NXSL_SCRIPT hScript);
96 void LIBNXSL_EXPORTABLE NXSLDump(NXSL_SCRIPT hScript, FILE *pFile);
97 TCHAR LIBNXSL_EXPORTABLE *NXSLLoadFile(TCHAR *pszFileName, DWORD *pdwFileSize);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif