Just a Help addition - Alias name can use variables

Oct 18, 2009
178
7
#1
No change to the code, but point out the following in the Help for Alias:

The Alias name can be contained in a variable:
Set AliasName=MyAlias
Alias %AliasName=Echo Hello

:: Will output: Echo Hello
Alias MyAlias​


Example use:

UNALIAS C_*​

:: bw and `%bw` avoid an irrelevant parameter-passing issue, where
:: if a GOSUB parameter contains spaces, even if it is in quotes or
:: back-apostrophes, TCC will treat text after the space as separate
:: parameter unless the variable-in-back-apostrophes approach is
:: used.

set bw=Bright white

GOSUB DCC C_MAIN Blue `%bw`
GOSUB DCC C_ERR Red `%bw`
GOSUB DCC C_EMPH Green `%bw`​
unset bw

C_MAIN
Echo This is the main color.

C_ERR
Echo Oops! -- Error!

C_EMPH
Echo Let me emphasize that!

C_MAIN
Echo Done!

QUIT

::******************************************************
:: DEFINE COLOR COMBINATIONS
:DCC [AliasName foreground background]
::
::******************************************************
Alias %AliasName=color %foreground on %background

RETURN
:: End of DCC [AliasName foreground background]