libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
util.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <limits.h>

Go to the source code of this file.

Data Structures

struct  das_error_msg
 Structure returned from das_get_error(). More...
 

Macros

#define DAS_OKAY   0
 success return code
 
#define DASERR_DIS_EXIT   0
 Used to indicate that errors should trigger program exit.
 
#define DASERR_DIS_RET   1
 Used to indicate that errors should trigger library functions to return error values.
 
#define DASERR_DIS_ABORT   43
 Used to indicate that errors should trigger program abort with a core dump.
 
#define das_error(nErrCode,...)   das_error_func(__FILE__, __func__, __LINE__, nErrCode, __VA_ARGS__ )
 Signal an error condition. More...
 
#define das_within(A, B, E)   (fabs(A - B) < E ? true : false)
 Check to see if two floating point values are within an epsilon of each other.
 
#define DAS_XML_MAXPROPS   400
 limit of number of properties per descriptor. More...
 
#define DAS_XML_BUF_LEN   1000000
 The limit on xml packet length, in bytes. More...
 
#define DAS_XML_NODE_NAME_LEN   256
 The limit of xml element name length, in bytes. More...
 

Typedefs

typedef int DasErrCode
 return code type 0 indicates success, negative integer indicates failure
 
typedef void(* das_log_handler_t )(int nLevel, const char *sMsg, bool bPrnTime)
 Definition of a message handler function pointer. More...
 

Functions

void das_init (const char *sProgName, int nErrDis, int nErrBufSz, int nLevel, das_log_handler_t logfunc)
 Initialize any global structures in the Das2 library. More...
 
void das_abort_on_error (void)
 Error handling: Trigger Core Dumps. More...
 
void das_exit_on_error (void)
 Error handling: Normal Exit Set the library to call exit(ErrorCode) when a problem is detected. More...
 
void das_return_on_error (void)
 Error handling: Normal Return Set the library to return normally to the calling function with a return value that indicates a problem has occurred. More...
 
int das_error_disposition (void)
 Error handling: get the library's error disposition. More...
 
void das_print_error (void)
 Error handling: Print formatted error to standard error stream Set the library to ouput formatted error messages to the processes standard error stream. More...
 
bool das_save_error (int maxmsg)
 Error handling: Save formatted error in a message buffer. More...
 
const char * das_lib_version (void)
 Get the library version. More...
 
bool das_assert_valid_id (const char *sId)
 Check that a string is suitable for use as an object ID. More...
 
void das_store_str (char **psDest, size_t *puLen, const char *sSrc)
 Store string in a buffer that is reallocated if need be. More...
 
char * das_string (const char *fmt,...)
 Allocate a new string on the heap and format it. More...
 
char * das_strdup (const char *sIn)
 Copy a string into a new buffer allocated on the heap. More...
 
char * das_vstring (const char *fmt, va_list ap)
 Store a formatted string in a newly allocated buffer. More...
 
bool das_isdir (const char *path)
 Is the path a directory. More...
 
bool das_isfile (const char *path)
 Is the path a file. More...
 
int das_dirlist (const char *sPath, char ppDirList[][256], size_t uMaxDirs, char cType)
 Get a sorted directory listing. More...