AKADoc.tioga
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Swinehart, November 23, 1988 11:53:22 am PST
AKA
CEDAR 7.0 —
Aka
A persistent Alias command, and friends.
Dan Swinehart
© Copyright 1988 Xerox Corporation. All rights reserved.
Abstract: Aka provides a command near-identical in syntax and behavior to the Command Tool's "Alias" command. Each alias is stored in a local database as it is defined, so that it persists until manually redefined or disabled. Additional commands, either built-in or predefined in the default database, support the association of documentation with each command, the enabling and disabling of existing aliases, file server backup, database browsing, and some convenient utilities. Aliases defined by Aka may also be used as "ampersand variables", permitting their text to be substituted anywhere in a command line.
Created by: Dan Swinehart
Keywords: macro, alias, persistence, text substitution, database
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

Aka provides a command near-identical in syntax and behavior to the Command Tool's "Alias" command. Each alias is stored in a local database as it is defined, so that it persists until manually redefined or disabled. Additional commands, either built-in or predefined in the default database, support the association of documentation with each command, the enabling and disabling of existing aliases, file server backup, database browsing, and some convenient utilities. Aliases defined by Aka may also be used as "ampersand variables", permitting their text to be substituted anywhere in a command line.
1. Commands
Aka name { {(argumentList)} macroText}
Aka provides a substitution macro facility for the first token on a line. "Aka bro bringover -o" will cause "bro mumble" to be expanded into "bringover -o mumble". Aliases can also be given an (optional) argument list, in which case the tokens on the command line following the alias name will be substituted for the formal parameters. For example, "Alias brob (file dffile) bringover -a -o file.mesa file.bcd dffile.df" would cause "brob rope rigging" to expand to "bringover -a -o rope.mesa rope.bcd rigging.df". The scope of names is local to each separate user within a Cedar environment, but global to all of that user's Command Tool viewers, etc.; the name scope is unaffected by any search rules.
"Aka name", issued without arguments or macro text, enables the named alias if it had earlier been disabled (see below). If the alias is defined and enabled, this command has no effect.
Aka does not support the simple recursion that the Alias command does; for example, either "Aka Echo Echo foo" or a circular definition such as "Aka Foo Bar" along with "Aka Bar Foo", will result in a compute-intensive pause, with no output, until either VM is exhausted or the user interrupts the expansion. However, "Aka Echo ///7.0/System/Echo foo" will have the desired, if mundane, effect.
Normally, the expansion of the alias is shown as output in the CommandTool; for example, suppose an alias is created with the following command:
 % Aka Foo Echo Hello World
Normally, typing "Foo"produces this output:
 % Echo Hello World
Hello World
 %

Aka does not at present support the Alias command's -q switch. It does, however, honor the quiet alias option that can be set by command or by user profile entry:
 AliasMode <?|quiet|verbose|seeProfile>.
 CommandTool.QuietAlias: TRUE
If "AliasMode quiet" is in effect, or "AliasMode seeProfile" (the default) is in effect and the user profile option is true, typing "Foo" produces the output:
Hello World
 %
