-- file TestBinderImpl.Mesa
-- last edited by Satterthwaite, June 16, 1982 10:58 am

DIRECTORY
  Exec: TYPE USING [AddCommand, commandLine],
  ExecOps: TYPE USING [Command, Bind],
  Heap: TYPE USING [MakeNode, FreeNode];
  
TestBinderImpl: PROGRAM IMPORTS Exec, ExecOps, Heap = {

  Main: PROC ~ {
    nChars: CARDINAL ~ (Exec.commandLine.s.length - Exec.commandLine.i) + 1;
    command: ExecOps.Command ← Heap.MakeNode[n~(nChars+1)/2];
    j: CARDINAL ← 0;
    FOR i: CARDINAL IN [Exec.commandLine.i..Exec.commandLine.s.length) DO
      command[j] ← Exec.commandLine.s[i];  j ← j+1;
      ENDLOOP;
    command[j] ← '\n;
    [] ← ExecOps.Bind[command];
    Heap.FreeNode[p~command]};
    
  Init: PROC ~ {Exec.AddCommand["TestBinder.~"L, Main]};
  
  Init[];
  }.