5.2 Executing Functions and Macros

The menus and dialog boxes in PWB provide access to almost everything you need to do to develop your projects. You can edit, search, and browse your source files. You can build, run, and debug your project, and you can view Help for the entire system. However, the visible display provides access to only part of the capabilities available in PWB. Behind the menu commands lie functions with many more options than you can access from the menus. Many functions and macros are not assigned to keys by default.

The sophisticated PWB user learns how to use the functions and predefined macros to perform the precisely correct action. Each function has several forms that are invoked with the combinations of the Arg and Meta prefixes. These two functions are used to introduce arguments and modify the action of PWB functions.

Arg (ALT+A)

The fundamental function in PWB. You use Arg to begin selecting text, introduce text and numeric function arguments, or modify the action of functions by increasing the Arg count.

To pass a text argument to a function, for example, press ALT+A, and then type the text. The text you type doesn't go into your file. The Text Argument dialog box appears when you type the first letter of the text.

You can then edit the text. PWB displays the current argument count and Meta state in the dialog box.

Notice that there is no OK button in this dialog box. Instead of choosing OK, press the key for the function you want to execute with this argument. Choose the Cancel button if you do not want to execute a function.

Meta (F9)

Modifies the action of a function in different ways from the various argument types. It generally toggles an aspect of the function's action.

For example, the text-deletion functions usually move the deleted text to the clipboard. However, when modified with Meta, they clear the text without changing the clipboard.

The combination of Arg and Meta greatly increases the number of variations available to each function. For example, the Psearch function can perform different search operations depending on how it is executed. Psearch can:

Repeat the previous search (Psearch).

Search for text (Arg text Psearch).

Perform a case-sensitive text search (Arg Meta text Psearch).

Search for a regular expression (Arg Arg text Psearch).

Search for a case-sensitive regular expression (Arg Arg Meta text Psearch).

Because you can reassign keys to your preference, the PWB documentation cannot assume that a specific key executes a given function or macro. Therefore, the PWB documentation gives a sequence of functions or macros by name, followed by the same sequence of actions by key name. In this book, the key is the default key. In PWB Help, the displayed key is the one currently assigned to that function. When no key is assigned, PWB displays unassigned.

For example, to insert the definition of a macro at the cursor, you pass the name of the macro to the Tell function and modify Tell's action with the Meta prefix. This sequence of actions is expressed as follows:

Execute the function sequence Arg Meta macroname Tell (ALT+A F9 macroname CTRL+T).

If the Tell function is assigned to a different key, Help displays that key in place of CTRL+T.

Chapter 7, “Programmer's WorkBench Reference,” contains complete descriptions of all forms of each function in PWB.