Topic: Ctags.vdm and utags.vdm updated (1 of 7), Read 50 times, 2 File Attachments
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Wednesday, August 30, 2006 02:27 PM

CTAGS.VDM and UTAGS.VDM have the same problem with CUR_DIR that I mentioned in
my message about SEARCH_INC.VDM. CUR_DIR usually has wrong value, and
therefore TAGS file is not found.

I have now implemented into UTAGS.VDM the same search algorithm as in
SEARCH_INC.VDM. TAGS file is first searched from current file's directory,
then parent directories and finally from "current directory".
If you put TAGS into the root of your project's directory tree, it is always

CTAGS.VDM earlier stored TAGS into "current directory". It is difficult to
change the current directory in order to choose TAGS location.
I have now changed ctags.vdm so that TAGS file is stored into current file's
directory. So, you can choose the directory by opening a file from that
directory. (Maybe in the future, we can use "project home directory".)

Another change I made in ctags.vdm is that now it skips comments.
In some projects, the C files have been documented such way that there are
function names and parameters in comment block. The old ctags.vdm found those
comments instead of the actual function definition.
After this change, the actual function definition is found.

The modified files enclosed.



Topic: Ctags.vdm and utags.vdm updated (2 of 7), Read 40 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Friday, March 23, 2007 12:17 PM

I have made new versions of macros CTAGS.VDM and UTAGS.VDM.

CTAGS.VDM now supports Windows.
Instead of answering series of questions in text mode, you can now input the options using a dialog box.

The base directory for source files can now be set by using input box or Browse button. No need to do tricks to select correct directory any more.
Default value for the base directory is current files directory.

Directory for TAGS file can now be selected independently of the base directory, by using an input box or "Tags Dir" button. This way you can easily input files from different directories into the same TAGS file.
When ctags.vdm starts, it searches for TAGS file from current file's directory and it's parent directories. If found, that is used by default (but you can change it, of course). If not found, current file's dir is set as default.

You can append to existing TAGS file by checking a tickbox. If TAGS file was not found, the tickbox is grayed.

Type of patterns to recognize is selected using radio buttons.

After you have done your selections, click the button "Add files to TAGS" or press Enter.

If you selected "Symbol recognition pattern", another dialog box opens for entering the pattern.
After that, the processing begins.

After all the files have been processed, the main dialog box opens again.
Number of functions and files added to TAGS database are displayed at the bottom of dialog.
You can then continue to add more files (Append tickbox is now automatically ticked.)

After you have finished adding files to TAGS, click "Cancel" or press Esc.

Ctags.vdm still supports DOS Vedit, too. If you run the macro from DOS version, the old text mode user interface is used.
You can force text mode user interface in Windows version (perhaps to automate your work by using input redirection) by calling label DOS_MODE, e.g.

vpw -c'Call_File(100,"ctags.vdm","DOS_MODE")'

