#pragma once

/**
 * @file lephisto.h
 *
 * @brief Header file with generic functions and lephisto-specifics.
 */

#define APPNAME "Lephisto"    /**< Application name. */

#define MALLOC_L(type)(malloc(sizeof(type)))      /**< Deprecated. */
#define CALLOC_L(type)(calloc(1, sizeof(type)))   /**< Deprecated. */

#define ABS(x)    (((x)<0)?-(x):(x))    /**< Return absulute value. */
#define FABS(x)   (((x)<0.)?-(x):(x))   /**< Return float absolute value. */

#define MAX(x,y)  (((x)>(y))?(x):(y))   /**< Return maximum. */
#define MIN(x,y)  (((x)>(y))?(y):(x))   /**< Return minumum. */

#define pow2(x)  ((x)*(x))              /**< ^2 */

#define DATA_DEF    "data"              /**< Default data packfile. */
extern char* data;                      /**< Modifiable datafile. */
#define DATA        data                /**< Standard data file to use. */
#define DATA_NAME_LEN 32                /**< Max length of data name. */
extern char dataname[DATA_NAME_LEN];    /**< Datafile name. */

/* Max filename path. */
#ifndef PATH_MAX
#  define PATH_MAX 128                  /**< If not already defined. */
#endif

#ifndef M_PI
#define M_PI 3.14159265358979323846     /**< If not already defined. */
#endif

char* lephisto_version(void);

