Qore Programming Language  0.8.11
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
support.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  support.h
4 
5  Qore Programming Language
6 
7  Copyright (C) 2005 - 2013 David Nichols
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23 
24 #ifndef QORE_SUPPORT_H
25 
26 #define QORE_SUPPORT_H
27 
28 #include <qore/common.h>
29 
30 DLLEXPORT int printe(const char *fmt, ...);
31 DLLEXPORT char *remove_trailing_newlines(char *str);
32 DLLEXPORT char *remove_trailing_blanks(char *str);
33 
34 // we supply debugging function also for non-debugging builds as library entry points
35 // in case a debugging-enabled binary is linked against a non-debugging-enabled lib
36 
38 DLLEXPORT void trace_function(int code, const char *funcname);
40 DLLEXPORT int print_debug(int level, const char *fmt, ...);
41 
42 DLLEXPORT extern int qore_trace;
43 DLLEXPORT extern int debug;
44 
45 #define TRACE_IN 1
46 #define TRACE_OUT 2
47 
48 #ifdef DEBUG
49 #define printd print_debug
51 
53 #define QORE_TRACE(a) trace_function(TRACE_IN, a); ON_BLOCK_EXIT(trace_function, TRACE_OUT, a)
54 
55 #else
56 #ifdef __GNUC__
57 #define printd(args...)
59 #define QORE_TRACE(args...)
61 #else
62 #define printd(args, ...)
64 #define QORE_TRACE(x)
66 #endif
67 #endif
68 
69 #if !defined(HAVE_ISBLANK) && !defined(isblank)
70 #define isblank(a) ((a) == ' ' || (a) == '\t')
71 #endif
72 
73 #endif