4 # Registration Macros Generator
6 # (c) 2006, Luis E. Garcia Onatnon <luis.ontanon@gmail.com>
10 # Wireshark - Network traffic analyzer
11 # By Gerald Combs <gerald@wireshark.org>
12 # Copyright 1998 Gerald Combs
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 push @classes, $1 if /WSLUA_CLASS_DEFINE\050\s*([A-Za-z0-9]+)/;
35 push @functions, $1 if /WSLUA_FUNCTION\s+wslua_([a-z_0-9]+)/;
38 open C
, ">register_wslua.c";
39 open H
, ">declare_wslua.h";
41 print H
"/* This file is automatically genrated by make-reg.pl do not edit */\n\n";
42 print C
"/* This file is automatically genrated by make-reg.pl do not edit */\n\n";
44 print H
"#define WSLUA_DECLARE_CLASSES() \\\n";
46 print H
"\tWSLUA_CLASS_DECLARE($_);\\\n"
50 print H
"#define WSLUA_DECLARE_FUNCTIONS() \\\n";
52 print H
"\tWSLUA_FUNCTION wslua_$_(lua_State* L);\\\n"
55 print H
"extern void wslua_register_classes(lua_State* L);\n";
56 print H
"extern void wslua_register_functions(lua_State* L);\n";
59 print C
'#include "config.h"' . "\n";
61 print C
'#include "wslua.h"' . "\n\n";
62 print C
"static void wslua_reg_module(lua_State* L, const char *name, lua_CFunction func) { \n";
63 print C
"\tlua_pushcfunction(L, func);\n";
64 print C
"\tlua_pushstring(L, name);\n";
65 print C
"\tlua_call(L, 1, 0);\n";
67 print C
"void wslua_register_classes(lua_State* L) { \n";
69 print C
"\twslua_reg_module(L, \"${_}\", ${_}_register);\n";
71 print C
"\twslua_reg_module(L, \"bit\", luaopen_bit);\n";
75 print C
"void wslua_register_functions(lua_State* L) {\n";
77 print C
"\tWSLUA_REGISTER_FUNCTION($_); \n"