Set Tabs on Imported File to Corporate Standard

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


Set Tabs on Imported File to Corporate Standard.


Consider the following conditions ...

  • There is a collection of source modules that you want to add to your environment that were created by another organization.

  • The modules being imported use tab stops that are different from those that you use.

  • The modules being imported use spaces instead of tabs in the stored file.

tlaReTab will convert the imported file from its old form to the form that you have defined in your CodeWright language definition. To do this you need to provide two things:

  • The module being imported.
  • A definition of the tab settings currently used in the file.

(Since it is being converted to the tab structure you have defined for the language, you do not need to tell what they are.)

tlaReTab calls tlaSpace to perform the tab changes in accordance with your company standards. In the distributed version of tlaSpace this is the conversion of leading spaces to tabs, the removal of all other tabs, and stripping trailing whitespace from each line. (This is our corporate standard).


Prompt - ask user for tab specification

tlaReTab( )

No Prompt - Command Line - use provided tab specification. In this example the file being imported has the tabs set at "9 17" with a tab every eight spaces.

tlaReTab 9 17

No Prompt - Function Call

tlaReTab( "9 17" )

Input Parameters

Optional tab specification.

Return Codes

Code Message


This function calls tlaStandardFormat and tlaStripTrailing.


Current version verified under:

  • CodeWright 7.0b
  • CodeWright 7.0c
  • CodeWright 7.5.1
  • CodeWright 7.5.2
  • CodeWright for .NET 7.0

CodeWright for .NET Restriction

CodeWright for .NET removed the notation in the configuration of "4 7" to set a tab every 3 columns. In the configuration you now specify "3" to mean every 3 columns. Unfortunately the function calls that query and set this information have not been revised. You are currently required to enter "4" to get a tab stop every 3 spaces. The query and set commands use the first character of the old notation apparently for downward comparability. This function adjusts for that condition. When two new functions are made available in CodeWright to service the new notation the current restriction will be lifted.


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.

tlaReTab 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