- Make sure that the registration files are created whenever there's a change
- get rid of 5.0.2 stuff - add the apply_filter() API svn path=/trunk/; revision=19406
This commit is contained in:
parent
3474ea868c
commit
e23201c62a
|
@ -87,6 +87,7 @@ typedef struct _funnel_ops_t {
|
|||
void (*set_filter)(const char*);
|
||||
gboolean (*open_file)(const char* fname, const char* filter, char** error);
|
||||
void (*reload)(void);
|
||||
void (*apply_filter)(void);
|
||||
} funnel_ops_t;
|
||||
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ wslua_modules = \
|
|||
|
||||
libwslua_la_SOURCES = \
|
||||
$(wslua_modules) \
|
||||
register_wslua.c \
|
||||
init_wslua.c \
|
||||
wslua.h
|
||||
|
||||
|
@ -45,7 +46,8 @@ libwslua_la_LIBADD = @LUA_LIBS@
|
|||
|
||||
BUILT_SOURCES = \
|
||||
taps.c-inc \
|
||||
wslua_register.h
|
||||
register_wslua.c \
|
||||
declare_wslua.h
|
||||
|
||||
pkgdata_DATA = init.lua
|
||||
|
||||
|
@ -63,7 +65,8 @@ MAINTAINERCLEANFILES = \
|
|||
init.lua
|
||||
|
||||
EXTRA_DIST = \
|
||||
wslua_register.h \
|
||||
declare_wslua.h \
|
||||
register_wslua.c \
|
||||
taps \
|
||||
make-reg.pl \
|
||||
make-doc.pl \
|
||||
|
@ -86,33 +89,15 @@ taps.c-inc: make-taps.pl taps
|
|||
|
||||
taps.txt: taps.c-inc
|
||||
|
||||
wslua.h: wslua_register.h
|
||||
wslua.h: declare_wslua.h
|
||||
|
||||
# do not do not unnecessarilly modify the old file in order avoid recompiling every module every time
|
||||
wslua_register.h: make-reg.pl $(lua_modules) taps.c-inc
|
||||
$(PERL) $(srcdir)/make-reg.pl \
|
||||
wslua_tvb.c \
|
||||
wslua_proto.c \
|
||||
wslua_tree.c \
|
||||
wslua_pinfo.c \
|
||||
wslua_listener.c \
|
||||
wslua_gui.c \
|
||||
wslua_util.c \
|
||||
wslua_field.c \
|
||||
wslua_dumper.c > wslua_register.h.new ;\
|
||||
if diff wslua_register.h.new wslua_register.h >/dev/null; then rm wslua_register.h.new; else mv wslua_register.h.new wslua_register.h; fi
|
||||
register_wslua.c: declare_wslua.h
|
||||
|
||||
doc: make-doc.pl $(lua_modules)
|
||||
$(PERL) $(srcdir)/make-doc.pl \
|
||||
wslua_tvb.c \
|
||||
wslua_proto.c \
|
||||
wslua_tree.c \
|
||||
wslua_pinfo.c \
|
||||
wslua_listener.c \
|
||||
wslua_gui.c \
|
||||
wslua_util.c \
|
||||
wslua_field.c \
|
||||
wslua_dumper.c
|
||||
declare_wslua.h: make-reg.pl $(wslua_modules) taps.c-inc
|
||||
$(PERL) $(srcdir)/make-reg.pl $(wslua_modules);
|
||||
|
||||
doc: make-doc.pl $(wslua_modules)
|
||||
$(PERL) $(srcdir)/make-doc.pl $(wslua_modules)
|
||||
|
||||
dummy:
|
||||
touch dummy
|
||||
|
|
|
@ -35,28 +35,41 @@ while (<>) {
|
|||
push @functions, $1 if /WSLUA_FUNCTION\s+wslua_([a-z_]+)/;
|
||||
}
|
||||
|
||||
print "/* This file is automatically genrated by elua_makereg.pl do not edit */\n\n";
|
||||
open C, ">register_wslua.c";
|
||||
open H, ">declare_wslua.h";
|
||||
|
||||
print "#define WSLUA_DECLARE_CLASSES() \\\n";
|
||||
print H "/* This file is automatically genrated by make-reg.pl do not edit */\n\n";
|
||||
print C "/* This file is automatically genrated by make-reg.pl do not edit */\n\n";
|
||||
|
||||
print H "#define WSLUA_DECLARE_CLASSES() \\\n";
|
||||
for (@classes) {
|
||||
print "\tWSLUA_CLASS_DECLARE($_);\\\n"
|
||||
print H "\tWSLUA_CLASS_DECLARE($_);\\\n"
|
||||
}
|
||||
print "\n\n";
|
||||
print H "\n\n";
|
||||
|
||||
print "#define WSLUA_REGISTER_CLASSES() { \\\n";
|
||||
print H "#define WSLUA_DECLARE_FUNCTIONS() \\\n";
|
||||
for (@functions) {
|
||||
print H "\tWSLUA_FUNCTION wslua_$_(lua_State* L);\\\n"
|
||||
}
|
||||
print H "\n\n";
|
||||
print H "extern void wslua_register_classes(lua_State* L);\n";
|
||||
print H "extern void wslua_register_functions(lua_State* L);\n";
|
||||
print H "\n\n";
|
||||
|
||||
|
||||
print C '#include "wslua.h"' . "\n\n";
|
||||
print C "void wslua_register_classes(lua_State* L) { \n";
|
||||
for (@classes) {
|
||||
print "\t${_}_register(L);\\\n"
|
||||
print C "\t${_}_register(L);\n"
|
||||
}
|
||||
print "}\n\n";
|
||||
print C "}\n\n";
|
||||
|
||||
print "#define WSLUA_DECLARE_FUNCTIONS() \\\n";
|
||||
for (@functions) {
|
||||
print "\tWSLUA_FUNCTION wslua_$_(lua_State* L);\\\n"
|
||||
}
|
||||
print "\n\n";
|
||||
|
||||
print "#define WSLUA_REGISTER_FUNCTIONS() {\\\n";
|
||||
print C "void wslua_register_functions(lua_State* L) {\n";
|
||||
for (@functions) {
|
||||
print "\t WSLUA_REGISTER_FUNCTION($_); \\\n"
|
||||
print C "\tWSLUA_REGISTER_FUNCTION($_); \n"
|
||||
}
|
||||
print "}\n\n";
|
||||
print C "}\n\n";
|
||||
|
||||
close H;
|
||||
close C;
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include <epan/tvbparse.h>
|
||||
#include <epan/epan.h>
|
||||
|
||||
#include "wslua_register.h"
|
||||
#include "declare_wslua.h"
|
||||
|
||||
#define WSLUA_INIT_ROUTINES "init_routines"
|
||||
#define LOG_DOMAIN_LUA "wslua"
|
||||
|
@ -226,36 +226,10 @@ int dummy##C
|
|||
|
||||
#define WSLUA_INIT(L) \
|
||||
luaL_openlibs(L); \
|
||||
WSLUA_REGISTER_CLASSES(); \
|
||||
WSLUA_REGISTER_FUNCTIONS();
|
||||
wslua_register_classes(L); \
|
||||
wslua_register_functions(L);
|
||||
|
||||
|
||||
#else /* Lua 5.0 */
|
||||
|
||||
#define WSLUA_REGISTER_CLASS(C) { \
|
||||
luaL_openlib(L, #C, C ## _methods, 0); \
|
||||
luaL_newmetatable(L, #C); \
|
||||
luaL_openlib(L, 0, C ## _meta, 0); \
|
||||
lua_pushliteral(L, "__index"); \
|
||||
lua_pushvalue(L, -3); \
|
||||
lua_rawset(L, -3); \
|
||||
lua_pushliteral(L, "__metatable"); \
|
||||
lua_pushvalue(L, -3); \
|
||||
lua_rawset(L, -3); \
|
||||
lua_pop(L, 1); \
|
||||
}
|
||||
|
||||
#define WSLUA_REGISTER_META(C) luaL_newmetatable (L, #C); luaL_openlib (L, NULL, C ## _meta, 0);
|
||||
|
||||
#define WSLUA_INIT(L) \
|
||||
if ( ! L) L = lua_open(); \
|
||||
luaopen_base(L); \
|
||||
luaopen_table(L); \
|
||||
luaopen_io(L); \
|
||||
luaopen_string(L); \
|
||||
WSLUA_REGISTER_CLASSES(); \
|
||||
WSLUA_REGISTER_FUNCTIONS();
|
||||
|
||||
#endif
|
||||
|
||||
#define WSLUA_FUNCTION extern int
|
||||
|
|
|
@ -572,3 +572,25 @@ WSLUA_FUNCTION wslua_set_filter(lua_State* L) { /* set the main filter text */
|
|||
return 0;
|
||||
}
|
||||
|
||||
WSLUA_FUNCTION wslua_apply_filter(lua_State* L) { /* apply the filter in the main filter box */
|
||||
if (!ops->apply_filter) {
|
||||
WSLUA_ERROR(wslua_set_filter, "does not work on TShark");
|
||||
}
|
||||
|
||||
ops->apply_filter();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WSLUA_FUNCTION wslua_reload(lua_State* L) { /* set the main filter text */
|
||||
#define WSLUA_ARG_set_filter_TEXT 1 /* The filter's text. */
|
||||
|
||||
if (!ops->reload) {
|
||||
WSLUA_ERROR(wslua_reload, "does not work on TShark");
|
||||
}
|
||||
|
||||
ops->reload();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -504,6 +504,11 @@ static void funnel_set_filter(const char* filter_string) {
|
|||
gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), filter_string);
|
||||
}
|
||||
|
||||
static void funnel_apply_filter() {
|
||||
const char* filter_string = gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
|
||||
main_filter_packets(&cfile, filter_string, FALSE);
|
||||
}
|
||||
|
||||
/* XXX: finish this */
|
||||
static void funnel_logger(const gchar *log_domain _U_,
|
||||
GLogLevelFlags log_level _U_,
|
||||
|
@ -584,7 +589,8 @@ static const funnel_ops_t funnel_ops = {
|
|||
copy_to_clipboard,
|
||||
funnel_set_filter,
|
||||
funnel_open_file,
|
||||
funnel_reload
|
||||
funnel_reload,
|
||||
funnel_apply_filter
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ static const funnel_ops_t funnel_ops = {
|
|||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue