Functions display shows structures also

If reporting a bug with the Zeus IDE please post the details here. Please do not post questions here.
Post Reply
Jack
Posts: 27
Joined: Tue Jul 09, 2019 2:06 pm

Functions display shows structures also

Post by Jack »

The navigator tag called Functions use to show just functions in the active file. Now, in addition to functions, it also shows all the fields in structures declared at the file scope. Same problem with the FunctionFindAll macro

For example, if the file looks like this:
typedef struct struct_name
{
int var;
int var2;
} STRUCT_NAME_T

void func1( void)
{
}
void func2( void)
{
}

The functions tab looks like this
func1
func2
var1
var2
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Functions display shows structures also

Post by jussij »

To understand what is going on, first understand Zeus has two methods of generating this function information and I will describe these below.

1. Workspace Functions Panel
As the name suggests, this mode requires an open workspace. When a workspace is open Zeus automatically creates tag information for all files contained in that workspace.

For any file defined in the workspace, Zeus will use the Function tag information to populate the Functions panel.

For a workspace containing your file this result is produced:
func_ws.png
func_ws.png (34.08 KiB) Viewed 12666 times
2. Default Functions Panel
For the case where no workspace is open or the active file is not defined in that workspace, there is no tag information and for this scenario Zeus falls back to using the Function regexp define in the General section of the document type to populate this panel.

For your file used in this scenario the following results are produced:
func_default.png
func_default.png (42.37 KiB) Viewed 12666 times
NOTE: For most document types this regexp is not defined and in these cases Zeus reverts to a default function regex.

Resolving the Issue
With this information in mind, it's clear you are seeing the result of the Workspace Functions Panel scenario.

To make those results display as required you need to turn on the tag long name option which can be done by editing the general section of the editor options panel as shown below:
func_option.png
func_option.png (149.62 KiB) Viewed 12666 times
With that option enabled, the following results are produced for the Workspace Functions Panel mode:
func_long.png
func_long.png (34.31 KiB) Viewed 12666 times
Cheers Jussi
Jack
Posts: 27
Joined: Tue Jul 09, 2019 2:06 pm

Re: Functions display shows structures also

Post by Jack »

Turning on the long class names changes the format of the function display to also show function class name and structure variable's data type. It still displays the structure variables as if they are functions

While viewing this file that is in my workspace
// ***************************************************************************
typedef struct struct_tag
{
int var1;
int var2;
} TEST;

void func1( void)
{

}
void func2( void)
{

}
//***********************************************************************

I execute the FunctionFindAll macro and get this
---------------------------------------------------------------------------
Zeus IDE - Version 3.99a - Beta5
Copyright (c) Xidicone P/L 2023 All rights reserved.
---------------------------------------------------------------------------


func1
func2
var1
var2


However, if I execute the same macro on an identical file that is not in my workspace, I get the correct result
---------------------------------------------------------------------------
Zeus IDE - Version 3.99a - Beta5
Copyright (c) Xidicone P/L 2023 All rights reserved.
---------------------------------------------------------------------------


void func1( void)
void func2( void)
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Functions display shows structures also

Post by jussij »

For me, running the FunctionFindAll function displays the correct results (i.e. file open and workspace open):

Code: Select all

func1
func2
But I can replicate your issue by turning off the option shown below, doing a Tags Rebuild and then re-running the FunctionFindAll function:
func_tags.png
func_tags.png (120.28 KiB) Viewed 12653 times
That suggests to you me you have that option turned off, which means you are running the ctags program (i.e. xtags.exe) as the source of tag information.

If that is the case, this is an issue will be with the ctags program and one possible fix would be copying the xtags.exe from your old install and replacing the current xtags.exe file.

But a better option would be turning on the TSP tags options as the ctags option for tag information is a legacy feature.

Cheers Jussi

PS: For the second case of a file not in the workspace, there is no tag information available, so that FunctionFindAll function reverts to using the Function regular expression to generate the results.
Jack
Posts: 27
Joined: Tue Jul 09, 2019 2:06 pm

Re: Functions display shows structures also

Post by Jack »

Hi Jussi,

When I 1st looked at my C++ keywords tab, both TSP boxes were unchecked and I have an entry for numbers. I made my dialog matched yours and rebuilt tags, but the problem persisted. Then I checked Enable TSP for tags generation and rebuilt tags. With it checked, both function displays are now correct. I know that is the opposite of what you said, but that is how it is working for me. Thanks for the help. I would have never thought to looks at these option, not knowing what TSP is.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Re: Functions display shows structures also

Post by jussij »

I made my dialog matched yours and rebuilt tags, but the problem persisted.
That was my mistake as my post was not clear. I was showing that with this off, the problem is created.
I would have never thought to looks at these option, not knowing what TSP is.
The TSP is the Tree Sitter Parser. It is used for syntax highlighting and a replacement tag generator.

With this option off, Zeus uses the xtags.exe for tag information and hance the cause of the problem you reported is found in that xtags.exe component.

Cheers Jussi
Post Reply