Other changes:
- Open files in Browse mode for faster execution
- Disable Undo during macro execution (avoid "can't undo" prompt, faster execution)
- Keep file list in edit buffer to allow unlimited size, do not convert it into a macro.
- Fix: In user pattern search, advance position after search (caused infinite loop)
(I wonder if anybody has ever used "Symbol recognition pattern" option, since it didn't work?)

In addition, there is the enhancement I published earlier: if function definition is found inside a comment, it is not included in TAGS.
Previous version (2006-08-03) had a bug: sequence //* was interpreted as block comment. This has now been fixed.


Utags.vdm now has multi-level return function.
Each time you jump to function definition using utags.vdm, the original location is stored in file utag_stack.tmp.
You can then return to original location by calling label GO_BACK. There is no limit in how many levels of return can be stored in the file.

In old utags.vdm, there was the option #60=3 that reconfigured F12 for return and displayed help window on bottom of screen. The macro was kind of left open and you could not search for more function definitions.
Now that is not needed, you can continue normal editing. At any point you can search for next function definition or return to previous location.
However, the #60 option is still there. If you set #60=3, key combination Ctrl-Shft-F12 is configured for return operation and help window is displayed on bottom of screen.
When you have returned all levels and there are no more return items in the stack, the window is closed.

However, I recommend that you add the return function in User menu, and configure keys to use User menu items. Then #60=3 is not needed.
I have the following lines in my C-User.mnu:
Return from Ctags file
#124=Reg_Free Call_File(#124,"utags.vdm","GO_BACK") Reg_Empty(#124)

I have configured the following keys:
Ctrl-F12 = User -> Lookup in Ctags
Ctrl-Shft-F12 = User -> Return from Ctags file

Other changes:
- Uses only free T-Regs.
- Function name may contain optional '_' at the beginning. If you have function call foo() in C file, label _foo in asm file is found, too. (C compilers usually add _ at the beginning of identifiers when compiling to assembly language.)
- Use any small block as function name. This allows you to specify exactly what you are searching for.
- Use color on status line to make error messages more noticeable.

In addition, there is the enhancement I published earlier: TAGS file is searched from current file's dir and all it's parent dirs.

Files ctags.vdm and utags.vdm are included in the .zip file:


ctags.vdm + utags.vdm


Topic: Ctags.vdm and utags.vdm updated (3 of 7), Read 36 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Wednesday, May 02, 2007 11:58 AM

Here are updated versios of CTAGS and UTAGS macros I posted a few weeks ago.
They contain the following changes:

CTAGS.VDM (v2.1):

You can now add Macros and Constants (#define) in the TAGS, in addition to functions.

On the dialog, the "Pattern to recognize" selection is now called "Language" (C, Asm, Fortran, Symbol r.p.).
New tickboxes allow you to select any combination of: Functions, Macros and Constants.
For C, all the three item types are supported. For Asm, only Functions and Macros are supported. For Fortran, only Functions are supported.

Adding macros to TAGS is useful, since often macros look like functions in source code, but the old ctags did not find them.
Adding constants may be useful, too, but that usually increases TAGS file size quite a lot.

Normally, you probably should only add macros and constants from .h files, since macros and constants inside .c source files are not visible to other .c files.

Other changes:

Improved C "whittling" submacro. It now checks for '{' after finding ')' followed by end-of-line. Previously, for example a macro call without ';', such as
DEBUG_MESSAGE("This is a test")
was identified as function definition.

Fix on comment skipping: did not recognize comment immediately at the beginning of file.


Now supports multiple copies of each function/macro/constant in TAGS.

You may have multiple copies of the same function in your TAGS file for example if you have multiple versions of the same file in your directory tree, or multiple versions of the same function selected with #if (conditional compilation).

Old Utags only displayed the first occurrence. Now, if there are multiple occurrences, Utags displays e.g. "Match 1 of 3" on status line.
You can then call Utags again to show the next occurrence, and so on (the cursor must be on the function name, of course). After the last occurrence is displayed, the first occurrence is displayed again.


ctags.vdm and utags.vdm


Topic: Ctags.vdm and utags.vdm updated (4 of 7), Read 28 times, 2 File Attachments
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Tuesday, December 04, 2007 04:24 AM

Here are new versions of CTAGS.VDM and UTAGS.VDM.
They contain the following changes:


Ctags.ini file is now stored in the same directory as TAGS database.
(TAGS file is searched from current file's directory and it's parent directories, as before.)
This allows you to have different configuration for each project, and the settings stored match the actual TAGS database.

The last settings are still stored in the USER-MACRO directory, too. When you start ctags.vdm, it first searches the .ini file from the TAGS directory. If not found, it uses the file stored in USER-MACRO directory.

Ctags.ini file now stores all the settings used for creating the tags database. That is, if you append files to TAGS from several directory trees, or process different file types (.c, .h, .asm etc.), all the settings are stored. When you start ctags.vdm next time, the first settings used for creating the TAGS database are loaded by default (instead of the last settings), so you can more easily repeat the process from the beginning.
(The ctags.ini in user-macro directory only contains the last settings, as in earlier versions.)

You can process files with the old settings by just pressing Enter, or you can change the settings first.
After you have run the first set, the next set of options is automatically fetched from ctags.ini.
You can re-create the TAGS database step by step by just pressing Enter a few times.
When all the settings in .ini file have been processed, the settings do not change any more, [Cancel] button changes into [Exit], and the message "Click [Exit] to finish adding files" is displayed on the dialog.

Ctags.vdm now supports batch processing.
Click the [Batch] button to open Batch Processing dialog. You can then select the file that contains the settings. Default is the ctags.ini file stored in the directory that contains TAGS database. Therefore, to re-build TAGS database with same settings as before you only need to press Enter.

You can select batch processing mode directly when calling ctags.vdm (for example from the User menu).
Call label BATCH_AUTO to run batch processing with the default ctags.ini file.
Call label BATCH_SET to select another .ini file. In this case, the filename must be given in text register 40.


RS(40,"c:\projecs\gizmo\ctag1.ini") Call_File(100,"ctags.vdm","BATCH_SET")

Or, you can call ctags.vdm from DOS command line or .BAT file.

c:\vedit\vpw -q -c'Call_File(100,"ctags.vdm","BATCH_AUTO")'
c:\vedit\vpw -q -c'RS(40,"ctag1.ini") Call_File(100,"ctags.vdm","BATCH_SET")'

If the -q option is given, ctags.vdm runs quietly without displaying anything. When done, Vedit is closed.
If the -q option is not given, the filenames are displayed while processing as normally. When done, ctags.vdm dialog box says open displaying the number of items found.

Added online help to ctags.vdm, using Windows HTML Help.
Click [Help] button to display the help window.
The help file ctags.chm is included in the .zip package. It gives help for both CTAGS.VDM and UTAGS.VDM. It must be stored in user-mac directory.

Number of files processed is now shown on status line during processing.

Backup file for TAGS database is now created only when you overwrite TAGS, not when you append to existing TAGS. This way, tags.bak will be the previous full TAGS database.


If cursor is not located on a symbol, utags.vdm now opens a dialog box instead of showing status line message. You then have an option to enter the symbol manually (or paste it from clipboard). This allows you to lookup function or other symbol even if it is not used in current in source file.

I have done some improvements to compatibility with Unix ctags utility.

- Utags.vdm now accepts line number as locating command, as an option to search string.

- Relative path can be used in TAGS (in addition to absolute path).

- Search strings in TAGS are regular expressions, so they may contain quote characters.
If you are using tags file created by other application, you can set configuration option #68 = 1 (near the beginning of utags.vdm), which instructs utags.vdm to remove quote characters from the search string.

I have been testing utags.vdm a bit with tags created with Exuberant Ctags (Windows version) and it seems to work well.
You can use Exuberant Ctags for example to create tags database for languages currently not supported by ctags.vdm.
You can download it free from:

The enclosed package contains ctags.vdm, utags.vdm and the help file ctags.chm.
The file contains the HTML source for the help. HTML Help project and index files can be found in the subdirectory .\help.


HTML Help source files


Topic: Ctags.vdm and utags.vdm updated (5 of 7), Read 27 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Tuesday, December 04, 2007 05:16 AM

I noticed that the zip file I posted in previous message contained a bit old version of ctags.chm (compiled help file). So here is the latest version. (The help source files were up to date.)


Compiled help file


Topic: Re: Ctags.vdm and utags.vdm updated (6 of 7), Read 27 times
Conf: VEDIT Macro Library
From: Ted Green
Date: Tuesday, December 04, 2007 06:13 AM

At 05:19 AM 12/4/2007, you wrote:
>From: "Pauli Lindgren"
>I noticed that the zip file I posted in previous message contained a bit old version of ctags.chm (compiled help file). So here is the latest version. (The help source files were up to date.)

Please be sure to upload any new macros. I will release a minor update next week. A few bugs have been fixed and I will include the new macros. More details will follow.

Thank you!



Topic: Re: Ctags.vdm and utags.vdm updated (7 of 7), Read 15 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Monday, February 09, 2009 02:31 PM

Here are new versions (v2.3) of CTAGS.VDM and UTAGS.VDM.


I actually made this version of ctags.vdm already a year ago.

The main change from version 2.2 is the option to store filenames using relative path instead of absolute path.
This can significantly reduce the size of the tags file.
The option is selected by setting numreg #45 = 1 (it is set by default).

The search mode selected in Symbol recognition pattern dialog is now stored in the .ini file.


If the search string in tags file contains characters '|', those are removed so that the search works correctly.

When you select "GO BACK" function to return to calling file/location, the file containing the function definition can be automatically closed. However, the file is only closed if it was opened by utags.vdm, and it has not been modified.
I think this is an important improvement. Now you can freely peek into function definitions and return back to calling location without worrying about your workspace being filled with unnecessary files.
This option is enabled by setting #61 = 1 (on the line after the label GO_NEXT). It is enabled by default.

"Batch mode" allows utags.vdm to be called from .bat file or from another macro. There are no user prompts even in case of error. Instead, an error code is returned in Return_Value.
(I made this option so that I could use utags.vdm with my another macro that generates a list of function call hierarchy.)
The batch mode is selected by calling utags.vdm at label BATCH_GOTO.
Utags.vdm returns the number of items found, 0 if no items found, or -1 in case of error.
(There is no need for special batch mode in GO_BACK function since it does not have any user prompts.)

The help file ctags.chm has been updated to reflect these changes.