Extract Function Definition Names in Directory Tree

CodeWright® - API Macro - Royalty Free - 2005.01.01 17:15
Send Comments


Extract Function Definition Names in Directory Tree.


This function processes every file in the directory tree that matches a user-supplied file definition. This file definition can (and usually will) contain wildcards.

This function scans each file. It scans for the macro or function name on each line of the Routines( ) output.

When one is found the macro or function name, file name, and line number are copied to the output file ("tlaNamesNoSort.xls" by default) that is a tab-delimited Excel-compatable file format.

At termination, the output file is optionally left visible with tabs appropriately set. Columns of this file can then be easily accessed using the column-select feature of CodeWright or VisualStudio. In addition, the file can be loaded into Microsoft Excel for further manipulation.

The output file generate will look something like ...

0001: initopts                     ~\VI\viopts.c 125
0002: dumpopts                     ~\VI\viopts.c 251
0003: saveopts                     ~\VI\viopts.c 397
0004: setopts                      ~\VI\viopts.c 456
0005: autoindent                   ~\VI\viopts.c 692
0006: directory                    ~\VI\viopts.c 702
0007: ignorecase                   ~\VI\viopts.c 709
0008: list                         ~\VI\viopts.c 716
4015: _bas_language_colors_update  ~\BAS\bas.c   374
4016: _bas_language_colors         ~\BAS\bas.c   413
4017: _bas_add_keyword             ~\BAS\bas.c   603
4018: _bas_assign_template         ~\BAS\bas.c   654
4019: _bas_indent                  ~\BAS\bas.c   675
4020: _bas_in_comment              ~\BAS\bas.c   766
4021: _bas_routines                ~\BAS\bas.c   788
4022: _bas_spellcheck_data_request ~\BAS\bas.c   801


tlaNamesNoSort( );
tlaNamesNoSort( ,"*.cs" );
tlaNamesNoSort( "c:\source","*.c","c:\out.xls",'f','h' );
tlaNamesNoSort( ,"*.c","c:\temp\out.xls" );
tlaNamesNoSort( ,,,'f','v' );

Input Parameters

Parm Name Code Meaning
1 Root   Prompt for Root specification.
root Root specification to use.
2 Mask   Prompt for selection mask.
mask Selection mask to use.
3 Output   Prompt for output file.
file Output file to use.
4 Parse   Parse function.
function Parse function.
macro Parse API macros.
5 View   View output buffer at completion.
hide Hide output buffer at completion.
view View output buffer at completion.

Return Codes

Code Message
-1 tlaNamesNoSort: No matching files found in tree for "mask".
-1 tlaNamesNoSort: Parameter 4 not null, "function", or "macro".
-1 tlaNamesNoSort: Parameter 5 not null, "hide", or "view".
-1 tlaNamesNoSort: Terminated by request.
number tlaNamesNoSort: number files found in tree but not processed for "mask".
number tlaNamesNoSort: number files processed from tree for "tlaNamesNoSort.xls".


This function calls tlaError.


Current version verified under:

  • CodeWright 7.5.2
  • CodeWright for .NET 7.0

CodeWright for .NET Restriction



There are three primary methods for installing this macro on your system. Method A uses the tlaMDE tool available for purchase from this website. Method B manipulates the macro repository directly. Method C uses the API Macro... tool provided in every copy of CodeWright (but not CodeWright for .NET).

Method A - tlaMDE - CodeWright or CodeWright for .NET

  • Select the Code button on this page.
  • When the second window opens, select all the text in the text box.
  • Issue Ctl-C (copy).
  • Create a new file in CodeWright or CodeWright for .NET.
  • Issue Ctl-V (paste).
  • Issue tlaMDE C (save and compile).

Method B - Copy to Repository - CodeWright or CodeWright for .NET

  • Select the Code button on this page.
  • When the second window opens, select all the text in the text box for a macro.
  • Issue Ctl-C (copy).
  • Load the macro repository "cwright.mac" from your CodeWright or CodeWright for .NET root:
  • issue Ctl-End to go to the end of file.
  • Issue Ctl-V (paste).
  • Close the file and respond yes to the write request.

Method C - API Macro ... - CodeWright Only

  • Select the Code button on this page.
  • When the second window opens, select text from the text box for a macro:
    • Do not select the [API Macro ... header line.
    • Select all other lines in the macro.
  • Issue Ctl-C (copy).
  • Open the CodeWright Tools | API Macros... dialog.
  • Press the New button.
  • Select the Edit box.
  • Issue Ctl-V (paste).
  • Double-click on the function name in the header of the macro.
  • Issue Ctl-C (copy).
  • Select the Name box.
  • Issue Ctl-V (paste).
  • Delete the trailing blank from the name.
  • Select the Save button.
  • Select the Close button.
  • Repeat this process for each macro in the text box.


tlaTools is a Dynamic Link Library that contains most of the API macros on this website in a single easy to install package. The tlaTools DLL can be purchased by selecting the Buy button on this page.

tlaNamesNoSort is not included as a function in tlaTools.

tlaNames is included as a function in tlaTools.

Copyright © 1993-2005 Thom Little Associates, Ltd. revised 2005.01.01 17:15
One Central Square, Keene, NH 03431-3787 phone 603-357-7567