wcsutil.h File Reference

Go to the source code of this file.

Functions

void wcsutil_blank_fill (int n, char c[])
 Fill a character string with blanks.
void wcsutil_null_fill (int n, char c[])
 Fill a character string with NULLs.
int wcsutil_allEq (int nvec, int nelem, const double *first)
 Test for equality of a particular vector element.
void wcsutil_setAll (int nvec, int nelem, double *first)
 Set a particular vector element.
void wcsutil_setAli (int nvec, int nelem, int *first)
 Set a particular vector element.
void wcsutil_setBit (int nelem, const int *sel, int bits, int *array)
 Set bits in selected elements of an array.
char * wcsutil_fptr2str (int(*func)(void), char hext[19])
 Translate pointer-to-function to string.
int wcsutil_str2double (const char *buf, const char *format, double *value)
 Translate string to a double, ignoring the locale.
void wcsutil_double2str (char *buf, const char *format, double value)
 Translate double to string ignoring the locale.


Detailed Description

Simple utility functions for internal use only by WCSLIB. They are documented here solely as an aid to understanding the code. They are not intended for external use - the API may change without notice!

Function Documentation

void wcsutil_blank_fill ( int  n,
char  c[] 
)

INTERNAL USE ONLY.

wcsutil_blank_fill() pads a character string with blanks starting with the terminating NULL character.

Used by the Fortran wrapper functions in translating C character strings into Fortran CHARACTER variables.

Parameters:
[in] n Length of the character array, c[].
[in,out] c The character string. It will not be null-terminated on return.
Returns:

void wcsutil_null_fill ( int  n,
char  c[] 
)

INTERNAL USE ONLY.

wcsutil_null_fill() strips off trailing blanks and pads the character array holding the string with NULL characters.

Used mainly to make character strings intelligible in the GNU debugger which prints the rubbish following the terminating NULL, obscuring the valid part of the string.

Parameters:
[in] n Number of characters.
[in,out] c The character string.
Returns:

int wcsutil_allEq ( int  nvec,
int  nelem,
const double *  first 
)

INTERNAL USE ONLY.

wcsutil_allEq() tests for equality of a particular element in a set of vectors.

Parameters:
[in] nvec The number of vectors.
[in] nelem The length of each vector.
[in] first Pointer to the first element to test in the array. The elements tested for equality are
                          *first == *(first + nelem)
                                 == *(first + nelem*2)
                                            :
                                 == *(first + nelem*(nvec-1));

The array might be dimensioned as
                          double v[nvec][nelem];
Returns:
Status return value:
  • 0: Not all equal.
  • 1: All equal.

void wcsutil_setAll ( int  nvec,
int  nelem,
double *  first 
)

INTERNAL USE ONLY.

wcsutil_setAll() sets the value of a particular element in a set of vectors.

Parameters:
[in] nvec The number of vectors.
[in] nelem The length of each vector.
[in,out] first Pointer to the first element in the array, the value of which is used to set the others
                          *(first + nelem) = *first;
                          *(first + nelem*2) = *first;
                                  :
                          *(first + nelem*(nvec-1)) = *first;

The array might be dimensioned as
                          double v[nvec][nelem];
Returns:

void wcsutil_setAli ( int  nvec,
int  nelem,
int *  first 
)

INTERNAL USE ONLY.

wcsutil_setAli() sets the value of a particular element in a set of vectors.

Parameters:
[in] nvec The number of vectors.
[in] nelem The length of each vector.
[in,out] first Pointer to the first element in the array, the value of which is used to set the others
                          *(first + nelem) = *first;
                          *(first + nelem*2) = *first;
                                  :
                          *(first + nelem*(nvec-1)) = *first;

The array might be dimensioned as
                          int v[nvec][nelem];
Returns:

void wcsutil_setBit ( int  nelem,
const int *  sel,
int  bits,
int *  array 
)

INTERNAL USE ONLY.

wcsutil_setBit() sets bits in selected elements of an array.

Parameters:
[in] nelem Number of elements in the array.
[in] sel Address of a selection array of length nelem. May be specified as the null pointer in which case all elements are selected.
[in] bits Bit mask.
[in,out] array Address of the array of length nelem.
Returns:

char * wcsutil_fptr2str ( int(*)(void)  func,
char  hext[19] 
)

INTERNAL USE ONLY.

wcsutil_fptr2str() translates a pointer-to-function to hexadecimal string representation for output. It is used by the various routines that print the contents of WCSLIB structs, noting that it is not strictly legal to type-pun a function pointer to void*. See http://stackoverflow.com/questions/2741683/how-to-format-a-function-pointer

Parameters:
[in] fptr Pointer to function.
[out] hext Null-terminated string. Should be at least 19 bytes in size to accomodate a 64-bit address (16 bytes in hex), plus the leading "0x" and trailing '\0'.
Returns:
The address of hext.

int wcsutil_str2double ( const char *  buf,
const char *  format,
double *  value 
)

INTERNAL USE ONLY.

wcsutil_str2double() converts a string to a double, but unlike sscanf() it ignores the locale and always expects a '.' as the decimal separator.

Parameters:
[in] buf The string containing the value
[in] format The formatting directive, such as "lf". This may be any of the forms accepted by sscanf(), but should only include a single formatting directive.
[out] value The double value parsed from the string.

void wcsutil_double2str ( char *  buf,
const char *  format,
double  value 
)

INTERNAL USE ONLY.

wcsutil_double2str() converts a double to a string, but unlike sprintf() it ignores the locale and always uses a '.' as the decimal separator.

Parameters:
[out] buf The buffer to write the string into.
[in] format The formatting directive, such as "f". This may be any of the forms accepted by sprintf(), but should only include a formatting directive and nothing else.
[in] value The value to convert to a string.


Generated on Tue Jan 29 16:31:03 2013 for WCSLIB 4.17 by  doxygen 1.5.6