author | Myhailo Danylenko <isbear@ukrpost.net> |
Mon, 23 Mar 2009 05:47:09 +0200 | |
changeset 14 | 4cb715fed99b |
parent 12 | 63f06a23c235 |
child 16 | 09b375e9ce32 |
permissions | -rw-r--r-- |
0 | 1 |
|
2 |
#include <lua.h> |
|
3 |
#include <lauxlib.h> |
|
4 |
#include <loudmouth/loudmouth.h> |
|
5 |
||
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
6 |
#include "config.h" |
0 | 7 |
#include "lm_types.h" |
8 |
||
9 |
/// lm.message_node |
|
10 |
/// Object, representing xml node of the message. |
|
11 |
/// Cannot be created directly, only as a part of message tree. |
|
12 |
||
13 |
/// lm.message_node.bless |
|
14 |
/// Blesses given pointer to lm message node object. |
|
15 |
/// A: lightuserdata (C lm message node object) |
|
16 |
/// R: lm message node object |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
17 |
static int bless_lua_lm_node (lua_State *L) |
0 | 18 |
{ |
19 |
luaL_argcheck (L, lua_islightuserdata (L, 1), 1, "loudmouth message node lightuserdata expected"); |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
20 |
bless_lm_node (L, lua_touserdata (L, 1)); |
0 | 21 |
return 1; |
22 |
} |
|
23 |
||
24 |
/// message_node:name |
|
25 |
/// Gets a name of message node. |
|
26 |
/// R: string |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
27 |
int name_lm_node (lua_State *L) |
0 | 28 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
29 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
30 |
lua_pushstring (L, node->name); |
0 | 31 |
return 1; |
32 |
} |
|
33 |
||
34 |
/// message_node:next |
|
35 |
/// Gets next message node. |
|
36 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
37 |
int next_lm_node (lua_State *L) |
0 | 38 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
39 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
40 |
LmMessageNode *next = node->next; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
41 |
if (next) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
42 |
bless_lm_node (L, next); |
0 | 43 |
else |
44 |
lua_pushnil (L); |
|
45 |
return 1; |
|
46 |
} |
|
47 |
||
48 |
/// message_node:prev |
|
49 |
/// Gets previous message node. |
|
50 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
51 |
int prev_lm_node (lua_State *L) |
0 | 52 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
53 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
54 |
LmMessageNode *prev = node->prev; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
55 |
if (prev) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
56 |
bless_lm_node (L, prev); |
0 | 57 |
else |
58 |
lua_pushnil (L); |
|
59 |
return 1; |
|
60 |
} |
|
61 |
||
62 |
/// message_node:children |
|
63 |
/// Gets first child node (raw access used). |
|
14
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
64 |
/// Note: this method is deprecated and soon will be removed. |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
65 |
/// Use child without arguments instead. |
0 | 66 |
/// R: lm message node object or nil |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
67 |
int children_lm_node (lua_State *L) |
0 | 68 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
69 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
70 |
LmMessageNode *child = node->children; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
71 |
if (child) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
72 |
bless_lm_node (L, child); |
0 | 73 |
else |
74 |
lua_pushnil (L); |
|
75 |
return 1; |
|
76 |
} |
|
77 |
||
78 |
/// message_node:parent |
|
79 |
/// Gets parent message node. |
|
80 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
81 |
int parent_lm_node (lua_State *L) |
0 | 82 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
83 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
84 |
LmMessageNode *parent = node->parent; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
85 |
if (parent) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
86 |
bless_lm_node (L, parent); |
0 | 87 |
else |
88 |
lua_pushnil (L); |
|
89 |
return 1; |
|
90 |
} |
|
91 |
||
92 |
/// message_node:value |
|
93 |
/// Gets or sets a value of message node. |
|
94 |
/// A: string (optional value) |
|
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
95 |
/// R: string (if called without arguments) or lm message node object |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
96 |
int value_lm_node (lua_State *L) |
0 | 97 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
98 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 99 |
if (lua_gettop (L) > 1) { // Set |
100 |
const char *value = luaL_checkstring (L, 2); |
|
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
101 |
lm_message_node_set_value (node, value); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
102 |
lua_pop (L, 1); |
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
103 |
} else // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
104 |
lua_pushstring (L, lm_message_node_get_value (node)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
105 |
return 1; |
0 | 106 |
} |
107 |
||
108 |
/// message_node:child |
|
109 |
/// Gets or creates child node object with given name. |
|
14
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
110 |
/// If name is omitted, first child node is returned. |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
111 |
/// A: string (name, optional), string (optional value) |
0 | 112 |
/// R: lm message node object or nil |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
113 |
int child_lm_node (lua_State *L) |
0 | 114 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
115 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 116 |
LmMessageNode *child; |
14
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
117 |
int top = lua_gettop (L); |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
118 |
if (top > 1) { |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
119 |
const char *name = luaL_checkstring (L, 2); |
0 | 120 |
|
14
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
121 |
if (top > 2) // Add |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
122 |
child = lm_message_node_add_child (node, name, |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
123 |
luaL_checkstring (L, 3)); |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
124 |
else // Get |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
125 |
child = lm_message_node_get_child (node, name); |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
126 |
} else |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
127 |
child = node->children; |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
128 |
|
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
129 |
if (child) |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
130 |
bless_lm_node (L, child); |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
131 |
// XXX lm_message_node_unref (child); // may be necessary on _get/_add'ed nodes |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
132 |
else |
4cb715fed99b
Merge children and child node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
133 |
lua_pushnil (L); |
0 | 134 |
return 1; |
135 |
} |
|
136 |
||
137 |
/// message_node:find_child |
|
138 |
/// Searches for node with a given name over all node subtree. |
|
139 |
/// A: string (name) |
|
140 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
141 |
int find_child_lm_node (lua_State *L) |
0 | 142 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
143 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 144 |
const char *name = luaL_checkstring (L, 2); |
145 |
LmMessageNode *child; |
|
146 |
||
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
147 |
child = lm_message_node_get_child (node, name); |
0 | 148 |
if (!child) |
149 |
lua_pushnil (L); |
|
150 |
else { |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
151 |
bless_lm_node (L, child); |
0 | 152 |
// XXX lm_message_node_unref (child); |
153 |
} |
|
154 |
return 1; |
|
155 |
} |
|
156 |
||
157 |
/// message_node:raw |
|
158 |
/// Gets or sets raw mode flag for node. |
|
159 |
/// When set, value of node will not be escaped. |
|
160 |
/// A: boolean (optional) |
|
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
161 |
/// V: boolean (if called with no apguments) or lm message node object |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
162 |
int raw_lm_node (lua_State *L) |
0 | 163 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
164 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 165 |
if (lua_gettop (L) > 1) { // Set |
166 |
luaL_checktype (L, 2, LUA_TBOOLEAN); |
|
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
167 |
lm_message_node_set_raw_mode (node, lua_toboolean (L, 2)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
168 |
lua_pop (L, 1); |
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
169 |
} else // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
170 |
lua_pushboolean (L, lm_message_node_get_raw_mode (node)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
171 |
return 1; |
0 | 172 |
} |
173 |
||
174 |
/// message_node:attribute |
|
175 |
/// Gets or sets value of node attribute with a given name. |
|
176 |
/// A: string (name), string (optional value) |
|
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
177 |
/// R: string (when called with one aprgument) or lm message node object |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
178 |
int attribute_lm_node (lua_State *L) |
0 | 179 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
180 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 181 |
const char *name = luaL_checkstring (L, 2); |
182 |
if (lua_gettop (L) > 2) { // Set |
|
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
183 |
lm_message_node_set_attribute (node, name, luaL_checkstring (L, 3)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
184 |
lua_pop (L, 2); |
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
185 |
} else // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
186 |
lua_pushstring (L, lm_message_node_get_attribute (node, name)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
187 |
return 1; |
0 | 188 |
} |
189 |
||
190 |
/// message_node:xml |
|
191 |
/// Returns node representation in xml. |
|
192 |
/// R: string |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
193 |
int xml_lm_node (lua_State *L) |
0 | 194 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
195 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
196 |
lua_pushstring (L, lm_message_node_to_string (node)); |
0 | 197 |
return 1; |
198 |
} |
|
199 |
||
8 | 200 |
/// message_node:path |
201 |
/// Returns node with specified path to it. |
|
202 |
/// If any element in a path cannot be found, it returns nil. |
|
203 |
/// A: string (node name), ... |
|
204 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
205 |
int path_lm_node (lua_State *L) |
8 | 206 |
{ |
207 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
|
208 |
int i = 1; |
|
209 |
while (i++ < lua_gettop (L)) { |
|
210 |
node = lm_message_node_get_child (node, luaL_checkstring (L, i)); |
|
211 |
if (node == NULL) { |
|
212 |
lua_pushnil (L); |
|
213 |
return 1; |
|
214 |
} |
|
215 |
} |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
216 |
bless_lm_node (L, node); |
8 | 217 |
// XXX lm_message_node_unref (child); |
218 |
return 1; |
|
219 |
} |
|
220 |
||
0 | 221 |
/// message_node:pointer |
222 |
/// Returns pointer to underlying C structure. |
|
223 |
/// R: lightuserdata |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
224 |
static int pointer_lm_node (lua_State *L) |
0 | 225 |
{ |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
226 |
llm_node_t *object = luaL_checklm_node (L, 1); |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
227 |
lua_pushlightuserdata (L, object->node); |
0 | 228 |
return 1; |
229 |
} |
|
230 |
||
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
231 |
static int gc_lm_node (lua_State *L) |
0 | 232 |
{ |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
233 |
llm_node_t *object = luaL_checklm_node (L, 1); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
234 |
D ("Message node %X gc called", (int) object); |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
235 |
lm_message_node_unref (object->node); |
0 | 236 |
return 0; |
237 |
} |
|
238 |
||
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
239 |
static const luaL_Reg reg_f_lm_node[] = { |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
240 |
{ "bless", bless_lua_lm_node }, |
12 | 241 |
{ NULL, NULL }, |
0 | 242 |
}; |
243 |
||
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
244 |
static const luaL_Reg reg_m_lm_node[] = { |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
245 |
{ "name", name_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
246 |
{ "next", next_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
247 |
{ "prev", prev_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
248 |
{ "children", children_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
249 |
{ "parent", parent_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
250 |
{ "value", value_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
251 |
{ "child", child_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
252 |
{ "find_child", find_child_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
253 |
{ "attribute", attribute_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
254 |
{ "raw", raw_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
255 |
{ "xml", xml_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
256 |
{ "path", path_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
257 |
{ "pointer", pointer_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
258 |
{ "__gc", gc_lm_node }, |
12 | 259 |
{ NULL, NULL }, |
0 | 260 |
}; |
261 |
||
262 |
int luaopen_lm_message_node (lua_State *L) |
|
263 |
{ |
|
264 |
luaL_newmetatable (L, "loudmouth.message_node"); |
|
265 |
lua_pushstring (L, "__index"); |
|
266 |
lua_pushvalue (L, -2); |
|
267 |
lua_settable (L, -3); |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
268 |
luaL_register (L, NULL, reg_m_lm_node); |
0 | 269 |
lua_pop (L, 1); |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
270 |
luaL_register (L, "lm.message_node", reg_f_lm_node); |
0 | 271 |
return 1; |
272 |
} |
|
273 |