summaryrefslogtreecommitdiffstats
path: root/libmsi
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-12-11 14:14:37 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2012-12-12 10:02:02 +0100
commit3bce7a0298024ec5a56935cf2eb03da57156682e (patch)
tree5f5f5076b74873b6d7c7cbf079a56fbb8ac70d7b /libmsi
parent75e5665a7ebd9ddc1cd8054c20c9750dced3d8b8 (diff)
downloadmsitools-3bce7a0298024ec5a56935cf2eb03da57156682e.tar.gz
msitools-3bce7a0298024ec5a56935cf2eb03da57156682e.tar.xz
msitools-3bce7a0298024ec5a56935cf2eb03da57156682e.zip
Move debug.h to libmsi directory
Diffstat (limited to 'libmsi')
-rw-r--r--libmsi/Makefile.am1
-rw-r--r--libmsi/debug.h127
2 files changed, 128 insertions, 0 deletions
diff --git a/libmsi/Makefile.am b/libmsi/Makefile.am
index 4ce4413..784c939 100644
--- a/libmsi/Makefile.am
+++ b/libmsi/Makefile.am
@@ -10,6 +10,7 @@ AM_YFLAGS = -d
BUILT_SOURCES = sql-parser.c sql-parser.h
noinst_HEADERS = \
+ debug.h \
list.h \
msipriv.h \
query.h
diff --git a/libmsi/debug.h b/libmsi/debug.h
new file mode 100644
index 0000000..a4393c1
--- /dev/null
+++ b/libmsi/debug.h
@@ -0,0 +1,127 @@
+/*
+ * Wine debugging interface
+ *
+ * Copyright 1999 Patrik Stridvall
+ *
+ * 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, or (at your option) any later version.
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_WINE_DEBUG_H
+#define __WINE_WINE_DEBUG_H
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Internal definitions (do not use these directly)
+ */
+
+enum __wine_debug_class
+{
+ DBCL_FIXME,
+ DBCL_ERR,
+ DBCL_WARN,
+ DBCL_TRACE,
+
+ DBCL_INIT = 7 /* lazy init flag */
+};
+
+/*
+ * Exported definitions and macros
+ */
+
+/* These functions return a printable version of a string, including
+ quotes. The string will be valid for some time, but not indefinitely
+ as strings are re-used. */
+static inline const char *wine_dbgstr_an( const char * s, int n )
+{
+ if (!s) return "";
+ return s;
+}
+
+static inline const char *wine_dbg_sprintf( const char *format, ...)
+{
+ static char *p_ret[10];
+ static int i;
+
+ char *ret;
+ unsigned len;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = g_strdup_vprintf(format, ap);
+ len = strlen(ret);
+ va_end(ap);
+
+ i = (i + 1) % 10;
+ p_ret[i] = realloc(p_ret[i], len + 1);
+ strcpy(p_ret[i], ret);
+ g_free(ret);
+ return p_ret[i];
+}
+
+#define wine_dbg_printf(format,...) (printf(format, ## __VA_ARGS__), fflush(stdout))
+#define WINE_DPRINTF(class, function, format, ...) \
+ wine_dbg_printf(#class ":%s:" format, function, ## __VA_ARGS__)
+
+static inline const char *wine_dbgstr_a( const char *s )
+{
+ return wine_dbgstr_an( s, -1 );
+}
+
+static inline const char *wine_dbgstr_guid( const uint8_t *id )
+{
+ return wine_dbg_sprintf( "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ id[0], id[1], id[2], id[3], id[4], id[5], id[6], id[7],
+ id[8], id[9], id[10], id[11], id[12], id[13], id[14], id[15]);
+}
+
+static inline const char *wine_dbgstr_longlong( unsigned long long ll )
+{
+ if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
+ return wine_dbg_sprintf( "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
+ else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
+}
+
+/* Wine uses shorter names that are very likely to conflict with other software */
+
+static inline const char *debugstr_an( const char * s, int n ) { return wine_dbgstr_an( s, n ); }
+static inline const char *debugstr_guid( const uint8_t *id ) { return wine_dbgstr_guid( id ); }
+static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
+
+#undef ERR /* Solaris got an 'ERR' define in <sys/reg.h> */
+#define TRACE(fmt, ...) (void)0 // WINE_DPRINTF(TRACE, __func__, fmt, ## __VA_ARGS__)
+#define TRACE_ON(channel) 0
+#define WARN(fmt, ...) (void)0 // WINE_DPRINTF(WARN, __func__, fmt, ## __VA_ARGS__)
+#define WARN_ON(channel) 0
+#define FIXME(fmt, ...) (void)0 // WINE_DPRINTF(FIXME, __func__, fmt, ## __VA_ARGS__)
+#define FIXME_ON(channel) 0
+#define ERR(fmt, ...) (void)0 // WINE_DPRINTF(ERR, __func__, fmt, ## __VA_ARGS__)
+#define ERR_ON(channel) 0
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_WINE_DEBUG_H */