DIRECTORY IO, EBTypes, RefTab, Rope; EBLanguage: CEDAR DEFINITIONS = BEGIN ButtonInfo: TYPE = EBTypes.ButtonInfo; Context: TYPE = EBTypes.Context; ROPE: TYPE = Rope.ROPE; EBLanguageProc: TYPE = EBTypes.EBLanguageProc; PoppyParse: PROC [stream: IO.STREAM] RETURNS [symbols: RefTab.Ref, order: LIST OF ATOM]; PoppyParseFieldNames: PROC [stream: IO.STREAM] RETURNS [symbols: RefTab.Ref, order: LIST OF ATOM]; PoppyParseFieldValues: PROC [symbols: RefTab.Ref]; PoppyUnparse: PROC [symbols: RefTab.Ref, order: LIST OF ATOM] RETURNS [result: ROPE]; FieldParseProc: TYPE = PROC [stream: IO.STREAM] RETURNS [val: REF]; RegisterFieldParseProc: PROC [fieldName: ATOM, parseProc: FieldParseProc]; FieldUnparseProc: TYPE = PROC[val: REF] RETURNS [rope: ROPE]; RegisterFieldUnparseProc: PROC [fieldName: ATOM, unparseProc: FieldUnparseProc]; VariableType: TYPE = REF VariableTypeObj; VariableTypeObj: TYPE = RECORD [ class: {boolean, atom, rope, integer, real, enumerated}, enumeration: SEQUENCE count: NAT OF REF ANY ]; VariableTable: TYPE = RefTab.Ref; Variable: TYPE = REF VariableObj; VariableObj: TYPE = RECORD [ type: VariableType, value: REF ]; CreateVariableTable: PROC [] RETURNS [table: VariableTable]; GetVariable: PROC [table: VariableTable, name: ATOM] RETURNS [variable: Variable]; SetVariable: PROC [table: VariableTable, name: ATOM, variable: Variable]; DeleteVariable: PROC [table: VariableTable, name: ATOM] RETURNS [existed: BOOL ¬ FALSE]; GetFieldRope: PROC [symbols: RefTab.Ref, key: ATOM] RETURNS [rope: ROPE]; GetFieldAtom: PROC [symbols: RefTab.Ref, key: ATOM] RETURNS [atom: ATOM]; GetFieldRef: PROC [symbols: RefTab.Ref, key: ATOM] RETURNS [ref: REF]; SetFieldRope: PROC [symbols: RefTab.Ref, order: LIST OF ATOM, key: ATOM, rope: ROPE]; SetFieldAtom: PROC [symbols: RefTab.Ref, order: LIST OF ATOM, key: ATOM, atom: ATOM]; SetFieldRef: PROC [symbols: RefTab.Ref, order: LIST OF ATOM, key: ATOM, ref: REF]; Equal: PROC [o1, o2: REF ANY] RETURNS [result: BOOL ¬ FALSE]; EqualInt: PROC [o1: REF ANY, o2: INT] RETURNS[result: BOOL ¬ FALSE]; EqualBool: PROC [o1: REF ANY, o2: BOOL] RETURNS[result: BOOL ¬ FALSE]; RegisterProc: PROC [name: ATOM, proc: EBLanguageProc, interpreted: BOOL ¬ TRUE]; Evaluate: PROC [expression: REF, buttonInfo: ButtonInfo, clientData: REF ¬ NIL, context: Context ¬ NIL] RETURNS [REF ANY]; AddEntity: PROC [entity: REF ANY, entityList, ptr: LIST OF REF ANY] RETURNS [newList, newPtr: LIST OF REF ANY]; CreateContext: PROC [] RETURNS [context: Context]; GetSystemValue: PROC [context: Context, name: ATOM] RETURNS [value: REF]; SetSystemValue: PROC [context: Context, name: ATOM, value: REF]; END. Ζ EBLanguage.mesa Copyright Σ 1989, 1991, 1992 by Xerox Corporation. All rights reserved. Goodisman, August 16, 1989 4:54:50 pm PDT Bier, August 28, 1991 1:29 pm PDT Doug Wyatt, April 10, 1992 6:56 pm PDT Contents: parser, unparser, evaluator, and some convenience routine for the EmbeddedButtons language (a lisp-like, not-turing equivalent language). Produces a printed representation of the object. If object is a list, uses the prettyPrintList to pretty print the object. The first item in the list is a rope to be inserted before every top level object in the list. The second item in this list is a boolean specifying if the rope should be inserted before the first item. The third and fourth items in the list are for the second level, etc. Parses expressions in the Poppy Language, and stores name value pairs in "symbols". For example, this expression binds values for the names ButtonClass, Menu, MessageHandler, and Feedback: ButtonClass: PopUpButton Menu: ( (Event1 "First Item" "Sends Event1 to application") ((Event2 Arg2) "Second Item" "Sends Event2 to application") ((Event3 ) "Third Item" "Sends Event3 to application") ) MessageHandler: MessageWindow Feedback: ( (MouseMoved ) ) Records the poppy keywords in the symbol table and associates each one with a ROPE representing the value. Use PoppyParseFieldValues to parse the values. PoppyParseFieldNames followed by PoppyParseFieldValues is equivalent to PoppyParse. For each key-value pair in symbols that has a ROPE value, parse that value based on the parsing routines registered for that key. Used after PoppyParseFieldNames to complete a two-step (lazy evaluation) parse. Returns ERROR ERROR is some key has a non-rope value. Produces a printed representation of the name-value pairs in "symbols" using the Poppy Language. Gets the value and type of the named variable from the variable table. Sets the value and type of the named variable in the variable table. Deletes the named variable from the table. Short for "IO.SkipWhitespace[...]; ReadWord[f]" If o1 and o2 are types produced by Parse, checks if they are equal. Registers a name-proc pair for use in evaluation. If the object is a procedure call, looks up the procedure and calls it, evaluating arguments first, if topOnly is FALSE. Otherwise, if topOnly is FALSE, evaluates every item in the list. Adds the entity to the end of the list, returning the new tail pointer. Good for list construction. Κ•NewlineDelimiter –(cedarcode) style™šœ™Jšœ Οeœ=™HJšœ)™)Icode™!K™&—K˜JšΟnœ‹™“J™šΟk ˜ KšŸœ˜—K˜šž œŸœŸ œŸ˜%K˜Kšœ Ÿœ˜&Kšœ Ÿœ˜ KšŸœŸœŸœ˜—K˜šœŸœ˜.Jšœ2™2J™ά—J™šž œŸœ ŸœŸœŸœŸœŸœŸœ˜XJšœ½™½Idisplay™¬—šžœŸœ ŸœŸœŸœŸœŸœŸœ˜bJšœο™οJ™—šžœŸœ˜2Jšœ‰™‰J™—šž œŸœŸœŸœŸœŸœ Ÿœ˜UJšœ`™`—K˜Kš œŸœŸœ ŸœŸœŸœŸœ˜CKšžœŸœ Ÿœ˜JK˜Kš œŸœŸœŸœŸœŸœ˜=KšžœŸœ Ÿœ!˜PJ™KšœŸœŸœ˜)šœŸœŸœ˜ Kšœ8˜8Kšœ ŸœŸœŸœŸ˜+Kšœ˜K˜—šœŸœ˜!K™—Kšœ ŸœŸœ ˜!šœ ŸœŸœ˜Kšœ˜KšœŸ˜ K˜—K˜KšžœŸœŸœ˜<šž œŸœŸœŸœ˜RK™FK™—šž œŸœŸœ˜IK™DK™—š žœŸœŸœŸœ ŸœŸœ˜XK™*Iprocšœ Ÿœ"™/M™—M˜Mš ž œŸœŸœŸœŸœ˜IMš ž œŸœŸœŸœŸœ˜IMš ž œŸœŸœŸœŸœ˜FMšž œŸœŸœŸœŸœŸœŸœ˜UMšž œŸœŸœŸœŸœŸœŸœ˜UMšž œŸœŸœŸœŸœŸœŸœ˜RK˜šžœŸœ ŸœŸœŸœ ŸœŸœ˜=J™C—J™KšžœŸœŸœŸœŸœŸœ ŸœŸœ˜Dšž œŸœŸœŸœŸœŸœ ŸœŸœ˜FK˜—š ž œŸœŸœ%ŸœŸœ˜PJ™1J™—šžœŸœŸœ&ŸœŸœŸœŸœŸœŸœ˜zJ™»—K˜šž œŸœ ŸœŸœŸœŸœŸœŸœŸœŸœŸœŸœŸœ˜oJ™d—K˜Kšž œŸœŸœ˜2Kš žœŸœŸœŸœ Ÿœ˜IKšžœŸœŸœ Ÿœ˜@K˜KšŸœ˜—…— X$