References

Post any comments, suggestions, annoyances or ideas for future releases here. Please do not post bug reports or questions here.
Post Reply
pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

References

Post by pwdiener » Sat Aug 11, 2007 10:23 pm

Jussi,

Some time ago, someone requested a facility in Zeus to find references. http://www.zeusedit.com/forum/viewtopic.php?t=739. I've also asked for a Find All features, mostly to find references in the current document. The grep solution works well, and creating a macro to do it helps even more, but it seems to me that this could still be improved.

As you comment in the topic above, it should be possible to integrate an xref tool into Zeus - unfortunately, I haven't found one yet at a price I'm willing to pay (not much). However, for COBOL at least, I think I could put one tegether pretty easily. Another possibility is to use the compiler's XREF output.

Here's what I'd like to see:

Use a database similar to the tags DB to store references as well. The content would be the name and where it's defined, possibly the type of definition. This would be followed by a list of references with where it's used. Having the ability to store a reference "type" would also be very useful - could be used for referenced, tested, modified, etc. - any type of usage that makes sense and can be derived by a tool.

Use a function similar to "show definition" to show references - bring up a list of references the same way "go to definition" does with tags - if there's only 1, just go there. Obviously, you could go to any item on the list. The only significant difference would be to display the reference type also.

I think you told me in a different conversation that the tags database has a reference type that wasn't used currently. If you had a way to populate them, could this be used to do the job? If the tag process could be extended (externally) to also provide reference data, that would provide a very useful capability.

A side note - to an old mainframe programmer, the tags facility is just awesome. However, after using it a while, I find myself wishing for a "Back" button like in a browser. If I remember properly, Brief used to provide something like this with a push/pop cursor command, but I haven't seen this is Zeus. In any event, it'd be very nice to have it automated to come back from definitions, references, finds, etc.

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Sun Aug 12, 2007 11:56 pm

Hi Bill,
Another possibility is to use the compiler's XREF output.
This is the solution I would also recommend. It should be easy enough the search the compiler XREF output using a grep tool and have the results displayed in Zeus.

Do you have an example of the compiler's XREF output :?:
Use a database similar to the tags DB to store references as well.

The difficulty is not so much in creating the database, but more in defining the source of the XREF data.

If the ctags.exe provides a XREF option then this might be one possibility :?
I think you told me in a different conversation that the tags database has a reference type that wasn't used currently. If you had a way to populate them, could this be used to do the job?

While this would require a fair amount of code to be added to Zeus to manage, display and navigatie this reference information, it should definitely be possible ;)
If the tag process could be extended (externally) to also provide reference data, that would provide a very useful capability.

This is critical part. As Zeus will have to parse this XREF information there needs to be some sort of standard XREF data format.

Since Zeus can currently parse the ctags format it would be best if this XREF information is also in ctags format.
However, after using it a while, I find myself wishing for a "Back" button like in a browser.
You might be able to use these Zeus keyboard functions WindowNextFocus, WindowPreviousFocus which are described here:

http://www.zeusedit.com/forum/viewtopic ... wnextfocus

Alternatively there are also the TagsSearchRedo, TagsSearchUndo keyboard functions ;)

Cheers Jussi

pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

References

Post by pwdiener » Tue Aug 14, 2007 3:07 am

Jussi,

I'll check out the keyboard functions you mentioned - I've used the WindowPreviousFocus (I assume) - it works well when the tag is defined in a different file, not so well when in the same file. Another issue is that it would be nice to have a stack of "back" points. I haven't had a chance to check out the TagSearchUndo function yet.

What I had in mind for references was to provide a reference file in ctags format. That would eliminate your needing to parse a new file format. This seemed relatively easy until I looked at the compiler output a little more. The XREF consists of the listing line number where a symbol is defined, with reference listing line numbers following. The problem is that the listing line number bears only a passing relationship to the source file line number. First, this compiler only numbers executable lines - worse, it claims to number statements, where a single line can contain more than 1 statement. Second, it numbers lines from COPY files (files copied in to the program for compilation). This certainly makes the job a bit more complex, since it would obviously be nice to have accurate line numbers that refer to the (or a) source file. I don't think this is an insurmountable obstacle, but it does make life a little more interesting.

How does Zeus locate a tag definition - using the line number or with the tag file pattern field? What does the inherit field do? How about attribute? Are these fields used in the class browser? Since I've been working mostly in COBOL so far, I haven't seen where these might show up yet.

I thought of another useful capability when displaying references - it would be nice to see file (the active document), project (any file in the workspace), or global (any available reference/tag DB) references selectively.

I'll keep you posted on my progress in producing an XREF file file when I make any.

Bill

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Tue Aug 14, 2007 3:37 am

Hi Bill,
Another issue is that it would be nice to have a stack of "back" points. I haven't had a chance to check out the TagSearchUndo function yet.

The TagSearchUndo, TagSearchRedo functions hold the "tag points" in a stack so you should be able to move back and forth at will ;)
This seemed relatively easy until I looked at the compiler output a little more.
I looked at the ctags and unfortunately it does not produce XREF information :(

I think the reference tag item that is currently in Zeus was never actually used, but instead was added just in case :?
How does Zeus locate a tag definition - using the line number or with the tag file pattern field?

Zeus uses the line number and file name. The pattern is used in things like the function tooltip and class browser display.
What does the inherit field do?

The inherit field shows that the class was inherited from some other base class. Zeus will display the class details and the details of it's inherited base class.
How about attribute?

The attribute contains the timestamp of the file. Zeus uses this value to check if the file needs to be re-tagged.
Are these fields used in the class browser?

The type, name and pattern are the details displayed in the class browser.

The pattern is displayed if the Options, Editor Options, Use class browser long names options is checked.
I thought of another useful capability when displaying references - it would be nice to see file (the active document), project (any file in the workspace), or global (any available reference/tag DB) references selectively.

With a suitable reference source the file and global views would happen automatically ;)

For example, currently all the tag information shown above the Project Files folder represents a global or workspace view while at the Project Files level the tag information is grouped by file.

Cheers Jussi

pwdiener
Posts: 134
Joined: Wed Jul 11, 2007 3:45 pm

TagSearchUndo

Post by pwdiener » Tue Aug 14, 2007 9:53 pm

Jussi,

In some brief testing of TagSearchUndo, it appears to work if there is only a single definition of the tag in the database. When there are multiple definitions, the list of definitions comes up and allows you to choose. After doing that, TagSearchUndo does not appear to work.

Am I doing something wrong?

Bill

jussij
Site Admin
Posts: 2449
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Tue Aug 14, 2007 11:07 pm

The TagSearchUndo function pre-dates the tag search results dialog so it is probably a bug :(

But it should be easy enough to fix ;)

Cheers Jussi

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: Google [Bot] and 3 guests