00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef H5IMPORT_H__
00023 #define H5IMPORT_H__
00024 
00025 
00026 
00027 
00028 #define FILNAME 0
00029 
00030 #define OPT_o   1
00031 
00032 #define OPT_c   2   
00033 #define OPT_h   3   
00034 #define OPT_d   4   
00035 #define OPT_p   5   
00036 #define OPT_t   6   
00037 #define OPT_s   7   
00038 #define ERR    20  
00039 
00040 #define MAX_GROUPS_IN_PATH  20
00041 #define MAX_PATH_NAME_LENGTH 255
00042 #define NUM_KEYS 14
00043 #define MIN_NUM_DIMENSION  1
00044 #define MAX_NUM_DIMENSION  32
00045 #define BASE_10 10
00046 
00047 #define CHUNK            0
00048 #define COMPRESS         1
00049 #define EXTEND           2
00050 #define EXTERNAL         3
00051 #define DIM              4
00052 #define RANK             5
00053 #define PATH             6
00054 #define INPUT_CLASS      7
00055 #define INPUT_SIZE       8
00056 #define OUTPUT_CLASS     9
00057 #define OUTPUT_SIZE     10
00058 #define OUTPUT_ARCH     11
00059 #define OUTPUT_B_ORDER  12
00060 #define COMPRESS_PARAM  13
00061 
00062 
00063 #define H5DT_INT8      signed char
00064 #define H5DT_INT16     short
00065 #define H5DT_INT32     int
00066 #define H5DT_FLOAT32   float
00067 #define H5DT_FLOAT64   double
00068 #define VOIDP          void*
00069 #define H5DT_UINT8     unsigned char
00070 #define H5DT_UINT16    unsigned short
00071 #define H5DT_UINT32    unsigned int
00072 #define H5DT_INT64     long long
00073 #define H5DT_UINT64    unsigned H5DT_INT64
00074 
00075 struct path_info
00076 {
00077   char group[MAX_GROUPS_IN_PATH][MAX_PATH_NAME_LENGTH];
00078   int count;
00079 };
00080 
00081 struct Input
00082 {
00083   struct path_info path;
00084   int inputClass;
00085   int inputSize;
00086   int rank;
00087   hsize_t* sizeOfDimension;
00088   int outputClass;
00089   int outputSize;
00090   int outputArchitecture;
00091   int outputByteOrder;
00092   hsize_t* sizeOfChunk;
00093   hsize_t* maxsizeOfDimension;
00094   int compressionType;
00095   int compressionParam;
00096   char *externFilename;
00097   VOIDP data;
00098   int configOptionVector[NUM_KEYS];
00099 };
00100 
00101 struct infilesformat
00102 {
00103   char datafile[255];
00104   char configfile[255];
00105   struct Input in;
00106   int config; 
00107 };
00108 
00109 struct Options
00110 {
00111   struct infilesformat  infiles[30];  
00112   char   outfile[256];  
00113   int    fcount;       
00114 };
00115 
00116 char keytable[NUM_KEYS][30] = {
00117   "PATH",
00118   "INPUT-CLASS",
00119   "INPUT-SIZE",
00120   "RANK",
00121   "DIMENSION-SIZES",
00122   "OUTPUT-CLASS",
00123   "OUTPUT-SIZE",
00124   "OUTPUT-ARCHITECTURE",
00125   "OUTPUT-BYTE-ORDER",
00126   "CHUNKED-DIMENSION-SIZES",
00127   "COMPRESSION-TYPE",
00128   "COMPRESSION-PARAM",
00129   "EXTERNAL-STORAGE",
00130   "MAXIMUM-DIMENSIONS"
00131 };
00132 
00133 static int  state_table[15][8] =
00134 {
00135   
00136 
00137 
00138   
00139   {1, ERR, ERR, 6, ERR, ERR, ERR, ERR},
00140 
00141   
00142   {ERR, ERR, 2, ERR, 7, ERR, ERR, ERR},
00143 
00144   
00145   {3, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00146 
00147   
00148   {1, 4, ERR, ERR, ERR, ERR, ERR, ERR},
00149 
00150   
00151   {5, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00152 
00153   
00154   {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00155 
00156   
00157   {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00158 
00159   
00160   {8, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00161 
00162   
00163   {1, 4, ERR, ERR, ERR, 9, 11, 13},
00164 
00165   
00166   {10, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00167 
00168   
00169   {1, 4, ERR, ERR, ERR, ERR, 11, 13},
00170 
00171   
00172   {12, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00173 
00174   
00175   {1, 4, ERR, ERR, ERR, ERR, ERR, 13},
00176 
00177   
00178   {14, ERR, ERR, ERR, ERR, ERR, ERR, ERR},
00179 
00180   
00181   {1, 4, ERR, ERR, ERR, ERR, ERR, ERR}
00182 
00183 };
00184 
00185 
00186 
00187 
00188 
00189 
00190 void  usage(char *);
00191 void  setDefaultValues(struct Input *in, int count);
00192 void  help(char *);
00193 
00194 static int  gtoken(char *s);
00195 static int  process(struct Options *opt);
00196 static int  processConfigurationFile(char *infile, struct Input *in, FILE **strm);
00197 static int  mapKeywordToIndex(char *key);
00198 static int  parsePathInfo(struct path_info *path, char *strm);
00199 static int  parseDimensions(struct Input *in, char *strm);
00200 static int  getInputSize(struct Input *in, int ival);
00201 static int  getInputClass(struct Input *in, char * strm);
00202 static int  InputClassStrToInt(char *temp);
00203 static int  getRank(struct Input *in, FILE** strm);
00204 static int  getDimensionSizes(struct Input *in, FILE** strm);
00205 static int  getOutputSize(struct Input *in, FILE** strm);
00206 static int  getOutputClass(struct Input *in, FILE** strm);
00207 static int  OutputClassStrToInt(char *temp);
00208 static int  getOutputArchitecture(struct Input *in, FILE** strm);
00209 static int  OutputArchStrToInt(char *temp);
00210 static int  getOutputByteOrder(struct Input *in, FILE** strm);
00211 static int  OutputByteOrderStrToInt(char *temp);
00212 static int  getChunkedDimensionSizes(struct Input *in, FILE **strm);
00213 static int  getCompressionType(struct Input *in, FILE** strm);
00214 static int  CompressionTypeStrToInt(char *temp);
00215 static int  getCompressionParameter(struct Input *in, FILE** strm);
00216 static int  getExternalFilename(struct Input *in, FILE** strm);
00217 static int  getMaximumDimensionSizes(struct Input *in, FILE **strm);
00218 static int  processDataFile(char *infile, struct Input *in, FILE **strm, hid_t file_id);
00219 static int  readIntegerData(FILE **strm, struct Input *in);
00220 static int  readFloatData(FILE **strm, struct Input *in);
00221 static int  allocateIntegerStorage(struct Input *in);
00222 static int  allocateFloatStorage(struct Input *in);
00223 hid_t       createOutputDataType(struct Input *in);
00224 hid_t       createInputDataType(struct Input *in);
00225 static int  readUIntegerData(FILE **strm, struct Input *in);
00226 static int  allocateUIntegerStorage(struct Input *in);
00227 static int  validateConfigurationParameters(struct Input * in);
00228 static int  processStrData(FILE **strm, struct Input *in, hid_t file_id);
00229 
00230 #endif  
00231