[Getdata-commits] SF.net SVN: getdata:[799] trunk/defile
Scientific Database Format
Brought to you by:
ketiltrout
|
From: <ket...@us...> - 2013-03-05 04:34:26
|
Revision: 799
http://sourceforge.net/p/getdata/code/799
Author: ketiltrout
Date: 2013-03-05 04:34:19 +0000 (Tue, 05 Mar 2013)
Log Message:
-----------
Add df_update_frames. Also some aclocal macros.
Modified Paths:
--------------
trunk/defile/bin/defile.c
trunk/defile/lib/Makefile.am
trunk/defile/lib/defile.h
trunk/defile/lib/libdefile.c
Added Paths:
-----------
trunk/defile/lib/defile.m4
Modified: trunk/defile/bin/defile.c
===================================================================
--- trunk/defile/bin/defile.c 2013-03-05 01:14:46 UTC (rev 798)
+++ trunk/defile/bin/defile.c 2013-03-05 04:34:19 UTC (rev 799)
@@ -2516,7 +2516,11 @@
}
/* remember and release our CWD */
- getcwd(df->orig_cwd, 4096);
+ if (getcwd(df->orig_cwd, 4096) == NULL) {
+ df_dperror(DF_PRN_ERR, "getcwd");
+ exit(1);
+ }
+
if (chdir("/") < 0) {
df_dperror(DF_PRN_ERR, "chdir");
exit(1);
@@ -2527,9 +2531,18 @@
df->syslog = 1;
/* drop the TTY */
- freopen("/dev/null", "r", stdin);
- freopen("/dev/null", "w", stdout);
- freopen("/dev/null", "w", stderr);
+ if (freopen("/dev/null", "r", stdin) == NULL) {
+ df_dperror(DF_PRN_ERR, "redirecting stdin");
+ exit(1);
+ }
+ if (freopen("/dev/null", "w", stdout) == NULL) {
+ df_dperror(DF_PRN_ERR, "redirecting stdout");
+ exit(1);
+ }
+ if (freopen("/dev/null", "w", stderr) == NULL) {
+ df_dperror(DF_PRN_ERR, "redirecting stderr");
+ exit(1);
+ }
}
}
}
Modified: trunk/defile/lib/Makefile.am
===================================================================
--- trunk/defile/lib/Makefile.am 2013-03-05 01:14:46 UTC (rev 798)
+++ trunk/defile/lib/Makefile.am 2013-03-05 04:34:19 UTC (rev 799)
@@ -20,6 +20,9 @@
#
AUTOMAKE_OPTIONS = foreign
+aclocaldir = $(datadir)/aclocal
+aclocal_DATA = defile.m4
+
lib_LTLIBRARIES = libdefile.la
include_HEADERS = defile.h
AM_CPPFLAGS = ${GETDATA_CFLAGS}
Modified: trunk/defile/lib/defile.h
===================================================================
--- trunk/defile/lib/defile.h 2013-03-05 01:14:46 UTC (rev 798)
+++ trunk/defile/lib/defile.h 2013-03-05 04:34:19 UTC (rev 799)
@@ -166,6 +166,7 @@
int df_set_string(const char *name, const char *string);
int df_set_carray(const char *name, unsigned int start, size_t len,
gd_type_t type, const void *data_in);
+int df_update_nframes(long long nframes, int add);
/* the remaining functions declared here can be used at any time */
int df_check_abort(void);
Added: trunk/defile/lib/defile.m4
===================================================================
--- trunk/defile/lib/defile.m4 (rev 0)
+++ trunk/defile/lib/defile.m4 2013-03-05 04:34:19 UTC (rev 799)
@@ -0,0 +1,87 @@
+dnl Copyright (C) 2013 D. V. Wiebe
+dnl
+dnl llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
+dnl
+dnl This file is free software; the copyright holder gives unlimited
+dnl permission to copy and/or distribute it, with or without modifications,
+dnl as long as this notice is preserved.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl DF_CHECK_DEFILE_H
+dnl -----------------------------------------------------
+dnl Look for defile.h. AC_DEFINEs HAVE_DEFILE_H if found.
+AC_DEFUN([DF_CHECK_DEFILE_H],
+[AC_CHECK_HEADERS([defile.h],, [AC_MSG_FAILURE([defile.h not found])])])
+
+dnl DF_CHECK_LIBDEFILE
+dnl -----------------------------------------------------------
+dnl Try to find libdefile -- a normal AC_SEARCH_LIBS doesn't work, unfortunately
+dnl due to unresolved symbols in the library
+AC_DEFUN([DF_CHECK_LIBDEFILE],
+ [AC_CACHE_CHECK([for libdefile], [ac_cv_libdefile],
+ [df_check_lib_save_LIBS=$LIBS
+ LIBS="-ldefile $LIBS"
+ AC_LINK_IFELSE([AC_LANG_CALL([
+void *df;
+void *df_rpc_push_string;
+void *df_rpc_push_double;
+void *df_rpc_push_uint32;
+void *df_discard_metadata;
+void *df_copy_swap;
+void *df_rpc_push_uint8;
+void *df_rpc_push_data;
+void *df_ivprintf;
+void *df_rpc_push_mem;
+void *df_rpc_push_uint64;
+void *df_rpc_fini;
+void *df_rpc_push_uint16;
+void *df_rc_shell_expand;
+void *df_rpc_del;
+void *df_rpc_init;
+void *df_iperror;
+void *df_iputc;
+void *df_iputs;
+void *df_iprintf;
+void *df_rpc_push_complex_double;
+void *df_state_mx;
+void *df_config_mx;
+void *df_rate_mx;
+void *df_print_mx;
+], [df_init])],
+ [ac_cv_libdefile="yes"], [ac_cv_libdefile="no"])])
+ LIBS="$df_check_lib_save_LIBS"
+ if test "x$ac_cv_libdefile" = "xyes"; then
+ LIBS="-ldefile $LIBS"
+ else
+ AC_MSG_FAILURE([libdefile not found])
+ fi dnl
+])
+
+dnl DF_CHECK_DEFILE
+dnl ----------------------------------------------------
+dnl Look for the defile program. Declares DEFILE as precious (see AC_ARG_VAR)
+AC_DEFUN([DF_CHECK_DEFILE],
+ [AC_ARG_VAR([DEFILE], [the path to the defile program])
+ AC_PATH_PROGS([DEFILE], [defile], [not found])
+ if test "x$DEFILE" = "xnot found"; then
+ AC_MSG_ERROR([defile not found])
+ fi
+ ])
+
+dnl DF_PLUGIN_PATH
+dnl -------------------------------------------
+dnl Determine the plugin path by running defile. Declares "defiledir" to be
+dnl precious.
+AC_DEFUN([DF_PLUGIN_PATH],
+ [AC_REQUIRE([DF_CHECK_DEFILE])
+ AC_ARG_VAR([defiledir], [the defile plugin directory])
+ AC_MSG_CHECKING([the defile plugin path])
+ if test "x$defiledir" = "x"; then
+ defiledir=`$DEFILE --lib-dir`
+ fi
+ AC_MSG_RESULT([$defiledir])dnl
+])
Modified: trunk/defile/lib/libdefile.c
===================================================================
--- trunk/defile/lib/libdefile.c 2013-03-05 01:14:46 UTC (rev 798)
+++ trunk/defile/lib/libdefile.c 2013-03-05 04:34:19 UTC (rev 799)
@@ -665,6 +665,9 @@
free(type);
}
+ if (ret == DF_SUCCESS)
+ df_lprintf(DF_PRN_DEBUG_I, "added spec: \"%s\"\n", spec);
+
free(name);
return ret;
@@ -725,7 +728,7 @@
if (!(append || df->mode_flags & DF_MODE_SERVER)) {
/* try adding it to the dirfile */
- if (gd_add_raw(df->D, f->name, f->type, f->spf, fragment))
+ if (gd_add_raw(df->D, f->name, f->type, f->spf * count, fragment))
return DF_OUTPUT;
}
@@ -1042,6 +1045,23 @@
return DF_SUCCESS;
}
+int df_update_nframes(long long nframes, int add)
+{
+ DF_CHECK_SEQUENCE2(DF_ST_BUILD, DF_ST_RUN);
+
+ /* don't bother doing this in follow mode */
+ if (!(df->mode_flags & DF_MODE_FOLLOW)) {
+ pthread_mutex_lock(&df_config_mx);
+ if (add)
+ df->nframes += nframes;
+ else
+ df->nframes = nframes;
+ pthread_mutex_unlock(&df_config_mx);
+ }
+
+ return DF_SUCCESS;
+}
+
int df_init(long long nframes, double rate, const char *name)
{
DF_CHECK_SEQUENCE(DF_ST_START);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|