4.7 Replacing Aspen SCM Commands with your Own

As you use Aspen SCM Expert System more, the limitations of certain constructs becomes evident. You may wish to extend their functionality. The simplest way of doing this is to write your own version of a command which has a different name and then use that instead of the standard one. However, this means that your existing code will continue to use the standard version unless you change the references.

A more powerful approach is to make Aspen SCM Expert System use your version in preference to the standard version. Until Mimi 6.0 you could replace commands in rules by the simple expedient of omitting the command from the $NOPRED set. Now you can achieve the same by defining the alternative in $ALIAS. Put the command you wish to replace in the Code in $ALIAS and the substitute in the Description. This should either be the command to run a macro, e.g. <MYMACRO, or a rule, e.g. >MYRULE.

Unfortunately you cannot use this technique to substitute your own macro for commands such as AMPSET and PROMPT which take an amper variable as one of their arguments. Suppose that $ALIAS redefines PROMPT as <MYPROMPT. Then the command

PROMPT $1 "default" message_token_1 message_token_2 ...

is interpreted as

<MYPROMPT [value of $1] "default" message_token_1 message_token_2 ...

where [value of $1] is the value which $1 happens to take. 

As $1 could consist of several tokens and the message consists of an unknown number of tokens, it is not possible to work out in MYPROMPT what the command was which the user entered.

Back                                Next