eviofmt.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "evio.h"

Defines

#define MAX(a, b)   ( (a) > (b) ? (a) : (b) )
#define debugprint(ii)   printf(" [%3d] %3d (16 * %2d + %2d), nr=%d\n",ii,ifmt[ii],ifmt[ii]/16,ifmt[ii]-(ifmt[ii]/16)*16,nr)

Functions

int eviofmt (char *fmt, unsigned char *ifmt, int ifmtLen)

Define Documentation

#define debugprint ( ii   )     printf(" [%3d] %3d (16 * %2d + %2d), nr=%d\n",ii,ifmt[ii],ifmt[ii]/16,ifmt[ii]-(ifmt[ii]/16)*16,nr)

Referenced by eviofmt().

#define MAX ( a,
 )     ( (a) > (b) ? (a) : (b) )

Referenced by eviofmt().


Function Documentation

int eviofmt ( char *  fmt,
unsigned char *  ifmt,
int  ifmtLen 
)
  This routine transforms a composite, format-containing
  ASCII string to an unsigned char array. It is to be used
  in conjunction with eviofmtswap to swap the endianness of
  composite data.
   format code bits <- format in ascii form
     [7:4] [3:0]
       #     0           #'('
       0    15           #'(' same as above, but have to take # from the data (32-bit)
       0     0            ')'
       #     1           #'i'   unsigned int
       #     2           #'F'   floating point
       #     3           #'a'   8-bit char (C++)
       #     4           #'S'   short
       #     5           #'s'   unsigned short
       #     6           #'C'   char
       #     7           #'c'   unsigned char
       #     8           #'D'   double (64-bit float)
       #     9           #'L'   long long (64-bit int)
       #    10           #'l'   unsigned long long (64-bit int)
       #    11           #'I'   int
       #    12           #'A'   hollerit (4-byte char with int endining)
   NOTES:
    1. If format ends but end of data did not reach, format in last parenthesis
       will be repeated until all data processed; if there are no parenthesis
       in format, data processing will be started from the beginnig of the format
       (FORTRAN agreement)
    2. The number of repeats '#' must be the number between 2 and 15; if the number
       of repeats is symbol 'N' instead of the number, it will be taken from data
       assuming 'int' format
 
Parameters:
fmt null-terminated composite data format string
ifmt unsigned char array to hold transformed format
ifmtLen length of unsigned char array, ifmt, in # of chars
Returns:
the number of bytes in ifmt[] (positive)
-1 to -8 for improper format string
-9 if unsigned char array is too small

References debugprint, and MAX.


Generated on 4 Feb 2014 for evio by  doxygen 1.6.1