function list for C++
function list for C++
The function list and the ability to navigate up or down in a file by function is great. How about allowing these features to work with C++ operations? I assume it wouldn't be too hard since the "Functions" tagged in the navigator pane shows C and C++ routines.
I assume by this you mean the View, Next and Prevous Functions menu items. I agree entirely and personal uses this feature of Zeus most of allThe function list and the ability to navigate up or down in a file by function is great.

As you have found the Functions List does not tie up with the function navigation feature. The reasons for this are historic, and basically relate to the fact that function navigation was one of the first features added to Zeus will the ctags function list is one of the lastHow about allowing these features to work with C++ operations? I assume it wouldn't be too hard since the "Functions" tagged in the navigator pane shows C and C++ routines.

But having said that, it is also possible to re-configure Zeus to work this way

First some background. The function navigation is tied directly to the Functions Regexp found in the General of the document type Document Type. To better understand how this works try the following:
- Edit C/C++ Document type
- Gi to the General section
- Enter test as the Functions Regexp

What happens is when no Functions Regexp is defined, Zeus uses the a set of default c/c++ regexps but when a Functions Regexp is is provided these default regexps are no longer used.
So back to the original question of making these features work for operators functions. To make this work just requires the creation of a new regexp to identify functions. For most languages this is quite easy since they use some sort of function or procedure keyword but for c/c++ it is a little harder.
These are the default c/c++ Zeus regular expressions:
Code: Select all
#define REGEXP_C_FUNC_WITH_RETURN "^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$"
#define REGEXP_CPP_CTOR_OR_DTOR "^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$"
#define REGEXP_CPP_FUNC_WITH_RETURN "^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$"
Code: Select all
(^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)

Thus all that remains is to modify the regexp to also find these operation functions. Then re-edit the document type adding in the new regexp. I can not help you with this last bit since for me the regexp does find the operator function that I used as a test. But if you post a short snippet of the operator function that is failing I will post a new regexp to fix the problem.
Finally, notice how this means you could extend the function navigation to also include the header files. For example this new regexp:
Code: Select all
(^class)|(^struct)|(^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)
Cheers Jussi
Thanks for the response. I'd like to take you up on your offer. Below, the C functions init and init1 are found but their C++ counterparts are not.
Jack
void bcr_register :: init( SUPERVISOR *supervisor_ptr )
{
}
void init( SUPERVISOR *supervisor_ptr )
{
}
void bcr_register :: init1( SUPERVISOR *supervisor_ptr )
{
}
void init1( SUPERVISOR *supervisor_ptr )
{
}
Jack
void bcr_register :: init( SUPERVISOR *supervisor_ptr )
{
}
void init( SUPERVISOR *supervisor_ptr )
{
}
void bcr_register :: init1( SUPERVISOR *supervisor_ptr )
{
}
void init1( SUPERVISOR *supervisor_ptr )
{
}
If you look at the original search string:
in particular the last two parts of this search string:
you will notice the : character is defined to belong in the [:_a-z0-9&+=*<>~] set of characters. There is no space character defined for this set and hence the reason the regular expression fails to find these functions:
Adding the space character to the corresponding sets gives this regular expression:
which now finds all the functions 
Cheers Jussi
Code: Select all
(^class)|(^struct)|(^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)
Code: Select all
(^[_a-z0-9&+=*<>]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)
(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[:_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)
Code: Select all
void bcr_register :: init( SUPERVISOR *supervisor_ptr )
void bcr_register :: init1( SUPERVISOR *supervisor_ptr )
Code: Select all
(^class)|(^struct)|(^[_a-z0-9]+[ &*\t]+[_a-z0-9 \t]*[_a-z0-9]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9&+=*<>]+[ :_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)|(^[_a-z0-9]+[ <&*\t]+[_a-z0-9\t]*[_a-z0-9&+=*<> ]+[ :_a-z0-9&+=*<>~]+[ \t]*[(]+.*[^;]+$)

Cheers Jussi