tlaMacro
Save/Delete Single API Macro in Buffer

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

Purpose

Save/Delete Single API Macro in Buffer.

Operation

The CodeWright Tools | API Macros... allows the editing and execution of CodeWright API macros from within a dialog.

This function provides an alternative that dialog box and allows you to use all the capabilities of CodeWright to develop your macro just like any other document. When you are done, simply execute this function to save the document to the system repository (cwright.mac). In addition, you can delete the macro from the repository.

There are two options to this function: save and delete:

Save

Invoke tlaComment to update the date/time stamp in the file (if present) and then write the macro to the macro repository (cwright.mac). The macro name used is from the header as described below.

Delete

Delete the macro from the macro repository (cwright.mac). If the macro is not present in the repository, nothing occurs. The macro name used is from the header as described below.

This facility is most useful if you establish two buttons that are assigned to "Save" and "Delete".

Special Consideration

The tlaMDE Dynamic Link Library provides a robust superst of the capabilities in tlaMacro. It operates on multiple macros in the buffer, and supports compilation, execution, and fetching.

Examples

tlaMacro( "save" )
tlaMacro( "delete" )

Input Parameters

Parm Name Code Meaning
1 Type "save" Save macro associated with buffer.
"delete" Delete macro associated with buffer.

Other Input Parameters

The first line of the file must be a section header of the form ...

[API Macro:macro-name]

The macro name used by tlaMacro is extracted from this sction header.

If the file associated with the buffer is c:\somefolder\tlaTest.cwa and the buffer contains ...

[API Macro:xxxTest]
// --------------------------------
// tlaTest
// --------------------------------
void tlaTest( void )
   {
   MsgNotify( "Message" );
   }
// --------------------------------
// 2002.10.01 11:18

The macro name used will be xxxTest.

Note that the name of the file name, name in the header, and name on the function are all differtent.

tlaMacro uses the name in the header and passes that name to CodeWright as the macro name.

CodeWright uses the macro name and ignores the name on the function statement.

Return Codes

Mode Message
0 n/a
-1 tlaMacro: Request not "save" or "delete".

Reference

tlaMacro calls tlaComment, tlaDateTime, and tlaError,

Compatibility

Current version verified under:

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

CodeWright for .NET Restriction

None.

Installation

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.

Purchase

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.

tlaMacro 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