home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
tsd050.zip
/
TSD.DOC
next >
Wrap
Text File
|
1995-04-04
|
5KB
|
165 lines
TSD - C-oriented search utility
===============================
Version: 0.5
File: TSD.EXE
Size: 21834 bytes
Date: 4/4/95
Status: freeware
(C) Andrey Kogan, 1995
E-mail: kogan@delphi.com
TSD program is useful when working with a big project
containing hundreds of C-language source files. It allows you to
find the definition of function or global variable. Standard
text search utility may be inconvenient in this case, especially
if the function you are trying to locate is called from many places.
TSD command has the following syntax:
TSD file_where_to_search word_to_search_for
The first parameter may contain wildcards. All subrirectories
of the specified directory will also be searched.
The second parameter contains valid C identifier. Files will be
searched for the case-sensitive match of the whole word.
Within each file, only global scope will be searched.
Example:
TSD D:\*.C MyWord
This command will search for the definition of "MyFunction" in
all C-files on drive D. Then it will display an appropriate
fragment on the screen and prompt user for the next search.
Example of the fragments which will be shown:
// 1. Prototype in global scope.
void MyWord(int a);
// 2. Function body.
void MyWord(int a){
// ...
}
// 3. Variable declaration in a global scope.
int MyWord;
void f(){
// ...
}
// 4. Simple macro.
#define MyWord (something)
// 5. Macro with parameters.
#define MyWord(a,b,c) my_fun(1,a,b,c)
Example of the fragments which will NOT be shown:
// int MyWord; - comments are ignored
/*
void MyWord(); // comments are ignored
*/
flt MyWORD; // different identifier - match is case sensitive
char MyWord_2; // different identifier - the whole word must match
void f(){
int MyWord; // local variable
}
g(){
MyWord(x); // function call, not a definition
}
#define MY_MACRO() MyWord() // function usage, not a definition
Using TSD in batch files
------------------------
Program returns nonzero ERRORLEVEL if and only if search was aborted
by user. In any other case ERRORLEVEL is zero. This feature allows
to chain several TSD commands which will behave as a single one.
Example. Let's define FINDDEF command which will search all *.C
and *.H-files under CPROJ directory of drive C.
Here is a proposed text of FINDDEF.BAT:
TSD C:\CPROJ\*.C %1
IF NOT ERRORLEVEL 1 TSD C:\CPROJ\*.H %1
NOTE: TSD is executed in "background"
-------------------------------------
When TSD finds a match, it displays an appropriate fragment of
text on the screen, asks user "Continue search ?" and continues
search immediately. Thus, if user will answer "Yes" after some
pause, next match would probably be already found. The only
visible effect of this background search is a flashing hard
disk access indicator.
When TSD doesn't work properly
------------------------------
TSD contain no C parser nor C preprocessor. It works properly
if:
1. Searched file contains correct C-program.
2. Each macro expansion has balanced brackets.
3. Program doesn't contain nested comments (this
limitation will probably be eliminated in next version).
Improper text will result in extra "Match found" screens.
Example:
#define BR_OPEN {
#define BR_CLOSE }
void f()
BR_OPEN
MyWord(); // will be treated as function definition
BR_CLOSE
DISTRIBUTION STATUS
===================
TSD program v.0.5 can be used freely by anyone for any legal
purpose. The only limitation is:
Distributing TSD.EXE without this file is not allowed.
Registered users will be informed about new releases.
To register send E-mail to:
kogan@delphi.com
with the word "TSD" in subject or first nonempty line.
The author will greatly appreciate any comments/complains/advises....
Andrey Kogan. 4/4/95