ExecHacksDoc.tioga
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, March 12, 1985 1:05:00 pm PST
Tim Diebert May 28, 1985 11:20:35 am PDT
Rick Beach, June 14, 1986 2:55:55 pm PDT
Spreitzer, January 21, 1986 7:23:44 pm PST
Last Edited by: Gasbarro January 22, 1986 4:27:38 pm PST
Mike Spreitzer December 9, 1986 6:14:46 pm PST
Eric Nickell, December 23, 1986 3:36:18 pm PST
Bertrand Serlet July 18, 1986 4:32:51 pm PDT
EXECHACKS
CEDAR 6.1 — FOR INTERNAL XEROX USE ONLY
ExecHacks
Michael Plass
© Copyright 1985 Xerox Corporation. All rights reserved.
Abstract: ExecHacks adds some handy menu buttons to CommandTool viewers: "DoIt" and "Redo". "DoIt" deduces a filename from the selection, and depending on the extension executes some interesting command: for .Mesa files, it compiles; for .DF files it SModels and VerifiesDF, etc. "Redo" performs two functions. Left-clicking or middle-clicking "Redo" will replay the command currently pointed to. Right-clicking "Redo" will list the last 10 commands issued to the CommandTool, with duplicates removed. ExecHacks also registers two commands. "Redo <string>" re-executes the most recent command beginning with "<string>". "History -d 10" does the same thing as right buttoning "Redo". Finally, ExecHacks modifies the "Save" button on tioga viewers, so that right-clicking Save will save the file and DoIt, depending on the extension of the file.
Keywords: DoIt, Redo, History, DWIM, Compile, SModel, VerifyDF, Copy, Command File, User Profile, Save Button, EditorComforts, Icons
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

