diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2008-04-25 19:04:52 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2008-04-25 19:04:52 +0000 |
commit | da005d4aaf7cb123256b6f355a18967c5864fa2e (patch) | |
tree | 2025c6d79d4d2fdc0cc46d2da80bf14a131ac56f /epan/wslua | |
parent | a923b5491c90bd15ec4a81d885b3a66e94b3f0c7 (diff) |
From Márton Németh:
Cleanup ident of epan/wslua/init_wslua.c: use spaces instead of tabs.
cleanup the ident of generator scripts and for template-init.lua
Spaces used instead of tabs for indent. Removed spaces placed by generator
script just before a newline.
svn path=/trunk/; revision=25176
Diffstat (limited to 'epan/wslua')
-rw-r--r-- | epan/wslua/init_wslua.c | 50 | ||||
-rwxr-xr-x | epan/wslua/make-init-lua.pl | 36 | ||||
-rw-r--r-- | epan/wslua/template-init.lua | 8 |
3 files changed, 47 insertions, 47 deletions
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c index 790ea22190..79c7d07769 100644 --- a/epan/wslua/init_wslua.c +++ b/epan/wslua/init_wslua.c @@ -55,10 +55,10 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { lua_pinfo = pinfo; lua_tvb = tvb; - lua_tree = ep_alloc(sizeof(struct _wslua_treeitem)); - lua_tree->tree = tree; - lua_tree->item = proto_tree_add_text(tree,tvb,0,0,"lua fake item"); - PROTO_ITEM_SET_HIDDEN(lua_tree->item); + lua_tree = ep_alloc(sizeof(struct _wslua_treeitem)); + lua_tree->tree = tree; + lua_tree->item = proto_tree_add_text(tree,tvb,0,0,"lua fake item"); + PROTO_ITEM_SET_HIDDEN(lua_tree->item); /* * almost equivalent to Lua: @@ -92,9 +92,9 @@ int dissect_lua(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree) { if (lua_isnumber(L, -1)) { consumed_bytes = (int) lua_tonumber(L, -1); lua_pop(L, 1); /* pop returned value */ + } } - } - + } else { proto_item* pi = proto_tree_add_text(tree,tvb,0,0,"Lua Error: did not find the %s dissector" " in the dissectors table",pinfo->current_proto); @@ -160,7 +160,7 @@ static int init_error_handler(lua_State* LS) { static void wslua_init_routine(void) { - static gboolean initialized = FALSE; + static gboolean initialized = FALSE; if ( ! initialized ) { lua_prime_all_fields(NULL); @@ -227,8 +227,8 @@ static void basic_logger(const gchar *log_domain _U_, } static int wslua_panic(lua_State* LS) { - g_error("LUA PANIC: %s",lua_tostring(LS,-1)); - return 0; + g_error("LUA PANIC: %s",lua_tostring(LS,-1)); + return 0; } int wslua_init(lua_State* LS) { @@ -244,16 +244,16 @@ int wslua_init(lua_State* LS) { G_LOG_LEVEL_DEBUG, ops ? ops->logger : basic_logger, NULL); - if (!L) { - if (LS) - L = LS; - else - L = luaL_newstate(); - } + if (!L) { + if (LS) + L = LS; + else + L = luaL_newstate(); + } - WSLUA_INIT(L); + WSLUA_INIT(L); - lua_atpanic(L,wslua_panic); + lua_atpanic(L,wslua_panic); /* the init_routines table (accessible by the user) */ lua_pushstring(L, WSLUA_INIT_ROUTINES); @@ -265,7 +265,7 @@ int wslua_init(lua_State* LS) { lua_dissectors_table_ref = luaL_ref(L, LUA_REGISTRYINDEX); /* set running_superuser variable to it's propper value */ - WSLUA_REG_GLOBAL_BOOL(L,"running_superuser",started_with_special_privs()); + WSLUA_REG_GLOBAL_BOOL(L,"running_superuser",started_with_special_privs()); /* load system's init.lua */ filename = get_datafile_path("init.lua"); @@ -282,10 +282,10 @@ int wslua_init(lua_State* LS) { lua_gettable(L, LUA_GLOBALSINDEX); if (lua_isboolean(L,-1) && lua_toboolean(L,-1)) { - /* disable lua */ - lua_close(L); - L = NULL; - return 0; + /* disable lua */ + lua_close(L); + L = NULL; + return 0; } /* check whether we should run other scripts even if running superuser */ @@ -303,8 +303,8 @@ int wslua_init(lua_State* LS) { if (( file_exists(filename))) { lua_load_script(filename); - g_free(filename); - filename = NULL; + g_free(filename); + filename = NULL; } while((filename = (gchar *)ex_opt_get_next("lua_script"))) { @@ -331,7 +331,7 @@ int wslua_init(lua_State* LS) { lua_data_handle = find_dissector("data"); lua_malformed = proto_get_id_by_filter_name("malformed"); - Proto_commit(L); + Proto_commit(L); return 0; } diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl index 7bf6fb3069..8ca9773eeb 100755 --- a/epan/wslua/make-init-lua.pl +++ b/epan/wslua/make-init-lua.pl @@ -42,9 +42,9 @@ my $menu_groups = ''; my %replacements = %{{ WTAP_ENCAPS => \$wtap_encaps_table, FT_TYPES => \$ft_types_table, - BASES => \$bases_table, - EXPERT => \$expert_pi, - MENU_GROUPS => \$menu_groups, + BASES => \$bases_table, + EXPERT => \$expert_pi, + MENU_GROUPS => \$menu_groups, }}; @@ -106,31 +106,31 @@ my $base_num = 0; open PROTO_H, "< $WSROOT/epan/proto.h" or die "cannot open '$WSROOT/epan/proto.h': $!"; while(<PROTO_H>) { - if (/^\s+BASE_([A-Z_]+),/ ) { - $bases_table .= "\t[\"$1\"] = $base_num,\n"; - $base_num++; - } - - if ( /^.define\s+(PI_[A-Z_]+)\s+((0x)?[0-9A-Fa-f]+)/ ) { - my ($name, $value) = ($1, hex($2)); - $expert_pi .= "$name = $value\n"; - } + if (/^\s+BASE_([A-Z_]+),/ ) { + $bases_table .= "\t[\"$1\"] = $base_num,\n"; + $base_num++; + } + + if ( /^.define\s+(PI_[A-Z_]+)\s+((0x)?[0-9A-Fa-f]+)/ ) { + my ($name, $value) = ($1, hex($2)); + $expert_pi .= "$name = $value\n"; + } } close PROTO_H; # register_stat_group_t -$menu_groups .= "-- menu groups for register_menu \n"; +$menu_groups .= "-- menu groups for register_menu\n"; my $menu_i = 0; open STAT_MENU, "< $WSROOT/stat_menu.h" or die "cannot open '$WSROOT/stat_menu.h': $!"; while(<STAT_MENU>) { - if (/REGISTER_([A-Z]+)_GROUP_([A-Z]+)/) { - $menu_groups .= "MENU_$1_$2 = $menu_i\n"; - $menu_groups =~ s/_NONE//; - $menu_i++; - } + if (/REGISTER_([A-Z]+)_GROUP_([A-Z]+)/) { + $menu_groups .= "MENU_$1_$2 = $menu_i\n"; + $menu_groups =~ s/_NONE//; + $menu_i++; + } } close STAT_MENU; diff --git a/epan/wslua/template-init.lua b/epan/wslua/template-init.lua index ad40451b7f..2c66cb60d4 100644 --- a/epan/wslua/template-init.lua +++ b/epan/wslua/template-init.lua @@ -6,7 +6,7 @@ -- It can be used to load libraries, disable functions and more. -- -- $Id$ --- +-- -- Wireshark - Network traffic analyzer -- By Gerald Combs <gerald@wireshark.org> -- Copyright 1998 Gerald Combs @@ -36,8 +36,8 @@ run_user_scripts_when_superuser = false -- disable potentialy harmful lua functions when running superuser if running_superuser then - local disabled_lib = {} - setmetatable(disabled_lib,{ __index = function() error("this package has been disabled") end } ); + local disabled_lib = {} + setmetatable(disabled_lib,{ __index = function() error("this package has been disabled") end } ); dofile = function() error("dofile has been disabled") end loadfile = function() error("loadfile has been disabled") end @@ -52,7 +52,7 @@ end -- has been suppresed so that it yields an error. -- have print() call info() instead. if gui_enabled() then - print = info + print = info end -- %WTAP_ENCAPS% |