LAL  7.5.0.1-c9a8ef6
StreamInputTest.c
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2007 Teviet Creighton
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with with program; see the file COPYING. If not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 
20 /**
21  * \file
22  * \ingroup StreamInput_h
23  * \author Creighton, T. D.
24  *
25  * \brief Reads a sequence or vector sequence from a file.
26  *
27  * ### Usage ###
28  *
29  * \code
30  * StreamInputTest [-o outfile] [-d debuglevel] [-t]
31  * [-v {ch | i2 | i4 | i8 | u2 | u4 | u8 | s | d} infile]
32  * [-s {ch | i2 | i4 | i8 | u2 | u4 | u8 | s | d | c | z} infile]
33  * \endcode
34  *
35  * ### Description ###
36  *
37  * This test program parses data from an input file or from \c stdin.
38  * The following option flags are accepted:
39  * <ul>
40  * <li>[<tt>-o</tt>] Writes the output to \c outfile. If
41  * \c outfile is given as \c stdout, the data is written to
42  * standard output (\e not to a file named \c stdout). If the
43  * <tt>-o</tt> flag is not given, the routines are exercised, but no output
44  * is written.</li>
45  * <li>[<tt>-d</tt>] Sets the debug level to \c debuglevel; if
46  * absent, <tt>-d 0</tt> is assumed.</li>
47  * <li>[<tt>-t</tt>] Writes to \c stderr the system time required to
48  * read the file.</li>
49  * <li>[<tt>-v</tt>] Reads the contents of \c infile as a sequence
50  * of vectors to be parsed by the routines
51  * <tt>LAL<datatype>ReadVectorSequence()</tt>, where <tt><datatype></tt> is
52  * determined by the argument immediately following the <tt>-v</tt> option
53  * flag. If \c infile is given as \c stdin, the data is read
54  * from standard input (\e not from a file named \c stdin).</li>
55  * <li>[<tt>-s</tt>] As <tt>-v</tt>, above, except that the file contents
56  * are parsed by the routines <tt>LAL<datatype>ReadSequence()</tt>. If
57  * neither <tt>-v</tt> nor <tt>-s</tt> is specified,
58  * <tt>-v s StreamInput.dat</tt> is assumed (this file is provided with the
59  * distribution so that running the code with no arguments, \'a la
60  * <tt>make check</tt>, will perform a nontrivial test of the algorithm).</li>
61  * </ul>
62  *
63  * For data read in as a character vector sequences, the output will
64  * consist of a number of lines equal to the length of the sequence, with
65  * each line being the length of the vector; all non-graphical characters
66  * in the vector (including the various types of whitespace) will be
67  * replaced with single spaces. For character sequences, the output will
68  * essentially be a copy of the input. For numerical vector sequences,
69  * the output will consist of separate lines for each vector of the
70  * sequence, with each line printing the components of the vector in some
71  * type-dependent format. For numerical sequences, each line of output
72  * contains a single number, or, in the case of complex datatypes, two
73  * numbers representing the real and imaginary components, again in some
74  * type-dependent format.
75  */
76 
77 /** \name Error Codes */ /** @{ */
78 #define STREAMINPUTTESTC_ENORM 0 /**< Normal exit */
79 #define STREAMINPUTTESTC_ESUB 1 /**< Subroutine failed */
80 #define STREAMINPUTTESTC_EARG 2 /**< Error parsing arguments */
81 #define STREAMINPUTTESTC_EFILE 3 /**< Could not open file */
82 /** @} */
83 
84 /** \cond DONT_DOXYGEN */
85 
86 #define STREAMINPUTTESTC_MSGENORM "Normal exit"
87 #define STREAMINPUTTESTC_MSGESUB "Subroutine failed"
88 #define STREAMINPUTTESTC_MSGEARG "Error parsing arguments"
89 #define STREAMINPUTTESTC_MSGEFILE "Could not open file"
90 
91 #include <stdlib.h>
92 #include <ctype.h>
93 #include <math.h>
94 #include <time.h>
95 #include <lal/LALStdio.h>
96 #include <lal/FileIO.h>
97 #include <lal/LALStdlib.h>
98 #include <lal/SeqFactories.h>
99 #include <lal/StreamInput.h>
100 
101 /* Default parameter settings. */
102 #define INFILE TEST_DATA_DIR "StreamInput.data"
103 
104 /* Usage format string. */
105 #define USAGE "Usage: %s [-o outfile] [-d debuglevel] [-t]\n" \
106 "\t[-v {ch | i2 | i4 | i8 | u2 | u4 | u8 | s | d} infile]\n" \
107 "\t[-s {ch | i2 | i4 | i8 | u2 | u4 | u8 | s | d | c | z} infile]\n"
108 
109 /* Valid datatypes for vectors or sequences. */
110 #define VTYPES "ch i2 i4 i8 u2 u4 u8 s d"
111 #define STYPES "ch i2 i4 i8 u2 u4 u8 s d c z"
112 
113 /* Macros for printing errors and testing subroutines. */
114 #define ERROR( code, msg, statement ) \
115 if ( lalDebugLevel & LALERROR ) \
116 { \
117  LALPrintError( "Error[0] %d: program %s, file %s, line %d, %s\n" \
118  " %s %s\n", (code), *argv, __FILE__, \
119  __LINE__, "$Id$", statement ? statement : \
120  "", (msg) ); \
121 } \
122 else (void)(0)
123 
124 #define INFO( statement ) \
125 if ( lalDebugLevel & LALINFO ) \
126 { \
127  LALPrintError( "Info[0]: program %s, file %s, line %d, %s\n" \
128  " %s\n", *argv, __FILE__, __LINE__, \
129  "$Id$", (statement) ); \
130 } \
131 else (void)(0)
132 
133 #define SUB( func, statusptr ) \
134 if ( (func), (statusptr)->statusCode ) \
135 { \
136  ERROR( STREAMINPUTTESTC_ESUB, STREAMINPUTTESTC_MSGESUB, \
137  "Function call \"" #func "\" failed:" ); \
138  return STREAMINPUTTESTC_ESUB; \
139 } \
140 else (void)(0)
141 
142 /* Macro to determine the print format for integers. */
143 #define GETINTFORMAT \
144 do { \
145  if ( fpOut ) { \
146  UINT4 nTot = values->length*dim; \
147  REAL8 max = 0.0; \
148  BOOLEAN neg = 0; \
149  for ( i = 0; i < nTot; i++ ) { \
150  REAL8 x = (REAL8)( values->data[i] ); \
151  REAL8 y = fabs( x ); \
152  if ( x > max ) \
153  max = x; \
154  if ( x != y ) \
155  neg = 1; \
156  } \
157  max += 0.5; \
158  if ( neg ) \
159  max *= 10.0; \
160  sprintf( format, "%%%ui", (UINT4)( log( max )/log( 10 ) ) + 2 ); \
161  } \
162 } while (0)
163 
164 #define GETUINTFORMAT \
165 do { \
166  if ( fpOut ) { \
167  UINT4 nTot = values->length*dim; \
168  REAL8 max = 0.0; \
169  BOOLEAN neg = 0; \
170  for ( i = 0; i < nTot; i++ ) { \
171  REAL8 x = (REAL8)( values->data[i] ); \
172  REAL8 y = fabs( x ); \
173  if ( x > max ) \
174  max = x; \
175  if ( x != y ) \
176  neg = 1; \
177  } \
178  max += 0.5; \
179  if ( neg ) \
180  max *= 10.0; \
181  sprintf( format, "%%%uu", (UINT4)( log( max )/log( 10 ) ) + 1 ); \
182  } \
183 } while (0)
184 
185 #define GETREALFORMAT \
186 do { \
187  if ( fpOut ) { \
188  UINT4 nTot = values->length*dim; \
189  BOOLEAN neg = 0; \
190  for ( i = 0; i < nTot; i++ ) \
191  if ( values->data[i] < 0.0 ) \
192  neg = 1; \
193  if ( neg ) \
194  sprintf( format, "%%10.3e" ); \
195  else \
196  sprintf( format, "%%9.3e" ); \
197  } \
198 } while (0)
199 
200 #define GETCOMPLEX8FORMAT \
201 do { \
202  if ( fpOut ) { \
203  UINT4 nTot = values->length*dim; \
204  BOOLEAN neg = 0; \
205  for ( i = 0; i < nTot; i++ ) \
206  if ( crealf(values->data[i]) < 0.0 || cimagf(values->data[i]) < 0.0 ) \
207  neg = 1; \
208  if ( neg ) \
209  sprintf( format, "%%10.3e" ); \
210  else \
211  sprintf( format, "%%9.3e" ); \
212  } \
213 } while (0)
214 
215 #define GETCOMPLEX16FORMAT \
216 do { \
217  if ( fpOut ) { \
218  UINT4 nTot = values->length*dim; \
219  BOOLEAN neg = 0; \
220  for ( i = 0; i < nTot; i++ ) \
221  if ( creal(values->data[i]) < 0.0 || cimag(values->data[i]) < 0.0 ) \
222  neg = 1; \
223  if ( neg ) \
224  sprintf( format, "%%10.3e" ); \
225  else \
226  sprintf( format, "%%9.3e" ); \
227  } \
228 } while (0)
229 
230 /* Macros for printing sequences and vector sequences. */
231 #define PRINTCHARVECTORSEQUENCE \
232 do { \
233  if ( fpOut ) \
234  for ( i = 0; i < values->length; i++ ) { \
235  for ( j = 0; j < dim; j++ ) { \
236  int c = (int)( values->data[i*dim+j] ); \
237  if ( isgraph( c ) ) \
238  fputc( c, fpOut ); \
239  else \
240  fputc( (int)(' '), fpOut ); \
241  } \
242  fputc( (int)('\n'), fpOut ); \
243  } \
244 } while (0)
245 
246 #define PRINTVECTORSEQUENCE \
247 do { \
248  if ( fpOut ) \
249  for ( i = 0; i < values->length; i++ ) { \
250  fprintf( fpOut, format, values->data[i*dim] ); \
251  for ( j = 1; j < dim; j++ ) { \
252  fprintf( fpOut, " " ); \
253  fprintf( fpOut, format, values->data[i*dim+j] ); \
254  } \
255  fprintf( fpOut, "\n" ); \
256  } \
257 } while (0)
258 
259 #define PRINTCHARSEQUENCE \
260 do { \
261  if ( fpOut ) \
262  for ( i = 0; i < values->length; i++ ) \
263  fputc( (int)( values->data[i] ), fpOut ); \
264 } while (0)
265 
266 #define PRINTSEQUENCE \
267 do { \
268  if ( fpOut ) \
269  for ( i = 0; i < values->length; i++ ) { \
270  fprintf( fpOut, format, values->data[i] ); \
271  fprintf( fpOut, "\n" ); \
272  } \
273 } while (0)
274 
275 #define PRINTCOMPLEX8SEQUENCE \
276 do { \
277  if ( fpOut ) \
278  for ( i = 0; i < values->length; i++ ) { \
279  fprintf( fpOut, format, crealf(values->data[i]) ); \
280  fprintf( fpOut, " " ); \
281  fprintf( fpOut, format, cimagf(values->data[i]) ); \
282  fprintf( fpOut, "\n" ); \
283  } \
284 } while (0)
285 
286 #define PRINTCOMPLEX16SEQUENCE \
287 do { \
288  if ( fpOut ) \
289  for ( i = 0; i < values->length; i++ ) { \
290  fprintf( fpOut, format, creal(values->data[i]) ); \
291  fprintf( fpOut, " " ); \
292  fprintf( fpOut, format, cimag(values->data[i]) ); \
293  fprintf( fpOut, "\n" ); \
294  } \
295 } while (0)
296 
297 int
298 main(int argc, char **argv)
299 {
300  static LALStatus stat; /* top-level status structure */
301  INT4 arg; /* index over command-line options */
302  UINT4 i, j; /* indecies */
303  UINT4 dim = 1; /* dimension of vector data */
304  BOOLEAN timing = 0; /* whether to perform timing tests */
305  BOOLEAN vector = 1; /* input is a sequence of vectors */
306  CHAR format[256]; /* integer output format */
307  CHAR *outfile = NULL; /* name of output file */
308  const CHAR *infile = INFILE; /* name of input file */
309  const CHAR *datatype = "s"; /* data type tag */
310  FILE *fpIn = NULL; /* input file pointer */
311  FILE *fpOut = NULL; /* output file pointer */
312  clock_t start = 0, stop = 0; /* data input timestamps */
313 
314 
315  /* Parse argument list. arg stores the current position. */
316  arg = 1;
317  while ( arg < argc ) {
318  /* Parse output file option. */
319  if ( !strcmp( argv[arg], "-o" ) ) {
320  if ( argc > arg + 1 ) {
321  arg++;
322  outfile = argv[arg++];
323  } else {
324  ERROR( STREAMINPUTTESTC_EARG, STREAMINPUTTESTC_MSGEARG, 0 );
325  LALPrintError( USAGE, *argv );
326  return STREAMINPUTTESTC_EARG;
327  }
328  }
329  /* Parse debug level option. */
330  else if ( !strcmp( argv[arg], "-d" ) ) {
331  if ( argc > arg + 1 ) {
332  arg++;
333  } else {
334  ERROR( STREAMINPUTTESTC_EARG, STREAMINPUTTESTC_MSGEARG, 0 );
335  LALPrintError( USAGE, *argv );
336  return STREAMINPUTTESTC_EARG;
337  }
338  }
339  /* Parse timing option. */
340  else if ( !strcmp( argv[arg], "-t" ) ) {
341  arg++;
342  timing = 1;
343  }
344  /* Parse vector sequence input option. */
345  else if ( !strcmp( argv[arg], "-v" ) ) {
346  if ( argc > arg + 2 ) {
347  arg++;
348  datatype = argv[arg++];
349  infile = argv[arg++];
350  vector = 1;
351  } else {
352  ERROR( STREAMINPUTTESTC_EARG, STREAMINPUTTESTC_MSGEARG, 0 );
353  LALPrintError( USAGE, *argv );
354  return STREAMINPUTTESTC_EARG;
355  }
356  }
357  /* Parse plain sequence input option. */
358  else if ( !strcmp( argv[arg], "-s" ) ) {
359  if ( argc > arg + 2 ) {
360  arg++;
361  datatype = argv[arg++];
362  infile = argv[arg++];
363  vector = 0;
364  } else {
365  ERROR( STREAMINPUTTESTC_EARG, STREAMINPUTTESTC_MSGEARG, 0 );
366  LALPrintError( USAGE, *argv );
367  return STREAMINPUTTESTC_EARG;
368  }
369  }
370  /* Check for unrecognized options. */
371  else {
372  ERROR( STREAMINPUTTESTC_EARG, STREAMINPUTTESTC_MSGEARG, 0 );
373  LALPrintError( USAGE, *argv );
374  return STREAMINPUTTESTC_EARG;
375  }
376  } /* End of argument parsing loop. */
377 
378  /* Open input and output files. */
379  if ( strcmp( infile, "stdin" ) ) {
380  if ( !( fpIn = fopen( infile, "r" ) ) ) {
381  ERROR( STREAMINPUTTESTC_EFILE, "- " STREAMINPUTTESTC_MSGEFILE,
382  infile );
383  return STREAMINPUTTESTC_EFILE;
384  }
385  } else
386  fpIn = stdin;
387  if ( outfile ) {
388  if ( strcmp( outfile, "stdout" ) ) {
389  if ( !( fpOut = fopen( outfile, "w" ) ) ) {
390  ERROR( STREAMINPUTTESTC_EFILE, "- " STREAMINPUTTESTC_MSGEFILE,
391  outfile );
392  return STREAMINPUTTESTC_EFILE;
393  }
394  } else
395  fpOut = stdout;
396  }
397 
398  /* Read the data as a vector sequence, and print it according to the
399  selected datatype. */
400  if ( vector ) {
401  if ( !strcmp( datatype, "ch" ) ) {
402  CHARVectorSequence *values = NULL;
403  start = clock();
404  SUB( LALCHARReadVectorSequence( &stat, &values, fpIn ), &stat );
405  stop = clock();
406  dim = values->vectorLength;
407  PRINTCHARVECTORSEQUENCE;
408  SUB( LALCHARDestroyVectorSequence( &stat, &values ), &stat );
409  } else if ( !strcmp( datatype, "i2" ) ) {
410  INT2VectorSequence *values = NULL;
411  start = clock();
412  SUB( LALI2ReadVectorSequence( &stat, &values, fpIn ), &stat );
413  stop = clock();
414  dim = values->vectorLength;
415  GETINTFORMAT;
416  PRINTVECTORSEQUENCE;
417  SUB( LALI2DestroyVectorSequence( &stat, &values ), &stat );
418  } else if ( !strcmp( datatype, "i4" ) ) {
419  INT4VectorSequence *values = NULL;
420  start = clock();
421  SUB( LALI4ReadVectorSequence( &stat, &values, fpIn ), &stat );
422  stop = clock();
423  dim = values->vectorLength;
424  GETINTFORMAT;
425  PRINTVECTORSEQUENCE;
426  SUB( LALI4DestroyVectorSequence( &stat, &values ), &stat );
427  } else if ( !strcmp( datatype, "i8" ) ) {
428  INT8VectorSequence *values = NULL;
429  start = clock();
430  SUB( LALI8ReadVectorSequence( &stat, &values, fpIn ), &stat );
431  stop = clock();
432  dim = values->vectorLength;
433  GETINTFORMAT;
434  PRINTVECTORSEQUENCE;
435  SUB( LALI8DestroyVectorSequence( &stat, &values ), &stat );
436  } else if ( !strcmp( datatype, "u2" ) ) {
437  UINT2VectorSequence *values = NULL;
438  start = clock();
439  SUB( LALU2ReadVectorSequence( &stat, &values, fpIn ), &stat );
440  stop = clock();
441  dim = values->vectorLength;
442  GETUINTFORMAT;
443  PRINTVECTORSEQUENCE;
444  SUB( LALU2DestroyVectorSequence( &stat, &values ), &stat );
445  } else if ( !strcmp( datatype, "u4" ) ) {
446  UINT4VectorSequence *values = NULL;
447  start = clock();
448  SUB( LALU4ReadVectorSequence( &stat, &values, fpIn ), &stat );
449  stop = clock();
450  dim = values->vectorLength;
451  GETUINTFORMAT;
452  PRINTVECTORSEQUENCE;
453  SUB( LALU4DestroyVectorSequence( &stat, &values ), &stat );
454  } else if ( !strcmp( datatype, "u8" ) ) {
455  UINT8VectorSequence *values = NULL;
456  start = clock();
457  SUB( LALU8ReadVectorSequence( &stat, &values, fpIn ), &stat );
458  stop = clock();
459  dim = values->vectorLength;
460  GETUINTFORMAT;
461  PRINTVECTORSEQUENCE;
462  SUB( LALU8DestroyVectorSequence( &stat, &values ), &stat );
463  } else if ( !strcmp( datatype, "s" ) ) {
464  REAL4VectorSequence *values = NULL;
465  start = clock();
466  SUB( LALSReadVectorSequence( &stat, &values, fpIn ), &stat );
467  stop = clock();
468  dim = values->vectorLength;
469  GETREALFORMAT;
470  PRINTVECTORSEQUENCE;
471  SUB( LALSDestroyVectorSequence( &stat, &values ), &stat );
472  } else if ( !strcmp( datatype, "d" ) ) {
473  REAL8VectorSequence *values = NULL;
474  start = clock();
475  SUB( LALDReadVectorSequence( &stat, &values, fpIn ), &stat );
476  stop = clock();
477  dim = values->vectorLength;
478  GETREALFORMAT;
479  PRINTVECTORSEQUENCE;
480  SUB( LALDDestroyVectorSequence( &stat, &values ), &stat );
481  } else {
482  ERROR( -1, "Internal consistency error!", 0 );
483  }
484  }
485 
486  /* Read the data as a plain sequence, and print it according to the
487  selected datatype. */
488  else {
489  if ( !strcmp( datatype, "ch" ) ) {
490  CHARVector *values = NULL;
491  start = clock();
492  SUB( LALCHARReadSequence( &stat, &values, fpIn ), &stat );
493  stop = clock();
494  PRINTCHARSEQUENCE;
495  SUB( LALCHARDestroyVector( &stat, &values ), &stat );
496  } else if ( !strcmp( datatype, "i2" ) ) {
497  INT2Vector *values = NULL;
498  start = clock();
499  SUB( LALI2ReadSequence( &stat, &values, fpIn ), &stat );
500  stop = clock();
501  GETINTFORMAT;
502  PRINTSEQUENCE;
503  SUB( LALI2DestroyVector( &stat, &values ), &stat );
504  } else if ( !strcmp( datatype, "i4" ) ) {
505  INT4Vector *values = NULL;
506  start = clock();
507  SUB( LALI4ReadSequence( &stat, &values, fpIn ), &stat );
508  stop = clock();
509  GETINTFORMAT;
510  PRINTSEQUENCE;
511  SUB( LALI4DestroyVector( &stat, &values ), &stat );
512  } else if ( !strcmp( datatype, "i8" ) ) {
513  INT8Vector *values = NULL;
514  start = clock();
515  SUB( LALI8ReadSequence( &stat, &values, fpIn ), &stat );
516  stop = clock();
517  GETINTFORMAT;
518  PRINTSEQUENCE;
519  SUB( LALI8DestroyVector( &stat, &values ), &stat );
520  } else if ( !strcmp( datatype, "u2" ) ) {
521  UINT2Vector *values = NULL;
522  start = clock();
523  SUB( LALU2ReadSequence( &stat, &values, fpIn ), &stat );
524  stop = clock();
525  GETUINTFORMAT;
526  PRINTSEQUENCE;
527  SUB( LALU2DestroyVector( &stat, &values ), &stat );
528  } else if ( !strcmp( datatype, "u4" ) ) {
529  UINT4Vector *values = NULL;
530  start = clock();
531  SUB( LALU4ReadSequence( &stat, &values, fpIn ), &stat );
532  stop = clock();
533  GETUINTFORMAT;
534  PRINTSEQUENCE;
535  SUB( LALU4DestroyVector( &stat, &values ), &stat );
536  } else if ( !strcmp( datatype, "u8" ) ) {
537  UINT8Vector *values = NULL;
538  start = clock();
539  SUB( LALU8ReadSequence( &stat, &values, fpIn ), &stat );
540  stop = clock();
541  GETUINTFORMAT;
542  PRINTSEQUENCE;
543  SUB( LALU8DestroyVector( &stat, &values ), &stat );
544  } else if ( !strcmp( datatype, "s" ) ) {
545  REAL4Vector *values = NULL;
546  start = clock();
547  SUB( LALSReadSequence( &stat, &values, fpIn ), &stat );
548  stop = clock();
549  GETREALFORMAT;
550  PRINTSEQUENCE;
551  SUB( LALSDestroyVector( &stat, &values ), &stat );
552  } else if ( !strcmp( datatype, "d" ) ) {
553  REAL8Vector *values = NULL;
554  start = clock();
555  SUB( LALDReadSequence( &stat, &values, fpIn ), &stat );
556  stop = clock();
557  GETREALFORMAT;
558  PRINTSEQUENCE;
559  SUB( LALDDestroyVector( &stat, &values ), &stat );
560  } else if ( !strcmp( datatype, "c" ) ) {
561  COMPLEX8Vector *values = NULL;
562  start = clock();
563  SUB( LALCReadSequence( &stat, &values, fpIn ), &stat );
564  stop = clock();
565  GETCOMPLEX8FORMAT;
566  PRINTCOMPLEX8SEQUENCE;
567  SUB( LALCDestroyVector( &stat, &values ), &stat );
568  } else if ( !strcmp( datatype, "z" ) ) {
569  COMPLEX16Vector *values = NULL;
570  start = clock();
571  SUB( LALZReadSequence( &stat, &values, fpIn ), &stat );
572  stop = clock();
573  GETCOMPLEX16FORMAT;
574  PRINTCOMPLEX16SEQUENCE;
575  SUB( LALZDestroyVector( &stat, &values ), &stat );
576  } else {
577  ERROR( -1, "Internal consistency error!", 0 );
578  }
579  }
580 
581  /* Print timing information, if requested. */
582  if ( timing )
583  fprintf( stderr, "CPU time required to read data: %.2f s\n",
584  (double)( stop - start )/CLOCKS_PER_SEC );
585 
586  /* Close files, cleanup, and exit. */
587  if ( infile && strcmp( infile, "stdin" ) )
588  fclose( fpIn );
589  if ( outfile && strcmp( outfile, "stdout" ) )
590  fclose( fpOut );
592  INFO( STREAMINPUTTESTC_MSGENORM );
593  return STREAMINPUTTESTC_ENORM;
594 }
595 /** \endcond */
#define USAGE
Definition: GzipTest.c:27
void LALCheckMemoryLeaks(void)
Definition: LALMalloc.c:784
#define SUB(func, statusptr)
#define ERROR(code, msg, statement)
#define INFO(statement)
#define STREAMINPUTTESTC_EFILE
Could not open file.
#define STREAMINPUTTESTC_EARG
Error parsing arguments.
#define STREAMINPUTTESTC_ENORM
Normal exit.
#define fprintf
int main(int argc, char *argv[])
Definition: cache.c:25
void LALSDestroyVectorSequence(LALStatus *status, REAL4VectorSequence **vectorSequence)
void LALU2DestroyVectorSequence(LALStatus *status, UINT2VectorSequence **vectorSequence)
void LALI4DestroyVectorSequence(LALStatus *status, INT4VectorSequence **vectorSequence)
void LALU4DestroyVectorSequence(LALStatus *status, UINT4VectorSequence **vectorSequence)
void LALDDestroyVectorSequence(LALStatus *status, REAL8VectorSequence **vectorSequence)
void LALU8DestroyVectorSequence(LALStatus *status, UINT8VectorSequence **vectorSequence)
void LALI2DestroyVectorSequence(LALStatus *status, INT2VectorSequence **vectorSequence)
void LALI8DestroyVectorSequence(LALStatus *status, INT8VectorSequence **vectorSequence)
unsigned char BOOLEAN
Boolean logical type, see Headers LAL(Atomic)Datatypes.h for more details.
char CHAR
One-byte signed integer, see Headers LAL(Atomic)Datatypes.h for more details.
uint32_t UINT4
Four-byte unsigned integer.
int32_t INT4
Four-byte signed integer.
int LALPrintError(const char *fmt,...)
Definition: LALError.c:46
void LALU4ReadSequence(LALStatus *status, UINT4Sequence **sequence, FILE *stream)
void LALU8ReadSequence(LALStatus *status, UINT8Sequence **sequence, FILE *stream)
void LALDReadSequence(LALStatus *status, REAL8Sequence **sequence, FILE *stream)
void LALSReadSequence(LALStatus *status, REAL4Sequence **sequence, FILE *stream)
void LALCReadSequence(LALStatus *status, COMPLEX8Sequence **sequence, FILE *stream)
void LALU2ReadSequence(LALStatus *status, UINT2Sequence **sequence, FILE *stream)
void LALI8ReadSequence(LALStatus *status, INT8Sequence **sequence, FILE *stream)
void LALZReadSequence(LALStatus *status, COMPLEX16Sequence **sequence, FILE *stream)
void LALCHARReadSequence(LALStatus *status, CHARSequence **sequence, FILE *stream)
void LALI2ReadSequence(LALStatus *status, INT2Sequence **sequence, FILE *stream)
void LALI4ReadSequence(LALStatus *status, INT4Sequence **sequence, FILE *stream)
void LALU2ReadVectorSequence(LALStatus *status, UINT2VectorSequence **sequence, FILE *stream)
void LALI8ReadVectorSequence(LALStatus *status, INT8VectorSequence **sequence, FILE *stream)
void LALSReadVectorSequence(LALStatus *status, REAL4VectorSequence **sequence, FILE *stream)
void LALCHARReadVectorSequence(LALStatus *status, CHARVectorSequence **sequence, FILE *stream)
void LALU4ReadVectorSequence(LALStatus *status, UINT4VectorSequence **sequence, FILE *stream)
void LALI2ReadVectorSequence(LALStatus *status, INT2VectorSequence **sequence, FILE *stream)
void LALU8ReadVectorSequence(LALStatus *status, UINT8VectorSequence **sequence, FILE *stream)
void LALI4ReadVectorSequence(LALStatus *status, INT4VectorSequence **sequence, FILE *stream)
void LALDReadVectorSequence(LALStatus *status, REAL8VectorSequence **sequence, FILE *stream)
void LALZDestroyVector(LALStatus *, COMPLEX16Vector **)
void LALCHARDestroyVector(LALStatus *, CHARVector **)
void LALI4DestroyVector(LALStatus *, INT4Vector **)
void LALCDestroyVector(LALStatus *, COMPLEX8Vector **)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
void LALSDestroyVector(LALStatus *, REAL4Vector **)
void LALU2DestroyVector(LALStatus *, UINT2Vector **)
void LALU8DestroyVector(LALStatus *, UINT8Vector **)
void LALU4DestroyVector(LALStatus *, UINT4Vector **)
void LALI8DestroyVector(LALStatus *, INT8Vector **)
void LALI2DestroyVector(LALStatus *, INT2Vector **)
void LALCHARDestroyVectorSequence(LALStatus *status, CHARVectorSequence **vectorSequence)
Vector of type CHAR, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:73
Sequence of CHAR Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:261
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:266
Vector of type COMPLEX16, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:172
Vector of type COMPLEX8, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:163
Vector of type INT2, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:91
Sequence of INT2 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:271
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:276
Vector of type INT4, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:109
Sequence of INT4 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:291
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:296
Vector of type INT8, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:127
Sequence of INT8 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:311
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:316
LAL status structure, see The LALStatus structure for more details.
Definition: LALDatatypes.h:947
Vector of type REAL4, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:145
Sequence of REAL4 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:331
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:336
Vector of type REAL8, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:154
Sequence of REAL8 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:341
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:346
Vector of type UINT2, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:100
Sequence of UINT2 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:281
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:286
Vector of type UINT4, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:118
Sequence of UINT4 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:301
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:306
Vector of type UINT8, see DATATYPE-Vector types for more details.
Definition: LALDatatypes.h:136
Sequence of UINT8 Vectors, see DATATYPE-VectorSequence types for more details.
Definition: LALDatatypes.h:321
UINT4 vectorLength
The length n of each vector.
Definition: LALDatatypes.h:326