Bug #10881 2007-04-13 22:23

ondra_holub

Advanced Regexes not available on some versions of wx lib

In revision 3853, file src/sdk/editormanager.cpp, method EditorManager::Replace are used advanced regular expressions - flag wxRE_ADVANCED. However this flag is available in wxWidgets library only when builtin regexes are used (configure --with-regex=bultin). Otherwise it is not compilable.

I think that either requrement to have wxWidgets library with builtin regex support should be added somewhere or the whole feature with advanced regexes should be #ifdef'ed with wxHAS_REGEX_ADVANCED.

Category
Application::WrongBehaviour
Group
 
Status
Closed
Close date
2007-06-08 09:48
Assigned to
biplab
pauliusz 2007-04-14 11:27

You can turn this feature off in Settings->Editor...->General settings->Other options->Use Advanced RegEx searches

ondra_holub 2007-04-14 18:40

Yes, it can be turned off in settings in compiled application. But non-existence of wxRE_ADVANCED causes compilation error.

pauliusz 2007-04-15 10:09

I don't see why it shouldn't compile...

In wx/regex.h:

#ifdef wxHAS_REGEX_ADVANCED

wxRE_ADVANCED = 1,

#endif

and this file includes wx/features.h:

#ifndef WX_NO_REGEX_ADVANCED

#define wxHAS_REGEX_ADVANCED

#else

#undef wxHAS_REGEX_ADVANCED

#endif

Since CB is compiled without WX_NO_REGEX_ADVANCED there will be no errors unless someone specifies this manually... I think very unlikely to happen...

pauliusz 2007-04-15 11:05

OK, I am taking my last words back :)

I am working on the patch...

stahta01 2007-04-15 11:28
Possible Quick Fix

Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp	(revision 3858)
+++ src/sdk/editormanager.cpp	(working copy)
@@ -64,6 +64,9 @@

 #include "wx/wxFlatNotebook/wxFlatNotebook.h"

+#ifndef wxHAS_REGEX_ADVANCED
+    #define wxRE_ADVANCED wxRE_EXTENDED
+#endif

 namespace compatibility { typedef TernaryCondTypedef<wxMinimumVersion<2,5>::eval, wxTreeItemIdValue, long int>::eval tree_cookie_t; };

pauliusz 2007-05-02 22:01

I think someone should apply stahta01 patch... It is the best solution so far...

stahta01 2007-05-20 19:59
Slightly simpler patch. Tim S

Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp	(revision 3858)
+++ src/sdk/editormanager.cpp	(working copy)
@@ -64,6 +64,9 @@

 #include "wx/wxFlatNotebook/wxFlatNotebook.h"

+#ifndef wxHAS_REGEX_ADVANCED
+    #define wxRE_ADVANCED 0
+#endif

 namespace compatibility { typedef TernaryCondTypedef<wxMinimumVersion<2,5>::eval, wxTreeItemIdValue, long int>::eval tree_cookie_t; };
biplab 2007-05-21 16:47

Tim, the patch will avoid compilation error. But it may create a False sense of Advanced Feature.

IMHO, it would not be a good idea to keep that option enabled if wxRE_ADVANCED is not at all available during compilation. If an user tries to use advanced regex function with wxRE_ADVANCED set to 0, the function will not work appropriately and we may see another bug report on that case.

I hope I could explain the problem.

biplab 2007-06-08 09:48

This bug is now fixed in HEAD.

Thank you for reporting it.