DIRECTORY IntCodeDefs, IO, Rope; C2CBasics: CEDAR DEFINITIONS = BEGIN c2cVersion: READONLY Rope.ROPE; rootNode: IntCodeDefs.Node; labelWithLambda: IntCodeDefs.LabelNode; Context: TYPE = RECORD [key: REF ¬ NIL, node: IntCodeDefs.Node¬NIL, data: REF ¬ NIL]; ContextSequence: TYPE = RECORD [ idx: NAT, seq: SEQUENCE max: NAT OF Context ]; ctxTop: REF ContextSequence; PushContext: PROC [ctx: Context]; PopContext: PROC []; GetProp: PROC [key: REF] RETURNS [val: REF]; PutProp: PROC [key, val: REF]; Report: PROC [what: Rope.ROPE ¬ NIL]; FatalError: ERROR [what: Rope.ROPE ¬ NIL]; ErrorStream: PROC [] RETURNS [IO.STREAM]; CantHappen: SIGNAL; CantHappenCedar: SIGNAL; CantHappenPreprocessed: SIGNAL; CaseMissing: SIGNAL; NotYetImpl: SIGNAL; NotYetImplPreprocessed: SIGNAL; CallbackWhenC2CIsCalled: PROC [p: PROC]; END. , C2CBasics.mesa Copyright Σ 1987, 1988, 1989, 1990, 1991 by Xerox Corporation. All rights reserved. Christian Jacobi, 1987 Christian Jacobi, January 15, 1993 11:31 am PST This definition exports internal basic features of C2C. It copies some few well defined fields from C2CAccess to prevent too frequent imports of C2CAccess. On the other side only quite stable features are available in C2CBasics, as this is at the root of C2C's dependency graph. Note that C2C is non re-entrant and uses global per compilation state. Globals and state A text which allows to identify the version of C2C used. The input node... The current procedure... Context mechanism Today I consider it somewhat questionable Interpretation of context: Start with C2CBasics.ctxTop.seq[C2CBasics.ctxTop.idx] and go backwards until first unknown key is found once an unknown key is found interpreting more context is not safe. Properties Use rarely, mainly while developing feature Get property from current compilation Put property onto current compilation Every compilation starts with an empty property list Errors and prograss Reports some progress. Defaults to a dot. usa rarely ! Signalled on fatal errors which should be told to the client. There is something wrong in the compiled program, not the compiler. Compilation aborts when raised. Returns a stream for error messages Side effect: this causes C2C to fail but compilation does not yet aborts. Signalled when something is simply not possible (according to our intentions, at least) Signalled when something is simply not possible in the case of Cedar to C Signalled when something is should not be possible according to our preprocessing requirements Used e.g. as endcase where we think we considered all cases; Protects from future incomplete introduction of new cases Proceed may work or lead to disaster We intend to require preprocessing which makes this impossible Proceed may work or lead to disaster Callbacks Registers a procedure which is called whenever C2C is newly called Use this to initialize global per compilation variables Κφ–(cedarcode) style•NewlineDelimiter ™šœ™Icodešœ ΟeœI™TKšœ™K™/—K˜šΟk ˜ Kšœ ˜ Kšžœ˜Kšœ˜—K˜K™9K™Kšœί™ίK™K™FK™KšΟn œžœž œ˜Kšž˜head™šœ žœžœ˜Kšœ8™8—K˜šœ˜K™—K˜šœ'˜'K™——šœ™K™)K˜Kšœ žœžœžœžœžœžœžœ˜Ušœžœžœ˜ Kšœžœ˜ Kšœžœžœžœ˜!K˜—Kšœžœ˜KšŸ œžœ˜!šŸ œžœ˜™Kšœg™gK™C———™ K™+K˜š Ÿœžœžœžœžœ˜,K™%—šŸœžœ žœ˜K™%K™4——™šŸœžœ žœžœ˜%J™*J™ —K˜š Ÿ œžœ žœžžœ˜*Kšœ=™=K™CK™—K˜impš Ÿ œžœžœžœžœ˜)M™#M™IM™—šŸ œžœ˜KšœW™W—šŸœžœ˜Kšœ?Οbœ™I—šŸœžœ˜Kšœ^™^—šŸ œžœ˜K™=K™9—šŸ œžœ˜KšΟc$™$—šŸœžœ˜Kšœ>™>Kš‘$™$——™ šŸœžœžœ˜(M™BM™7M™——Mšžœ˜M˜K˜—…—:\