2-Nov-93

TagDir.DLL - Set the tagfile and current directory automatically

This DLL provides two event handlers which are called whenever the
current buffer is switched.  One tells Codewright that the tag file is
located in the directory of the file currently being edited.  The other
sets Codewright's current directory to that directory.  The first is
activated by the API call TagTrackCwd; the second is activated by
SysTrackCwd.

TagTrackCwd

Its purpose is free you from having to specify a tag file every time you
switch projects.  If you have one project per directory, just create a
tags database in each project directory.  Then set the tag file name
("tags.dat", for example), without a path, in CWRIGHT.INI.  This handler
will append that name to the directory of the file in the current buffer
and use that for a tag file name.  For example, when you're editing
C:\PROJECTS\NIMZO\FRACUS.C, the tag file will automatically be set to
C:\PROJECTS\NIMZO\TAGS.DAT.

For versions 2.05 and earlier of Codewright, the Startup module must be
modified to support the Tagdir functions.  This means editing the file
tags.c in the startup directory, then rebuilding startup.dll and moving
it to the codewright directory.  Add these lines to tags.c, after the
definition of TagSetFile().

	/*
	 * Return the name of the tag data file.
	 */
	LPSTR DLL
	TagQFile( void )
	{
		if (tagFileName && *tagFileName)
			return(tagFileName);
		return("");
	}

Then add this line to startup.c, in the section labeled "/*** tags.c ***/"

	LibExport( "LPSTR TagQFile" );


To install TagDir, copy TAGDIR.DLL into the cwright directory and add these
lines to the [Editor] section of CWRIGHT.INI:

	LibPreload=TagDir
	TagSetFile="tags.dat"
	TagTrackCwd=TRUE




SysTrackCwd

This installs an event handler which is called whenever a file buffer
becomes current. It determines the directory in which the newly current
file is located and makes sets Codewright's idea of the current
directory to that directory.

The purpose of this handler is to make it easier to edit files which
are in the same directory because they are related.  For example, many
programmers dedicate one or more directories to one project's files.
Using this handler, it's easy to open another file in the same directory
as the one you're currently editing.

To activate this handler, be sure TAGDIR.DLL is installed and preloaded
as described above.  Then add this line just below the line that
preloads the DLL:

	SysTrackCwd=TRUE


For more information about these two event handlers, see the comments
in the source code.  This module is supported by Premia Corporation;
you may contact Technical Support at (503) 641-6000.

Daniel Elbaum


This version modified from the 14-July release to work properly
under Codewright version 3.0, and to initialize correctly when
invoked in the middle of an editing session.