diff --git a/doc/README.wslua b/doc/README.wslua index d8b1e36a82..c96a4f4be4 100644 --- a/doc/README.wslua +++ b/doc/README.wslua @@ -48,7 +48,7 @@ epan/wslua/CMakeLists.txt. You also have to add the module name into docbook/user-guide.xml and docbook/wsluarm.xml, and the source files into docbook/CMakeLists.txt, to get it to be generated in the user guide. -Another Perl script is used as well, called 'make-init-lua.pl', which +Another Python3 script is used as well, called 'make-init-lua.py', which generates the init.lua script. A large part of it deals with exposing #define values into the Lua global table, or sub-tables. Unfortunately not all of them are put in sub-tables, which means the global Lua table is quite polluted @@ -59,7 +59,7 @@ all have a common 'PI_' prefix should be an indicator they can be put in a table named PI, or PacketInfo. Just because C-code doesn't have namespaces, doesn't mean Lua can't. This has now been fixed, and the PI_* names are now in two separate subtables of a table named 'expert', as 'expert.group' and -'expert.severity' subtables. Follow that model in 'make-init-lua.pl'. +'expert.severity' subtables. Follow that model in 'make-init-lua.py'. Due to those documentation and registration scripts, you MUST follow some very diff --git a/epan/proto.h b/epan/proto.h index 6854ed8247..2f2f675e58 100644 --- a/epan/proto.h +++ b/epan/proto.h @@ -362,7 +362,7 @@ void proto_report_dissector_bug(const char *format, ...) * bit, required for FT_UINT_STRING and for UCS-2 and UTF-16 strings) * and the bottom bit (which we ignore for now so that programs that * pass TRUE for the encoding just do ASCII). (The encodings are given - * directly as even numbers in hex, so that make-init-lua.pl can just + * directly as even numbers in hex, so that make-init-lua.py can just * turn them into numbers for use in init.lua.) * * We don't yet process ASCII and UTF-8 differently. Ultimately, for @@ -655,7 +655,7 @@ void proto_report_dissector_bug(const char *format, ...) #define FIELD_DISPLAY_E_MASK 0xFF /* - * Note that this enum values are parsed in make-init-lua.pl so make sure + * Note that this enum values are parsed in make-init-lua.py so make sure * any changes here still makes valid entries in init.lua. * XXX The script requires the equals sign. */ @@ -896,7 +896,7 @@ typedef proto_node proto_item; * the bottom up. */ -/* do not modify the PI_SEVERITY_MASK name - it's used by make-init-lua.pl */ +/* do not modify the PI_SEVERITY_MASK name - it's used by make-init-lua.py */ /* expert severities */ #define PI_SEVERITY_MASK 0x00F00000 /**< mask usually for internal use only! */ /** Packet comment */ @@ -910,7 +910,7 @@ typedef proto_node proto_item; /** Serious problems, e.g. a malformed packet */ #define PI_ERROR 0x00800000 -/* do not modify the PI_GROUP_MASK name - it's used by make-init-lua.pl */ +/* do not modify the PI_GROUP_MASK name - it's used by make-init-lua.py */ /* expert "event groups" */ #define PI_GROUP_MASK 0xFF000000 /**< mask usually for internal use only! */ /** The protocol field has a bad checksum, usually uses PI_WARN severity */ diff --git a/epan/stat_groups.h b/epan/stat_groups.h index e58bb34603..e9d9a8ab64 100644 --- a/epan/stat_groups.h +++ b/epan/stat_groups.h @@ -26,7 +26,7 @@ extern "C" { * XXX - stats should be able to register additional menu groups, although * the question then would be "in what order should they appear in the menu?" * - * NOTE: the enum below is parsed by epan/wslua/make-init-lua.pl in order + * NOTE: the enum below is parsed by epan/wslua/make-init-lua.py in order * to generate usable values for Lua scripts to use, so they can add to * the menus in the GUI. The perl script's regex is such that the following * prefixes must only appear once in this list: @@ -42,7 +42,7 @@ extern "C" { */ /*! Statistics groups. Used for UI menu layout. */ -/* This is parsed by make-init-lua.pl, so we can't do anything fancy here. */ +/* This is parsed by make-init-lua.py, so we can't do anything fancy here. */ typedef enum register_stat_group_e { REGISTER_PACKET_ANALYZE_GROUP_UNSORTED, /*!< Unsorted packet analysis */ REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER, /*!< Conversation filters. Unused? */ diff --git a/epan/wslua/CMakeLists.txt b/epan/wslua/CMakeLists.txt index ee93c7a6a4..239bd8009d 100644 --- a/epan/wslua/CMakeLists.txt +++ b/epan/wslua/CMakeLists.txt @@ -104,13 +104,12 @@ add_custom_command( add_custom_command( OUTPUT init.lua - COMMAND ${PERL_EXECUTABLE} - ${CMAKE_CURRENT_SOURCE_DIR}/make-init-lua.pl - ${CMAKE_SOURCE_DIR} + COMMAND ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/make-init-lua.py ${CMAKE_CURRENT_SOURCE_DIR}/template-init.lua - > init.lua + init.lua DEPENDS - ${CMAKE_CURRENT_SOURCE_DIR}/make-init-lua.pl + ${CMAKE_CURRENT_SOURCE_DIR}/make-init-lua.py ${CMAKE_CURRENT_SOURCE_DIR}/template-init.lua ${CMAKE_SOURCE_DIR}/epan/ftypes/ftypes.h ${CMAKE_SOURCE_DIR}/wiretap/wtap.h diff --git a/epan/wslua/make-init-lua.pl b/epan/wslua/make-init-lua.pl deleted file mode 100755 index c5974d7067..0000000000 --- a/epan/wslua/make-init-lua.pl +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/perl -# -# make-init-lua.pl -# -# create the init.lua file based on a template (stdin) -# -# (c) 2006, Luis E. Garcia Onatnon -# -# Wireshark - Network traffic analyzer -# By Gerald Combs -# Copyright 2004 Gerald Combs -# -# SPDX-License-Identifier: GPL-2.0-or-later - -use strict; - -my $WSROOT = shift; - -die "'$WSROOT' is not a directory" unless -d $WSROOT; - -my $wtap_encaps_table = ''; -my $wtap_tsprecs_table = ''; -my $wtap_commenttypes_table = ''; -my $ft_types_table = ''; -my $frametypes_table = ''; -my $wtap_rec_types_table = ''; -my $wtap_presence_flags_table = ''; -my $bases_table = ''; -my $encodings = ''; -my $expert_pi = ''; -my $expert_pi_tbl = ''; -my $expert_pi_severity = ''; -my $expert_pi_group = ''; -my $menu_groups = ''; - -my %replacements = %{{ - WTAP_ENCAPS => \$wtap_encaps_table, - WTAP_TSPRECS => \$wtap_tsprecs_table, - WTAP_COMMENTTYPES => \$wtap_commenttypes_table, - FT_TYPES => \$ft_types_table, - FT_FRAME_TYPES => \$frametypes_table, - WTAP_REC_TYPES => \$wtap_rec_types_table, - WTAP_PRESENCE_FLAGS => \$wtap_presence_flags_table, - BASES => \$bases_table, - ENCODINGS => \$encodings, - EXPERT => \$expert_pi, - EXPERT_TABLE => \$expert_pi_tbl, - MENU_GROUPS => \$menu_groups, -}}; - - -# -# load template -# -my $template = ''; -my $template_filename = shift; - -open TEMPLATE, "< $template_filename" or die "could not open '$template_filename': $!"; -$template .= $_ while(