#include "simple_kdtree.h"
#include "ammarep.h"
#include "debug.h"

static const char *const CVSID = "$Id: main.c,v 1.14 2003/02/27 16:48:52 dpelleg Exp $";

int main(int argc,char *argv[])
{
  char *s = (argc < 2) ? "help" : argv[1];
  memory_leak_check_args(argc,argv);

  Verbosity = double_from_args("verbose",argc,argv,0.0);

  printf("\nK-means/X-means clusterer\nCopyright 2000 Dan Pelleg <dpelleg+kmeans@cs.cmu.edu>\n\n");

  get_debug_flags_from_names(DEBUG_FLAG_NAMES_SIMPLE_KDTREE, argc, argv);

  if ( eq_string(s,"gen") )
  {
    void gen_simple_main(int argc,char *argv[]);
    gen_simple_main(argc,argv);
  }
  else if ( eq_string(s,"kmeans") )
  {
    void kmeans_main(int argc,char *argv[]);
    kmeans_main(argc,argv);
  }
  else if ( eq_string(s,"kdtree") )
  {
    void kdtree_main(int argc,char *argv[]);
    kdtree_main(argc,argv);
  }
  else if ( eq_string(s,"makeuni") )
  {
    void makeuni_main(int argc,char *argv[]);
    makeuni_main(argc,argv);
  }
  else if ( eq_string(s,"incremental") )
  {
    void incremental_main(int argc,char *argv[]);
    incremental_main(argc,argv);
  }
  else if ( eq_string(s,"membership") )
  {
    void membership_main(int argc,char *argv[]);
    membership_main(argc,argv);
  }

  else
    printf("%s not recognized. See kmeans/main.c for options\n",s);

  if(DEBUG_FLAG(D_INTERACTIVE))
	really_wait_for_key();
  if(am_malloc_report_polite())
    wait_for_key();
  if(DEBUG_FLAG(D_INTERACTIVE))
	really_wait_for_key();
  return 0;
}