AkaOn
This command enables the Aka system. Unfortunately, Aka works by registering additional lookup methods with the Command Tool, and there is no global registration facility. Therefore, the user must issue AkaOn separately in each Command Tool where Aka names are desired. Including "AkaOn" in the BootCommands, EachCommandToolCommands, and PerLogin sections of of the user profile is known to add Aka processing to each command tool.
AkaDoc name documentationText
Ordinarily, the CommandTool's "??" command will respond, for an Aka-defined name, with the corresponding macro text. If, however, documentation text has been provided, this text is supplied instead. Some may find this useful.
AkaBackup
This command closes the Aka database, backs up the database using SModel, then reopens the database. See the AkaPrep command in Section 3 and the installation section, Section 5, for more information about the database and its maintenance.
AkaGetDefaultDB
This names a command file that moves a copy of the default database (named AkaLB.df) to your user root directory in the local directory and then, if all goes well, changes it to point to your home user directory. See the installation section, Section 5.
Nka name
This command disables the recognition or expansion of the name. The definition remains unchanged in the database, but will not be recognized until the name is enabled again using the Aka name command. This permits standard command tool commands or aliases to be superceded by alternative definitions, at the descretion of the user.
AkaUser {simple|rName}
Intended primarily for use in some of the predefined aliases described below, "AkaUser" or "AkaUser rName" behave like the CommandTool User command (they print the Grapevine user name), except that they also return this value as their result, so that the ampersand-variable &Result will contain this value during the execution of the next command. "AkaUser simple" returns only the user name, without the registry.
No switches are defined for any of the Aka-related commands.
2. Ampersand-substitution
Any Aka-defined name may be used as a command tool &-variable, permitting its expansion anywhere in a command line. Again, the name space for a given user is global to the entire system, not one command tool or one process. Although these names are stored in a single space, probably no one definition will be useful as both a command expansion and an &-variable expansion. In particular, parameters will not be substituted in the &-variable expansion.
As an example of this feature, if one were to define "Aka ch7t /Cedar/CedarChest7.0/top", then "bringover -p &ch7t/Finch" would expand to "bringover -p /Cedar/CedarChest7.0/top/Finch". Of course, as with Aka-defined commands, these definitions persist until disabled or redefined.
3. Predefined aliases
If you follow the installation instructions in Section 4, the following command(s) will be available in your personal database as soon as you have issued the AkaOn command.
AkaPrep
If you issue AkaPrep before defining new aliases (or at the beginning of every session) and AkaBackup after making changes (or at the end of every session—good luck arranging that reliably), then wherever you go, you will always have an up-to-date version of all of your Aka-maintained aliases. This was considered more reliable than arranging for the database to reside on a non-replicated service, and significantly easier than providing a automatically replicated one.
This alias is defined approximately as:
Aka AkaPrep Push;lbclose akalb;AkaUser simple;BringOver /user/&Result/top/akalb;pop
where AkaUser is the built-in command described above.
4. Suggested aliases.
These are some of my favorites. They are also included in the initial database, but are marked as disabled. To enable alias foo, type Aka foo. Or edit the database directory to enable all of the commands. See the LoganBerry documentation.
Aka AkaBrowse Push;LoganBerryBrowse AkaLB.df;pop
 -- Full documentation through database browsing
Aka BCh (x) bring -p /cedar/cedarchest7.0/top/x.df
Aka BP (x) bring -p /cedar/cedar7.0/top/df
Aka Bring QBO
Aka BringR (x) pushv commands;bch x;pop
Aka c7 /cedar/cedar7.0 -- &-variables
Aka c7t /cedar/cedar7.0/top
Aka ch7 /cedar/cedarchest7.0
Aka ch7t /cedar/cedarchest7.0/top
Aka InstallR (xx) pushv commands;install xx;pop
Aka LSDirty ls -u *!H
Aka Make (x) MakeDo -dr x
Aka Profile Push;AkaUser simple;Open &Result.Profile;Pop
Aka r ///7.0/commands -- &-variable for current release directory.
Aka Replace (x) smodel -~c x -- Fast, dangerous SModel.
Aka s ///7.0/system
Aka SendQuoth (x) sendip -h quoth x.interpress
Aka SMerify (x) smodel x; verify x
Aka TTI (x) TiogaToInterpress x.tioga
Aka TTIQuoth (x) tti x;sendquoth x
5. Installation and maintenance.
Bringover Aka.df from Cedar Chest into your standard commands directory. Issue the AkaGetDefaultDB command, which will put a copy of the standard database (root file AkaLB.df) on your user root directory and edit it to point to your own User/®/Top/ subdirectory. Issue the AkaOn command. Arrange with your user profile for AkaOn to be issued once in each command tool as it is created. Enable any of the suggested aliases, either by issuing Aka foo for each foo you want or by text-editing the database (see LoganBerry documentation). Issue the AkaBackup command to move a copy of your database to the backup directory.
Subsequently, invoke AkaPrep when moving to a new machine or when you're about to add to the database. Issue AkaBackup when you've finished making the changes.
6. Shortfalls
Once the notion of a persistent name space and a flexible data base in which to store it has been introduced, there are doubtless an unending number of improvements that could be contemplated. This is not the place to discuss them, but the author welcomes ideas.
A known shortcoming is that ampersand-variables appearing in the definitions of aliases that are themselves used as ampersand-variables will not be expanded; they must be manually expanded in their definitions.
One additional problem is that commands such as AkaPrep and AkaBrowse, which require the valid results of the AkaUser commands, will not work right in an XNS-only world, since they deal only with Grapevine RNames. Installation will also not go smoothly for XNS-only users, at present. Perhaps such a user would like to debug the process.
Please report other problems, so that they can be repaired or at least documented here.