CDMakeProcPrivate.mesa (module for ChipNDale)
Copyright © 1985 by Xerox Corporation. All rights reserved.
by Christian Jacobi, May 9, 1985 1:58:40 pm PDT
last edited Christian Jacobi, October 8, 1985 2:11:00 pm PDT
DIRECTORY
CD, Rope;
CDMakeProcPrivate: CEDAR DEFINITIONS =
BEGIN
Private interface to split the tool which generates Cedar programs to generate layout
Environment: TYPE = REF EnvironmentRep;
--the environment represents the unfinished Cedar code to be produced
--it is passed through and has all the necessary information about used idendentifiers
--already issued declarations and other crap.
EnvironmentRep: TYPE;
-- For classes defining specific generation of code
-- implementing requests of generation of certain pieces of code
ExpressionProc: TYPE = PROC [env: Environment, x: REF, probablyReUse: BOOLFALSE] RETURNS [Rope.ROPE];
--env: environment for the code (declarations... might be used or included
--x: object for which an expression is to be made
--probablyReUse: this object migh be needed again and it would be wise to somehow
-- make a definition
--It is ok to issue a local statement; such a statement would preceed the statement which
--contains the returned expression.
RegisterExpressionProc: PROC [for: REF, ep: ExpressionProc, tech: CD.Technology ← NIL];
--register certain Object classes with a procedure how to make an object of this class
-- Dealing with identifiers and declarations
IncludeDirectory: PROC [env: Environment, module: Rope.ROPE, import: BOOLTRUE];
--The code gets a DIRECTORY entry for the module
--import: the code also gets an IMPORT...
LayerIdent: PROC [env: Environment, l: CD.Layer] RETURNS [Rope.ROPE];
--Returns a rope with an identifier for this layer
--This identifier will be initialized
GlobalIdent: PROC [env: Environment, whatFor: REF] RETURNS [Rope.ROPE];
--Returns a rope with an identifier for whatFor
--Must not depend on it beeing defined with GlobalDeclaration1,
--but either GlobalDeclaration1 or GlobalDeclaration2 has defined the identifier
--Nil if not declared in module
RequestGlobalIdent: PROC[env: Environment, proposed: Rope.ROPE, whatFor: REFNIL] RETURNS [Rope.ROPE];
--Returns an identifier which is unique
--If called twice, it returns different identifier's
--if whatFor#NIL the identifier can be fetched using GlobalIdent; the caller is responsible
--for declaring that ident using either GlobalDeclaration1 or GlobalDeclaration2
-- Introducing declarations and code into the program
-- to build up the right environment to fulfil a request
LocalStatement: PROC[env: Environment, line: Rope.ROPE];
--introduces statement for the local procedure
GlobalDeclaration1: PROC[env: Environment, line: Rope.ROPE];
--introduces declaration into the module, before the main procedures
GlobalDeclaration2: PROC[env: Environment, line: Rope.ROPE];
--introduces declaration into the module, just before the statements
GlobalStatement: PROC[env: Environment, line: Rope.ROPE];
--introduces statement for the module
--convert procedures
AtomToRope: PROC [env: Environment, a: ATOM] RETURNS [Rope.ROPE];
--vanilla procedures converting to ropes
PosToRope: PROC [pos: CD.Position] RETURNS [Rope.ROPE];
RectToRope: PROC [rect: CD.Rect] RETURNS [Rope.ROPE];
RopeToRope: PROC [Rope.ROPE] RETURNS [Rope.ROPE];
END.