For Internal Xerox Use Only
ExecHacks
ExecHacks adds some handy menu buttons to CommandTool viewers: DoIt and Redo.
DoIt Buttons
A DoIt button deduces a filename from the selection, and depending on the extension executes some interesting command: for .mesa files, it compiles; for .df files it SModels and VerifiesDF; .cm or .load files are simply invoked; and so on. The action perfomed is actually determined by user profile entries, and can be extended by the user. The association given above is from the defaults, which are given below. The DoIt operation is purely textual, and the command is executed in the current working directory of the command tool, which may be different from the directory containing the file, so watch your directories.
When a DoIt button labeled DoThis operation is invoked on a file with extension foo, ExecHacks looks for a user profile entry ExecHacks.DoThis.foo (if not found it will look for ExecHacks.For.foo for historical compatibility), or ExecHacks.DoThisNoExtension (plus ExecHacks.ForNoExtension for historical compatibility) if the filename has no extension. The command to be executed is derived from the entry by replacing every occurrence of the a string of the form "<field>" by the appropriate part of the filename. The recognized fields are: `server', `dir', `subDirs', `base', `ext', `ver', `directory', `short' and `fileName'. The `fileName' field means the whole filename, in IFS "brackety" syntax, including version, if present. The others are the result of parsing the filename as "[Server]<Dir>SubDirs>Base.Ext!Ver" or as "DirectoryShort!Ver".
Redo Button
Redo performs two functions on the history of commands in a CommandTool typescript. Left-clicking or middle-clicking Redo will replay the command(s) currently contained in the current selection. If the selection is at the end of the CommandTool viewer or in another viewer, then the most recently issued command is executed. Right-clicking Redo will list the last 10 commands issued to the CommandTool, with duplicates removed. These can then be executed by selecting one or more of them and left-clicking Redo.
Initiating ExecHacks
To use ExecHacks, add the command ExecHacks to the CommandTool.PerLogin and CommandTool.PerCommandTool entries in your profile. The ExecHacks command affects only the command tool it is invoked from.
Redo and History Commands
ExecHacks also implements a UNIX-like redo. Issuing the command

%
Redo fo
(in a command tool that has been hacked by ExecHacks) causes the most recent command whose name (excluding directory part) begins with "fo". The command

% History -d 47
prints out the last 47 commands; if the number is omitted, 10 is used. The -d means to suppress duplicates. Also, a -% switch would suppress printing the prompt before each command. This is useful for building command files from history.
SaveAndDoIt
When the SaveAndDoIt feature is enabled, right-clicking Save will save the file, look for a CommandTool in the same directory as the file, and DoIt (accordingly to the extension) in that CommandTool. The screen will blink if it is not possible to DoIt. No attention is paid whether the CommandTool is currently active, or iconic, or both: in all cases the action is logged in the CommandTool queue. Note that SaveAndDoIt will execute the first button in your DoIt button list.
The SaveAndDoIt feature leaves unchanged the left and middle Save, so people wanting to use both EditorComforts and the SaveAndDoIt saving features should in sequence left-click and right-Click Save, and a middle click still only executes vanilla Save.
Icon Mapping
ExecHacks also will automatically select an icon shape for newly created (or edited or saved) files, based on the extension of the file, and whether the viewer is considered to be edited or not. The icons to be used must have been registered with IconRegistry. The icon to be used will be the first of the following:
1) The icon specified by the profile entry "ExecHacks.Icon.extension". (It will also check for "ExecHacks.DirtyIcon.extension" first if the viewer is edited.)
2) If the icon "extension" is registered (and "Dirtyextension" if ...), then it will use that one.
3) The icon specified by the profile entry "ExecHacks.DefaultIcon". (It will also check for "ExecHacks.DirtyDefaultIcon" first if the viewer is edited.)
4) Whatever the client code which created the viewer requested.
The following profile entry may by added to your profile to get one such mapping. (N.B. If you use Remember or another package which uses IconRegistry, you may need to fold these in as additions.)
RegisteredIcons: "
Mesa: ///Commands/ExecHacks.icons 0
DirtyMesa: ///Commands/ExecHacks.icons 1
Tioga: ///Commands/ExecHacks.icons 2
DirtyTioga: ///Commands/ExecHacks.icons 3
Df: ///Commands/ExecHacks.icons 4
DirtyDf: ///Commands/ExecHacks.icons 5
Config: ///Commands/ExecHacks.icons 6
DirtyConfig: ///Commands/ExecHacks.icons 7
Errlog: ///Commands/ExecHacks.icons 8
DirtyErrlog: ///Commands/ExecHacks.icons 9
"
User Profile Entries
ExecHacks.DoitButtonName: LIST OF ROPELIST["DoIt"]
The name(s) to be used for the DoIt buttons posted in command tools.
ExecHacks.RedoButtonName: ROPE ← "Redo"
The name to be used for the redo buttons.
ExecHacks.ButtonName.Mesa: ROPE ← "RCompile <base>"
ExecHacks.ButtonName.Cedar: ROPE ← "RCompile <base>"
ExecHacks.ButtonName.Config: ROPE ← "Bind <base>"
ExecHacks.ButtonName.cm: ROPE ← "<base>"
ExecHacks.ButtonName.load: ROPE ← "<base>"
ExecHacks.ButtonName.DF: ROPE ← "SModel <base>;\nVerifyDF <base>"
ExecHacks.ButtonName.BCD: ROPE ← "Run <base>"
ExecHacks.ButtonName.Profile: ROPE ← "Copy [User]<<base>>6.1> ← ///<base>.profile"
ExecHacks.ButtonName.*: ROPE ← "Blink"
These profile entries give the command line to be executed for files with the specified extensions (disregarding case), where <base> is the base part of the selected file name <base>.<ext>, when the button with the name ButtonName is executed.
ExecHacks.ButtonNameNoExtension: ROPE ← "RCompile <base>"
This gives the command to be executed for files that have no extension.
ExecHacks.SaveAndDoIt: BOOLTRUE
Enables the SaveAndDoIt feature.
ExecHacks.DirtyIcon.extension: ROPEIconName
ExecHacks.Icon.extension: ROPEIconName
ExecHacks.DefaultDirtyIcon: ROPEIconName
ExecHacks.DefaultIcon: ROPEIconName