PROC [to, from: Rope.
{
ENABLE
FS.Error =>
IF error.group # bug THEN {msg ← FSErrorMsg1[error];};
s: IO.STREAM ← FS.StreamOpen[to, $create];
script: Rope.ROPE;
i: INT;
pattern: Rope.ROPE;
handle: ISToken.NodeTVHandle;
scanner: ISScan.ScanHandle;
implementation, documentImpl, paraImpl, charsImpl, styleImpl, propertiesImpl, looksImpl: ISNode.Implementation;
ISMessage.OpenTempFile[];
ISMessage.OpenTiogaOutput[to];
pattern ← from;
pattern ← FileNames.ResolveRelativePath[pattern];
pattern ← FS.ExpandName[pattern].fullFName;
s ← FS.StreamOpen[pattern];
i ← IO.GetIndex[s];
script ← RopeFile.FromStream[s];
documentImpl ← NEW[ISNode.ImplementationObject];
documentImpl.internalize ← ISTiogaIntern.InternalizeDocument;
[] ← ISNode.SetImplementation [$DOCUMENT, $Tioga, documentImpl];
paraImpl ← NEW[ISNode.ImplementationObject];
paraImpl.internalize ← ISTiogaIntern.InternalizePara;
paraImpl.printTioga ← ISTiogaIntern.PrintPara;
[] ← ISNode.SetImplementation [$PARA, $Tioga, paraImpl];
charsImpl ← NEW[ISNode.ImplementationObject];
charsImpl.internalize ← ISTiogaIntern.InternalizeChars;
charsImpl.printTioga ← ISTiogaIntern.PrintChars;
[] ← ISNode.SetImplementation [$CHARS, $Tioga, charsImpl];
styleImpl ← NEW[ISNode.ImplementationObject];
styleImpl.internalize ← ISTiogaIntern.InternalizeStyle;
[] ← ISNode.SetImplementation [$STYLE, $Tioga, styleImpl];
looksImpl ← NEW[ISNode.ImplementationObject];
looksImpl.internalize ← ISTiogaIntern.InternalizeLooks;
[] ← ISNode.SetImplementation [$LOOKS, $Tioga, looksImpl];
propertiesImpl ← NEW[ISNode.ImplementationObject];
propertiesImpl.internalize ← ISTiogaIntern.InternalizeProperties;
[] ← ISNode.SetImplementation [$PROPERTIES, $Tioga, propertiesImpl];
implementation ← ISNode.GetImplementation[NIL, NIL];
implementation.internalize ← ISTiogaIntern.DefaultInternalizeProc;
implementation.printTioga ← ISTiogaIntern.DefaultPrintProc;
[] ← ISNode.SetImplementation[NIL, NIL, implementation];
scanner ← ISScan.CreateScan[base: script, index: i];
ISScan.InitializeScanThroughCurly[scanner];
ISScan.AdvanceScan[scanner];
handle ← ISScan.CollectNode[scanner];
ISMessage.WriteTiogaOutputFile[];
};