CDEnvironment.mesa (part of ChipNDale)
Copyright © 1983, 1987 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, August 11, 1983 11:32 am
Last Edited by: Christian Jacobi, March 3, 1987 5:32:43 pm PST
DIRECTORY
CD USING [Technology],
Commander USING [CommandProc],
Icons USING [IconFlavor],
Rope USING [ROPE],
TIPUser USING [TIPTable];
CDEnvironment: CEDAR DEFINITIONS =
BEGIN
Implementation of Cedar user interface features
cdVersion:
READONLY
NAT;
--The current ChipNDale release number
--e.g. 28
profilePrefix:
READONLY Rope.
ROPE;
--Prefix for user profile options
--e.g. "ChipNDale28."
preRelease:
READONLY
BOOL;
--Never ever make output with a pre-released version of ChipNDale
--and try to read the files with a released version of ChipNDale.
-- Tip tables
SetTipTable:
PROC [for:
REF, tipTable: Rope.
ROPE←
NIL];
--Verbose on TerminalIO
--for: Design, Technology or global
--tipTable: NIL for standard lookup (user profile)
GetTipTable:
PROC [for:
REF]
RETURNS [TIPUser.TIPTable];
--for: Design, Technology or global
-- Icons
SetIcon:
PROC [for:
REF, file: Rope.
ROPE, n:
NAT];
--for: Design, Technology or global
--Only new viewers might get the new icon
GetIcon:
PROC [for:
REF]
RETURNS [Icons.IconFlavor];
--for: Design, Technology or global
SetPanelIcon:
PROC [for:
REF, file: Rope.
ROPE, n:
NAT];
--for: Design, Technology or global
--Only new viewers might get the new icon
GetPanelIcon:
PROC [for:
REF]
RETURNS [Icons.IconFlavor];
--for: Design, Technology or global
-- Working Directories
SetWorkingDirectory:
PROC [for:
REF, wDir: Rope.
ROPE←
NIL];
--Sets the working directory of ChipNDale feature (not process)
--for: Design, Technology, NIL for ChipNDale itself (dangerous)
--wDir: if NIL: takes wDir from profile or process
GetWorkingDirectory:
PROC [for:
REF←
NIL]
RETURNS [wDir: Rope.
ROPE];
--Gets the working directory for a ChipNDale feature (not process) [in slash format]
--design: Design, Technology or ChipNDale's global directory
DoWithWDir:
PROC [wDir: Rope.
ROPE, proc:
PROC];
--executes proc with wDir as current working directory for process
-- Commander
RegisterCommander:
PROC [key: Rope.
ROPE, proc: Commander.CommandProc ←
NIL, doc: Rope.
ROPE ←
NIL, clientData:
REF ←
NIL, interpreted:
BOOL ←
TRUE, technology:
CD.Technology ←
NIL];
--Like Commander.Register, but also registers command with directory prefixes for
--technology's and ChipNDale's global directory [in slash format]
-- Names
MakeName:
PROC [base: Rope.
ROPE, ext: Rope.
ROPE←
NIL, wDir: Rope.
ROPE←
NIL, modifier: Rope.
ROPE←
NIL]
RETURNS [Rope.
ROPE];
--Makes a full path filename: adds extension ext if base does not have an extension;
--Adds working directory wDir if base is not a full path name
--Adds modifier if not NIL.
--No check whether file exist is made.
FindFile:
PROC [base: Rope.
ROPE, ext: Rope.
ROPE←
NIL, for:
REF←
NIL]
RETURNS [Rope.
ROPE];
--Makes a full path filename and checks existence of file.
--Returns NIL if file does not exist.
-- Loader
RemoveSpaces:
PROC [line: Rope.
ROPE]
RETURNS [Rope.
ROPE←
NIL];
--Returns rope with spaces (and tabs) removed from both ends
SplitLine:
PROC [line: Rope.
ROPE]
RETURNS [key, rest: Rope.
ROPE←
NIL];
--Splits a line into a keyword and the rest
--Returns
-- key: keyword at beginning of line;
-- (leading spaces and trailing separator [space or colon] removed)
-- rest: rest of line (after separator)
-- (leading spaces removed)
FetchKeyLine:
PROC [fileName: Rope.
ROPE, key: Rope.
ROPE]
RETURNS [entry: Rope.
ROPE];
--Searches for a line starting with key in file
--Returns the rest of the line found or NIL if not found
StuffToCommandTool:
PROC [r: Rope.
ROPE, wDir: Rope.
ROPE←
NIL, searchPath:
LIST
OF Rope.
ROPE←
NIL, catchErrors:
BOOL←
TRUE, continueErrors:
BOOL←
TRUE]
RETURNS [result:
REF←
NIL];
--Executes r with a commandtool
--catchErrors: allows to interactively debug on errors
--continueErrors: continue after error or aborting the debugger
ExecFileEntry:
PROC [key: Rope.
ROPE, technology:
CD.Technology←
NIL, modifier: Rope.
ROPE←
NIL, catchErrors:
BOOL←
TRUE, continueErrors:
BOOL←
TRUE];
--Checks whether a particular key is mentioned in a .CDLoadList file
--if particular key is found, executes the rest of the line with a command tool
--technology and modifier are used to make the name of the used .CDLoadList file
--(using modifier .CDLoadList files for particular feature classes can be distinguished)
--building of name for the .CDLoadList files:
-- ChipNDale-CD.CDLoadList if {technology=NIL, modifier=NIL}
-- ChipNDale-CD-modifier.CDLoadList if {technology=NIL, modifier#NIL}
-- ChipNDale-technologyName.CDLoadList if {technology#NIL, modifier=NIL}
-- ChipNDale-technologyName-modifier.CDLoadList if {technology#NIL, modifier#NIL}
LoadTechnology:
PROC [key:
ATOM, name: Rope.
ROPE]
RETURNS [
CD.Technology];
--Makes all the necessary messages if not loaded
END.