Heading:qjk40(635) Cedar 7T10 Updatey756qjk40\b17B Page Numbers: Yes X: 527 Y: 10.5"qjk40 Inter-Office Memorandumz18592l4445y762\f5b To Cedar Users Date December 18, 1981z18592l4445d2998e21(0,65535)(1,4445)(5,11684)(6,14146)\f7 2f0t2 1t0 11t6 1f7t0 4f0t7 1t0 From Ed Satterthwaite Location Palo Altoz18592l4445d2998y716e25\f7 4f0t2 1t0 16t6 1f7t0 8f0t7 1t0 Subject Cedar 7T10 Language and Compiler Update Organization CSLz18592l4445d2998e25\f7 7f0t2 1t0 39t6 1f7t0 12f0t7 1t0 XEROX z18592l508y644e14(2116)\f2 5f0 Filed on: [Indigo]Lang>Cedar7T10Update.Bravo DRAFTe30(0,16264)(1,65535)(5,65535)(6,65535)\f7 49f0 1f7 5f1 1f9b5f1B x2e12(2116) This memo summarizes the differences between the 7T7 and 7T10 versions of the Cedar language and compiler. It consists of extracts from the document [Indigo]Lang>Cedar7T10.press.x2jk40(1799) LANGUAGE CHANGESx2e24k80\b Predeclared Typesx2e18k80\b17B To support the currently recommended Cedar standards, the types BOOL, INT and CHAR are predeclared, with the following definitions:e12j(635)\64i4I2i3I5i4I BOOL: TYPE = BOOLEAN; CHAR: TYPE = CHARACTER; INT: TYPE = LONG INTEGER;l3564e12\1i5I1f7 4f0 3i7I3i5I1f7 4f0 3i9I3i4I1f7 4f0 3f7 4f0 1i7I Also, the definition of the predeclared type CONDITION has been changed. The default value for the timeout interval now is effectively infinite; i.e., a WAIT on a condition variable with default initialization will never time out. (The previous default provided a timeout after 100 ticks.) Use a runtime procedure such as Process.SetTimeout to change the default setting.e12j\45i9I100f7 4f0 167i7I1i10I Rope Literalsx2e18k80(1799)\b13B The Cedar language now provides rope literals. Such a literal is denoted by a quoted string, e.g., "This is a rope literal". Its value is a reference to a rope object in the standard (counted) zone provided by the Cedar system.x2e12jk40 The target type established by the context in which a quoted string literal appears determines the interpretation of that literal. There are three cases:x2e12jk40 If the target type is Rope.ROPE, Rope.Ref or Rope.Text, the quoted string denotes a rope literal and has type Rope.Ref.l3564x2e6jk40\22i4I1i4I2i4I1i3I4i4I1i4I56i4I1i3I If the target type is any other REF type, the literal has type REF TEXT.l3564x2e6k40\32f7 3f0 28f7 8f0 Otherwise, the literal has type STRING.l3564x2e6k40\32f7 6f0 In the first case, the test is actually for equivalence between the target type and either REF Rope.RopeRep or REF Rope.TextRep. The matching is performed on the names of the interface (Rope) and referent type (RopeRep or TextRep), not on the structure of the referent type. Since this is a loophole in the type checking, use nonstandard versions of the Rope interface very cautiously.x2e12jk40\f1 91f7 3f1 1i4I1i7I4f7 3f1 1i4I1i7I60i4I21i7I4i7I126i4I Escape Convention for Literalsx2e18k80\b30B Cedar provides an escape convention to allow denotations of nonprinting characters in character and string literals (cf. the escape convention for the language C). The escape character is \, and the following codes are recognized:e12j(635) Code Interpretationl3564x2e6k40(1799)\2u4U20u14U \n, \N, \r, \R Ascii.CR \t, \T Ascii.TAB \b, \B Ascii.BS \f, \F Ascii.FF \l, \L Ascii.LF -- note that \n = LF in C \ddd dddC -- where d is an octal digit, ddd < 377B \\ \ \' ' \" "l3564x2e6k40\15i6I1i2I9i6I1i3I9i6I1i2I10i6I1i2I9i6I1i2I29i3I2i4I12i1I20i3I1f3 1f0 10i1I6i1I6i1I Anything else following a \ is an error.e6(635) You can use the escape convention in character literals (e.g., '\n or '\032) or string literals (e.g., "abc\ndef").e12j APPLY and RETURNx2e18k80(1799)\f7b5f0 5f7 6f0B Cedar is based upon a model of interprocedural control transfer in which the construction of an argument record is clearly separated from the actual transfer of control. In the usual forms for specifying call or return, however, these operations are syntactically indivisible. There are now alternative syntactic forms that allow you to invoke transfer operations using already constructed argument records.e12j(635) This extension is not fully general. The existing record must have a type compatible with the type required by the transfer operation, and the only types compatible with argument record types are other argument record types. Such types are defined implicitly by the definitions of transfer types, and they are always anonymous. Thus you cannot declare variables having such types, nor can you construct values with such types unless the target type is established by a transfer operation of some sort. e12j\f1 The operator APPLY is used to apply a value with some transfer type to an argument record. The syntactic form ise12j\13f7 5f0 Call ::= ... | APPLY [ Expression , Expression ] | APPLY [ Expression , Expression ! CatchSeries ]l3564x2e6k40(1799)\f6b4f0B15f7 5f0 3f6b10f0B3f6b10f0B8f7 5f0 3f6b10f0B3f6b10f0B3f6b11f0B The type of the first Expression must be some transfer type (i.e., a type built using PROC, SIGNAL, ERROR, PROCESS, PORT or PROGRAM), and the second Expression must have a record type as good as the argument type required for the transfer (see below). The effect is to invoke the transfer operation appropriate to the type of the first Expression, i.e., to call a procedure, raise a signal, join a process, etc. The scope of the optional catch phrase is just the transfer itself.e12j(635)\22f6b10f0B54f7 4f0 2f7 6f0 2f7 5f0 2f7 7f0 2f7 4f0 4f7 7f0 18f6b10f0B178f6b10f0B Note that the first Expression implies a target type for the second, which can be (but normally would not be) a constructor. For example,e12j\20f6b10f0B p[x, y] can be written as APPLY[p, [x, y]] q[x] can be written as APPLY[q, [x]] -- not APPLY[q, x]l3564x2e6k40(1799)\i1I1i1I2i1I20f7 5f0 1i1I3i1I2i1I3i1I1i1I20f7 5f0 1i1I3i1I16f7 5f0 1i1I2i1I The corresponding forms for returning an existing record aree12jk792(635) ReturnStmt ::= ... | RETURN Call | RETURN ( Expression )l3564x2e6k40(1799)\f6b10f0B14f7 6f0 1f6b4f0B6f7 6f0 3f6b10f0B ResumeStmt ::= ... | RESUME Call | RESUME ( Expression )l3564x2e6k40\f6b10f0B14f7 6f0 1f6b4f0B6f7 6f0 3f6b10f0B In these forms, the required type is established by the context in which the statement appears. The type of the Call or Expression must be a record type as good as the result type of the procedure body in which the ReturnStmt appears (or of the catch phrase in which the ResumeStmt appears).e12j(635)\113f6b4f0B4f6b10f0B85f6b10f0B46f6b10f0B An argument record type T1 is as good as an argument record type T2 if both of the following conditions are satisfied:e12j\24i1f1o252I1f0o0 39i1f1o252I1f0o0 T1 and T2 have the same number of fields, say n.l3564x2e6k40(1799)\i1f1o252I1f0o0 5i1f1o252I1f0o0 37i1I For each i, 1 < i < n, the type of the i-th component of T1 is as good as the type of the i-th component of T2; in addition, if both these components are named, the names are identical (i.e., names of field selectors must match, but an anonymous component matches any named component). l3564x2e6jk40\9i1I4f3 1f0 1i1I1f3 1f0 1i1I18i1I17i1f1o252I1f0o0 31i1I17i1f1o252I1f0o0 Note that this rule is more liberal than the rule for explicitly declared record types.e6j(635) In the terminology of the Mesa 5 manual, T1 is as good as T2 iff T1 conforms freely to T2; e.g., [0..10) is as good as [0..100). In the new view of types, we would say that T1 is as good as T2 iff the predicate for T1 implies the predicate for T2.e6j\f1 41i1o252I1o0 15i1o252I1o0 5i1o252I1o0 20i1o252I1o0 85i1o252I1o0 15i1o252I1o0 23i1o252I1o0 27i1o252I1o0 In Cedar 7T10, the constructs described above do not work for empty argument records; i.e., you cannot nest applications of procedures taking/returning nothing.e6j\f1 Examples:e12\i9I P1: PROC [x, y: INT] RETURNS [m, n: INT] = {...};l3564x2e6k40(1799)\i3I1f7 4f0 2i1I2i2I1i3I2f7 7f0 2i1I2i2I1i3I P2: PROC [m, n: INT] RETURNS [u, v: INT] = {...};l3564x2e6k40\i3I1f7 4f0 2i1I2i2I1i3I2f7 7f0 2i1I2i2I1i3I P3: PROC [a, b: INT] RETURNS [u, v: INT] = { RETURN APPLY[P2, P1[a, b]]};l3564x2e6k40\i3I1f7 4f0 2i1I2i2I1i3I2f7 7f0 2i1I2i2I1i3I8f7 6f0 1f7 5f0 1i2I2i2I1i1I2i1I i, j: INT; . . . [i, j] _ APPLY[P2, IF i < j THEN P1[i, j] ELSE [j, i]]; [i, j] _ APPLY[P3, [0, 0] ! s => {GOTO L}]; -- [i, j] _ P3[0, 0 ! s => {GOTO L}]l3564x2e6k40\i1I2i2I1f7 3f0 9i1I2i1I4f7 5f0 5f7 2f0 1i1I3i1I1f7 4f0 1i2I1i1I2i1I2f7 4f0 2i1I2i1I5i1I2i1I4f7 5f0 1i2I11i1I5f7 4f0 1i1I12i1I2i1I4i2I8i1I5f7 4f0 1i1I COMPILER CHANGESx2e30k80\b Tioga Source Filesx2e18k80\b18B The compiler and binder ignore text in Tioga trailers. Any occurrence of a pair of NUL characters (characters with value 0C) in a source file marks the logical end of that source file.e12j(635) File Lockingx2e18k80(1799)\b12B The Cedar 7T10 compiler is designed to be run under control of the system modeller. It also exports an interface allowing it to be run from Tajo or from the temporary Cedar executive. When it is run in this mode, the (rather minimal) facilities in PreCascade for obtaining exclusive access to a file are bypassed. Use caution.e12j(635)