#if ! defined(APPLICATION_NAME) #define APPLICATION_NAME "@PROG_N@" #endif #if ! defined(APPLICATION_EXEC) #define APPLICATION_EXEC "@PROG_X@" #endif #define APPLICATION_YEAR "@PROG_Y@" #define APPLICATION_VERSION "@PROG_V@" #define APPLICATION_COPYRIGHT "Jani Salonen <" PACKAGE_BUGREPORT ">" /* Static definitions, no user serviceable parts below this */ enum is_types { IS_NO = 0, /* These must be numbered as they are, renumering wrecks everything */ IS_YES = 1, IS_MAYBE = 2 }; #define CHARSET_DEFAULT "UTF-8" #define CHARSET_DEFAULT_SIZE 5 #define APPRES_FILE APPLICATION_EXEC ".res" #define CONFIG_FILE APPLICATION_EXEC ".conf" #define CONFIG_LINE_FEED_LF 10 /* Selection of fine linefeeds */ #define CONFIG_LINE_FEED_CR 13 #define CONFIG_LINE_FEED_NL 133 #define CONFIG_LINE_FEED CONFIG_LINE_FEED_LF #define CONFIG_PATH_DELIM_UNIX '/' /* Path delimiters to choose from */ #define CONFIG_PATH_DELIM_DOS '\\' #define CONFIG_PATH_DELIM_MAC ':' #define CONFIG_PATH_DELIM_VMS '.' #define CONFIG_PATH_DELIM CONFIG_PATH_DELIM_UNIX #define CONFIG_OPTION_NOTREQUIRED IS_NO /* Config parameter is required or not */ #define CONFIG_OPTION_REQUIRED IS_YES #define CONFIG_OPTION_LOOSE IS_NO /* Config parameter is secure or not */ #define CONFIG_OPTION_SECURE IS_YES enum config_types { /* Config types */ CONFIG_TYPE_BOOLEAN = 1, CONFIG_TYPE_INTEGER, CONFIG_TYPE_FLOAT, CONFIG_TYPE_STRING, CONFIG_TYPE_COLOR }; #define CONFIG_TYPE_BOOLEAN_NO IS_NO /* Config boolean bits */ #define CONFIG_TYPE_BOOLEAN_YES IS_YES /* Static directory paths */ #define DIR_PLACE_PRE "@prefix@" #define DIR_PLACE_BIN BINDIR "/" APPLICATION_EXEC /* If order of these dirs ever changes, check the unveil t_rst structs too */ #define DIR_PLACE_CONFS_1 "~/." APPLICATION_EXEC #define DIR_PLACE_CONFS_2 "${XDG_CONFIG_HOME}" #define DIR_PLACE_CONFS_3 "${XDG_CONFIG_HOME}/" APPLICATION_EXEC #define DIR_PLACE_CONFS_4 "~/.config" #define DIR_PLACE_CONFS_5 "~/.config/" APPLICATION_EXEC #define DIR_PLACE_CONFS_6 "~/.local" #define DIR_PLACE_CONFS_7 "~/.local/" APPLICATION_EXEC #if ! defined(PROG_HAS_DEBUG) #define DIR_PLACE_CONFS_8 "${" APPLICATION_EXEC "_HOME}/etc" #endif #define DIR_PLACE_CONFS_9 ETCDIR #define DIR_PLACE_CONFD_1 "~/." APPLICATION_EXEC ".d" #define DIR_PLACE_CONFD_2 "${XDG_CONFIG_HOME}/" APPLICATION_EXEC ".d" #define DIR_PLACE_CONFD_3 "~/.config/" APPLICATION_EXEC ".d" #define DIR_PLACE_CONFD_4 "~/.local/" APPLICATION_EXEC ".d" #if ! defined(PROG_HAS_DEBUG) #define DIR_PLACE_CONFD_5 "${" APPLICATION_EXEC "_HOME}/etc/" APPLICATION_EXEC ".d" #endif #define DIR_PLACE_CONFD_6 ETCDIR "/" APPLICATION_EXEC ".d" #define DIR_PLACE_FONTS_1 "~/.fonts" #define DIR_PLACE_FONTS_2 "~/." APPLICATION_EXEC "/fonts" #define DIR_PLACE_FONTS_3 "${XDG_DATA_HOME}/fonts" #define DIR_PLACE_FONTS_4 "${XDG_DATA_HOME}/" APPLICATION_EXEC "/fonts" #define DIR_PLACE_FONTS_5 "${XDG_DATA_HOME}/detroit/fonts" #define DIR_PLACE_FONTS_6 "~/.local/share/fonts" #define DIR_PLACE_FONTS_7 "~/.local/share/" APPLICATION_EXEC "/fonts" #define DIR_PLACE_FONTS_8 "~/.local/share/detroit/fonts" #if ! defined(PROG_HAS_DEBUG) #define DIR_PLACE_FONTS_9 "${" APPLICATION_EXEC "_HOME}/share/fonts" #define DIR_PLACE_FONTS_10 "${" APPLICATION_EXEC "_HOME}/share/" APPLICATION_EXEC "/fonts" #define DIR_PLACE_FONTS_11 "${" APPLICATION_EXEC "_HOME}/share/detroit/fonts" #endif #define DIR_PLACE_FONTS_12 SHRDIR "/fonts" #define DIR_PLACE_FONTS_13 SHRDIR "/" APPLICATION_EXEC "/fonts" #define DIR_PLACE_FONTS_14 SHRDIR "/detroit/fonts" #define DIR_PLACE_FONTS_15 "." #define DIR_PLACE_WIDGETS_1 "~/.widgets" #define DIR_PLACE_WIDGETS_2 "~/." APPLICATION_EXEC "/widgets" #define DIR_PLACE_WIDGETS_3 "${XDG_DATA_HOME}/" APPLICATION_EXEC "/widgets" #define DIR_PLACE_WIDGETS_4 "${XDG_DATA_HOME}/detroit/widgets" #define DIR_PLACE_WIDGETS_5 "~/.local/share/" APPLICATION_EXEC "/widgets" #define DIR_PLACE_WIDGETS_6 "~/.local/share/detroit/widgets" #if ! defined(PROG_HAS_DEBUG) #define DIR_PLACE_WIDGETS_7 "${" APPLICATION_EXEC "_HOME}/share/" APPLICATION_EXEC "/widgets" #define DIR_PLACE_WIDGETS_8 "${" APPLICATION_EXEC "_HOME}/share/detroit/widgets" #endif #define DIR_PLACE_WIDGETS_9 SHRDIR "/" APPLICATION_EXEC "/widgets" #define DIR_PLACE_WIDGETS_10 SHRDIR "/detroit/widgets" #define DIR_PLACE_WIDGETS_11 "." #define DIR_PLACE_BOBS_1 "~/.bobs" #define DIR_PLACE_BOBS_2 "~/." APPLICATION_EXEC "/bobs" #define DIR_PLACE_BOBS_3 "${XDG_DATA_HOME}/" APPLICATION_EXEC "/bobs" #define DIR_PLACE_BOBS_4 "${XDG_DATA_HOME}/detroit/bobs" #define DIR_PLACE_BOBS_5 "~/.local/share/" APPLICATION_EXEC "/bobs" #define DIR_PLACE_BOBS_6 "~/.local/share/detroit/bobs" #if ! defined(PROG_HAS_DEBUG) #define DIR_PLACE_BOBS_7 "${" APPLICATION_EXEC "_HOME}/share/" APPLICATION_EXEC "/bobs" #define DIR_PLACE_BOBS_8 "${" APPLICATION_EXEC "_HOME}/share/detroit/bobs" #endif #define DIR_PLACE_BOBS_9 SHRDIR "/" APPLICATION_EXEC "/bobs" #define DIR_PLACE_BOBS_10 SHRDIR "/detroit/bobs" #define DIR_PLACE_BOBS_11 "." #if defined(HAVE_PATHS_H) && defined(_PATH_TMP) #define DIR_PLACE_TEMP _PATH_TMP #else #define DIR_PLACE_TEMP "/tmp/" /* POSIX says that this must exists */ #endif enum error_types { /* Error severity levels */ ERROR_NOERROR = 1, ERROR_SLIGHT, ERROR_FATAL }; enum image_types { /* Image types supported at the moment */ IMAGE_FORMAT_NONE = 0, IMAGE_FORMAT_BMP, IMAGE_FORMAT_CEL, IMAGE_FORMAT_PIX, IMAGE_FORMAT_PPM, IMAGE_FORMAT_RAS, IMAGE_FORMAT_RGB, IMAGE_FORMAT_RLA, IMAGE_FORMAT_TGA }; enum string_types { /* String types for string length functions */ STRING_ASCII = 0, STRING_UTF8, STRING_UTF32 }; enum thread_states { /* Thread states */ THREAD_STATE_STOP = 0, THREAD_STATE_RUN, THREAD_STATE_IDLE, THREAD_STATE_BORN }; enum thread_classes { /* Thread classes for bunching */ THREAD_CLASS_INTERNAL = 0, THREAD_CLASS_DSL, THREAD_CLASS_APP }; enum thread_likes { THREAD_TERM_SELF = 0, /* Thread likes to term by itself */ THREAD_TERM_CANCEL /* Thread likes to term by pthread_cancel() */ }; enum numa_policies { /* Numa policies */ THREAD_NUMA_POLICY_NONE = 0, THREAD_NUMA_POLICY_ROUND_ROBIN, THREAD_NUMA_POLICY_FIXED_DOMAIN, THREAD_NUMA_POLICY_FIXED_DOMAIN_ROUND_ROBIN, THREAD_NUMA_POLICY_FIRST_TOUCH, THREAD_NUMA_POLICY_FIRST_TOUCH_ROUND_ROBIN }; #define TIMER_RESOLUTION_THREADAGAIN (1000000 * 1000) / 1000 /* Timer delay for general use, thats 0.001 secs */ #define AUDIO_MIXER_CHANNELS 2 /* Audio mixer channels per audio track, MUST be even, preferably two */ #define BAKERY_DSL_LOCK 0 /* Lockable subsystem object id's */ #define BAKERY_DSL_INST 1 #define BAKERY_THR_POOL 2 #if defined(HAVE_LIBTOOL) #define BAKERY_LIB_LTDL 3 #define BAKERY_SUBSYSTEMS 4 /* Lockable subsystems with libtool */ #else #define BAKERY_SUBSYSTEMS 3 /* Lockable subsystems without libtool */ #endif #define BAKERY_THREADS 4096 /* Lockable threads in each subsystem */ enum file_flags { /* File flag bits */ FILE_SILENT = 0x1, FILE_NO_COMPRESS = 0x2, FILE_SYNC_ON_CLOSE = 0x4 }; #define FILE_MODE_READ "r" /* File modes (man 3 fopen) */ #define FILE_MODE_READ_AND_WRITE "r+" #define FILE_MODE_WRITE_AND_TRUNCATE "w" #define FILE_MODE_READ_AND_WRITE_AND_TRUNCATE "w+" #define FILE_MODE_APPEND "a" #define FILE_MODE_READ_AND_APPEND "a+" #define NUM_STR_SIZE 80 /* Maximum size of any number in chars */ #define CONST_FLOAT_EQUALS 0.0000000000001 /* Difference when two floats are considered as equal */ /* Math constants */ #define CONST_PI 3.14159265358979323846264338327950288419716 #define CONST_PIF 3.14159265358979323846264338327950288419716f #define CONST_PI_2 CONST_PI * 2.0 #define CONST_PIF_2 CONST_PIF * 2.0f #define CONST_PI_4 CONST_PI * 4.0 #define CONST_PIF_4 CONST_PIF * 4.0f #define CONST_SQRT_1_2 0.70710678118654752440 #define CONST_SQRTF_1_2 0.70710678118654752440f #define CONST_SQRT_2_PI 1.12837916709551257390 #define CONST_SQRTF_2_PI 1.12837916709551257390f /* Compiler stuff */ #if defined(__STDC_VERSION__) #if (__STDC_VERSION__ >= 202311L) #define C23 #elif (__STDC_VERSION__ >= 201710L) #define C17 #elif (__STDC_VERSION__ >= 201112L) #define C11 #elif (__STDC_VERSION__ >= 199901L) #define C99 #else #define C90 #define inline /* This should be inline */ #endif #elif defined(__STDC__) #define C89 #define inline /* This should be inline */ #endif #ifndef __func__ #if (__STDC_VERSION__ < 199901L) #if (__GNUC__ >= 2) #define __func__ __FUNCTION__ #else #define __func__ "" #endif #endif #endif