INTEGER putvec_(INTEGER *long_vector) { if (sizeof(WFDB_Sample) == sizeof(INTEGER)) { return (putvec((WFDB_Sample *)long_vector)); } else { WFDB_Sample v[WFDB_MAXSIG*WFDB_MAXSPF]; int i; for (i = 0; i < WFDB_MAXSIG*WFDB_MAXSPF; i++) v[i] = long_vector[i]; return (putvec(v)); } }
void process(char *record, FILE *ifile) { char ofname[10], data[5]; WFDB_Time t = -1; static WFDB_Siginfo si[2]; static WFDB_Anninfo ai; static WFDB_Sample v[2]; static WFDB_Annotation a; setsampfreq(250.0); /* AHA DB is sampled at 250 Hz for each signal */ sprintf(ofname, "%s.dat", record); si[0].fname = ofname; si[0].desc = "ECG0"; si[0].units = "mV"; si[0].gain = 400; si[0].fmt = 212; si[0].adcres = 12; si[1] = si[0]; si[1].desc = "ECG1"; ai.name = "atr"; ai.stat = WFDB_WRITE; if (osigfopen(si, 2) != 2 || annopen(record, &ai, 1) < 0) { wfdbquit(); return; } while (fread(data, 1, 5, ifile) == 5) { v[0] = (data[0] & 0xff) | ((data[1] << 8) & 0xff00); v[1] = (data[2] & 0xff) | ((data[3] << 8) & 0xff00); (void)putvec(v); if (data[4] != '.') { a.anntyp = ammap(data[4]); a.subtyp = (data[4] == 'U' ? -1 : 0); a.time = t; (void)putann(0, &a); } t++; } (void)newheader(record); wfdbquit(); fprintf(stderr, "wrote %s.atr, $s.dat, and %s.hea\n", record,record,record); return; }