1 /* 2 * 3 * This file is part of the XForms library package. 4 * 5 * XForms is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU Lesser General Public License as 7 * published by the Free Software Foundation; either version 2.1, or 8 * (at your option) any later version. 9 * 10 * XForms is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with XForms. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 20 /** 21 * \file ulib.h 22 * 23 * Macros and Prototypes for the utilities routines 24 */ 25 26 #ifndef TC_ULIB_H 27 #define TC_ULIB_H 28 29 #include <stdio.h> /* for FILE */ 30 #include <errno.h> 31 32 33 #ifndef FL_EXPORT 34 # if ! defined FL_WIN32 || ! defined SHARED_LIB 35 # define FL_EXPORT 36 # else 37 # ifdef MAKING_FORMS 38 # define FL_EXPORT __declspec( dllexport ) extern 39 # else 40 # define FL_EXPORT __declspec( dllimport ) extern 41 # endif /* MAKING_FORMS */ 42 # endif /* FL_WIN32 */ 43 #endif /* !def FL_EXPORT */ 44 45 46 /***************** Portable IO operations *******************{**/ 47 48 int fli_readint( FILE * ); 49 int fli_readpint( FILE * ); 50 int fli_readhexint( FILE * ); 51 int fli_fget4MSBF( FILE * ); 52 int fli_fput4MSBF( int, 53 FILE * ); 54 int fli_fget2LSBF( FILE * ); 55 int fli_fput2LSBF( int, 56 FILE * ); 57 int fli_fget2MSBF( FILE * ); 58 int fli_fput2MSBF( int, 59 FILE * ); 60 int fli_fget4LSBF( FILE *); 61 int fli_fput4LSBF( int, 62 FILE * ); 63 64 65 /********** End of Portable IO *******************}**/ 66 67 char * fli_de_space( char * ); 68 char * fli_space_de( char * ); 69 char * fli_de_space_de( char * ); 70 char * fli_nuke_all_non_alnum( char * ); 71 72 73 /********************************************************************* 74 * Basic error handling routines 75 ********************************************************************/ 76 77 /* Message levels (verbosity). Error generating routine should 78 * have a (positive) control parameter specifying how loud 79 * to bark (i.e., amount of messages generated) */ 80 81 # define ML_ERR -1 82 # define ML_WARN 0 83 # define ML_INFO1 1 84 # define ML_INFO2 2 85 # define ML_DEBUG 3 86 # define ML_TRACE 4 87 88 FL_ERROR_FUNC fli_error_setup( int, 89 const char *, 90 int ); 91 92 extern FL_ERROR_FUNC efp_; 93 extern FL_ERROR_FUNC user_error_function_; 94 95 96 /* Define the actual names that will be used */ 97 98 # define M_err \ 99 ( efp_ = fli_error_setup( ML_ERR, __FILE__, __LINE__ ) ), efp_ 100 101 # define M_warn \ 102 ( efp_ = fli_error_setup( ML_WARN, __FILE__, __LINE__ ) ), efp_ 103 104 # define M_info \ 105 ( efp_ = fli_error_setup( ML_INFO1, __FILE__, __LINE__ ) ), efp_ 106 107 # define M_info2 \ 108 ( efp_ = fli_error_setup( ML_INFO2, __FILE__, __LINE__ ) ), efp_ 109 110 # define M_debug \ 111 ( efp_ = fli_error_setup( ML_DEBUG, __FILE__, __LINE__ ) ), efp_ 112 113 # define M_trace \ 114 ( efp_ = fli_error_setup( ML_TRACE, __FILE__, __LINE__ ) ), efp_ 115 116 117 /****** Misc. control routines **********/ 118 119 void fli_set_msg_threshold( int ); 120 121 const char *fli_get_syserror_msg( void ); 122 123 124 #endif /* TC_ULIB_H */ 125 126 127 /* 128 * Local variables: 129 * tab-width: 4 130 * indent-tabs-mode: nil 131 * End: 132 */ 133