-- XStartup.mesa

DIRECTORY
  CRuntime,
  CString,
  Heap,
  MFile,
  MLoader,
  MStream,
  PilotClient,
  Runtime,
  XMKDriver;
  
XStartup:PROGRAM IMPORTS CRuntime, CString, Heap, MFile, MLoader, MStream, Runtime, XMKDriver EXPORTS PilotClient =

  BEGIN
  p:PROCESS;
  h:MStream.Handle;
  h1:MStream.Handle;
  name:CString.CString;
  xname:CString.CString;
  turboSwapClient:MFile.Handle;
  
  Run: PUBLIC PROCEDURE =
    BEGIN
    END;
    
  turboSwapClient ← MFile.ReadOnly[name:"TurboSwapClient.bcd", release:[NIL,NIL]];
  [] ← MLoader.Run[file:turboSwapClient];
  p ← FORK XMKDriver.XMKDriverProc[];
  h ← MStream.WriteOnly[name:"<Tajo>X11out.log", release:[NIL,NIL], type:text];
  h1 ← MStream.ReadOnly[name:"<Tajo>HOSTS.TXT", release:[NIL,NIL]];
  name ← CString.LongStringToCString["X11Server", Heap.systemZone];
  
  xname ← CString.LongStringToCString["<tajo>X11.bcd", Heap.systemZone];
  Runtime.Interrupt[];
  [] ← CRuntime.StartProgram[xname, 1, @name, h1, h, h];
  Runtime.Interrupt[];
  
  END.