29 #include <sys/types.h>
34 #define DASERR_DIS_EXIT 0
37 #define DASERR_DIS_RET 1
40 #define DASERR_DIS_ABORT 43
118 const char* sProgName,
int nErrDis,
int nErrBufSz,
int nLevel,
126 const char* sFile,
const char* sFunc,
int nLine,
DasErrCode nCode,
127 const char* sFmt, ...
131 const char* sFile,
const char* sFunc,
int nLine,
DasErrCode nCode,
185 #define das_error(nErrCode, ...) \
186 das_error_func(__FILE__, __func__, __LINE__, nErrCode, __VA_ARGS__ )
267 typedef struct das_error_message {
295 #define das_within(A, B, E) (fabs(A - B) < E ? true : false)
298 #define DAS_XML_BUF_LEN 1000000
301 #define DAS_XML_NODE_NAME_LEN 256
311 #define DAS_MAX_ID_BUFSZ 64
361 DAS_API
size_t das_tokncpy(
char* dest,
const char* src,
size_t n);
403 uint8_t* pDest,
const uint8_t* pSrc,
size_t uElemSz,
size_t uCount
467 DAS_API
bool das_copyfile(
const char* src,
const char* dest);
469 DAS_API
bool das_copyfile(
const char* src,
const char* dest, mode_t mode);
500 const char* sPath,
char ppDirList[][256],
size_t uMaxDirs,
char cType
Minimal definitions for das2 utilities that can safely be run without calling das_init().
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition: defs.h:164
Structure returned from das_get_error().
Definition: util.h:267
DAS_API das_error_msg * das_get_error(void)
Return the saved das2 error message buffer.
DAS_API void das_error_free(das_error_msg *pMsg)
Free an error message structure allocated on the heap.
DAS_API DasErrCode das_mkdirsto(const char *path)
Insure directories to a specific location exist.
void(* das_log_handler_t)(int nLevel, const char *sMsg, bool bPrnTime)
Definition of a message handler function pointer.
Definition: util.h:58
DAS_API bool das_isfile(const char *path)
Is the path a file.
DAS_API size_t das_tokncpy(char *dest, const char *src, size_t n)
Copy string as an XML token.
DAS_API uint8_t * das_memset(uint8_t *pDest, const uint8_t *pSrc, size_t uElemSz, size_t uCount)
A memset that handles multi-byte items
DAS_API int das_error_disposition(void)
Error handling: get the library's error disposition.
DAS_API void das_errdisp_release_lock()
Used for co-operative locking of time-limited error disposition changse.
DAS_API const char * das_userhome(void)
Get the home directory for the current account.
DAS_API void das_return_on_error(void)
Error handling: Normal Return Set the library to return normally to the calling function with a retur...
DAS_API char * das_string(const char *fmt,...)
Allocate a new string on the heap and format it.
DAS_API const char * das_xml_escape(char *dest, const char *src, size_t uOutLen)
Translate unsafe characters for XML string output.
DAS_API char * das_strdup(const char *sIn)
Copy a string into a new buffer allocated on the heap.
DAS_API bool das_isdir(const char *path)
Is the path a directory.
DAS_API int das_dirlist(const char *sPath, char ppDirList[][256], size_t uMaxDirs, char cType)
Get a sorted directory listing.
DAS_API void das_finish(void)
A do nothing function on Unix, closes network sockets on windows.
DAS_API bool das_assert_valid_id(const char *sId)
Check that a string is suitable for use as an object ID.
DAS_API void das_print_error(void)
Error handling: Print formatted error to standard error stream Set the library to ouput formatted err...
DAS_API void das_store_str(char **psDest, size_t *puLen, const char *sSrc)
Store string in a buffer that is reallocated if need be.
DAS_API char * das_vstring(const char *fmt, va_list ap)
Store a formatted string in a newly allocated buffer.
DAS_API void das_abort_on_error(void)
Error handling: Trigger Core Dumps.
DAS_API const char * das_lib_version(void)
Get the library version.
DAS_API 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.
DAS_API bool das_save_error(int maxmsg)
Error handling: Save formatted error in a message buffer.
DAS_API double das_strtod_c(const char *nptr, char **endptr)
A C locale string to double converter.
DAS_API void das_error_setdisp(int nDisp)
The inverse of das_error_disposition.
DAS_API bool das_copyfile(const char *src, const char *dest, mode_t mode)
Copy a file to a distination creating directories as needed.
DAS_API void das_exit_on_error(void)
Error handling: Normal Exit Set the library to call exit(ErrorCode) when a problem is detected.
DAS_API void das_errdisp_get_lock()
Used for co-operative locking of time-limited error disposition changse.