home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
vis-ftp.cs.umass.edu
/
vis-ftp.cs.umass.edu.tar
/
vis-ftp.cs.umass.edu
/
pub
/
Miscellaneous
/
utah_range_database
/
whitescan.c
< prev
Wrap
C/C++ Source or Header
|
1992-07-08
|
2KB
|
71 lines
/* -*-c-mode-*- */
/*------------------------------------------------------
* WHITESCAN.C - read WHite scanner data file
* Robert Heller Created on Mon May 18 11:09:12 1987
* Last mod -
*--------------------------------------------------------
* Contents:
*--------------------------------------------------------
* (c) Copyright 1987 by The University of Massachusetts
*------------------------------------------------------*/
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
FILE *infile;
static short int sl[240][5];
int INT, STATUS,i,lines;
float x,y,z;
short int swap();
if (argc != 2) {
fprintf(stderr,"usage: whitescan file\n");
abort(argc);
}
infile = fopen(argv[1],"r");
if (infile == NULL) {
perror("whitescan");
fprintf(stderr,"whitescan: could not open %s\n",argv[1]);
abort(0);
}
while ((lines = fread(sl,sizeof(sl),1,infile)) > 0) {
for (i=0; i < 240; i++) {
#ifdef SWAP
x = swap(sl[i][0]) / 1000.0;
y = swap(sl[i][1]) / 1000.0;
z = swap(sl[i][2]) / 1000.0;
STATUS = (swap(sl[i][3]) & 0x0044);
INT = swap(sl[i][4]);
#else
x = sl[i][0] / 1000.0;
y = sl[i][1] / 1000.0;
z = sl[i][2] / 1000.0;
STATUS = (sl[i][3] & 44);
INT = sl[i][4];
#endif
if ((STATUS == 4) && (INT > 50) && (i != 230) && (i != 159)) {
printf(" %9.3f %9.3f %9.3f %10d %10d \n",x,y,z,INT,i);
}
}
}
}
short int swap(val)
short int val;
{
union {
struct { unsigned char lo,hi; } bytes;
short int word;
} a,b;
a.word = val;
b.bytes.lo = a.bytes.hi;
b.bytes.hi = a.bytes.lo;
return(b.word);
}