utils

Contents

Type Size Name Notes
makefile 272B Makefile
C source code 1kB addcline.c This routine adds a comment line to a header buffer. If available buffer space is exceeded, the routine dies, as is also true if the comment line cline is too long. Cline must have a newline at the end, and be terminated with a null as are normal C language strings.
C source code 3kB addfld.c This routine adds a field to a header buffer. The type is either 's' for static or 'v' for variable. The elements of the field structure are arguments 4, 5, 6, ... of the function call. The total number of arguments is variable depending on the dimension of the field.
C source code 1kB addpar.c This routine adds a parameter name-value pair to a header buffer. Various error exits occur if there are problems.
C source code 10kB auxio.c Contains all non-float type Candis I/O routines
C source code 4kB cdfio.c contains all float type Candis I/O routines
4kB cdfio.c.old
C source code 728B copycmt.c This routine copies an entire comment from one header buffer to another. The calling routine must worry about overflow.
C source code 845B copyfld.c Copy specified field section of common data format header file.
C source code 631B copypar.c Copy parameters section of common data format header file.
C source code 675B elemcnt.c This routine computes and returns an element count from header information for either a static (type = 's') or variable (type = 'v') slice. The header must previously been written into a buffer. This routine uses getfld.
C source code 421B floatswap.c switch order of bytes in floats
C source code 496B getbuff.c This routine uses malloc to allocate float buffer space. The argument nelem defines the number of floating point elements. It returns a float pointer to the space. If malloc fails, getbuff dies with an error message.
C source code 926B getcmt.c This routine extracts the comment form a common data format header buffer. The number of comment lines is returned. At most max lines of the header buffer will be scanned.
C source code 3kB getfld.c This routine scans through a common data format header buffer looking for a field in position pos. If found, it returns a pointer to a field structure that contains the field information. Otherwise it returns NULL. At most, max lines of the buffer will be scanned. If the end of the buffer is actually reached, a format error in the header exists. If type = 's', the static area is searched. Otherwise the variable field area is searched.
C source code 1kB getfmt.c getfmt accepts a header buffer and a maximum number of lines to search and returns a character that indicates the format of the data file: i, f, or a. It dies if the end of header was reached or if the maximum number of lines was read unsuccessfully
C source code 1kB getpar.c This routine scans through a common data format header buffer looking for a parameter in a specified position. If found, it puts the parameter name and its value in pname and value, and returns OK. At most, max lines of the buffer will be scanned. If the end of the buffer is actually reached, a format error in the header exists. This causes a fatal error. If no parameter exists in that position, FAIL is returned.
C source code 975B getptr.c This routine returns a pointer to a field, given the name of the field, its type, and the locations of the header and slice buffers. Failure mode is either to die with an error message or to return NULL, depending on the value of failmode.
C source code 1kB getptr2.c This routine returns a pointer to a field, given the name of the field, its type, and the locations of the header and slice buffers. Failure mode is either to die with an error message or to return NULL, depending on the value of failmode. Also returned is a pointer to the associated field structure.
C source code 898B nullhdr.c This routine creates a null header in buffer of type format -- "float", "int", or "ascii". If max < 10, it dies with a message that the buffer isn't big enough. It also dies if format isn't a recognized type.
C source code 12kB quickcandis.c This set of functions implements a higher level (and somewhat restricted) method for Candis files. The major restrictions are: a) only one variable slice, and b) only index fields in static slice, and c) index fields are required for each dimension.
C source code 3kB seekfld.c This routine scans through a common data format header buffer looking for a field named fname. If found, it returns a pointer to a field structure that contains the field information. Otherwise it returns NULL. At most, max lines of the buffer will be scanned. If the end of the buffer is actually reached, a format error in the header exists. If type = 's', the static area is searched. Otherwise the variable field area is searched.
C source code 1kB seekpar.c This routine scans through a common data format header buffer looking for a specified parameter name. If found, it returns an OK after putting the value of the parameter in value. At most, max lines of the buffer will be scanned. If the end of the buffer is actually reached, a format error in the header exists. This causes a fatal error. If the desired parameter isn't found, a FAIL is returned.
C source code 3kB subspace1.c This function locates a one-dimensional sub-space from an arbitrarily dimensioned field, the sub-space being defined by holding all dimensions except the specified dimension constant. There are tsize/dsize instances of this subspace. Particular instances are defined by an instance number, which takes the range 0 to tsize/dsize - 1. Each instance is located by a starting point, an increment, and an element count for that sub-space.