[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22981 - Extractor/src/main
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22981 - Extractor/src/main |
Date: |
Mon, 30 Jul 2012 15:21:24 +0200 |
Author: grothoff
Date: 2012-07-30 15:21:24 +0200 (Mon, 30 Jul 2012)
New Revision: 22981
Added:
Extractor/src/main/extractor_logging.c
Extractor/src/main/extractor_logging.h
Modified:
Extractor/src/main/Makefile.am
Log:
log functions for LE
Modified: Extractor/src/main/Makefile.am
===================================================================
--- Extractor/src/main/Makefile.am 2012-07-30 13:06:01 UTC (rev 22980)
+++ Extractor/src/main/Makefile.am 2012-07-30 13:21:24 UTC (rev 22981)
@@ -40,13 +40,14 @@
libextractor_la_CPPFLAGS = -DPLUGINDIR=\"@address@hidden"
-DPLUGININSTDIR=\"${plugindir}\" $(AM_CPPFLAGS)
libextractor_la_SOURCES = \
- extractor_metatypes.c \
- extractor_print.c \
extractor_common.c extractor_common.h \
extractor_datasource.c extractor_datasource.h \
+ $(EXTRACTOR_IPC) extractor_ipc.c extractor_ipc.h \
+ extractor_logging.c extractor_logging.h \
+ extractor_metatypes.c \
extractor_plugpath.c extractor_plugpath.h \
extractor_plugins.c extractor_plugins.h \
- $(EXTRACTOR_IPC) extractor_ipc.c extractor_ipc.h \
+ extractor_print.c \
extractor_plugin_main.c extractor_plugin_main.h \
extractor.c
Added: Extractor/src/main/extractor_logging.c
===================================================================
--- Extractor/src/main/extractor_logging.c (rev 0)
+++ Extractor/src/main/extractor_logging.c 2012-07-30 13:21:24 UTC (rev
22981)
@@ -0,0 +1,68 @@
+/*
+ This file is part of libextractor.
+ (C) 2012 Vidyut Samanta and Christian Grothoff
+
+ libextractor is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ libextractor 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libextractor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+/**
+ * @file main/extractor_logging.c
+ * @brief logging API for GNU libextractor
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "extractor_logging.h"
+
+#if DEBUG
+/**
+ * Log function.
+ *
+ * @param file name of file with the error
+ * @param line line number with the error
+ * @param ... log message and arguments
+ */
+void
+EXTRACTOR_log_ (const char *file, int line, const char *format, ...)
+{
+ va_list va;
+
+ fprintf (stderr,
+ sizeof (file_line),
+ "EXTRACTOR %s:%d ");
+ va_start (va, format);
+ vfprintf (stderr, format, va);
+ va_end (va);
+ fflush (stderr);
+}
+#endif
+
+
+/**
+ * Abort the program reporting an assertion failure
+ *
+ * @param file filename with the failure
+ * @param line line number with the failure
+ */
+void
+EXTRACTOR_abort_ (const char *file,
+ int line)
+{
+#if DEBUG
+ EXTRACTOR_log_ (file, line, "Assertion failed.\n");
+#endif
+ abort ();
+}
+
+/* end of extractor_logging.c */
Added: Extractor/src/main/extractor_logging.h
===================================================================
--- Extractor/src/main/extractor_logging.h (rev 0)
+++ Extractor/src/main/extractor_logging.h 2012-07-30 13:21:24 UTC (rev
22981)
@@ -0,0 +1,72 @@
+/*
+ This file is part of libextractor.
+ (C) 2012 Vidyut Samanta and Christian Grothoff
+
+ libextractor is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ libextractor 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libextractor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+/**
+ * @file main/extractor_logging.h
+ * @brief logging API for GNU libextractor
+ * @author Christian Grothoff
+ */
+#ifndef EXTRACTOR_LOGGING_H
+#define EXTRACTOR_LOGGING_H
+
+#define DEBUG 1
+
+#if DEBUG
+
+/**
+ * Log function.
+ *
+ * @param file name of file with the error
+ * @param line line number with the error
+ * @param ... log message and arguments
+ */
+void
+EXTRACTOR_log_ (const char *file, int line, const char *format, ...);
+
+/**
+ * Log a message.
+ *
+ * @param fmt format string
+ * @param ... arguments for fmt (printf-style)
+ */
+#define LOG(fmt, ...) EXTRACTOR_log_ (__FILE__, __LINE__, fmt, __VA_ARGS__)
+#else
+#define LOG(...)
+#endif
+
+
+/**
+ * Abort the program reporting an assertion failure
+ *
+ * @param file filename with the failure
+ * @param line line number with the failure
+ */
+void
+EXTRACTOR_abort_ (const char *file,
+ int line);
+
+/**
+ * Abort program if assertion fails.
+ *
+ * @param cond assertion that must hold.
+ */
+#define ASSERT(cond) do { if (! (cond)) EXTRACTOR_abort_ (__FILE__, __LINE__);
} while (0)
+
+
+#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22981 - Extractor/src/main,
gnunet <=