Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

dumplib.h File Reference

Go to the source code of this file.


Data Structures

struct  vnode

Defines

#define NO_NETCDF_2
#define EXIT_SUCCESS   0
#define EXIT_FAILURE   1
#define FLT_DIGITS   7
#define DBL_DIGITS   15

Typedefs

typedef vnode vnode

Functions

void error (const char *fmt,...)
void set_indent (int indent)
void set_max_len (int len)
void lput (const char *string)
void set_formats (int flt_digs, int dbl_digs)
char * get_fmt (int ncid, int varid, nc_type type)
vnodenewvlist (void)
void varadd (vnode *vlist, int varid)
int varmember (const vnode *vlist, int varid)

Variables

char * progname
int float_precision_specified
int double_precision_specified
char float_var_fmt []
char double_var_fmt []
char float_att_fmt []
char double_att_fmt []

Define Documentation

#define DBL_DIGITS   15
 

Definition at line 22 of file dumplib.h.

Referenced by main(), set_precision(), and set_sigdigs().

#define EXIT_FAILURE   1
 

Definition at line 14 of file dumplib.h.

#define EXIT_SUCCESS   0
 

Definition at line 13 of file dumplib.h.

#define FLT_DIGITS   7
 

Definition at line 21 of file dumplib.h.

Referenced by main(), set_precision(), and set_sigdigs().

#define NO_NETCDF_2
 

Definition at line 9 of file dumplib.h.


Typedef Documentation

typedef struct vnode vnode
 

Definition at line 59 of file dumplib.h.


Function Documentation

void error const char *    fmt,
...   
 

Definition at line 33 of file dumplib.c.

References args.

Referenced by crop_image(), do_ncdump(), find_background(), find_color_or_error(), frame_argument(), get_fmt(), get_input_stream(), gifread_error(), input_stream(), main(), make_lvars(), merge_frame_interval(), name_path(), new_viewer(), newvnode(), output_information(), pipe_color_transformer(), pr_att(), pr_att_vals(), read_colormap_file(), read_text_colormap(), set_precision(), set_sigdigs(), type_name(), vardata(), and write_stream().

00034 {
00035     va_list args ;
00036 
00037     (void) fprintf(stderr,"%s: ", progname);
00038     va_start(args, fmt) ;
00039     (void) vfprintf(stderr,fmt,args) ;
00040     va_end(args) ;
00041 
00042     (void) fprintf(stderr, "\n") ;
00043     (void) fflush(stderr);      /* to ensure log files are current */
00044     exit(EXIT_FAILURE);
00045 }

char* get_fmt int    ncid,
int    varid,
nc_type    type
 

Definition at line 130 of file dumplib.c.

References double_precision_specified, double_var_fmt, error(), float_precision_specified, float_var_fmt, and has_c_format_att().

Referenced by vardata().

00135 {
00136     char *c_format_att;
00137 
00138     /* float or double precision specified with -p option overrides any
00139        C_format attribute value, so check for that first. */
00140 
00141     if (float_precision_specified && type == NC_FLOAT)
00142         return float_var_fmt;
00143 
00144     if (double_precision_specified && type == NC_DOUBLE)
00145         return double_var_fmt;
00146 
00147     /* If C_format attribute exists, return it */
00148     c_format_att = has_c_format_att(ncid, varid);
00149     if (c_format_att)
00150       return c_format_att;    
00151 
00152     /* Otherwise return sensible default. */
00153     switch (type) {
00154       case NC_BYTE:
00155         return "%d";
00156       case NC_CHAR:
00157         return "%s";
00158       case NC_SHORT:
00159         return "%d";
00160       case NC_INT:
00161         return "%d";
00162       case NC_FLOAT:
00163         return float_var_fmt;
00164       case NC_DOUBLE:
00165         return double_var_fmt;
00166       default:
00167         error("pr_vals: bad type");
00168     }
00169 
00170     return 0;
00171 }

void lput const char *    string
 

Definition at line 67 of file dumplib.c.

References linep, LINEPIND, and max_line_len.

Referenced by lastdelim2(), pr_bvals(), pr_dvals(), pr_fvals(), pr_ivals(), pr_svals(), and pr_tvals().

00068 {
00069     size_t nn = strlen(cp);
00070 
00071     if (nn+linep > max_line_len && nn > 2) {
00072         (void) fputs("\n", stdout);
00073         (void) fputs(LINEPIND, stdout);
00074         linep = (int)strlen(LINEPIND);
00075     }
00076     (void) fputs(cp,stdout);
00077     linep += nn;
00078 }

vnode* newvlist void   
 

Definition at line 190 of file dumplib.c.

References newvnode().

Referenced by do_ncdump().

00191 {
00192     vnode *vp = newvnode();
00193 
00194     vp -> next = 0;
00195     vp -> id = -1;              /* bad id */
00196 
00197     return vp;
00198 }

void set_formats int    flt_digs,
int    dbl_digs
 

Definition at line 82 of file dumplib.c.

References double_att_fmt, double_var_fmt, float_att_fmt, and float_var_fmt.

Referenced by main(), set_precision(), and set_sigdigs().

00083 {
00084     (void) sprintf(float_var_fmt, "%%.%dg", float_digits);
00085     (void) sprintf(double_var_fmt, "%%.%dg", double_digits);
00086     (void) sprintf(float_att_fmt, "%%#.%dgf", float_digits);
00087     (void) sprintf(double_att_fmt, "%%#.%dg", double_digits);
00088 }

void set_indent int    indent
 

Definition at line 53 of file dumplib.c.

References linep.

Referenced by vardata().

00054 {
00055     linep = in;
00056 }

void set_max_len int    len
 

Definition at line 60 of file dumplib.c.

References max_line_len.

Referenced by main().

00061 {
00062     max_line_len = len-2;
00063 }

void varadd vnode   vlist,
int    varid
 

Definition at line 202 of file dumplib.c.

References newvnode().

Referenced by do_ncdump().

00203 {
00204     vnode *newvp = newvnode();
00205     
00206     newvp -> next = vlist -> next;
00207     newvp -> id = varid;
00208     vlist -> next = newvp;
00209 }

int varmember const vnode   vlist,
int    varid
 

Definition at line 213 of file dumplib.c.

References vnode::id, and vnode::next.

Referenced by do_ncdump().

00214 {
00215     vnode *vp = vlist -> next;
00216 
00217     for (; vp ; vp = vp->next)
00218       if (vp->id == varid)
00219         return 1;
00220     return 0;    
00221 }

Variable Documentation

char double_att_fmt[]
 

Definition at line 29 of file dumplib.h.

Referenced by set_formats().

int double_precision_specified
 

Definition at line 25 of file dumplib.h.

Referenced by get_fmt().

char double_var_fmt[]
 

Definition at line 27 of file dumplib.h.

Referenced by get_fmt(), and set_formats().

char float_att_fmt[]
 

Definition at line 28 of file dumplib.h.

Referenced by set_formats().

int float_precision_specified
 

Definition at line 24 of file dumplib.h.

Referenced by get_fmt().

char float_var_fmt[]
 

Definition at line 26 of file dumplib.h.

Referenced by get_fmt(), and set_formats().

char* progname
 

Definition at line 7 of file dumplib.h.

 

Powered by Plone

This site conforms to the following standards: