Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
397f2c7b
Commit
397f2c7b
authored
Nov 22, 2018
by
Loic Hausammann
Browse files
Compile logger_loader with swift
parent
087254a4
Changes
13
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
397f2c7b
...
...
@@ -1008,9 +1008,10 @@ AC_ARG_WITH([python],
)
if test "x$with_python" != "xno"; then
AC_CACHE_CHECK(
"python version",
ac_cv_ver_python,
[ac_cv_ver_python=`python -c 'import sys;print(sys.version[[:3]])' 2> /dev/null`])
"python version",
ac_cv_ver_python,
[ac_cv_ver_python=`python -c 'import sys;print(sys.version[[:3]])' 2> /dev/null`]
)
if test "x$with_python" != "xyes" -a "x$with_python" != "x"; then
PYTHON_LIBS=""
...
...
@@ -1019,6 +1020,7 @@ if test "x$with_python" != "xno"; then
PYTHON_LIBS=""
PYTHON_INCS=""
fi
have_python="yes"
AC_CHECK_PROGS(
...
...
@@ -1033,8 +1035,8 @@ if test "x$with_python" != "xno"; then
[PyArg_ParseTuple],
[AC_DEFINE([HAVE_PYTHON],1,[The python library appears to be present.])
],
[AC_MSG_ERROR(Cannot find python library!)]
)
[AC_MSG_ERROR(Cannot find python library!)]
,
[$PYTHON_LIBS]
)
fi
AC_SUBST([PYTHON_LIBS])
AC_SUBST([PYTHON_INCS])
...
...
logger/Makefile.am
View file @
397f2c7b
...
...
@@ -39,11 +39,11 @@ lib_LTLIBRARIES = libswiftlogger.la
# endif
# List required headers
include_HEADERS
=
header.h io.h particle.h timeline.h tools.h
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 tools.c
timeline.c
logger_
tools.c
# Include files for distribution, not installation.
nobase_noinst_HEADERS
=
...
...
logger/header.c
View file @
397f2c7b
#include
"header.h"
#include
"io.h"
#include
"tools.h"
#include
"
logger_
tools.h"
#include
<Python.h>
#include
<stdio.h>
...
...
logger/header.h
View file @
397f2c7b
#ifndef __LOGGER_HEADER_H__
#define __LOGGER_HEADER_H__
#include
"tools.h"
#include
"
logger_
tools.h"
#include
<Python.h>
#include
<stdio.h>
...
...
logger/io.c
View file @
397f2c7b
#include
"io.h"
#include
"header.h"
#include
"tools.h"
#include
"
logger_
tools.h"
/* file size */
#include
<sys/stat.h>
...
...
@@ -24,7 +24,7 @@ int io_open_file(char *filename, int *fd, void **map) {
if
(
*
fd
==
-
1
)
error
(
errno
,
"Unable to open file %s"
,
filename
);
/* get file size */
size_t
size
;
size_t
size
=
0
;
int
status
=
io_get_file_size
(
*
fd
,
&
size
);
if
(
status
!=
0
)
return
status
;
...
...
@@ -38,7 +38,7 @@ int io_open_file(char *filename, int *fd, void **map) {
int
io_close_file
(
int
*
fd
,
void
**
map
)
{
/* get file size */
size_t
size
;
size_t
size
=
0
;
int
status
=
io_get_file_size
(
*
fd
,
&
size
);
if
(
status
!=
0
)
return
status
;
...
...
logger/io.h
View file @
397f2c7b
...
...
@@ -2,7 +2,7 @@
#define __SWIFT_LOGGER_IO_H__
#include
"header.h"
#include
"tools.h"
#include
"
logger_
tools.h"
#include
<stdio.h>
#include
<stdlib.h>
...
...
logger/logger_loader.c
View file @
397f2c7b
...
...
@@ -335,7 +335,7 @@ static PyObject *pyReverseOffset(__attribute__((unused)) PyObject *self,
/* definition of the method table */
static
PyMethodDef
l
ogger_load
erMethods
[]
=
{
static
PyMethodDef
l
ibswiftlogg
erMethods
[]
=
{
{
"loadFromIndex"
,
loadFromIndex
,
METH_VARARGS
,
"Load snapshot directly from the offset in an index file."
},
{
"reverseOffset"
,
pyReverseOffset
,
METH_VARARGS
,
...
...
@@ -344,21 +344,21 @@ static PyMethodDef logger_loaderMethods[] = {
{
NULL
,
NULL
,
0
,
NULL
}
/* Sentinel */
};
static
struct
PyModuleDef
l
ogger_load
ermodule
=
{
static
struct
PyModuleDef
l
ibswiftlogg
ermodule
=
{
PyModuleDef_HEAD_INIT
,
"l
ogger_load
er"
,
"l
ibswiftlogg
er"
,
"Module reading a SWIFTsim logger snapshot"
,
-
1
,
l
ogger_load
erMethods
,
l
ibswiftlogg
erMethods
,
NULL
,
/* m_slots */
NULL
,
/* m_traverse */
NULL
,
/* m_clear */
NULL
/* m_free */
};
PyMODINIT_FUNC
PyInit_l
ogger_load
er
(
void
)
{
PyMODINIT_FUNC
PyInit_l
ibswiftlogg
er
(
void
)
{
PyObject
*
m
;
m
=
PyModule_Create
(
&
l
ogger_load
ermodule
);
m
=
PyModule_Create
(
&
l
ibswiftlogg
ermodule
);
if
(
m
==
NULL
)
return
NULL
;
import_array
();
...
...
logger/tools.c
→
logger/
logger_
tools.c
View file @
397f2c7b
#include
"tools.h"
#include
"
logger_
tools.h"
#include
"header.h"
#include
"io.h"
...
...
@@ -45,7 +45,7 @@ int _tools_get_next_chunk_backward(const struct header *h, void *map,
while
(
current_offset
<
file_size
)
{
size_t
mask
=
0
;
size_t
prev_offset
;
int
test
=
io_read_mask
(
h
,
map
,
&
current_offset
,
&
mask
,
&
prev_offset
);
test
=
io_read_mask
(
h
,
map
,
&
current_offset
,
&
mask
,
&
prev_offset
);
if
(
test
!=
0
)
return
test
;
prev_offset
=
current_offset
-
prev_offset
-
chunk_header
;
...
...
logger/tools.h
→
logger/
logger_
tools.h
View file @
397f2c7b
File moved
logger/particle.c
View file @
397f2c7b
...
...
@@ -2,7 +2,7 @@
#include
"header.h"
#include
"io.h"
#include
"timeline.h"
#include
"tools.h"
#include
"
logger_
tools.h"
#include
<stdio.h>
#include
<stdlib.h>
...
...
logger/particle.h
View file @
397f2c7b
...
...
@@ -3,7 +3,7 @@
#include
"header.h"
#include
"timeline.h"
#include
"tools.h"
#include
"
logger_
tools.h"
#include
<stdio.h>
#include
<stdlib.h>
...
...
logger/timeline.c
View file @
397f2c7b
...
...
@@ -14,7 +14,6 @@ int time_read(integertime_t *timestamp, double *time, const struct header *h, vo
size_t
*
offset
)
{
int
error_code
=
0
;
size_t
mask
=
0
;
size_t
ind
=
0
;
size_t
prev_offset
=
0
;
*
timestamp
=
0
;
*
time
=
0
;
...
...
@@ -24,6 +23,8 @@ int time_read(integertime_t *timestamp, double *time, const struct header *h, vo
if
(
error_code
!=
0
)
return
error_code
;
#ifdef SWIFT_DEBUG_CHECKS
size_t
ind
=
0
;
/* check if timestamp is present */
if
(
!
header_is_present_and_get_index
(
h
,
"timestamp"
,
&
ind
))
error
(
EIO
,
"Header does not contain a timestamp"
);
...
...
logger/timeline.h
View file @
397f2c7b
...
...
@@ -2,7 +2,7 @@
#define __TIMELINE_H__
#include
"header.h"
#include
"tools.h"
#include
"
logger_
tools.h"
typedef
char
timebin_t
;
typedef
long
long
integertime_t
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment