1984-05-17 13:57:07 +00:00
|
|
|
#ifndef NORCSID
|
|
|
|
static char rcsid[] = "$Header$";
|
|
|
|
#endif
|
|
|
|
|
1984-05-17 13:42:36 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "param.h"
|
|
|
|
#include "types.h"
|
1990-09-04 16:42:43 +00:00
|
|
|
#include "tes.h"
|
1984-05-17 13:42:36 +00:00
|
|
|
#include "alloc.h"
|
1988-09-12 09:13:49 +00:00
|
|
|
#include <em_spec.h>
|
1984-05-17 13:42:36 +00:00
|
|
|
#include "ext.h"
|
|
|
|
|
|
|
|
/*
|
1987-03-10 01:42:07 +00:00
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
1984-05-17 13:42:36 +00:00
|
|
|
*
|
|
|
|
* Author: Hans van Staveren
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Main program for EM optimizer
|
|
|
|
*/
|
|
|
|
|
|
|
|
main(argc,argv) int argc; char *argv[]; {
|
1988-04-19 19:46:28 +00:00
|
|
|
int somespace[STACKROOM];
|
1984-05-17 13:42:36 +00:00
|
|
|
|
|
|
|
progname = argv[0];
|
|
|
|
while (argc-->1 && **++argv == '-')
|
|
|
|
flags(*argv);
|
|
|
|
if (argc>1) {
|
1991-11-20 15:53:11 +00:00
|
|
|
fprintf(stderr,"Usage: %s [-Ln] [-m<num>] [name]\n",progname);
|
1984-05-17 13:42:36 +00:00
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
if (argc)
|
|
|
|
if (freopen(*argv,"r",stdin) == NULL)
|
|
|
|
error("Cannot open %s",*argv);
|
|
|
|
fileinit();
|
1988-04-19 19:46:28 +00:00
|
|
|
coreinit((short *)somespace,(short *)(somespace+STACKROOM));
|
1984-05-17 13:42:36 +00:00
|
|
|
getlines();
|
|
|
|
cleanup();
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
flags(s) register char *s; {
|
|
|
|
|
|
|
|
for (s++;*s;s++)
|
|
|
|
switch(*s) {
|
|
|
|
case 'L': Lflag = TRUE; break;
|
|
|
|
case 'n': nflag = TRUE; break;
|
1991-11-20 15:53:11 +00:00
|
|
|
case 'm': if (*(s+1) == 'l') {
|
|
|
|
s++;
|
|
|
|
repl_longmuls = TRUE;
|
|
|
|
}
|
|
|
|
repl_muls = atoi(s+1); break;
|
1984-05-17 13:42:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fileinit() {
|
|
|
|
char *mktemp();
|
|
|
|
short readshort();
|
|
|
|
|
|
|
|
if (readshort() != (short) sp_magic)
|
|
|
|
error("wrong input file");
|
|
|
|
if (Lflag) {
|
|
|
|
outfile = fopen(mktemp(template),"w");
|
|
|
|
if (outfile == NULL)
|
|
|
|
error("can't create %s",template);
|
|
|
|
} else {
|
|
|
|
outfile = stdout;
|
|
|
|
outshort(sp_magic);
|
|
|
|
}
|
|
|
|
}
|