/* * The Spar Library - modular math parser * Copyright (C) 2000,2001 Davide Angelocola * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ /** * This file is partially generated by the configure script. * Contains all common defines, typedef, enum used in all * Spar sources and headers. * * Should be included into your programs and modules, however is * included implicity by any of the spar header's. */ #ifndef _sl_conf_h #define _sl_conf_h #ifdef HAVE_CONFIG_H #include #endif /* HAVE_CONFIG_H */ #undef NULL #undef __BEGIN_DECLS #undef __END_DECLS #ifdef __cplusplus #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else #define __BEGIN_DECLS #define __END_DECLS #endif /* * NULL * * Defines the NULL pointer */ #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *) 0) #endif /* __cplusplus */ #ifndef __cplusplus typedef enum { false, true } bool; #endif /* __cplusplus */ #ifndef _EXTERN_INLINE #ifdef __GNUC__ #define _EXTERN_INLINE extern __inline__ #else #define _EXTERN_INLINE static #endif #endif /** * sl_assert() is a private assertion checking scheme, similar to standard * but prints also the function that fails the assertion. * * This macro cannot be removed with the define NDEBUG: generally assertions * are meant for development, but might help when looking for a problem * later too. * * On success this function does nothing. */ /* * Implemented into assert.c file * only shows * * "file: function: line: SL assert fail 'expr'" message */ void __sl_assert_fail (const char *filename, const char *function, int line, const char *expr); #define __assert_fail(expr) __sl_assert_fail (__FILE__, __FUNCTION__, __LINE__, expr) #define __assert_fail_line(expr) __sl_assert_fail (__FILE__, "", __LINE__, expr) #define __assert_fail_function(expr) __sl_assert_fail (__FILE__, __FUNCTION__, "", expr) #define sl_assert(expr) ((expr) ? 0 : __assert_fail (#expr)) #define sl_assert_line(expr) ((expr) ? 0 : __assert_fail_line (#expr)) #define sl_assert_function(expr) ((expr) ? 0 : __assert_fail_function (#expr)) /* * other sublibs should be use this type * such as: util, parser, module, constants ecc.. */ typedef unsigned int sl_size; /** Generic return code for all functions */ enum { /** * This is returned on function success. It's widely used into spar sources * because makes the code more readable. * * for example: * * if (sl_variable_set ("x", .756) == SL_SUCCESS) * sl_writeln ("variable 'x' added."); */ SL_SUCCESS = 0, /** * This is returned on function errors. Generally when a function fails * an detailed error message is printed and the functions returns this * value. * * for example: * * if (sl_variable_set ("e", 125.2) == SL_ERROR) * sl_writeln ("error: variable 'e' wasn't added."); * */ SL_ERROR }; /** * This is the max lenght of a identifier. You can change as you wish: * use only non-negative values */ #define SL_IDENTIFIER_LENGHT 15 /** * This is the max lenght of a message. You can change as you wish: * use only non-negative values */ #define SL_MESSAGE_LENGHT 45 /** * This is the max number of variables (used at run-time). You can change as you * wish: use only non-negative values */ #define SL_MAX_VARIABLES 50 /** * This is the max number of variables (used at run-time). You can change as you * wish: use only non-negative values */ #define SL_MAX_MODULES 20 /** * This file contains the path of the modules to load */ #define SL_MODULE_CONFIG_FILE "/usr/local/share/spar/modules_config" #define SL_INCLUDE_DIRECTORY "/usr/local/include/spar" /** * Infos */ #define SL_HOMEPAGE_URL "http://spar.sourceforge.net" #define SL_MIRROR_HOMEPAGE_URL "http://web.tiscalinet.it/Davide18" #define SL_AUTHOR_EMAIL "davide178@inwind.it" #define PACKAGE "spar" #define MAJOR_VERSION 0 #define MINOR_VERSION 5 #define PATCH_LEVEL 10 #define HOST "i386-unknown-gnu" #define STATUS "development" #define SL_MAX_BUFFER_LEN (2*1024) /* * Default precision */ #define SL_DEFAULT_INTEGER_PRECISION 15 #define SL_DEFAULT_DECIMAL_PRECISION 15 /** * sl_identifier(x) * * MACRO: declare a string "x" of lenght SL_IDENTIFIER_LENGHT */ #define sl_identifier(x) char x[SL_IDENTIFIER_LENGHT + 1] /** * sl_message(x) * * MACRO: declare a string "x" of lenght SL_MESSAGE_LENGHT */ #define sl_message(x) char x[SL_MESSAGE_LENGHT + 1] /** * SL_SYMBOL_NOT_FOUND * * Reterned by search function in case of insuccess */ #define SL_SYMBOL_NOT_FOUND -1 #define SL_INFINITY_SUPPORT true #endif /* _sl_conf_h */