/* PROGRAM: translate.c ** PURPOSE: Back-end formatter for AIM (Adaptive Image Manager) MOC output ** - translates AIM MOC output into Matlab-compatible (x,y) pairs ** for use with Matlab graphs ** - can be used only with one MOC parameter specified at a time ** FILES: iostream.h : C++ I/O library ** fstream.h : C++ file library ** string.h : C++ string library ** AUTHOR: Yue Yin, University of Florida, 15 July 2000 ** LANG: C++ ** REVS: v0.* : Prototypes **/ #include "iostream.h" #include "fstream.h" #include "string.h" main(int argc, char *argv[]) // two args: MOC output file // MOC paramname(unquoted) { ifstream in(argv[1]); // build input file stream ofstream out(argv[2]); // build output file stream if (!in) { // if input open error cout << "Cannot open input file.\n"; return 1; } if (!out) { // if output open error cout << "Cannot open output file.\n"; return 1; } char temp[256]; // temporary buffer char ch; // current character double b,d,e=0; // b: beginning time, d: delta // e = b + d out<<0<<" "<<0<>temp; // get a line from MOC output if (strcmp(temp,argv[2])==0) { // if param-name = specified-param in>>b; // get beginning time in>>d; // get delta time // CASE 1: 1:1 line (parameter active) // output (b,e) ; (b + delta, e + delta) out<