// WELCOME!! This is THE PROGRAM YOU ARE LOOKING FOR.

!7

!include early #1033540 // include GazelleHost early for flags like PingV3

!include early #1033576 // November Gazelle

sS windowTitle = "November Gazelle v1";
sS progIDForDBAndAutoUpdate = #1033525;
sbool pingSourceStrictMode;

static GazelleHost host;
static GazelleV client;
static ThreadPool threadPool;

p {
  loadableUtils.utils.__setJavaX(x30.class);
  standaloneInit();
  
  ping_v3_setPingSourceMaker(-> {
    System.out.println("pingSourceMaker");
    if (pingSourceStrictMode)
      fail("Strict mode - make a ping source first!!");
    ret new PingSource(threadPool, "legacy");
  });
  
  threadPool = new ThreadPool(findIntArg cores(args, numberOfCores()));
  print(threadPool);
  //threadPool.verbose = true;
  PingSource ps = new(threadPool, print("Starting Gazelle"));
  ps.do(-> {
    System.out.println("Pinging");
    ping();
    //if (true) fail("error test");
  
    print("Pinged");
    
    programID = progIDForDBAndAutoUpdate;
      
    host = new GazelleHost(threadPool, -> {
      ret client = new GazelleV;
    });
    host.windowTitle = windowTitle;
    host.run(args);
    print("Stopping System.out");
    printAlsoToSystemOut = false;
  });
  print("aha.");
}