// Ifs.bcpl - The 'main' program
// Copyright Xerox Corporation 1979, 1980

// Last modified by Taft, February 27, 1980  3:56 PM
// Last modified by Butterfield, September 7, 1979  3:38 PM
// - IFSAfterJunta, add call to InitIfsRuntime

get "IFS.decl"

external
[
//outgoing procedures
IFS; IFSAfterJunta

//incoming procedures
CallContextList; InitIFSPart1; InitIFSPart2; InitIFSPart3; InitIfsRuntime;

//incoming statics
ifsCtxQ
]

//The flow of control during initialization is:
//  CallSubsys gives control to IFS
//  IFS calls InitIFSPart1
//  InitIFSPart1 does initialization requiring the OS, then Juntas
//  Junta gives control to IFSAfterJunta
//  IFSAfterJunta calls InitIfsRuntime, which enables extended frames,
//   IFS string handling, etc.
//  IFSAfterJunta calls InitIFSPart2
//  InitIFSPart2 makes overlays and vmem work
//  IFSAfterJunta then calls InitIFSPart3 - now swappable
//  InitIFSPart3 turns init code and stack into vmem buffers,
//   and finishes initialization.
//  IfsAfterJunta then starts the contexts running.
//the result is that the main program module is tiny and has
//a tiny stack when initialization is over.

//-----------------------------------------------------------------
let IFS(layoutVector, userParams, cfaRunFile) be
//-----------------------------------------------------------------
   InitIFSPart1(layoutVector, userParams, cfaRunFile)

//-----------------------------------------------------------------
and IFSAfterJunta() be
//-----------------------------------------------------------------
[
//have now juntaed away most of the OS
InitIfsRuntime();
InitIFSPart2()  //still resident
InitIFSPart3()  //now swappable
CallContextList(ifsCtxQ!0) repeat  //forever
]