<> <> <> <> DIRECTORY CD, Rope; CDMakeProcPrivate: CEDAR DEFINITIONS = BEGIN <> 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; <<>> GetEnvironmentProp: PROC [env: Environment, key: REF] RETURNS [REF]; PutEnvironmentProp: PROC [env: Environment, key: REF, val: REF]; <<>> <<-- For classes defining specific generation of code>> <<-- implementing requests of generation of certain pieces of code>> ExpressionProc: TYPE = PROC [env: Environment, x: REF, probablyReUse: BOOL_FALSE] 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: BOOL_TRUE]; <<--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: REF_NIL] 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.