summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-14 16:31:01 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-14 16:31:01 +0000
commit912a8f45cbe9300b7425702f85bb0af6b3026d2a (patch)
treeb83c5b46c72daaa632ed32dbb4acb7e0ed5c325a
parentf53310f5bd1e509c59b2f8047e897ae110c1066a (diff)
Strip command line input functions
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@37 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r--cleanbench.c393
-rw-r--r--cleanbench.h10
2 files changed, 0 insertions, 403 deletions
diff --git a/cleanbench.c b/cleanbench.c
index cf627e7..3a9a6a0 100644
--- a/cleanbench.c
+++ b/cleanbench.c
@@ -122,18 +122,6 @@ global_nnetstruct.adjust=0;
global_lustruct.adjust=0;
-/*
-** Handle any command-line arguments.
-*/
-if(argc>1)
- for(i=1;i<argc;i++)
- if(parse_arg(argv[i])==-1)
- { display_help(argv[0]);
- exit(0);
- }
-/*
-** Output header
-*/
puts("\nBYTEmark* Native Mode Benchmark ver. 2 (10/95)");
puts("Index-split by Andrew D. Balsa (11/97)");
puts("Linux/Unix* port by Uwe F. Mayer (12/96,11/97)");
@@ -251,384 +239,6 @@ puts("* Trademarks are property of their respective holder.");
return 0;
}
-/**************
-** parse_arg **
-***************
-** Given a pointer to a string, we assume that's an argument.
-** Parse that argument and act accordingly.
-** Return 0 if ok, else return -1.
-*/
-static int parse_arg(char *argptr)
-{
-int i; /* Index */
-FILE *cfile; /* Command file identifier */
-
-/*
-** First character has got to be a hyphen.
-*/
-if(*argptr++!='-') return(-1);
-
-/*
-** Convert the rest of the argument to upper case
-** so there's little chance of confusion.
-*/
-for(i=0;i<strlen(argptr);i++)
- argptr[i]=(char)toupper((int)argptr[i]);
-
-/*
-** Next character picks the action.
-*/
-switch(*argptr++)
-{
- case '?': return(-1); /* Will display help */
-
- case 'V': global_allstats=1; return(0); /* verbose mode */
-
- case 'C': /* Command file name */
- /*
- ** First try to open the file for reading.
- */
- cfile=fopen(argptr,"r");
- if(cfile==(FILE *)NULL)
- { printf("**Error opening file: %s\n",argptr);
- return(-1);
- }
- read_comfile(cfile); /* Read commands */
- fclose(cfile);
- break;
- default:
- return(-1);
-}
-return(0);
-}
-
-/*******************
-** display_help() **
-********************
-** Display a help message showing argument requirements and such.
-** Exit when you're done...I mean, REALLY exit.
-*/
-void display_help(char *progname)
-{
- printf("Usage: %s [-v] [-c<FILE>]\n",progname);
- printf(" -v = verbose\n");
- printf(" -c = input parameters thru command file <FILE>\n");
- exit(0);
-}
-
-
-/*****************
-** read_comfile **
-******************
-** Read the command file. Set global parameters as
-** specified. This routine assumes that the command file
-** is already open.
-*/
-static void read_comfile(FILE *cfile)
-{
-char inbuf[40];
-char *eptr; /* Offset to "=" sign */
-int i; /* Index */
-
-/*
-** Sit in a big loop, reading a line from the file at each
-** pass. Terminate on EOF.
-*/
-while(fgets(inbuf,39,cfile)!=(char *)NULL)
-{
- /* Overwrite the CR character */
- if(strlen(inbuf)>0)
- inbuf[strlen(inbuf)-1]='\0';
-
- /*
- ** Parse up to the "=" sign. If we don't find an
- ** "=", then flag an error.
- */
- if((eptr=strchr(inbuf,(int)'='))==(char *)NULL)
- { printf("**COMMAND FILE ERROR at LINE:\n %s\n",
- inbuf);
- goto skipswitch; /* A GOTO!!!! */
- }
-
- /*
- ** Insert a null where the "=" was, then convert
- ** the substring to uppercase. That will enable
- ** us to perform the match.
- */
- *eptr++='\0';
- strtoupper((char *)&inbuf[0]);
- i=MAXPARAM;
- do {
- if(strcmp(inbuf,paramnames[i])==0)
- break;
- } while(--i>=0);
-
- if(i<0)
- { printf("**COMMAND FILE ERROR -- UNKNOWN PARAM: %s",
- inbuf);
- goto skipswitch;
- }
-
- /*
- ** Advance eptr to the next field...which should be
- ** the value assigned to the parameter.
- */
- switch(i)
- {
- case PF_GMTICKS: /* GLOBALMINTICKS */
- global_min_ticks=(unsigned long)atol(eptr);
- break;
-
- case PF_MINSECONDS: /* MINSECONDS */
- global_min_seconds=(unsigned long)atol(eptr);
- set_request_secs();
- break;
-
- case PF_ALLSTATS: /* ALLSTATS */
- global_allstats=getflag(eptr);
- break;
-
- case PF_OUTFILE: /* OUTFILE */
- strcpy(global_ofile_name,eptr);
- global_ofile=fopen(global_ofile_name,"a");
- /*
- ** Open the output file.
- */
- if(global_ofile==(FILE *)NULL)
- { printf("**Error opening output file: %s\n",
- global_ofile_name);
- exit(1);
- }
- write_to_file=-1;
- break;
-
- case PF_CUSTOMRUN: /* CUSTOMRUN */
- global_custrun=getflag(eptr);
- for(i=0;i<NUMTESTS;i++)
- tests_to_do[i]=1-global_custrun;
- break;
-
- case PF_DONUM: /* DONUMSORT */
- tests_to_do[NUMSORT]=getflag(eptr);
- break;
-
- case PF_NUMNUMA: /* NUMNUMARRAYS */
- global_numsortstruct.numarrays=
- (ushort)atoi(eptr);
- global_numsortstruct.adjust=1;
- break;
-
- case PF_NUMASIZE: /* NUMARRAYSIZE */
- global_numsortstruct.arraysize=
- (unsigned long)atol(eptr);
- break;
-
- case PF_NUMMINS: /* NUMMINSECONDS */
- global_numsortstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOSTR: /* DOSTRINGSORT */
- tests_to_do[STRINGSORT]=getflag(eptr);
- break;
-
- case PF_STRASIZE: /* STRARRAYSIZE */
- global_strsortstruct.arraysize=
- (unsigned long)atol(eptr);
- break;
-
- case PF_NUMSTRA: /* NUMSTRARRAYS */
- global_strsortstruct.numarrays=
- (ushort)atoi(eptr);
- global_strsortstruct.adjust=1;
- break;
-
- case PF_STRMINS: /* STRMINSECONDS */
- global_strsortstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOBITF: /* DOBITFIELD */
- tests_to_do[BITFIELD]=getflag(eptr);
- break;
-
- case PF_NUMBITOPS: /* NUMBITOPS */
- global_bitopstruct.bitoparraysize=
- (unsigned long)atol(eptr);
- global_bitopstruct.adjust=1;
- break;
-
- case PF_BITFSIZE: /* BITFIELDSIZE */
- global_bitopstruct.bitfieldarraysize=
- (unsigned long)atol(eptr);
- break;
-
- case PF_BITMINS: /* BITMINSECONDS */
- global_bitopstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOEMF: /* DOEMF */
- tests_to_do[FPEMULATION]=getflag(eptr);
- break;
-
- case PF_EMFASIZE: /* EMFARRAYSIZE */
- global_emfloatstruct.arraysize=
- (unsigned long)atol(eptr);
- break;
-
- case PF_EMFLOOPS: /* EMFLOOPS */
- global_emfloatstruct.loops=
- (unsigned long)atol(eptr);
- break;
-
- case PF_EMFMINS: /* EMFMINSECOND */
- global_emfloatstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOFOUR: /* DOFOUR */
- tests_to_do[FOURIER]=getflag(eptr);
- break;
-
- case PF_FOURASIZE: /* FOURASIZE */
- global_fourierstruct.arraysize=
- (unsigned long)atol(eptr);
- global_fourierstruct.adjust=1;
- break;
-
- case PF_FOURMINS: /* FOURMINSECONDS */
- global_fourierstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOASSIGN: /* DOASSIGN */
- tests_to_do[ASSIGNMENT]=getflag(eptr);
- break;
-
- case PF_AARRAYS: /* ASSIGNARRAYS */
- global_assignstruct.numarrays=
- (unsigned long)atol(eptr);
- break;
-
- case PF_ASSIGNMINS: /* ASSIGNMINSECONDS */
- global_assignstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOIDEA: /* DOIDEA */
- tests_to_do[IDEA]=getflag(eptr);
- break;
-
- case PF_IDEAASIZE: /* IDEAARRAYSIZE */
- global_ideastruct.arraysize=
- (unsigned long)atol(eptr);
- break;
-
- case PF_IDEALOOPS: /* IDEALOOPS */
- global_ideastruct.loops=
- (unsigned long)atol(eptr);
- break;
-
- case PF_IDEAMINS: /* IDEAMINSECONDS */
- global_ideastruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOHUFF: /* DOHUFF */
- tests_to_do[HUFFMAN]=getflag(eptr);
- break;
-
- case PF_HUFFASIZE: /* HUFFARRAYSIZE */
- global_huffstruct.arraysize=
- (unsigned long)atol(eptr);
- break;
-
- case PF_HUFFLOOPS: /* HUFFLOOPS */
- global_huffstruct.loops=
- (unsigned long)atol(eptr);
- global_huffstruct.adjust=1;
- break;
-
- case PF_HUFFMINS: /* HUFFMINSECONDS */
- global_huffstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DONNET: /* DONNET */
- tests_to_do[NEURAL]=getflag(eptr);
- break;
-
- case PF_NNETLOOPS: /* NNETLOOPS */
- global_nnetstruct.loops=
- (unsigned long)atol(eptr);
- global_nnetstruct.adjust=1;
- break;
-
- case PF_NNETMINS: /* NNETMINSECONDS */
- global_nnetstruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_DOLU: /* DOLU */
- tests_to_do[LINEAR]=getflag(eptr);
- break;
-
- case PF_LUNARRAYS: /* LUNUMARRAYS */
- global_lustruct.numarrays=
- (unsigned long)atol(eptr);
- global_lustruct.adjust=1;
- break;
-
- case PF_LUMINS: /* LUMINSECONDS */
- global_lustruct.request_secs=
- (unsigned long)atol(eptr);
- break;
-
- case PF_ALIGN: /* ALIGN */
- global_align=atoi(eptr);
- break;
- }
-skipswitch:
- continue;
-} /* End while */
-
-return;
-}
-
-/************
-** getflag **
-*************
-** Return 1 if cptr points to "T"; 0 otherwise.
-*/
-static int getflag(char *cptr)
-{
- if(toupper((int)*cptr)=='T') return(1);
-return(0);
-}
-
-/***************
-** strtoupper **
-****************
-** Convert's a string to upper case. The string is presumed
-** to consist only of alphabetic characters, and to be terminated
-** with a null.
-*/
-static void strtoupper(char *s)
-{
-
-do {
-/*
-** Oddly enough, the following line did not work under THINK C.
-** So, I modified it....hmmmm. --RG
- *s++=(char)toupper((int)*s);
-*/
- *s=(char)toupper((int)*s);
- s++;
-} while(*s!=(char)'\0');
-return;
-}
-
/*********************
** set_request_secs **
**********************
@@ -639,7 +249,6 @@ return;
*/
static void set_request_secs(void)
{
-
global_numsortstruct.request_secs=global_min_seconds;
global_strsortstruct.request_secs=global_min_seconds;
global_bitopstruct.request_secs=global_min_seconds;
@@ -650,8 +259,6 @@ global_ideastruct.request_secs=global_min_seconds;
global_huffstruct.request_secs=global_min_seconds;
global_nnetstruct.request_secs=global_min_seconds;
global_lustruct.request_secs=global_min_seconds;
-
-return;
}
diff --git a/cleanbench.h b/cleanbench.h
index 3efc5dd..0318fbf 100644
--- a/cleanbench.h
+++ b/cleanbench.h
@@ -254,19 +254,9 @@ void *global_fstruct[] =
/*
** PROTOTYPES
*/
-static int parse_arg(char *argptr);
-static void display_help(char *progname);
-static void read_comfile(FILE *cfile);
-static int getflag(char *cptr);
-static void strtoupper(char *s);
static void set_request_secs(void);
static int bench_with_confidence(int fid,
double *mean, double *stdev, unsigned long *numtries);
-/*
-static int seek_confidence(double scores[5],
- double *newscore, double *c_half_interval,
- double *smean,double *sdev);
-*/
static int calc_confidence(double scores[],
int num_scores,
double *c_half_interval,double *smean,