//=-- MagicStats.cpp - A better way of managing web statistics ----------------=
//
//  MagicStats is a new and better way of managing web page statistics.  Not
//    only is it a free package, but it is the most easily extensible package
//    package available.
//
//=----------------------------------------------------------------------------=
//  This file is copyright (c) 1997-2000 Chris Lattner
//=----------------------------------------------------------------------------=

#include "MagicStats.h"

int __cdecl main(int argc, char *argv[]) {
  ResourceManager  ResourceMgr;
  PlatformAbstraction PA;  // Just call ctor and dtor, after resource MGR
  MSOptions        Options;
  PluginManager    PluginMgr;

  // Initialize all of the components.  Components print their own error msgs.
  if (Options.init(argc, argv) || PluginMgr.init())
    return 1;

  EnginePlugin *Engine = EnginePlugin::CreatePlugin("MSEngine");

  if (Engine == 0) {
    cout << "Could not start MagicStats engine!\n";
    return 1;
  }

  PluginMgr.LoadPluginData();

  int Result = Engine->RunEngine(); // delete'd when PluginManager is destroyed

  PluginMgr.SavePluginData();

  return Result;
}

