← Back to team overview

kicad-developers team mailing list archive

wxwidgets regex library type dependency - Remove it?

 

Hi,

I'm packaging KiCad for GNU Guix. In the course of doing that I found that KiCad depends on specific wxwidget flags, i.e. on how exactly wxwidgets was built. (I mean that I get a KiCad compilation error complaining about "wxRE_ADVANCED" - reason see below).

We can work around that in GNU Guix but there are only a few places in KiCad where this dependency exists and so I wanted to bring it up here and see whether we could modify these parts of KiCad.

What I'm talking about is the regular expression library that wxwidgets is built to use. Wxwidgets support "advanced" regular expressions ONLY when one specific regex library was used when building wxwidgets (--with-regex), and not when the system regex library was used when building wxwidgets (--with-regex=sys).

See also https://lists.gnu.org/archive/html/guix-devel/2016-05/msg00210.html for details.

The only places where KiCad (4.0.1) uses advanced regular expressions are:

./eeschema/class_netlist_object.cpp:static wxRegEx busLabelRe( wxT( "^([^[:space:]]+)(\\[[\\d]+\\.+[\\d]+\\])$" ), wxRE_ADVANCED );
./pcbnew/dialogs/dialog_fp_lib_table.cpp:        wxRegEx re( wxT( ".*?\\$\\{(.+?)\\}.*?" ), wxRE_ADVANCED );
./pcbnew/netlist_reader.cpp:    wxRegEx reOrcad( wxT( "(?i)[ ]*\\([ \t]+{+" ), wxRE_ADVANCED );
./pcbnew/netlist_reader.cpp:    wxRegEx reLegacy( wxT( "(?i)#[ \t]+EESchema[ \t]+Netlist[ \t]+" ), wxRE_ADVANCED );
./pcbnew/netlist_reader.cpp:    wxRegEx reKicad( wxT( "[ ]*\\(export[ ]+" ), wxRE_ADVANCED );

Normal ("extended") regular expression replacements would be something like:

./eeschema/class_netlist_object.cpp:static wxRegEx busLabelRe( wxT( "^([^[:space:]]+)([[][[:digit:]]+[.]+[[:digit:]]+[]])$" ));
./pcbnew/dialogs/dialog_fp_lib_table.cpp:        wxRegEx re( wxT( ".*?[$][{](.+?)[}].*?" ));
./pcbnew/netlist_reader.cpp:    wxRegEx reOrcad( wxT( "[ ]*[(][ \t]+[{]+" ), wxRE_EXTENDED | wxRE_ICASE );
./pcbnew/netlist_reader.cpp:    wxRegEx reLegacy( wxT( "#[ \t]+EESchema[ \t]+Netlist[ \t]+" ), wxRE_EXTENDED | wxRE_ICASE );
./pcbnew/netlist_reader.cpp:    wxRegEx reKicad( wxT( "[ ]*[(]export[ ]+" ) );

If we used the latter instead, it would work with all POSIX compliant regular expression libraries.

What do you think?