2.3.145. VMACRO

The VMACRO command attaches the output of a macro to a window or file.

Syntax

VMACRO {windowid | fileid} [,macro_name(args)]

where:

windowid | fileid

Specifies the window of file to be associated with the macro. This must be a user-defined windowid or fileid. See Window and file numbers for details.

macro_name

Specifies the name and call arguments of the macro that is to send its output to the specified window or file. This happens whenever the macro runs, either directly from the CLI or a command script, or by a breakpoint being hit to which the macro is attached.

Description

The VMACRO command attaches a specified macro to a specified window or file. The window or file is updated whenever the macro is called. You can use the following to write data to the window or file:

  • FPRINTF command (see FPRINTF)

  • fputc predefined macro (see fputc)

  • fwrite predefined macro (see fwrite).

If you do not supply a macro name, the window or file is disassociated from any macro. The VMACRO command runs asynchronously.

Examples

The following examples show how to use VMACRO:

vmacro 50,showmyvars()

Use the macro showmyvars() to write formatted variables to window 50.

vmacro 50

Unbind all macros from user window 50.

fopen 100,’c:\myfiles\messages.txt’ vmacro 100,showmyvars() showmyvars() vmacro 100 vclose 100

Use the macro showmyvars() to write formatted variables to the file messages.txt, unbind the macro from the file, and finally close the file.

See also

The following commands provide similar or related functionality:

The following macros provide similar or related functionality:

Copyright © 2002-2005 ARM Limited. All rights reserved.ARM DUI 0175G
Non-Confidential