% smlbsys.ml %

% This file is to be loaded on a full recursive system (dialect HTML) to
  produce a SML system %

% Memo:  A non-recursive SML environment could be built from scratch using a
  modified version of the "InitMLState" function of MLMAIN.ML - but the
  following code avoids having to produce such a modified function by copying
  a full recursive environment instead. %

%rjg: 1st attempt at getting a bare sml saved state%

Print.VarTypes := true;

let NewMLState = EmptyMLState(`Standard ML`,SML)
enc NewExportML = NewExportMLState NewMLState;

let OldMLState = CurrentMLState(): MLState';

let RecMLState( oldMLState: MLState', newMLState: MLState', fileName: string )
: MLState'
=
% A comment to be inserted by AM %
    let _ = UpdateTopEnvOfSysState(newMLState,CopyFromTopEnv( %AM: necessary?%
                                             TopEnvOfSysState(oldMLState),
					     [],[]))
    enc _ = NewUse newMLState [fileName]
    enc _ = NewML(newMLState)
    in newMLState;

NewSwitchMLState OldMLState (RecMLState(OldMLState, NewMLState,`smlbinit.sml`))
                 [`smlbopen.sml`];

