|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 2359 (0x937)
Types: TextFile
Names: »main.c++«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/euug-87hel/sec1/image/correlate/main.c++«
/*
This is the main routine for the correlation program
Syntax is:
correlation template.var [input.var [output.var]]
*/
#include <stream.h>
#include <stdio.h>
#include <double_image.h++>
#include <vartools.h++>
int
main ( int argc , char *argv[] )
{
switch(argc)
{
// if only 1 argument act as a pipe
case 2:
{
FILE *template_file;
// open the template file
if ( NULL == (template_file = fopen(argv[1],"r")))
{
perror(form("Problem with opening %s mode r:",argv[1]));
return 2;
}
// do the correlation
correlate(template_file,stdin,stdout,"");
}
break;
// if two arguments use the second for input file
case 3:
{
FILE *template_file;
// open the template file
if ( NULL == (template_file = fopen(argv[1],"r")))
{
perror(form("Problem with opening %s mode r:",argv[1]));
return 2;
}
FILE *input_file;
// open the input file
if ( NULL == (input_file = fopen(argv[2],"r")))
{
perror(form("correlate: Problem with opening %s mode r:",argv[2]));
return 3;
}
// do the correlation
correlate(template_file,input_file,stdout,"");
}
break;
// if 3 arguments use the second for input and the 3rd for output
case 4:
{
FILE *template_file;
// open the template file
if ( NULL == (template_file = fopen(argv[1],"r")))
{
perror(form("correlate: Problem with opening %s mode r:",argv[1]));
return 2;
}
FILE *input_file;
// open the input file
if ( NULL == (input_file = fopen(argv[2],"r")))
{
perror(form("correlate: Problem with opening %s mode r:",argv[2]));
return 3;
}
FILE *output_file;
// open the output file
if ( NULL == (output_file = fopen(argv[3],"w")))
{
perror(form("correlate: Problem with opening %s mode w:",argv[3]));
return 4;
}
// do the correlation
correlate(template_file,input_file,output_file,"");
}
break;
// if wrong number of arguments print error message and exit
default:
cerr << "Syntax is: correlation template.var [input.var [output.var]]\n";
return 1;
break;
}
return 0;
}
/*
Copyright (C) 1986, David Sher in the University of Rochester
Permission is granted to any individual or institution to use, copy, or
redistribute this software so long as it is not sold for profit, provided
this copyright notice is retained.
*/