(* Meta Printer Version 1.3 *) (* Author: Carsten Schuermann *) functor StatePrint (structure Global : GLOBAL (*! structure IntSyn' : INTSYN !*) (*! structure Tomega' : TOMEGA !*) (*! sharing Tomega'.IntSyn = IntSyn' !*) structure State' : STATE (*! sharing State'.IntSyn = IntSyn' !*) (*! sharing State'.Tomega = Tomega' !*) structure Names : NAMES (*! sharing Names.IntSyn = IntSyn' !*) structure Formatter' : FORMATTER structure Print : PRINT sharing Print.Formatter = Formatter' (*! sharing Print.IntSyn = IntSyn' !*) structure TomegaPrint : TOMEGAPRINT (*! sharing TomegaPrint.IntSyn = IntSyn' !*) (*! sharing TomegaPrint.Tomega = Tomega' !*) sharing TomegaPrint.Formatter = Formatter') : STATEPRINT = struct structure Formatter = Formatter' (*! structure IntSyn = IntSyn' !*) (*! structure Tomega = Tomega' !*) structure State = State' exception Error of string local structure I = IntSyn structure T = Tomega structure S = State' structure N = Names structure Fmt = Formatter fun nameCtx I.Null = I.Null | nameCtx (I.Decl (Psi, T.UDec D)) = I.Decl (nameCtx Psi, T.UDec (Names.decName (T.coerceCtx Psi, D))) | nameCtx (I.Decl (Psi, T.PDec (_, F))) = I.Decl (nameCtx Psi, T.PDec (SOME "s", F)) (* to be fixed! --cs *) (* nameState S = S' Invariant: If |- S state and S unnamed then |- S' State and S' named and |- S = S' state *) fun nameState (S.State ((Psi, F), W)) = let val _ = Names.varReset I.Null val Psi' = nameCtx Psi (* all this stuff should move into names. Ask Frank --cs *) in S.State ((Psi', F), W) end (* fun formatOrder (G, S.Arg (Us, Vs)) = [Print.formatExp (G, I.EClo Us), Fmt.String ":", Print.formatExp (G, I.EClo Vs)] | formatOrder (G, S.Lex Os) = [Fmt.String "{", Fmt.HVbox0 1 0 1 (formatOrders (G, Os)), Fmt.String "}"] | formatOrder (G, S.Simul Os) = [Fmt.String "[", Fmt.HVbox0 1 0 1 (formatOrders (G, Os)), Fmt.String "]"] and formatOrders (G, nil) = nil | formatOrders (G, O :: nil) = formatOrder (G, O) | formatOrders (G, O :: Os) = formatOrder (G, O) @ [Fmt.String ",", Fmt.Break] @ formatOrders (G, Os) (* format T = fmt' Invariant: If T is a tag then fmt' is a a format descibing the tag T *) fun formatTag (G, S.Parameter l) = [Fmt.String "