#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "posbb.h"
#include "posbb_rev.h"



int main();
void Perform_Test();
FILE *fi = 0;
unsigned char Version []=VERSTAG;
unsigned char Copyright []=VERS;



int main( argc, argv )
int argc;
char *argv[];
{
long tests = 0;
int c,precision = POSBB_PRECISIONLOW;
   if (argc == 1)  
   {
      printf("POSBB Portable OS Based Benchmark   ( Generic version )\n Created by Pietro Altomani <altomanipietro@pragmanet.it>\nUsage: %s <options>\nOptions:\n  -all  Perform all tests\n  -mem Perform only memory tests\n  -disk Perform only disk tests\n  -math Perform only math tests\n  -o <filename> Output file name\n  -p <precision> Set precision. <precision> can be 'low','medium','high','higher' or 'highest'.\nRead docs for more infos.\n",argv[0]);
      return 10;
   }
   for (c=0;c<argc;c++)
   {
      if (strcmp(argv[c],"-all") == 0)
      {
	 tests = -1;
      }
      if (strcmp(argv[c],"-gfx") == 0)
      {
	 tests |= POSBB_TESTWRITEPIXEL;
      }
      if (strcmp(argv[c],"-disk") == 0)
      {
	 tests |= (POSBB_TESTREAD | POSBB_TESTWRITE);
      }
      if (strcmp(argv[c],"-math") == 0)
      {
	 tests |= (POSBB_TESTIMATH | POSBB_TESTFPMATH);
      }
      if (strcmp(argv[c],"-mem") == 0)
      {
	 tests |= (POSBB_TESTCOPYMEM | POSBB_TESTCOPYMEM_1MB | POSBB_TESTCOPYMEM_512KB );
      }
      if (strcmp(argv[c],"-sort") == 0)
      {
	 tests |= (POSBB_TESTQSORT);
      }
      if ((strcmp(argv[c],"-o")) == 0)
      {
	 fi = fopen(argv[c+1],"w");
      }
      if ((strcmp(argv[c],"-p")) == 0)
      {
	 if ((strcmp(argv[c+1],"low")) == 0) precision = POSBB_PRECISIONLOW;
	 if ((strcmp(argv[c+1],"medium")) == 0) precision = POSBB_PRECISIONMEDIUM;
	 if ((strcmp(argv[c+1],"high")) == 0) precision = POSBB_PRECISIONHIGH;
	 if ((strcmp(argv[c+1],"higher")) == 0) precision = POSBB_PRECISIONHIGHER;
	 if ((strcmp(argv[c+1],"highest")) == 0) precision = POSBB_PRECISIONHIGHEST;
      }
   }

   if (fi == 0) fi = fopen(POSBB_DEFRESULTFILE,"w");
   Perform_Test(tests,precision);
   fclose( ( FILE * ) fi );
   return 0;
}

