|
Qore Programming Language
0.8.3
|
00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */ 00002 /* 00003 support.h 00004 00005 Qore Programming Language 00006 00007 Copyright (C) David Nichols 2005 - 2011 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #ifndef QORE_SUPPORT_H 00025 00026 #define QORE_SUPPORT_H 00027 00028 #include <qore/common.h> 00029 00030 DLLEXPORT int printe(const char *fmt, ...); 00031 DLLEXPORT char *remove_trailing_newlines(char *str); 00032 DLLEXPORT char *remove_trailing_blanks(char *str); 00033 00034 // we supply debugging function also for non-debugging builds as library entry points 00035 // in case a debugging-enabled binary is linked against a non-debugging-enabled lib 00036 00038 DLLEXPORT void trace_function(int code, const char *funcname); 00040 DLLEXPORT int print_debug(int level, const char *fmt, ...); 00041 00042 DLLEXPORT extern int qore_trace; 00043 DLLEXPORT extern int debug; 00044 00045 #define TRACE_IN 1 00046 #define TRACE_OUT 2 00047 00048 #ifdef DEBUG 00049 00050 #define printd print_debug 00051 00053 #define QORE_TRACE(a) trace_function(TRACE_IN, a); ON_BLOCK_EXIT(trace_function, TRACE_OUT, a) 00054 00055 #else 00056 #ifdef __GNUC__ 00057 00058 #define printd(args...) 00059 00060 #define QORE_TRACE(args...) 00061 #else 00062 00063 #define printd(args, ...) 00064 00065 #define QORE_TRACE(x) 00066 #endif 00067 #endif 00068 00069 #if !defined(HAVE_ISBLANK) && !defined(isblank) 00070 #define isblank(a) ((a) == ' ' || (a) == '\t') 00071 #endif 00072 00073 #endif