#if !defined(PS_MISC_H)
#define PS_MISC_H

/** \file psMisc.h
 *  \brief miscellaneous system utilities 
 *  \ingroup SystemGroup
 */

/** Functions **************************************************************/
/** \addtogroup SystemGroup System Utilities
 *  \{
 */

/// Prints an error message and aborts
void psAbort(const char *name,		///< Category of code that caused the abort
	     const char *fmt,		///< Format
	     ...			///< Extra arguments to use format
	     );

/// Allocates and returns a copy of a string
char *psStringCopy(const char *str	///< string to copy
    );

/// Allocates nChar and returns a copy of the string or segment
char *psStringNCopy(const char *str,	///< string to copy
		    int nChar		///< Number of characters (including \0 )
    );

/* \} */ // End of SystemGroup Functions
/*
 * Concatenate two macro arguments
 */
#define P_PS_CONCAT(A, B) A ## B	      //!< Expands to AB
#define PS_CONCAT(A, B) A ## B                //!< Also Expands to AB
#define PS_CONCAT2(A, B) PS_CONCAT(A, B)      //!< Also expands to AB
#define PS_CONCAT3(A, B, C) A ## B ## C	      //!< Expands to ABC
#define PS_CONCAT4(A, B, C, D) A ## B ## C ## D	//!< Expands to ABCD
  
#define PS_STRING(S) #S			///< converts argument to string

/// Magic values for errors
enum {
    PS_NO_VALUE = -111,			///< Corresponding value not yet measured
    PS_NO_ERROR = -222			///< Corresponding value has no error
};

#endif
