home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
FTAG11.ZIP
/
FTAG.DOC
< prev
next >
Wrap
Text File
|
1991-01-09
|
14KB
|
336 lines
FTAG by Joe Kleinwaechter
_________________________
v1.1
Contents
________
This small two file set is an add-on utility to the Brief text editor
that allows file tagging using Microsoft C 6.0's Browser database.
Included in this upload should be the following files:
1) ftag.doc - This file
2) ftag.exe - DOS version of ftag.exe
3) ftag.cm - DOS version of ftag.cm
4) ftag.exo - OS/2 version of ftag.exe
5) ftag.cmo - OS/2 version of ftag.cm
If you are using DOS, you should delete FTAG.EXO and FTAG.CMO. If you
are using OS/2 you should delete FTAG.EXE and FTAG.CM, rename
FTAG.EXO to FTAG.EXE, and rename FTAG.CMO to FTAG.CM. Whichever
version you are using, when you are done there should only be three
files remaining, FTAG.DOC, FTAG.EXE and FTAG.CM.
History
_______
v1.0 - Initial release includes tagging of definitions only
v1.1 - Added tagging of references.
Added goto next mechanism.
OS/2 support.
What is ftag?
_____________
FTAG is a specific implementation of the file tagging process
commonly known as CTAGS in the Unix world. Simply stated, this allows
one to edit a C source file, place the cursor over a symbol (function
or variable), press a key and be transferred to the file where that
symbol is defined or referenced. This is often called a "hyper-link".
This is an easy way to move around between several source modules
without having to recall where a particular symbol is defined.
Why is FTAG different? With so many excellent CTAG interfaces around,
why invent another one? FTAG is different because it links two of the
most popular development tools around; the Brief text editor and the
Microsoft 6.0 compiler. If you do not have both of these packages,
this program will not be of use to you.
With the current release of the Microsoft C compiler (6.0), came a
new utility called the Source Code Browser. This was a wonderful
utility, however it was of no use to you unless you also used the
Microsoft PWB editor (YUK!). Many of us Brief users wanted the
Browser access badly, but not if it meant giving up Brief. Luckily,
Microsoft has recently disclosed the details of the Browser (as well
as other goodies) and released them to the public as the Developer's
Toolkit Reference.
This recent development prompted the release of the first of many
FREEWARE products that I intend to release interfacing Brief to the
Browser.
How do I use FTAG?
__________________
Once installed (see "How do I install FTAG?", later), FTAG is quite
simple. It is transparently hooked into the "GOTO" routine that
already exists (Alt-G). Goto works just as it did before, except that
a default value will be placed in the prompt. This value will be the
symbol located either under the cursor or the one next to it. If you
want to use GOTO as before simply type the line number as usual.
However, if you want to go to where the default symbol shown is
DEFINED, just type ENTER. You can also replace the default symbol
with any valid symbol (case-sensitive) when prompted with "Goto ?".
In summary:
- If you want to use GOTO as usual (to goto a particular line
number), simply type ALT-G and enter the line number followed by
<CR>.
- If you want to find the definition of a symbol (tag), place the
cursor over the symbol to look for, type ALT-G and then press <CR>.
- If the symbol you want to look for is not readily accessible,
simply type ALT-G and enter the symbol name by hand followed by a
<CR>.
After performing the search, the file where the symbol is DEFINED is
placed on the screen with the cursor positioned at the start of the
line where the symbol is located. Note that the Browser tags the
start of a function as the first open brace "{" after the function
name.
Sometimes a directory has several development projects going on at
the same time. In this case, there could be more than one definition
of the symbol. Since FTAG doesn't know which one you want, it will
display a menu listing the choices. Simply place the cursor over the
definition file desired and hit <CR>.
Now, with v1.1 and later you can perform the above operation to find
not only where a symbol is defined but where it is referenced.
Instead of using ALT-G, you use ALT-R (for reference). The reference
feature works in the same manner as the definition feature.
Also, with v1.1 comes the ability to do repetitive searches with a
single database access. As stated earlier, whenever multiple tags are
found for a given symbol, a menu is displayed. Often one wishes to
check out several of these locations. Rather than having to
repetitively search the database, you can simply press the
Keypad-Insert key (0). This will redisplay the last multiple tag menu
(if one was defined) and place the cursor at the last tag that was
selected.
How do I install FTAG?
______________________
Note: If you are upgrading FTAG from a previous version, see the
section entitled "For those upgrading from v1.0". This will get you
there quicker.
Installation is fairly straight forward. However, all steps must be
completed.
1) Copy the FTAG.EXE program into a directory that is identifed
in your PATH.
2) Define the environment string BSCFILE with the full location and
name of the Browser database (the .BSC file). This is done inside of
your AUTOEXEC.BAT file as follows:
set BSCFILE=D:\PROJECT\DB.BSC
Obviously, the right side of the equal sign is specific to your
directory structure and Browser database name.
3) Place the file FTAG.CM into a directory identified by the
Brief environment string BPATH. This is where your Brief macros
reside.
4) Edit your initials macro source file and add the following
line to your initals macro:
autoload ("ftag.cm", "gotoTag", "gotoReference","nextTag");
assign_to_key("<Alt-g>", "gotoTag");
assign_to_key("<Alt-r>", "gotoReference");
assign_to_key ("<Keypad-Ins>", "nextTag");
NOTE: These statements assume the use of CBRIEF (Brief v3.0 and
later). If you are using a version of Brief prior to this see the
section entitled "For versions of Brief prior to v3.0".
Parts of the line are case-sensitive so to be safe, type it exactly
as shown. The first line tells Brief that whenever a call is made to
the macro gotoTag, load in the file ftag.cm (this is where gotoTag is
located). The second line tells Brief to assign the macro gotoTag to
the key ALT-G. This will override the current goto macro. This is ok,
because the new macro incorporates all of the old features plus more.
That's it!
How do I make a Browser database?
_________________________________
There's a loaded question if I have ever seen one. Actually, this is
covered indirectly in the Microsoft manuals. However for the sake of
simplicity I will show you the way(s) that I have implemented the
browser and let you go from there.
The final Browser database is one large file given the extension
.BSC. For our purposes let's call it PROJ.BSC. Browser data is gained
from the compiling of source code into object modules. If you want to
eventually include symbols from a source module into a Browser
database you must include the /FR switch on the compile line. For
example, to compile a module called SRC1.C into an object module you
would supply a line something like this:
cl /FR /c src1.c
When the compiler builds this object module, it also builds a .SBR
file having the same name. If a project had ten source files, it will
then have ten .SBR files. The .BSC file is created using the
information in the .SBR file. This is done using the PWBRMAKE utility
provided with the C compiler. (Use Quickhelp to obtain the command
line layout). I use the PWBRMAKE in incremental mode. This means that
the .BSC file is simply refreshed when PWBRMAKE is called not
re-created. If you are using a makefile (strongly recommded) you have
a choice to make. You can either place the call to PWBRMAKE as a rule
in your ".c.obj" inference or you can call it as the result of a
separate target build, called BROWSER for example. If your database
consists of many files I would recommend the latter. The first method
guarantees that your database will be refreshed whenever you compile
a file. This however can add significant time to a compile. By making
a target called BROWSER, you can update the Browser database by
simply calling MAKE with BROWSER as the target. This is less time
consuming, but you are manually responsible refreshing the database.
No matter which method is used, the following is the format for the
PWBRMAKE call assuming PROJ.BSC is the database name and the
database is updated incrementally:
@pwbrmake /v /o PROJ.BSC *.sbr
It is important to note that when a .SBR file is created, it has a
size greater than zero. Once its contents have been used to refresh
the .BSC file, its file size reduces to zero. Even though the file
size is zero, YOU MUST NOT DELETE THIS FILE. It is used as a
place-marker when PWBRMAKE is called to know what to maintain in the
database.
For versions of Brief prior to v3.0
____________________________________
All of the modifications shown to the Brief initials macro assume the
new CBRIEF notation. If you are using a version prior to this
translate the statements according to this table:
Translate:
autoload ("ftag.cm", "gotoTag", "gotoReference","nextTag");
assign_to_key("<Alt-g>", "gotoTag");
assign_to_key("<Alt-r>", "gotoReference");
assign_to_key ("<Keypad-Ins>", "nextTag");
To:
(autoload "ftag.cm" "gotoTag" "gotoReference" "nextTag")
(assign_to_key "<Alt-g>" "gotoTag")
(assign_to_key "<Alt-r>" "gotoReference")
(assign_to_key "<Keypad-Ins>" "nextTag")
For those upgrading from v1.0
______________________________
I am sorry that v1.1 has been released so close to the release of
v1.0, but I felt the new features were significant enough to justify
this. As it turns out, they were not as difficult as I had expected.
If you are currently using FTAG v1.0, simply do the following:
- Delete the old ftag.exe and replace it with the new one
included.
- Delete the old FTAG.CM and replace it with the new one, also.
- Modify:
autoload ("ftag.cm", "gotoTag");
to read:
autoload ("ftag.cm", "gotoTag", "gotoReference","nextTag");
- Leave the following line as it is:
assign_to_key("<Alt-g>", "gotoTag");
- Add the following two lines:
assign_to_key("<Alt-r>", "gotoReference");
assign_to_key ("<Keypad-Ins>", "nextTag");
NOTE: These statements assume the use of CBRIEF (Brief v3.0 and
later). If you are using a version of Brief prior to this see the
section entitled "For versions of Brief prior to v3.0".
You can, of course, use any keys you want. These are ones I happen to use.
That's it. For a description of the new features see the following
section.
How can I improve its performance?
__________________________________
If it seems to take an excessive amount of time to switch to the
tagged file you may want to check how Brief is swapping. Under most
circumstances you don't need to turn swapping on (see the -M switch
in the Brief manuals). If swapping is enabled and tagging is taking a
long time, try disabling it. If this significantly improves the time,
it means that when you are swapping out Brief, it does not have enough
EMS memory to swap to, therefore it is saving and restoring itself to
disk. In my opinion, swapping to disk is not a viable option for most
operations.
Can I give this program to a friend?
____________________________________
YES! FTAG is distributed as a FREEWARE program. This means that
anyone is free to use the program at NO CHARGE. The author assumes no
liabilty in its use therefore the user is at his own risk. I retain
the rights to FTAG and do not give anyone the permission to
distribute this program for a fee. If you find that someone is
charging for this program pleas contact me at the number below.
I have thoroughly tested this program on my machine (a Dataworld 386)
and seem to have gotten all of the bugs out. It is currently in its
first release, however, so some unexpected situations may occur. If
you are having a problem with FTAG feel free to contact me at the
number below.
Will there be anymore Brief/Browser programs coming?
____________________________________________________
Yes. I am currently working on developing a more comprehensive
Browser access machine to allow calltrees and file characterization.
I am not sure when they will be released (FREEWARE of course), but if
you have any ideas of how you would like to see a product like this
operate feel free to contact me at the number below.
Kudos
_____
Special thanks to Bruce Mallet of M-Tek (Derry, N.H.) for his
wonderful Brief macros package called ELEC-C. I highly recommend
obtaining a copy of this program (call the Brief BBS). While I did
not use his code directly, I did steal (with his permission) his
method of hooking the tag system into the Alt-G and the idea of using
the Dialog Manager when multiple definitions occur. Note that FTAG
complements ELEC-C well. There are some minor mods necessary to
disable his tag routines, but I will be happy to supply them to
anyone wishing to do so.
Contact
-------
I will be happy to communicate to anyone using a number of different
methods. By BBS you can reach me (KLEINW) at:
(404)320=6202 (AV-Sync)
(404)378-7914 (Shareware South)
or I can be reached via Internet at:
kleinw@swamc1.sinet.slb.com