|
curry19.c
This program takes ASCII data downloaded directly from the ISODAT
Version 5.3 database and prepares it for postprocessing on
UNIX machines. The following columns of information must be selected (*)
in the Format Editor for this program to work:
2 Date / Time
3 Spec no / Sample Ident / Sample Size
10 Process Information
13 Ion-gauge
33 Std Deviation
38 standardized Sample data [ion current]
curry19.c basically changes the exponential format to fixed, removes
extraneous spaces and aligns all columns so the data is screen readable
and editable.
/* C program to take series data from mass spec download and format*/
/*originally written by Skip Little, modified Aug1996 by DRO & RG*/
/*to recompile type cc curry19.c which makes a file called "a.out"*/
/*which can be moved to "curry19" for regular running of the program*/
#include
#include
#include
#define MAXLINE 1000
#define MAXOUT 2000
#define MAXWORD 500
#define IN 1
#define OUT 0
#define NO 0
#define YES 1
static char sa44[8]={'S','A','4','4','[','V',']','\0'};
static char st44[8]={'S','T','4','4','[','V',']','\0'};
static char c1312[8]={'1','3','/','1','2','-','C','\0'};
static char o1816[8]={'1','8','/','1','6','-','O','\0'};
static char sd45[6]={'4','5','/','4','4','\0'};
static char sd46[6]={'4','6','/','4','4','\0'};
static char temp[10]={'[','C','e','l','s','i','u','s',']','\0'};
static char micr[11]={'[','m','i','c','r','o','B','A','R',']','\0'};
static char expa[10]={'E','x','p','a','n','s','i','o','n','\0'};
static char pstn[9]={'P','o','s','i','t','i','o','n','\0'};
static char stA[6]={'i','d','e','n','t','\0'};
static char stB[8]={'P','r','o','c','e','s','s','\0'};
static char stC[5]={'A','c','i','d','\0'};
static char stD[10]={'[','C','e','l','s','i','u','s',']','\0'};
static char stE[9]={'s','t','d','.','d','e','v','.','\0'};
static char
std45[15]={'s','t','d','.','d','e','v','.','-','4','5','/','4','4', '\0'};
static char
std46[15]={'s','t','d','.','d','e','v','.','-','4','6','/','4','4', '\0'};
main()
{
int len,max,header;
int i,j,k,l,m,n,ll;
char line[MAXLINE];
int pos[MAXWORD];
int lng[MAXWORD];
int nw;
int cnt;
int posn;
int state;
int nlast=0,nfirst=0,ncol=0,nend=0,nstart=0;
char c;
float fnumb;
int kD;
/*int kA,kT,kC,kO,k45,k46,kTemp,kPres,kExpn,kPstn;*/
int ksa44,kst44,kc1312,ko1816,kstd45,kstd46,ktemp,kmicr,kexpa,kpstn;
int ksa44p,kst44p,kc1312p,ko1816p,kstd45p,kstd46p;
int intout;
int icnt,i1,i2,i3,i4,io,iolen,iomax=15;
char blnk,obuf[100];
/*added the next line to deal with the need to add a constant number*/
/*to the reset spec numbers resulting from bad Finnigan Programming*/
int specin,specout;
max = 0;
header = 1;
while ((len = getline(line, MAXLINE)) > 0) {
cnt = 0;
nw = 0;
posn = 0;
state = OUT;
/* fill in leading zero in date: */
if (header==0 && line[8]==' ') line[8] = '0';
for (i=0;ii2;--i) {
if (line[i] != ' ') {
blnk = NO;
obuf[io] = line[i];
--io;
/* special case:
put space before "cm" or "ug" */
if (((line[i]=='c'&&line[i+1]=='m')
||
(line[i]=='u'&&line[i+1]=='g'))
&&
isdigit(line[i-1])
&&
((line[i+2]=='/')
||
(line[i+2]==' ')) ) {
blnk = YES;
obuf[io] = ' ';
--io;
}
}
else if (line[i] == ' ' && blnk == NO) {
blnk = YES;
obuf[io] = line[i];
--io;
}
}
for (io=0;io
|