cefvarinfo.c 1.89 KB
/************************************************************/
/*        
/***********************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <CEF.h>
#include <string.h>
#include <time.h>
#include <math.h>
 
#define MAX_FILE_NAME_LEN  250        // Max. file name length

/**************************
   Function prototypes
**************************/
 
char * cef_str_datatype (long);

/*--------------------------------------------------------------------------*/
int main(int argc, char *argv[])
{
    
    t_err  err;
    t_variable *var; 
    t_meta *meta;
    int i;
    
 //   char  fileName[MAX_FILE_NAME_LEN];
 
//    int mode, tm, nb_entry = 0; 
  
 
/*********************** Open CEF file *****************************/
   
       err = Read_CEF_file(argv[1]);
       var = Get_variable(argv[2]);
       printf("%s %d %d", cef_str_datatype(var->type), var->nb_size, var->nb_elem);
       for (i = 0; i < var->nb_size; i++) printf(" %d",  var->size[i]);

	// fprintf(stdout,"%s %d %d\n", var->name, var->type, var->varying); 	 
      
   //    if ((cef_time = Get_variable("time_tags")) == NULL) exit(1);
        err = Close_CEF_file();   
  //     meta = Get_meta("Version_number");
//       version = Get_item(meta->entry, 0);
}
/*--------------------------------------------------------------------------
 *  This routine returns the string representation of the given CDF 
 *  datatype.
 *--------------------------------------------------------------------------*/
char *  cef_str_datatype (long type)
{
    switch (type) {
      
    
      case CEF_CHAR:
         return "CEF_CHAR";

      case CEF_INT:
         return "CEF_INT";

      case CEF_FLOAT:
         return "CEF_FLOAT";
 
      case CEF_DOUBLE:
         return "CEF_DOUBLE";
 
      case CEF_ISO_TIME:
         return "CEF_TIME";

    }
}