fixed makefile
[public/netxms.git] / include / nxsl.h
CommitLineData
0a145c10 1/*
cce155af 2** NetXMS - Network Management System
05b12e83 3** Copyright (C) 2003-2012 Victor Kirhenshtein
cce155af
VK
4**
5** This program is free software; you can redistribute it and/or modify
65d2c384
VK
6** it under the terms of the GNU Lesser General Public License as published by
7** the Free Software Foundation; either version 3 of the License, or
cce155af
VK
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**
65d2c384 15** You should have received a copy of the GNU Lesser General Public License
cce155af
VK
16** along with this program; if not, write to the Free Software
17** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18**
375e0736 19** File: nxsl.h
cce155af
VK
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
05b12e83
VK
36/**
37 * Various defines
38 */
b36dc6ff
VK
39#define MAX_FUNCTION_NAME 64
40
05b12e83
VK
41/**
42 * Script execution errors
43 */
64d10e08 44#define NXSL_ERR_SUCCESS 0
cd890184
VK
45#define NXSL_ERR_DATA_STACK_UNDERFLOW 1
46#define NXSL_ERR_CONTROL_STACK_UNDERFLOW 2
47#define NXSL_ERR_BAD_CONDITION 3
48#define NXSL_ERR_NOT_NUMBER 4
49#define NXSL_ERR_NULL_VALUE 5
50#define NXSL_ERR_INTERNAL 6
51#define NXSL_ERR_NO_MAIN 7
52#define NXSL_ERR_CONTROL_STACK_OVERFLOW 8
53#define NXSL_ERR_DIVIDE_BY_ZERO 9
54#define NXSL_ERR_REAL_VALUE 10
55#define NXSL_ERR_NO_FUNCTION 11
56#define NXSL_ERR_INVALID_ARGUMENT_COUNT 12
bd40de8f 57#define NXSL_ERR_TYPE_CAST 13
9e52272a
VK
58#define NXSL_ERR_NOT_OBJECT 14
59#define NXSL_ERR_NO_SUCH_ATTRIBUTE 15
2791a0c9 60#define NXSL_ERR_MODULE_NOT_FOUND 16
fa2b47a7 61#define NXSL_ERR_NOT_STRING 17
69aa75eb 62#define NXSL_ERR_REGEXP_ERROR 18
16ec9c2e 63#define NXSL_ERR_NOT_INTEGER 19
9c69cc80
VK
64#define NXSL_ERR_INVALID_OBJECT_OPERATION 20
65#define NXSL_ERR_BAD_CLASS 21
45ae7827 66#define NXSL_ERR_VARIABLE_ALREADY_EXIST 22
ffee16a5
VK
67#define NXSL_ERR_INDEX_NOT_INTEGER 23
68#define NXSL_ERR_NOT_ARRAY 24
c742e8c8 69#define NXSL_ERR_ASSIGNMENT_TO_CONSTANT 25
7eb5db40 70#define NXSL_ERR_NAMED_PARAM_REQUIERED 26
22aa5156 71#define NXSL_ERR_NOT_ITERATOR 27
05b12e83
VK
72#define NXSL_ERR_NO_STAT_DATA 28
73#define NXSL_ERR_NO_SUCH_STAT_PARAM 29
49fbe41f 74#define NXSL_ERR_NO_SUCH_METHOD 30
18321496 75#define NXSL_ERR_NO_SUCH_CONSTANT 31
f40f0e07 76#define NXSL_ERR_EXECUTION_ABORTED 32
06f09671
VK
77#define NXSL_ERR_NOT_HASHMAP 33
78#define NXSL_ERR_NOT_CONTAINER 34
79#define NXSL_ERR_KEY_NOT_STRING 35
f11423ed 80#define NXSL_ERR_NO_SELECTOR 36
25e5c41d
VK
81#define NXSL_ERR_NO_OBJECT_CONSTRUCTOR 37
82#define NXSL_ERR_INVALID_OC_ARG_COUNT 38
cd890184 83
05b12e83
VK
84/**
85 * Special return codes for external functions
86 */
ea84fc85
VK
87#define NXSL_STOP_SCRIPT_EXECUTION -1
88
57f34c0a
VK
89#ifdef __HP_aCC
90#pragma pack 1
91#else
92#pragma pack(1)
93#endif
94
95/**
96 * Serialized script header
97 */
98struct NXSL_FileHeader
99{
100 char magic[4];
101 BYTE version;
102 BYTE padding1[3];
4b47d7d7
VK
103 UINT32 codeSectionOffset;
104 UINT32 stringSectionOffset;
105 UINT32 constSectionOffset;
57f34c0a
VK
106 UINT32 moduleSectionOffset;
107 UINT32 functionSectionOffset;
4b47d7d7 108 UINT32 padding2;
57f34c0a
VK
109};
110
111#ifdef __HP_aCC
112#pragma pack
113#else
114#pragma pack()
115#endif
116
117/**
118 * Binary format version
119 */
7e32778c 120#define NXSL_BIN_FORMAT_VERSION 2
57f34c0a 121
05b12e83
VK
122/**
123 * Exportable classes
124 */
b36dc6ff
VK
125#ifdef __cplusplus
126#include <nxsl_classes.h>
375e0736
VK
127#else
128struct NXSL_Program;
b36dc6ff
VK
129#endif
130
05b12e83
VK
131/**
132 * Functions
133 */
4f0c7a63
VK
134#ifdef __cplusplus
135extern "C" {
136#endif
137
d881ea08 138NXSL_Program LIBNXSL_EXPORTABLE *NXSLCompile(const TCHAR *pszSource, TCHAR *pszError, int nBufSize, int *errorLineNumber);
6b29839d 139NXSL_VM LIBNXSL_EXPORTABLE *NXSLCompileAndCreateVM(const TCHAR *pszSource, TCHAR *pszError, int nBufSize, NXSL_Environment *env);
967893bb 140TCHAR LIBNXSL_EXPORTABLE *NXSLLoadFile(const TCHAR *pszFileName, UINT32 *pdwFileSize);
cce155af 141
4f0c7a63
VK
142#ifdef __cplusplus
143}
144#endif
cce155af
VK
145
146#endif