1 /*
2 ##############################################################################
3 # 	Copyright (c) 2000-2006 All rights reserved
4 # 	Alberto Reggiori <areggiori@webweaving.org>
5 #	Dirk-Willem van Gulik <dirkx@webweaving.org>
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
10 #
11 # 1. Redistributions of source code must retain the above copyright
12 #    notice, this list of conditions and the following disclaimer.
13 #
14 # 2. Redistributions in binary form must reproduce the above copyright
15 #    notice, this list of conditions and the following disclaimer in
16 #    the documentation and/or other materials provided with the
17 #    distribution.
18 #
19 # 3. The end-user documentation included with the redistribution,
20 #    if any, must include the following acknowledgment:
21 #       "This product includes software developed by
22 #        Alberto Reggiori <areggiori@webweaving.org> and
23 #        Dirk-Willem van Gulik <dirkx@webweaving.org>."
24 #    Alternately, this acknowledgment may appear in the software itself,
25 #    if and wherever such third-party acknowledgments normally appear.
26 #
27 # 4. All advertising materials mentioning features or use of this software
28 #    must display the following acknowledgement:
29 #    This product includes software developed by the University of
30 #    California, Berkeley and its contributors.
31 #
32 # 5. Neither the name of the University nor the names of its contributors
33 #    may be used to endorse or promote products derived from this software
34 #    without specific prior written permission.
35 #
36 # 6. Products derived from this software may not be called "RDFStore"
37 #    nor may "RDFStore" appear in their names without prior written
38 #    permission.
39 #
40 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
41 # ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
44 # FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51 # OF THE POSSIBILITY OF SUCH DAMAGE.
52 #
53 # ====================================================================
54 #
55 # This software consists of work developed by Alberto Reggiori and
56 # Dirk-Willem van Gulik. The RDF specific part is based based on public
57 # domain software written at the Stanford University Database Group by
58 # Sergey Melnik. For more information on the RDF API Draft work,
59 # please see <http://www-db.stanford.edu/~melnik/rdf/api.html>
60 # The DBMS TCP/IP server part is based on software originally written
61 # by Dirk-Willem van Gulik for Web Weaving Internet Engineering m/v Enschede,
62 # The Netherlands.
63 #
64 ##############################################################################
65 #
66 # $Id: rdfstore_log.h,v 1.6 2006/06/19 10:10:23 areggiori Exp $
67 #
68 */
69 
70 #ifndef _H_RDFSTORE_LOG
71 #define _H_RDFSTORE_LOG
72 
73 #ifndef A
74 #define log(x)	{ printf x; printf("\n"); }
75 #define plog(x)	{ printf x; perror("Reason:"); }
76 #define pdie(x) { printf x; perror(NULL);exit(1); }
77 #else
78 #define log(x)	{ }
79 #define plog(x)	{ }
80 #define pdie(x) { printf x; perror(NULL);exit(1); }
81 #endif
82 
83 #ifdef RDFSTORE_DEBUG_MALLOC
84 void * rdfstore_log_debug_malloc( size_t len, char * file, int line);
85 void rdfstore_log_debug_free( void * addr, char * file, int line );
86 void rdfstore_log_debug_malloc_dump();
87 
88 #define RDFSTORE_MALLOC(x) rdfstore_log_debug_malloc(x,__FILE__,__LINE__)
89 #define RDFSTORE_FREE(x) rdfstore_log_debug_free(x,__FILE__,__LINE__)
90 #else
91 #define RDFSTORE_MALLOC(x) malloc(x)
92 #define RDFSTORE_FREE(x)   free(x)
93 #endif
94 
95 #if defined(BSD)
96 #define _HAS_TIME_T
97 #define _HAS_SENSIBLE_SPRINTF
98 #endif
99 
100 #if defined(RDFSTORE_PLATFORM_SOLARIS) || defined(RDFSTORE_PLATFORM_CYGWIN) /* SOLARIS or Cygwin */
101 #define _HAS_TIME_T
102 #define _HAS_SENSIBLE_SPRINTF
103 #endif
104 
105 #if defined(_HAS_TIMESPEC)
106 #define TIMESPEC struct timespec
107 #endif
108 
109 #if defined(_HAS_TIMESTRUC_T)
110 #define TIMESPEC timestruc_t
111 #endif
112 
113 #if defined(_HAS_TIME_T)
114 #define TIMESPEC time_t
115 #endif
116 
117 #endif
118