Commit 482c49e8 authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Start removing python dependency

parent 397f2c7b
......@@ -43,7 +43,11 @@ include_HEADERS = header.h io.h particle.h timeline.h logger_tools.h
# Common source files
AM_SOURCES = header.c io.c logger_loader.c particle.c \
timeline.c logger_tools.c
timeline.c
if HAVEPYTHON
AM_SOURCES += logger_loader.c
endif
# Include files for distribution, not installation.
nobase_noinst_HEADERS =
......
......@@ -3,7 +3,7 @@
#include "io.h"
#include "logger_tools.h"
#include <Python.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
......
......@@ -3,7 +3,6 @@
#include "logger_tools.h"
#include <Python.h>
#include <stdio.h>
#include <stdlib.h>
......
#ifndef __TOOLS_H__
#define __TOOLS_H__
#ifndef __LOGGER_TOOLS_H__
#define __LOGGER_TOOLS_H__
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include "../config.h"
#ifdef HAVE_PYTHON
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <Python.h>
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -11,6 +16,7 @@
struct header;
#ifdef HAVE_PYTHON
/* Set the error message for python and return the error code
* WARNING for python, you need to return NULL and not the error code
*/
......@@ -30,6 +36,23 @@ struct header;
PyErr_SetString(PyExc_RuntimeError, error_msg); \
})
#else
#define error(err, s, ...) \
({ \
error_no_return(err, s, ##__VA_ARGS__); \
exit(1); \
})
#define error_no_return(err, s, ...) \
({ \
char error_msg[STRING_SIZE]; \
sprintf(error_msg, "%s:%s():%i: " s ": %s\n", __FILE__, __FUNCTION__, \
__LINE__, ##__VA_ARGS__, strerror(err)); \
})
#endif
#define message(s, ...) \
({ \
printf("%s:%s():%i: " s "\n", __FILE__, __FUNCTION__, __LINE__, \
......@@ -100,4 +123,4 @@ int tools_reverse_offset(const struct header *h, void *map, size_t *offset);
*/
int tools_check_offset(const struct header *h, void *map, size_t *offset);
#endif //__TOOLS_H__
#endif //__LOGGER_TOOLS_H__
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment