-- ViewRecScript.tioga
cd;
cd ViewRecDemo;
addd /cedar/cedar6.0/viewers/
Bringover -p [Cedar]<CedarChest6.0>Top>ViewRec.DF
← ViewRec.ViewInterface[name: "Rope", otherStuff: NIL, viewerInit: [name: "Rope", iconic: FALSE]]
-- Try Cat, Concat, Compare, &etc.
-- Demo the IO interface:
Bringover -p [Cedar]<CedarChest6.0>Top>StatementInterpreter.DF
EQT
{ ioType: TYPE = AMMiniModel.AcquireIRType["IO"]; ViewStream: PROC [s: IO.STREAM, name: ROPE] RETURNS [rv: ViewRec.RecordViewer] = {bl: ViewRec.BindingList = ViewRec.BindAllOfATypeFromTVs[CODE[ioType], CODE[IO.STREAM], NIL, [Value[NIL, &up[s]]]]; rv ← ViewRec.ViewInterface[name: "IO", specs: bl, otherStuff: NIL, viewerInit: [name: name]]}; NULL}
← &vio ← ViewerIO.CreateViewerStreams["IO.STREAM demo"]
← ViewStream[&vio.out, "out"]
← ViewStream[&vio.in, "in"]
-- Do out.GetInfo, PutRope, PutChar, Flush, EraseChar
-- Do in.GetInfo, EndOf, CharsAvail, PeekChar, GetChar, Backup, GetCedarTokenRope,
-- GetInt, GetReal, GetRopeLiteral, SkipWhitespace, others that work (GetUnpackedTime doesn't)
-- N.B.: &vio.in is an edited stream
-- Don't worry about things that fail most of them you can simply abort. I think the worst you can do is close a stream and to fix that you can simply create a new one and start over.
--
Demo the FS interface:
-- Bind the BasicTime.GMT's, because ViewRec doesn't have default handling for TYPE[2]'s:
← ViewRec.ViewInterface[name: "FS", specs: &bl, otherStuff: NIL, viewerInit: [name: "FS"]]
-- Do ExpandName, ConstructFName, FileInfo, Copy, Delete, Rename, SetKeep