getdata-commits Mailing List for GetData (Page 6)
Scientific Database Format
Brought to you by:
ketiltrout
This list is closed, nobody may subscribe to it.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(20) |
Nov
(21) |
Dec
(16) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(1) |
Feb
(1) |
Mar
(56) |
Apr
(20) |
May
(4) |
Jun
(2) |
Jul
(3) |
Aug
(11) |
Sep
(2) |
Oct
(4) |
Nov
(18) |
Dec
(16) |
2012 |
Jan
(8) |
Feb
(12) |
Mar
(30) |
Apr
(13) |
May
(10) |
Jun
(17) |
Jul
(18) |
Aug
(19) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(9) |
2013 |
Jan
(1) |
Feb
(4) |
Mar
(27) |
Apr
(6) |
May
(3) |
Jun
(1) |
Jul
(10) |
Aug
|
Sep
(3) |
Oct
(15) |
Nov
(4) |
Dec
(9) |
2014 |
Jan
|
Feb
(3) |
Mar
(4) |
Apr
(10) |
May
(15) |
Jun
|
Jul
(14) |
Aug
|
Sep
(2) |
Oct
(6) |
Nov
|
Dec
(9) |
2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ket...@us...> - 2013-03-15 02:09:55
|
Revision: 821 http://sourceforge.net/p/getdata/code/821 Author: ketiltrout Date: 2013-03-15 02:09:51 +0000 (Fri, 15 Mar 2013) Log Message: ----------- Map fragments across network. Modified Paths: -------------- trunk/defile/bin/net.c trunk/defile/lib/internal.h trunk/defile/lib/libdefile.c Modified: trunk/defile/bin/net.c =================================================================== --- trunk/defile/bin/net.c 2013-03-14 23:05:29 UTC (rev 820) +++ trunk/defile/bin/net.c 2013-03-15 02:09:51 UTC (rev 821) @@ -47,6 +47,9 @@ static char *iobuf = NULL; static uint64_t framecount = 0; +/* fragment index tracking */ +int n_srv_ind = 0; +int *srv_ind = NULL; static char *refname = NULL; @@ -314,7 +317,7 @@ #define DF_GET_STRING(n) DF_GET_SDATUM(string[n]) #define DF_GET_PARAM(t,n) DF_GET_DATUM(p_ ## t[n],t) -/* get data with byte swapping */ \ +/* get data with byte swapping */ #define DF_GET_DATA(n,t,l) \ do { \ const size_t len = GD_SIZE(t) * (l); \ @@ -329,11 +332,13 @@ pos++; \ } while (0) - #define DF_FREE_STRINGS(n) \ do { int i; for (i = 0; i < n; ++i) free(string[i]); } while(0) - static int df_do_rpcs(int sock) +/* array look-up with bounds checking */ +#define df_srv_ind(n) ((n < 0 || n >= n_srv_ind) ? -1 : srv_ind[n]) + +static int df_do_rpcs(int sock) { static int start = 1; if (start) { @@ -443,9 +448,9 @@ DF_GET_PARAM(int32,0); /* fragment */ case 3: df_dprintf(DF_PRN_DEBUG_I, "RPC: add_alias(\"%s\", \"%s\", %i)\n", - string[0], string[1], (int)p_int32[0]); + string[0], string[1], df_srv_ind(p_int32[0])); - n = df_add_alias(string[0], string[1], (int)p_int32[0]); + n = df_add_alias(string[0], string[1], df_srv_ind(p_int32[0])); DF_FREE_STRINGS(2); if (n < 0) { ioerr = DFIO_CALL_ERR; @@ -643,6 +648,7 @@ if (pos > lastpos) { df_dprintf(DF_PRN_DEBUG_I, "RPC: add_entry(<entry%x>)\n", E.field_type); + E.fragment_index = df_srv_ind(E.fragment_index); n = df_add_entry(&E); gd_free_entry_strings(&E); if (n < 0) { @@ -679,7 +685,17 @@ if (n < 0) { ioerr = DFIO_CALL_ERR; return 1; + } else { + /* add it to the fragment index map */ + int *ptr = (int*)realloc(srv_ind, sizeof(int) * (n_srv_ind + 1)); + if (ptr == NULL) { + DF_OOM(DF_PRN_DF); + exit(1); + } + srv_ind = ptr; + srv_ind[n_srv_ind++] = n; } + rpc = -1; } break; @@ -725,8 +741,8 @@ n = (rpc == DF_RPC_SERVER_FRAME) ? 1 : 0; df_dprintf(DF_PRN_DEBUG_I, "RPC: df_add_framedef(<fdef>, %i, %i)\n", n, - (int)p_int32[0]); - n = df_add_framedef(&fd, n, (int)p_int32[0]); + df_srv_ind(p_int32[0])); + n = df_add_framedef(&fd, n, df_srv_ind(p_int32[0])); for (i = 0; i < fd.n_fields; ++i) free(fd.field[i].name); free(fd.field); @@ -791,8 +807,8 @@ DF_GET_PARAM(int32,0); /* fragment */ case 2: df_dprintf(DF_PRN_DEBUG_I, "RPC: df_add_spec(\"%s\", %i)\n", - string[0], p_int32[0]); - n = df_add_spec(string[0], p_int32[0]); + string[0], df_srv_ind(p_int32[0])); + n = df_add_spec(string[0], df_srv_ind(p_int32[0])); DF_FREE_STRINGS(1); if (n < 0) { ioerr = DFIO_CALL_ERR; @@ -1195,6 +1211,14 @@ goto client_error; } + /* initialise the fragment index mapping */ + if ((srv_ind = malloc(sizeof(int))) == NULL) { + DF_OOM(DF_PRN_DF); + goto client_error; + } + n_srv_ind = 1; + srv_ind[0] = 0; + /* figure out whether we need to run via ssh */ for (port = df->host; *port && (*port != ':'); ++port) ; Modified: trunk/defile/lib/internal.h =================================================================== --- trunk/defile/lib/internal.h 2013-03-14 23:05:29 UTC (rev 820) +++ trunk/defile/lib/internal.h 2013-03-15 02:09:51 UTC (rev 821) @@ -338,7 +338,7 @@ int df_rpc_fini(struct df_rpc *slug, int debug); int df_rpc_push_mem(struct df_rpc *slug, size_t size, const void *src); int df_rpc_push_uint8(struct df_rpc *slug, uint8_t v); -#define df_rpc_push_int8(s,v) df_rpc_push_uint8((s),(uint16_t)(v)) +#define df_rpc_push_int8(s,v) df_rpc_push_uint8((s),(uint8_t)(v)) int df_rpc_push_uint16(struct df_rpc *slug, uint16_t hv); #define df_rpc_push_int16(s,v) df_rpc_push_uint16((s),(uint16_t)(v)) int df_rpc_push_uint32(struct df_rpc *slug, uint32_t hv); Modified: trunk/defile/lib/libdefile.c =================================================================== --- trunk/defile/lib/libdefile.c 2013-03-14 23:05:29 UTC (rev 820) +++ trunk/defile/lib/libdefile.c 2013-03-15 02:09:51 UTC (rev 821) @@ -2037,15 +2037,20 @@ int df_add_fragment(const char *name, int parent, unsigned long encoding, unsigned long byte_sex, const char *prefix, const char *suffix) { + static int srv_ind = 0; const int append = df_mode() & DF_MODE_APPEND; int ind; char *path, *ptr; DF_CHECK_SEQUENCE(DF_ST_BUILD); - if (df->mode_flags & DF_MODE_SERVER) - return df_rpc_push(df->srv_slug, DF_RPC_ADD_FRAGMENT, name, parent, + if (df->mode_flags & DF_MODE_SERVER) { + ind = df_rpc_push(df->srv_slug, DF_RPC_ADD_FRAGMENT, name, parent, encoding, byte_sex, prefix, suffix); + if (ind) + return ind; + return ++srv_ind; /* a fake fragment index */ + } /* make the containing directory */ ptr = strdup(name); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-14 23:05:32
|
Revision: 820 http://sourceforge.net/p/getdata/code/820 Author: ketiltrout Date: 2013-03-14 23:05:29 +0000 (Thu, 14 Mar 2013) Log Message: ----------- Turn on follow mode by default in ssh-remote mode: let the downstream process figure out when to turn it off (as it already was doing). Modified Paths: -------------- trunk/defile/bin/defile.c Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-03-14 00:10:49 UTC (rev 819) +++ trunk/defile/bin/defile.c 2013-03-14 23:05:29 UTC (rev 820) @@ -1011,14 +1011,12 @@ DF_FindInputPlugin(1, NULL, NULL, &l); return 0; case DF_WOPT_LISTEN: /* --listen */ - df->mode_flags |= DF_MODE_SERVER; + df->mode_flags |= (DF_MODE_SERVER | DF_MODE_FOLLOW); df->mode_flags &= ~(DF_MODE_ASYNC | DF_MODE_APPEND); if (strcmp(config->argument, "stdout") == 0) df->srv_port = -1; - else { - df->mode_flags |= DF_MODE_FOLLOW; + else df->srv_port = htons((uint16_t)atoi(config->argument)); - } break; case DF_WOPT_NOLISTEN: /* --no-listen */ df->mode_flags &= ~DF_MODE_SERVER; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-14 00:10:52
|
Revision: 819 http://sourceforge.net/p/getdata/code/819 Author: ketiltrout Date: 2013-03-14 00:10:49 +0000 (Thu, 14 Mar 2013) Log Message: ----------- Don't let affixes mangle /REFERENCE directives. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/src/flush.c trunk/getdata/test/Makefile.am Added Paths: ----------- trunk/getdata/test/flush_ref.c trunk/getdata/test/parse_include_affix_ref.c Property Changed: ---------------- trunk/getdata/test/ Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2013-03-12 21:24:44 UTC (rev 818) +++ trunk/getdata/ChangeLog 2013-03-14 00:10:49 UTC (rev 819) @@ -1,3 +1,8 @@ +2012-03-13 D. V. Wiebe <ge...@ke...> svn:819 + * src/flush.c (_GD_FlushFragment): Strip affixes from field codes in + /REFERENCE directives. + * test/flush_ref.c test/parse_include_affix_ref.c: Added. + 2012-03-12 D. V. Wiebe <ge...@ke...> svn:818 * bindings/python/pydirfile.c (gdpy_dirfile_getdata): Resize the ndarray before returning it, if necessary. Also, don't try to read past the EOF in Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2013-03-12 21:24:44 UTC (rev 818) +++ trunk/getdata/NEWS 2013-03-14 00:10:49 UTC (rev 819) @@ -13,8 +13,13 @@ * BUG FIX: Trying to read sample zero of a gzipped RAW field the second time now works as expected. Previously, the request to reposition the I/O pointer - back to zero would be ignored by the gzip framework. + back to zero would be ignored by the gzip framework. Reported by Alexandra + Rahlin. + * BUG FIX: The field code of a reference field declared in a subfragment + included with affixes is no longer corrupted by spurious application of the + affixes when the subfragment's metadata are (re-)written. Reported by Seth. + Bindings Changes: * PYTHON BUG FIX: Numpy arrays returned by dirfile.getdata() are now the Modified: trunk/getdata/src/flush.c =================================================================== --- trunk/getdata/src/flush.c 2013-03-12 21:24:44 UTC (rev 818) +++ trunk/getdata/src/flush.c 2013-03-14 00:10:49 UTC (rev 819) @@ -792,7 +792,7 @@ if (permissive || D->standards >= 6) if (D->fragment[i].ref_name != NULL) { fputs("/REFERENCE ", stream); - _GD_StringEscapeise(stream, D->fragment[i].ref_name, 0, permissive, + _GD_WriteFieldCode(D, stream, i, D->fragment[i].ref_name, permissive, D->standards); fputc('\n', stream); } Index: trunk/getdata/test =================================================================== --- trunk/getdata/test 2013-03-12 21:24:44 UTC (rev 818) +++ trunk/getdata/test 2013-03-14 00:10:49 UTC (rev 819) Property changes on: trunk/getdata/test ___________________________________________________________________ Modified: svn:ignore ## -362,6 +362,7 ## flush_bad_code flush_invalid flush_meta +flush_ref flush_spec foffs_alter foffs_get ## -655,6 +656,7 ## parse_include parse_include_absolute parse_include_absrel +parse_include_affix_ref parse_include_dir parse_include_loop parse_include_nonexistent Modified: trunk/getdata/test/Makefile.am =================================================================== --- trunk/getdata/test/Makefile.am 2013-03-12 21:24:44 UTC (rev 818) +++ trunk/getdata/test/Makefile.am 2013-03-14 00:10:49 UTC (rev 819) @@ -163,7 +163,8 @@ flist_meta_invalid flist_type flist_type_hidden flist_type_invalid \ flist_type_meta flist_type_meta_hidden flist_type_meta_invalid -FLUSH_TESTS=flush flush_all flush_bad_code flush_invalid flush_meta flush_spec +FLUSH_TESTS=flush flush_all flush_bad_code flush_invalid flush_meta flush_ref \ + flush_spec FOFFS_TESTS=foffs_alter foffs_get foffs_move @@ -262,8 +263,9 @@ parse_endian_little parse_endian_slash parse_eol parse_foffs \ parse_foffs_include parse_foffs_slash parse_hidden \ parse_hidden_field parse_hidden_meta parse_include \ - parse_include_absolute parse_include_absrel parse_include_dir \ - parse_include_loop parse_include_nonexistent parse_include_prefix \ + parse_include_absolute parse_include_absrel \ + parse_include_affix_ref parse_include_dir parse_include_loop \ + parse_include_nonexistent parse_include_prefix \ parse_include_prefix_dup parse_include_preprefix \ parse_include_ref parse_include_relabs parse_include_relrel \ parse_include_slash parse_include_suffix parse_include_sufsuffix \ Added: trunk/getdata/test/flush_ref.c =================================================================== --- trunk/getdata/test/flush_ref.c (rev 0) +++ trunk/getdata/test/flush_ref.c 2013-03-14 00:10:49 UTC (rev 819) @@ -0,0 +1,74 @@ +/* Copyright (C) 2013 D. V. Wiebe + * + *************************************************************************** + * + * This file is part of the GetData project. + * + * GetData 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. + * + * GetData 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 GetData; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/* Test include */ +#include "test.h" + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> +#include <stdio.h> + +int main(void) +{ + const char *filedir = "dirfile"; + const char *subdir = "dirfile/sub"; + const char *format = "dirfile/format"; + const char *format1 = "dirfile/sub/format"; + const char *format_data = "data RAW UINT8 1\nREFERENCE data\n"; + const char *format1_data = "mata RAW UINT8 11\nREFERENCE mata\n"; + int fd, e1, r = 0; + const char *r1; + unsigned int spf; + DIRFILE *D; + + rmdirfile(); + mkdir(filedir, 0777); + mkdir(subdir, 0777); + + fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data, strlen(format_data)); + close(fd); + + fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format1_data, strlen(format1_data)); + close(fd); + + D = gd_open(filedir, GD_RDWR | GD_VERBOSE); + gd_include_affix(D, "sub/format", 0, "prefix_", NULL, GD_IGNORE_REFS); + gd_rewrite_fragment(D, GD_ALL_FRAGMENTS); + gd_close(D); + D = gd_open(subdir, GD_RDONLY | GD_VERBOSE); + r1 = gd_reference(D, NULL); + CHECKS(r1, "mata"); + e1 = gd_error(D); + gd_discard(D); + + unlink(format1); + unlink(format); + rmdir(filedir); + + CHECKI(e1, 0); + + return r; +} Added: trunk/getdata/test/parse_include_affix_ref.c =================================================================== --- trunk/getdata/test/parse_include_affix_ref.c (rev 0) +++ trunk/getdata/test/parse_include_affix_ref.c 2013-03-14 00:10:49 UTC (rev 819) @@ -0,0 +1,65 @@ +/* Copyright (C) 2013 D. V. Wiebe + * + *************************************************************************** + * + * This file is part of the GetData project. + * + * GetData 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. + * + * GetData 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 GetData; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/* Test include */ +#include "test.h" + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> + +int main(void) +{ + const char *filedir = "dirfile"; + const char *format = "dirfile/format"; + const char *format1 = "dirfile/format1"; + const char *format_data = + "data RAW UINT8 1\n" + "INCLUDE format1 A B\n"; + const char *format1_data = "zata RAW UINT8 11\n/REFERENCE zata\n"; + int fd, r = 0; + DIRFILE *D; + const char *ref; + + rmdirfile(); + mkdir(filedir, 0777); + + fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data, strlen(format_data)); + close(fd); + + fd = open(format1, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format1_data, strlen(format1_data)); + close(fd); + + D = gd_open(filedir, GD_RDONLY | GD_VERBOSE); + ref = gd_reference(D, NULL); + CHECKS(ref, "AzataB"); + gd_close(D); + + unlink(format1); + unlink(format); + rmdir(filedir); + + return r; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-12 21:24:49
|
Revision: 818 http://sourceforge.net/p/getdata/code/818 Author: ketiltrout Date: 2013-03-12 21:24:44 +0000 (Tue, 12 Mar 2013) Log Message: ----------- Not even out a day... (bugfixes) Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/python/pydirfile.c trunk/getdata/m4/version.m4 trunk/getdata/man/gd_seek.3 trunk/getdata/src/fpos.c trunk/getdata/src/gzip.c trunk/getdata/test/Makefile.am Added Paths: ----------- trunk/getdata/test/gzip_get_get2.c trunk/getdata/test/seek_neg.c trunk/getdata/test/tell_multidiv.c Property Changed: ---------------- trunk/getdata/ trunk/getdata/test/ Index: trunk/getdata =================================================================== --- trunk/getdata 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata 2013-03-12 21:24:44 UTC (rev 818) Property changes on: trunk/getdata ___________________________________________________________________ Modified: svn:ignore ## -19,6 +19,9 ## install-sh libtool ltmain.sh +matlab_getdata-*.tar.gz +matlab_getdata-*.tar.bz2 +matlab_getdata-*.sig missing *.swp libltdl Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/ChangeLog 2013-03-12 21:24:44 UTC (rev 818) @@ -1,3 +1,22 @@ +2012-03-12 D. V. Wiebe <ge...@ke...> svn:818 + * bindings/python/pydirfile.c (gdpy_dirfile_getdata): Resize the ndarray + before returning it, if necessary. Also, don't try to read past the EOF in + read-to-end mode. + + * src/fpos.c (_GD_GetFilePos): Fix computation of two input field derived + types to properly return MULTIPOS when necessary. + * test/tell_multidiv.c: Added. + + * src/fpos.c (_GD_Seek): Return error if trying to place the I/O pointer + before sample zero. + * test/seek_neg.c: Added. + + * src/gzip.c (_GD_GzipSeek): Allow seeking to sample zero. + * test/gzip_get_get2.c: Added. + +2012-03-12 D. V. Wiebe <ge...@ke...> svn:815 + GetData-0.8.3 released. + 2012-03-09 D. V. Wiebe <ge...@ke...> svn:807 * src/flush.c: C89-ify the GD_VERS_... constants. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/NEWS 2013-03-12 21:24:44 UTC (rev 818) @@ -1,3 +1,29 @@ +New in version 0.8.4a: + + Library Changes: + + * BUG FIX: Trying to position an I/O pointer to before sample zero with + gd_seek() now properly fails. Previously it would allow it, causing bizarre + things to happen later. + + * BUG FIX: Using gd_tell to get the I/O pointer position of a derived field + with exactly two input fields (MULTIPLY, DIVIDE, MPLEX, WINDOW) now properly + reports an error in the "multiposition" case (ie. when the two inputs are + ultimately reading from different locations in the same RAW field). + + * BUG FIX: Trying to read sample zero of a gzipped RAW field the second time + now works as expected. Previously, the request to reposition the I/O pointer + back to zero would be ignored by the gzip framework. + + Bindings Changes: + + * PYTHON BUG FIX: Numpy arrays returned by dirfile.getdata() are now the + correct length. Previously they would always be the length requested (or the + length of the dirfile, if no length was explicitly given) even if fewer + samples were returned. Extra elements would contain uninitialised memory. + +|==============================================================================| + New in version 0.8.3: Library Changes: Modified: trunk/getdata/bindings/python/pydirfile.c =================================================================== --- trunk/getdata/bindings/python/pydirfile.c 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/bindings/python/pydirfile.c 2013-03-12 21:24:44 UTC (rev 818) @@ -589,7 +589,7 @@ PyObject *return_type_obj = NULL; long int num_frames = 0, num_samples = 0; size_t ns; - int as_list = 0; + int as_list = 0, read_to_end = 0; gd_type_t return_type; unsigned int spf = 1; PyObject *pyobj = NULL; @@ -620,12 +620,6 @@ PYGD_CHECK_ERROR(self->D, NULL); } - /* get num frames/samples */ - if (num_frames_obj == NULL && num_samples_obj == NULL) { - num_frames = gd_nframes(self->D); - PYGD_CHECK_ERROR(self->D, NULL); - } - if (num_frames_obj) { num_frames = PyInt_AsLong(num_frames_obj); if (num_frames == -1 && PyErr_Occurred()) { @@ -652,19 +646,32 @@ } } + /* read to end mode */ + if (num_frames_obj == NULL && num_samples_obj == NULL) + read_to_end = 1; + /* we need the SPF to know how many samples we have to allocate */ - if (num_frames) { + if (read_to_end || num_frames) { spf = gd_spf(self->D, field_code); PYGD_CHECK_ERROR(self->D, NULL); + + if (read_to_end) { + num_samples = gd_nframes(self->D) * spf; + PYGD_CHECK_ERROR(self->D, NULL); + + /* don't read past the frame indicated by nframes */ + num_samples -= first_frame * spf - first_sample; + if (num_samples < 0) + num_samples = 0; + } else + num_samples += num_frames * spf; } - ns = num_samples + num_frames * spf; - - if (ns == 0) { + if (num_samples == 0) { #ifdef USE_NUMPY if (!as_list) - pyobj = PyArray_ZEROS(1, dims, NPY_INT, 0); + pyobj = PyArray_ZEROS(1, dims, gdpy_npytype_from_type(return_type), 0); else #endif pyobj = Py_BuildValue("[]"); @@ -672,21 +679,36 @@ void *data; #ifdef USE_NUMPY if (!as_list) { - dims[0] = (npy_intp)ns; + dims[0] = (npy_intp)num_samples; pyobj = PyArray_SimpleNew(1, dims, gdpy_npytype_from_type(return_type)); data = PyArray_DATA(pyobj); } else #endif - data = malloc(ns * GD_SIZE(return_type)); + data = malloc(num_samples * GD_SIZE(return_type)); - ns = gd_getdata(self->D, field_code, first_frame, first_sample, - (size_t)num_frames, (size_t)num_samples, return_type, data); + ns = gd_getdata(self->D, field_code, first_frame, first_sample, 0, (size_t)num_samples, + return_type, data); + fprintf(stderr, "%zu/%zu\n", ns, (size_t)num_samples); - #ifdef USE_NUMPY - if (!as_list) + if (!as_list) { PYGD_CHECK_ERROR(self->D, NULL); - else + /* resize, if necessary */ + if (ns < num_samples) { + PyObject *check; + PyArray_Dims new_dims; + + new_dims.ptr = dims; + new_dims.len = 1; + dims[0] = (npy_intp)ns; + check = PyArray_Resize((PyArrayObject*)pyobj, &new_dims, 0, NPY_ANYORDER); + + if (check == NULL) /* error -- exception already raised */ + return NULL; + Py_DECREF(check); /* Despite the docs, PyArray_Resize returns an INCREF'd Py_None on + success */ + } + } else #endif { PYGD_CHECK_ERROR2(self->D, NULL, free(data)); Modified: trunk/getdata/m4/version.m4 =================================================================== --- trunk/getdata/m4/version.m4 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/m4/version.m4 2013-03-12 21:24:44 UTC (rev 818) @@ -20,8 +20,8 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 8) -m4_define(getdata_revision, 3) -m4_define(getdata_extra, []) +m4_define(getdata_revision, 4) +m4_define(getdata_extra, [a]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/getdata/man/gd_seek.3 =================================================================== --- trunk/getdata/man/gd_seek.3 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/man/gd_seek.3 2013-03-12 21:24:44 UTC (rev 818) @@ -1,6 +1,6 @@ .\" gd_getdata.3. The gd_getdata man page. .\" -.\" Copyright (C) 2011, 2012 D. V. Wiebe +.\" Copyright (C) 2011, 2012, 2013 D. V. Wiebe .\" .\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .\" @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH gd_seek 3 "21 March 2012" "Version 0.8.0" "GETDATA" +.TH gd_seek 3 "12 March 2013" "Version 0.8.4" "GETDATA" .SH NAME gd_seek \(em reposition a dirfile field pointer .SH SYNOPSIS @@ -28,13 +28,13 @@ .SH DESCRIPTION The .BR gd_seek () -function changes the field position of the field +function changes the position of the I/O pointer associated with the field .I field_code in the dirfile(5) database specified by .IR dirfile . In normal operation, .BR gd_seek () -advances the field pointer +advances the field I/O pointer .I frame_num frames plus .I sample_num @@ -44,7 +44,7 @@ .BR GD_SEEK_SET ", " GD_SEEK_CUR , or .BR GD_SEEK_END , -indicating, respectively, origins of sample zero, the current position of the +indicating, respectively, sample zero, the current position of the field pointer, and the location of the end-of-field marker (see .BR gd_eof (3)). @@ -118,11 +118,11 @@ .B RAW fields (and the implicit .I INDEX -field) have field pointers associated with them. Calling +field) have field I/O pointers associated with them. Calling .BR gd_seek () on a derived field will move the field pointers of all of the field's inputs. It is possible to create derived fields which simultaneously read from different -places of the same field. Calling +places of the same input field. Calling .BR gd_seek () on such a field will result in an error. @@ -180,6 +180,10 @@ An error occurred while trying to open or read from a file on disk containing a raw field. .TP +.B GD_E_RANGE +The request resulted an attempt to move the I/O pointer of the specified field +or one of its inputs to a negative sample number. +.TP .B GD_E_RECURSE_LEVEL Too many levels of recursion were encountered while trying to resolve .IR field_code . Modified: trunk/getdata/src/fpos.c =================================================================== --- trunk/getdata/src/fpos.c 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/src/fpos.c 2013-03-12 21:24:44 UTC (rev 818) @@ -77,8 +77,10 @@ case GD_MPLEX_ENTRY: if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1)) break; - pos = _GD_GetFilePos(D, E->e->entry[0], 0); - pos2 = _GD_GetFilePos(D, E->e->entry[0], pos); + pos = _GD_GetFilePos(D, E->e->entry[0], -1); + if (D->error) + break; + pos2 = _GD_GetFilePos(D, E->e->entry[1], pos); if (!D->error && pos != pos2) { _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, NULL, 0, NULL); pos = -1; @@ -239,6 +241,12 @@ return 1; } + if (offset < 0) { + _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL); + dreturn("%i", 1); + return 1; + } + switch (E->field_type) { case GD_RAW_ENTRY: /* open/create the file, if necessary */ @@ -333,7 +341,7 @@ 1); if (D->error) { - dreturn("%u", -1); + dreturn("%i", -1); return -1; } @@ -341,7 +349,7 @@ _GD_SetError(D, GD_E_DIMENSION, GD_E_DIM_CALLER, NULL, 0, field_code); if (field_code != field_code_in) free(field_code); - dreturn("%u", -1); + dreturn("%i", -1); return -1; } @@ -351,7 +359,7 @@ if (D->error) { if (field_code != field_code_in) free(field_code); - dreturn("%u", -1); + dreturn("%i", -1); return -1; } } Modified: trunk/getdata/src/gzip.c =================================================================== --- trunk/getdata/src/gzip.c 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/src/gzip.c 2013-03-12 21:24:44 UTC (rev 818) @@ -74,7 +74,7 @@ { off64_t n = 0; - dtrace("%p, %lli, 0x%X, 0x%X", file, (long long)count, mode, data_type); + dtrace("%p, %lli, 0x%X, 0x%X", file, (long long)count, data_type, mode); if (file->pos == count) { dreturn("%lli", (long long)count); @@ -83,7 +83,7 @@ count *= GD_SIZE(data_type); - if (count > 0) { + if (count >= 0) { n = (off64_t)gzseek((gzFile)file[(mode == GD_FILE_WRITE) ? 1 : 0].edata, (off_t)count, SEEK_SET); Index: trunk/getdata/test =================================================================== --- trunk/getdata/test 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/test 2013-03-12 21:24:44 UTC (rev 818) Property changes on: trunk/getdata/test ___________________________________________________________________ Modified: svn:ignore ## -474,6 +474,7 ## gzip_add gzip_get gzip_get_get +gzip_get_get2 gzip_get_put gzip_move_from gzip_move_to ## -846,6 +847,7 ## seek_cur seek_end seek_foffs +seek_neg seek_set sie_get_big sie_get_little ## -879,6 +881,7 ## table_type tell tell64 +tell_multidiv tok_arg tok_escape tok_quote Modified: trunk/getdata/test/Makefile.am =================================================================== --- trunk/getdata/test/Makefile.am 2013-03-12 00:57:21 UTC (rev 817) +++ trunk/getdata/test/Makefile.am 2013-03-12 21:24:44 UTC (rev 818) @@ -196,8 +196,8 @@ GLOBAL_TESTS=global_flags global_name global_ref global_ref_empty global_ref_set -GZIP_TESTS=gzip_add gzip_get gzip_get_get gzip_get_put gzip_move_from \ - gzip_move_to gzip_nframes gzip_put gzip_put_get +GZIP_TESTS=gzip_add gzip_get gzip_get_get gzip_get_get2 gzip_get_put \ + gzip_move_from gzip_move_to gzip_nframes gzip_put gzip_put_get HEADER_TESTS=header_complex @@ -319,7 +319,7 @@ repr_real_m repr_real_r repr_uint16 repr_uint32 repr_uint64 \ repr_uint8 -SEEK_TESTS=seek64 seek_cur seek_end seek_foffs seek_set +SEEK_TESTS=seek64 seek_cur seek_end seek_foffs seek_neg seek_set SIE_TESTS=sie_get_big sie_get_little sie_move_from sie_move_to sie_nframes_big \ sie_nframes_little sie_put_big sie_put_little @@ -335,7 +335,7 @@ TABLE_TESTS=table table_code table_type -TELL_TESTS=tell tell64 +TELL_TESTS=tell tell64 tell_multidiv TOK_TESTS=tok_arg tok_escape tok_quote Added: trunk/getdata/test/gzip_get_get2.c =================================================================== --- trunk/getdata/test/gzip_get_get2.c (rev 0) +++ trunk/getdata/test/gzip_get_get2.c 2013-03-12 21:24:44 UTC (rev 818) @@ -0,0 +1,92 @@ +/* Copyright (C) 2008-2011 D. V. Wiebe + * + *************************************************************************** + * + * This file is part of the GetData project. + * + * GetData 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. + * + * GetData 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 GetData; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/* Attempt to read UINT8 */ +#include "test.h" + +#include <inttypes.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> + +int main(void) +{ +#if !defined USE_GZIP || !defined TEST_GZIP + return 77; /* skip test */ +#else + const char *filedir = "dirfile"; + const char *format = "dirfile/format"; + const char *data = "dirfile/data"; + const char *gzipdata = "dirfile/data.gz"; + const char *format_data = "data RAW UINT16 8\n"; + uint16_t c1[8], c2[8]; + char command[4096]; + uint16_t data_data[256]; + int fd, i, n1, error1, n2, error2, r = 0; + DIRFILE *D; + + memset(c1, 0, 16); + memset(c2, 0, 16); + rmdirfile(); + mkdir(filedir, 0777); + + for (fd = 0; fd < 256; ++fd) + data_data[fd] = (unsigned char)fd; + + fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data, strlen(format_data)); + close(fd); + + fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666); + write(fd, data_data, 256 * sizeof(uint16_t)); + close(fd); + + /* compress */ + snprintf(command, 4096, "%s -f %s > /dev/null", GZIP, data); + if (gd_system(command)) + return 1; + + D = gd_open(filedir, GD_RDONLY | GD_VERBOSE); + n1 = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT16, c1); + error1 = gd_error(D); + n2 = gd_getdata(D, "data", 0, 0, 1, 0, GD_UINT16, c2); + error2 = gd_error(D); + gd_close(D); + + unlink(gzipdata); + unlink(format); + rmdir(filedir); + + CHECKI(error1, 0); + CHECKI(error2, 0); + CHECKI(n1, 8); + CHECKI(n2, 8); + for (i = 0; i < 8; ++i) { + CHECKUi(i,c1[i], i); + CHECKUi(i,c2[i], i); + } + + return r; +#endif +} Added: trunk/getdata/test/seek_neg.c =================================================================== --- trunk/getdata/test/seek_neg.c (rev 0) +++ trunk/getdata/test/seek_neg.c 2013-03-12 21:24:44 UTC (rev 818) @@ -0,0 +1,70 @@ +/* Copyright (C) 2011 D. V. Wiebe + * + *************************************************************************** + * + * This file is part of the GetData project. + * + * GetData 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. + * + * GetData 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 GetData; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/* gd_seek() */ +#include "test.h" + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> + +int main(void) +{ + const char *filedir = "dirfile"; + const char *format = "dirfile/format"; + const char *data = "dirfile/data"; + const char *format_data = "data RAW UINT8 8\n"; + unsigned char data_data[256]; + int fd, e1, e2, r = 0; + off_t m, n; + DIRFILE *D; + + rmdirfile(); + mkdir(filedir, 0777); + + for (fd = 0; fd < 256; ++fd) + data_data[fd] = (unsigned char)fd; + + fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data, strlen(format_data)); + close(fd); + + fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666); + write(fd, data_data, 256); + close(fd); + + D = gd_open(filedir, GD_RDONLY); + m = gd_seek(D, "data", -3, 0, GD_SEEK_CUR); + e1 = gd_error(D); + + gd_close(D); + + unlink(data); + unlink(format); + rmdir(filedir); + + CHECKI(e1, GD_E_RANGE); + CHECKI(m, -1); + + return r; +} Added: trunk/getdata/test/tell_multidiv.c =================================================================== --- trunk/getdata/test/tell_multidiv.c (rev 0) +++ trunk/getdata/test/tell_multidiv.c 2013-03-12 21:24:44 UTC (rev 818) @@ -0,0 +1,70 @@ +/* Copyright (C) 2011 D. V. Wiebe + * + *************************************************************************** + * + * This file is part of the GetData project. + * + * GetData 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. + * + * GetData 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 GetData; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +/* gd_seek() */ +#include "test.h" + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> + +int main(void) +{ + const char *filedir = "dirfile"; + const char *format = "dirfile/format"; + const char *data = "dirfile/data"; + const char *format_data = "data RAW UINT8 8\nphase PHASE data 1\ndiv DIVIDE phase data"; + unsigned char data_data[256]; + int fd, error, r = 0; + off_t n; + DIRFILE *D; + + rmdirfile(); + mkdir(filedir, 0777); + + for (fd = 0; fd < 256; ++fd) + data_data[fd] = (unsigned char)fd; + + fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data, strlen(format_data)); + close(fd); + + fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666); + write(fd, data_data, 256); + close(fd); + + D = gd_open(filedir, GD_RDONLY); + n = gd_tell(D, "div"); + error = gd_error(D); + + gd_close(D); + + unlink(data); + unlink(format); + rmdir(filedir); + + CHECKI(error, GD_E_DOMAIN); + CHECKI(n, -1); + + return r; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-12 00:57:25
|
Revision: 817 http://sourceforge.net/p/getdata/code/817 Author: ketiltrout Date: 2013-03-12 00:57:21 +0000 (Tue, 12 Mar 2013) Log Message: ----------- Tag getdata-0.8.3 Added Paths: ----------- tags/getdata-0.8.3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-12 00:55:52
|
Revision: 816 http://sourceforge.net/p/getdata/code/816 Author: ketiltrout Date: 2013-03-12 00:55:47 +0000 (Tue, 12 Mar 2013) Log Message: ----------- Update make push Modified Paths: -------------- trunk/getdata/Makefile.am trunk/html/Makefile Modified: trunk/getdata/Makefile.am =================================================================== --- trunk/getdata/Makefile.am 2013-03-12 00:20:24 UTC (rev 815) +++ trunk/getdata/Makefile.am 2013-03-12 00:55:47 UTC (rev 816) @@ -32,7 +32,7 @@ rm -rf *~ m4/*~ README.txt %.sig: % - gpg -abo $@ $< + gpg --use-agent -abo $@ $< DISTCHECK_CONFIGURE_FLAGS = --with-idl-dlm-dir="$$dc_install_base/idl" \ --with-perl-dir="$$dc_install_base/perl" \ @@ -132,7 +132,8 @@ # package lists PACKAGES=$(distdir).tar.gz $(distdir).tar.bz2 idl_$(distdir).tar.gz \ - idl_$(distdir).tar.bz2 getdata_win-$(PACKAGE_VERSION).zip + idl_$(distdir).tar.bz2 getdata_win-$(PACKAGE_VERSION).zip \ + matlab_$(distdir).tar.gz matlab_$(distdir).tar.bz2 SIGS=$(addsuffix .sig,$(PACKAGES)) # release stuff @@ -143,4 +144,5 @@ dist-post: $(SIGS) dist-push: $(PACKAGES) $(SIGS) README.txt + @if [ -z "${SFUSER}" ]; then echo "ERROR: SFUSER unset"; false; fi rsync -avP -e ssh $^ $(SFUSER),ge...@fr...:/home/frs/project/g/ge/getdata/getdata/$(PACKAGE_VERSION)/ Modified: trunk/html/Makefile =================================================================== --- trunk/html/Makefile 2013-03-12 00:20:24 UTC (rev 815) +++ trunk/html/Makefile 2013-03-12 00:55:47 UTC (rev 816) @@ -41,5 +41,6 @@ push: push-stamp push-stamp: ${PUBLIC_HTML} + @if [ -z "${SFUSER}" ]; then echo "ERROR: SFUSER unset"; false; fi rsync -avP -e ssh $^ ${SFUSER},ge...@we...:/home/groups/g/ge/getdata/htdocs/ touch push-stamp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-12 00:20:28
|
Revision: 815 http://sourceforge.net/p/getdata/code/815 Author: ketiltrout Date: 2013-03-12 00:20:24 +0000 (Tue, 12 Mar 2013) Log Message: ----------- GetData-0.8.3. Modified Paths: -------------- trunk/getdata/NEWS trunk/getdata/bindings/matlab/package/README trunk/getdata/m4/version.m4 trunk/html/bindings.html.in trunk/html/download.html.in trunk/html/getdata.html.in trunk/html/index.html.in Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/getdata/NEWS 2013-03-12 00:20:24 UTC (rev 815) @@ -1,4 +1,4 @@ -New in version 0.8.3rc1: +New in version 0.8.3: Library Changes: @@ -13,6 +13,12 @@ gd_alter_const() (or similar) no longer results in the value of the field being corrupted. + * BUG FIX: A bug in the parser's tokeniser has been fixed to prevent spurious + "unterminated token" syntax errors. Typically this would only be seen when + using gd_strtok() to tokenise an (apparently innocuous) user-supplied string, + but a carefully crafted format file could also be made to get gd_open() to + produce it. + Bindings Changes: * Bindings for MATLAB have been added. Modified: trunk/getdata/bindings/matlab/package/README =================================================================== --- trunk/getdata/bindings/matlab/package/README 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/getdata/bindings/matlab/package/README 2013-03-12 00:20:24 UTC (rev 815) @@ -1,11 +1,10 @@ -IDL BINDINGS FOR GETDATA -======================== +MATLAB BINDINGS FOR GETDATA +=========================== This package provides bindings to the GetData library for use with the -Interactive Data Language (IDL) developed by Research Systems, Incorporated, -now ITT Visual Information Solutions. +MATLAB developed by The MathWorks, Incorporated. -Building the IDL bindings with this package requires a system with a copy of +Building the MATLAB bindings with this package requires a system with a copy of GetData already installed. If you do not already have the GetData library, you may want to download and install the entire GetData Project instead, which includes these bindings. GetData source packages, as well as more information @@ -34,13 +33,12 @@ CONTENTS ======== -This package provides bindings for the Interactive Data Language (IDL) to the -GetData library. Documentation for the bindings can be found in file -`README.idl' in the top level directory. The C interface is described in this -document and the associated man pages. +This package provides bindings for MATLAB to the GetData library. Documentation +for the bindings can be found in file `README.matlab' in the top level +directory. A full list of features new to this release of GetData may be found in the -file called `NEWS', including features new to this copy of the IDL bindings. +file called `NEWS', including features new to this copy of the MATLAB bindings. BUILDING THE BINDINGS @@ -48,16 +46,15 @@ This package may be configured and built using the GNU autotools. Generic installation instructions are provided in the file called `INSTALL'. A -brief summary follows. A C99-compliant compiler is required to build (but not -to use) the bindings. +brief summary follows. Most users should be able to build the package by simply executing: $ ./configure $ make -from the top IDL GetData directory (the directory containing this README file). -After the project has been built, you may (optionally) test the build by +from the top MATLAB GetData directory (the directory containing this README +file). After the project has been built, you may (optionally) test the build by executing: $ make check @@ -66,7 +63,7 @@ $ make install -will install the bindings, and documentation. +will install the bindings and documentation. The package configuration can be changed, if the default configuration is insufficient, before building it by passing options to ./configure. Running @@ -79,16 +76,16 @@ PREREQUISITES ============= -These bindings require GetData 0.8 or newer to build, as well as an IDL -interpreter verison 5.5 or later. No other external libraries are required, -save for the C Standard Library. +These bindings require GetData 0.8 or newer to build, as well as a MATLAB +interpreter and MEX compiler. No other external libraries are required, save +for the C Standard Library. AUTHOR ====== -The IDL GetData Bindings are maintained by D. V. Wiebe <dv...@ke...>. -Bug reports and other communication relevant to these bindings are best directed +The MATLAB Bindings are maintained by D. V. Wiebe <dv...@ke...>. Bug +reports and other communication relevant to these bindings are best directed to the GetData mailing list: <get...@li...>. A full list of contributors to the GetData Project is given in the file called Modified: trunk/getdata/m4/version.m4 =================================================================== --- trunk/getdata/m4/version.m4 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/getdata/m4/version.m4 2013-03-12 00:20:24 UTC (rev 815) @@ -21,7 +21,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 8) m4_define(getdata_revision, 3) -m4_define(getdata_extra, [rc1]) +m4_define(getdata_extra, []) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/html/bindings.html.in =================================================================== --- trunk/html/bindings.html.in 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/html/bindings.html.in 2013-03-12 00:20:24 UTC (rev 815) @@ -24,11 +24,12 @@ which permit use of GetData in other programming languages. As of 0.8, bindings for the following languages are included in the GetData package: <ul> + <li><a href="#cxx">C++</a> <li><a href="#fortran">Fortran</a> - <li><a href="#cxx">C++</a> - <li><a href="#python">Python</a> <li><a href="#idl">IDL (the Interactive Data Language)</a> + <li><a href="#matlab">MATLAB</a> <li><a href="#perl">Perl</a> + <li><a href="#python">Python</a> </ul> <p>Further documentation for these bindings is provided in the GetData package in the <code>/doc/</code> subdirectory. Additionally, all @@ -37,62 +38,6 @@ <p>Both the Python and IDL bindings require a C99-compatible C compiler. If one cannot be found, these bindings will not be built. - <h2><A name="fortran">Fortran Bindings</a></h2> - <p>Two sets of Fortran bindings are provided. The basic bindings are - implemented in a compatibility library (libfgetdata) and defined in a - Fortran-77 source file, <code>getdata.f</code>, which will be installed - along with the GetData header files. This file defines several - convenient parameters including the DIRFILE flags, the data type - specifiers, and error codes, and declares all external subroutines defined - by the bindings. Any Fortran-77 compiler which implements the MIL STD - 1753 (DoD Extension) INCLUDE statement (which any remotely modern compiler - should) can include this file to define these parameters for convenience. - <p>These basic bindings define a Fortran-77 compliant interface with an - API similar to the C API. However, instead of a <span - class="syntax keyword">DIRFILE</span> pointer, the Fortran bindings - use a numerical Dirfile unit number to refer to an open dirfile. - Space is available in the compatibility library for only 1023 dirfile - units. If an application attempts to open more than 1023 dirfiles - simultaneously, the compatibility library will emit an error message on - standard error and raise SIGABRT. Passing an invalid dirfile unit number - to a subroutines which requires one as input will result in the call - failing with error code <span class="syntax literal">GD_EBD</span> (= - <span class="syntax literal">GD_E_BAD_DIRFILE</span>). The exceptions to - this are <span class="syntax">GDCLOS</span> and <span - class="syntax">GDDSCD</span> (corresponding to the C API's <span - class="syntax"><a href="getdata.html#gd_close">gd_close()</a></span> and - <span class="syntax"><a href="getdata.html#gd_discard" - >gd_discard()</a></span>) which ignore invalid dirfile units. - <p>Integers passed to the bindings are expected to have the same size as - the C API's <span class="syntax keyword">int</span> type. As a result, - largefile support may not present in the Fortran bindings, if this is not - a 64-bit type. - All character string arguments require also an integer indicating the - size of the character buffer provided. In cases where the bindings - return a string value, the value will not be returned if the string length - supplied is too short. In these cases, the character string will be left - untouched, but the integer indicating the string length will be updated to - indicate the required string length. The exception to this is - <span class="syntax">GDESTR</span> (the Fortran-77 equivalent to <span - class="syntax"><a href="getdata.html#gd_error_string" - >gd_error_string()</a></span>), which simply truncates the string - it outputs, as the C API does. - <p>Because of shortcomings in the Fortran-77 specification (for instance, - the six character limitation on identifier length), a second set of - Fortran bindings is implemented on top of the Fortran-77 bindings. These - second bindings conform to the Fortran-95 standard and declare a GetData - module, described by a <code>getdata.mod</code> file installed alongside - the GetData headers. The Fortran-95 bindings provide longer identifier - names, stronger type-safety, and abstract data types as compared to the - basic Fortran-77 bindings, and should be preferred when possible. - Furthermore, while character string arguments in the Fortran-77 bindings - require also an integer indicating the size of the character buffer, the - Fortran-95 bindings do not. - <p>The Fortran-95 bindings are a simple, light-weight wrapper around the - Fortran-77 bindings, and calls to the two sets of bindings may be mixed, - if desired, without ill effect. Both sets of bindings provide the C - API constants used by the library. - <h2><a name="cxx">C++ Bindings</a></h2> <p>The C++ bindings are implemented in a library (libgetdata++), and a collection of header files installed in @@ -154,67 +99,61 @@ <span class="syntax">std::complex<double></span> objects, and should be specified in the same way. - <h2><a name="python">Python Bindings</a></h2> - Bindings to <a href="http://www.python.org/">Python</a> are provided using - a Python Extension Module (pygetdata.so), which defines a <span - class="syntax identifier">pygetdata</span> module. These bindings - should work with any 2.x series Python interpreter from version 2.3 - onwards. If found at configure time, the bindings will be built with - <a href="http://numpy.scipy.org/">NumPy</a> support, which will result in - requests for vector data returning NumPy arrays instead of Python lists. - If built with NumPy support, importing the module will fail if the numpy - module cannot be found. NumPy support should be preferred where possible: - it is more efficient both in memory usage and speed of data retrieval. - <p>The pygetdata module defines three classes: - <ul> - <li><span class="syntax identifier">dirfile</span>, which encapsulates - the C API's <span class="syntax keyword">DIRFILE</span> pointer, and - is used to access Dirfile data and global metadata. - <li><span class="syntax identifier">entry</span>, which encapsulates - the C API's <span class="syntax keyword">gd_entry_t</span> object, and - is used to access field metadata. - <li><span class="syntax identifier">fragment</span>, which is used to - access and modify dirfile metadata with fragment scope (<i>ie.</i>, - byte sex, encoding scheme, frame offset and protection levels). - </ul> - <p>The pygetdata module also contains all the GetData API constants: - <span class="syntax">pygetdata.UINT8</span>, - <span class="syntax">pygetdata.E_OK</span>, - <span class="syntax">pygetdata.RAW_ENTRY</span>, &c. - <p>GetData library errors are converted into Python exceptions by the - module. In general, functions which accept numerical data, such as - <span class="syntax">dirfile.putdata()</span>, automatically choose an - appropriate C type for transferring the data to the dirfile, and - specifying an explicit type is not needed. If using NumPy, - <span class="syntax">dirfile.getdata()</span> will return a NumPy array - with a dtype corresponding to the return type specified. Without NumPy, - the data will be returned as a Python list, with data converted to a - native Python numerical type according to Table 1. - <div class="inset"> - <table> - <caption><b>Table 1:</b> Python and GetData data types</caption> - <tr> - <th>Python Type</th><th>GetData Types</th> - </tr> - <tr> - <td>int</td> - <td>UINT8, INT8, UINT16, INT16, INT32</td> - </tr> - <tr> - <td>long</td> - <td>UINT32, UINT64, INT64</td> - </tr> - <tr> - <td>float</td> - <td>FLOAT32, FLOAT64</td> - </tr> - <tr> - <td>complex</td> - <td>COMPLEX64, COMPLEX128</td> - </tr> - </table> - </div> - <p>All pygetdata functions may be given positional or keyword parameters. + <h2><A name="fortran">Fortran Bindings</a></h2> + <p>Two sets of Fortran bindings are provided. The basic bindings are + implemented in a compatibility library (libfgetdata) and defined in a + Fortran-77 source file, <code>getdata.f</code>, which will be installed + along with the GetData header files. This file defines several + convenient parameters including the DIRFILE flags, the data type + specifiers, and error codes, and declares all external subroutines defined + by the bindings. Any Fortran-77 compiler which implements the MIL STD + 1753 (DoD Extension) INCLUDE statement (which any remotely modern compiler + should) can include this file to define these parameters for convenience. + <p>These basic bindings define a Fortran-77 compliant interface with an + API similar to the C API. However, instead of a <span + class="syntax keyword">DIRFILE</span> pointer, the Fortran bindings + use a numerical Dirfile unit number to refer to an open dirfile. + Space is available in the compatibility library for only 1023 dirfile + units. If an application attempts to open more than 1023 dirfiles + simultaneously, the compatibility library will emit an error message on + standard error and raise SIGABRT. Passing an invalid dirfile unit number + to a subroutines which requires one as input will result in the call + failing with error code <span class="syntax literal">GD_EBD</span> (= + <span class="syntax literal">GD_E_BAD_DIRFILE</span>). The exceptions to + this are <span class="syntax">GDCLOS</span> and <span + class="syntax">GDDSCD</span> (corresponding to the C API's <span + class="syntax"><a href="getdata.html#gd_close">gd_close()</a></span> and + <span class="syntax"><a href="getdata.html#gd_discard" + >gd_discard()</a></span>) which ignore invalid dirfile units. + <p>Integers passed to the bindings are expected to have the same size as + the C API's <span class="syntax keyword">int</span> type. As a result, + largefile support may not present in the Fortran bindings, if this is not + a 64-bit type. + All character string arguments require also an integer indicating the + size of the character buffer provided. In cases where the bindings + return a string value, the value will not be returned if the string length + supplied is too short. In these cases, the character string will be left + untouched, but the integer indicating the string length will be updated to + indicate the required string length. The exception to this is + <span class="syntax">GDESTR</span> (the Fortran-77 equivalent to <span + class="syntax"><a href="getdata.html#gd_error_string" + >gd_error_string()</a></span>), which simply truncates the string + it outputs, as the C API does. + <p>Because of shortcomings in the Fortran-77 specification (for instance, + the six character limitation on identifier length), a second set of + Fortran bindings is implemented on top of the Fortran-77 bindings. These + second bindings conform to the Fortran-95 standard and declare a GetData + module, described by a <code>getdata.mod</code> file installed alongside + the GetData headers. The Fortran-95 bindings provide longer identifier + names, stronger type-safety, and abstract data types as compared to the + basic Fortran-77 bindings, and should be preferred when possible. + Furthermore, while character string arguments in the Fortran-77 bindings + require also an integer indicating the size of the character buffer, the + Fortran-95 bindings do not. + <p>The Fortran-95 bindings are a simple, light-weight wrapper around the + Fortran-77 bindings, and calls to the two sets of bindings may be mixed, + if desired, without ill effect. Both sets of bindings provide the C + API constants used by the library. <h2><a name="idl">IDL Bindings</a></h2> Bindings are provided for the <a @@ -262,6 +201,26 @@ situations which permits building just the IDL bindings against an already installed GetData. See the <a href="download.html">download section</a>. + <h2><a name="matlab">MATLAB Bindings</a></h2> + Bindings are provided for <a + href="http://www.mathworks.com/products/matlab/">MATLAB</a> developed by + The MathWorkds, Incorporated. The bindings are implemented as a + combination of native MATLAB and MEX files, plus a compatibility library + <code>libgetdata_matlab.so</code>. By default, the MATLAB bindings are + installed in <code>${libdir}/getdata/matlab/getdata</code>, which should + be added to the MATLAB search path. After installation, full + documentation for the bindings are provided from within the MATLAB help + system. After installing the bindings, running + <div class="syntax">>> <span class="keyword">help</span> + <span class="identifier">getdata</span> + </div> + will provide an overview of the bindings. + <p>Because of licensing restrictions, most pre-built versions of GetData + lack MATLAB bindings. A stand-alone source package is provided for these + situations which permits building just the MATLAB bindings against an + already installed GetData. See the <a href="download.html">download + section</a>. + <h2><a name="perl">Perl Bindings</a></h2> Bindings to <a href="http://www.perl.org/">Perl5</a> are provided in a Perl module (<code>GetData.pm</code>) backed by an XS interface library @@ -281,6 +240,68 @@ passed to the library is similarly flexible. Perl is not well suited to numerical analysis, and the bindings may be inefficient. + <h2><a name="python">Python Bindings</a></h2> + Bindings to <a href="http://www.python.org/">Python</a> are provided using + a Python Extension Module (pygetdata.so), which defines a <span + class="syntax identifier">pygetdata</span> module. These bindings + should work with any 2.x series Python interpreter from version 2.3 + onwards. If found at configure time, the bindings will be built with + <a href="http://numpy.scipy.org/">NumPy</a> support, which will result in + requests for vector data returning NumPy arrays instead of Python lists. + If built with NumPy support, importing the module will fail if the numpy + module cannot be found. NumPy support should be preferred where possible: + it is more efficient both in memory usage and speed of data retrieval. + <p>The pygetdata module defines three classes: + <ul> + <li><span class="syntax identifier">dirfile</span>, which encapsulates + the C API's <span class="syntax keyword">DIRFILE</span> pointer, and + is used to access Dirfile data and global metadata. + <li><span class="syntax identifier">entry</span>, which encapsulates + the C API's <span class="syntax keyword">gd_entry_t</span> object, and + is used to access field metadata. + <li><span class="syntax identifier">fragment</span>, which is used to + access and modify dirfile metadata with fragment scope (<i>ie.</i>, + byte sex, encoding scheme, frame offset and protection levels). + </ul> + <p>The pygetdata module also contains all the GetData API constants: + <span class="syntax">pygetdata.UINT8</span>, + <span class="syntax">pygetdata.E_OK</span>, + <span class="syntax">pygetdata.RAW_ENTRY</span>, &c. + <p>GetData library errors are converted into Python exceptions by the + module. In general, functions which accept numerical data, such as + <span class="syntax">dirfile.putdata()</span>, automatically choose an + appropriate C type for transferring the data to the dirfile, and + specifying an explicit type is not needed. If using NumPy, + <span class="syntax">dirfile.getdata()</span> will return a NumPy array + with a dtype corresponding to the return type specified. Without NumPy, + the data will be returned as a Python list, with data converted to a + native Python numerical type according to Table 1. + <div class="inset"> + <table> + <caption><b>Table 1:</b> Python and GetData data types</caption> + <tr> + <th>Python Type</th><th>GetData Types</th> + </tr> + <tr> + <td>int</td> + <td>UINT8, INT8, UINT16, INT16, INT32</td> + </tr> + <tr> + <td>long</td> + <td>UINT32, UINT64, INT64</td> + </tr> + <tr> + <td>float</td> + <td>FLOAT32, FLOAT64</td> + </tr> + <tr> + <td>complex</td> + <td>COMPLEX64, COMPLEX128</td> + </tr> + </table> + </div> + <p>All pygetdata functions may be given positional or keyword parameters. + <div class="foot"><div class="copy">© 2009, 2010, 2012 D. V. Wiebe</div> <div class="w3c"> Modified: trunk/html/download.html.in =================================================================== --- trunk/html/download.html.in 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/html/download.html.in 2013-03-12 00:20:24 UTC (rev 815) @@ -21,17 +21,17 @@ <h2><a name="source">Latest Release</a></h2> <p>The complete source code for official releases of the GetData project are available from SourceForge. The latest version of GetData, released - 13 December, 2012, is: + 12 March, 2013, is: <ul> <li><a - href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/" - >0.8.2</a>. Three packages are available: + href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/" + >0.8.3</a>. Four packages are available: <dl> - <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/getdata-0.8.2.tar.bz2/download">getdata-0.8.2.tar.bz2</a>/<a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/getdata-0.8.2.tar.gz/download">.gz</a>:</dt> + <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/getdata-0.8.3.tar.bz2/download">getdata-0.8.3.tar.bz2</a>/<a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/getdata-0.8.3.tar.gz/download">.gz</a>:</dt> <dd>The full source code to the library, with bindings. This package uses the GNU autotools build system, and is designed for POSIX systems (UNIX, Linux, BSD, MacOS X, Cygwin, MSys, &c.)</dd> - <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/getdata_win-0.8.2.zip/download">getdata_win-0.8.2.zip</a>:</dt> + <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/getdata_win-0.8.3.zip/download">getdata_win-0.8.3.zip</a>:</dt> <dd>A reduced source code package, with the CMake build system designed to be built on Microsoft Windows, either using the free MinGW compiler, or else Microsoft's Visual C++ compiler. (The full source @@ -41,13 +41,20 @@ compressed dirfiles, the Legacy API, and a few other features. This build is used in native Microsoft Windows builds of <a href="http://kst.kde.org/">kst-2</a>.</dd> - <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/idl_getdata-0.8.2.tar.bz2/download">idl_getdata-0.8.2.tar.bz2</a>/<a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/idl_getdata-0.8.2.tar.gz/download">.gz</a>:</dt> + <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/idl_getdata-0.8.3.tar.bz2/download">idl_getdata-0.8.3.tar.bz2</a>/<a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/idl_getdata-0.8.3.tar.gz/download">.gz</a>:</dt> <dd>The Interactive Data Language (IDL) bindings, packaged separately with an autotools build system, designed to be built against an already installed version of GetData. Due to licensing restrictions, <a href="#distro">pre-built packages</a> rarely come with these bindings, and this package allows end-users to add support for IDL without having to recompile the whole GetData package.</dd> + <dt><a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/matlab_getdata-0.8.3.tar.bz2/download">matlab_getdata-0.8.3.tar.bz2</a>/<a href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/matlab_getdata-0.8.3.tar.gz/download">.gz</a>:</dt> + <dd>The MATLAB bindings, packaged separately with an autotools build + system, designed to be built against an already installed version of + GetData. Due to licensing restrictions, <a href="#distro">pre-built + packages</a> rarely come with these bindings, and this package + allows end-users to add support for MATLAB without having to recompile + the whole GetData package.</dd> </dl> </ul> GetData may be @@ -129,8 +136,8 @@ <p>Older getdata releases available include the following: <ul> <li><a - href="http://sourceforge.net/projects/getdata/files/getdata/0.8.1/" - >0.8.1</a>—<i>August 2012</i> + href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/" + >0.8.2</a>—<i>December 2012</i> <li><a href="http://sourceforge.net/projects/getdata/files/getdata/0.7.3/" >0.7.3</a>—<i>April 2011</i> @@ -171,7 +178,7 @@ the <a href="COPYING.GPL">GNU General Public License</a>. Later releases are available under the <a href="#warranty">GNU Lesser General Public License</a>.</p> - <div class="foot"><div class="copy">© 2008, 2009, 2010, 2011 D. V. + <div class="foot"><div class="copy">© 2008–2013 D. V. Wiebe</div> <div class="w3c"> <a href="http://validator.w3.org/check?uri=referer"><img Modified: trunk/html/getdata.html.in =================================================================== --- trunk/html/getdata.html.in 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/html/getdata.html.in 2013-03-12 00:20:24 UTC (rev 815) @@ -302,12 +302,12 @@ languages. As of the version 0.8.0 release, light-weight bindings are available for the following languages: <ul> - <li>C++ - <li>Fortran 77 - <li>Fortran 95 - <li>Python - <li>The Interactive Data Language (IDL) - <li>Perl + <li><a href="#cxx">C++</a> + <li><a href="#fortran">Fortran</a> + <li><a href="#idl">IDL (the Interactive Data Language)</a> + <li><a href="#matlab">MATLAB</a> + <li><a href="#perl">Perl</a> + <li><a href="#python">Python</a> </ul> The <a href="bindings.html">GetData Bindings</a> document provides an overview of these bindings. Full documentation is included in the Modified: trunk/html/index.html.in =================================================================== --- trunk/html/index.html.in 2013-03-11 23:45:54 UTC (rev 814) +++ trunk/html/index.html.in 2013-03-12 00:20:24 UTC (rev 815) @@ -59,9 +59,9 @@ <p>The complete source code for official releases of the GetData project are available from SourceForge. <ul><li> - The latest version of GetData, released 13 December, 2012, is <a - href="http://sourceforge.net/projects/getdata/files/getdata/0.8.2/" - >GetData 0.8.2</a>.</ul> + The latest version of GetData, released 12 March, 2012, is <a + href="http://sourceforge.net/projects/getdata/files/getdata/0.8.3/" + >GetData 0.8.3</a>.</ul> See: <ul><li><a href="download.html">Get GetData</a></ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-11 23:45:57
|
Revision: 814 http://sourceforge.net/p/getdata/code/814 Author: ketiltrout Date: 2013-03-11 23:45:54 +0000 (Mon, 11 Mar 2013) Log Message: ----------- Avoid potential busy wait. Modified Paths: -------------- trunk/defile/bin/defile.c Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-03-11 23:17:35 UTC (rev 813) +++ trunk/defile/bin/defile.c 2013-03-11 23:45:54 UTC (rev 814) @@ -1980,6 +1980,8 @@ /* discard the (possibly) sent frames */ if (nf_out > 0) DF_DiscardServerFrames(nf_out); + else + usleep(10000); /* no data -- wait a bit */ /* check for a reinit */ if (df->output_state != DF_ST_RUN) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-11 23:17:41
|
Revision: 813 http://sourceforge.net/p/getdata/code/813 Author: ketiltrout Date: 2013-03-11 23:17:35 +0000 (Mon, 11 Mar 2013) Log Message: ----------- Memory handling stuff. Modified Paths: -------------- trunk/defile/bin/defile.c Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-03-10 19:40:23 UTC (rev 812) +++ trunk/defile/bin/defile.c 2013-03-11 23:17:35 UTC (rev 813) @@ -716,7 +716,6 @@ free(path); return 0; } - free(path); /* discard things we've already seen */ for (i = 0; i < l->n; ++i) { @@ -724,9 +723,11 @@ df_dprintf(DF_PRN_DEBUG_I, "ignoring extra %s plugin: %s\n", type, filename); lt_dlclose(lib); + free(path); return 0; } } + free(path); /* if we have an input name, probe this plugin to see if it wants it */ if (result == 0 && l->i) { @@ -2095,11 +2096,11 @@ break; case DF_ST_ABORT: DF_OUTSTATE_MX(DONE); - return NULL; + goto df_server_stop; default: df_dputs(DF_PRN_ERR, "unexpected traversal in output state map.\n"); DF_OUTSTATE_MX(ERROR); - return NULL; + goto df_server_stop; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-10 19:40:26
|
Revision: 812 http://sourceforge.net/p/getdata/code/812 Author: ketiltrout Date: 2013-03-10 19:40:23 +0000 (Sun, 10 Mar 2013) Log Message: ----------- Curfiles/symlinks. Also some changes to the df_optdef. Modified Paths: -------------- trunk/defile/bin/defile.c trunk/defile/bin/rc.c trunk/defile/doc/defile-input.7 trunk/defile/input/ascii.c trunk/defile/input/dirfile.c trunk/defile/lib/defile.h trunk/defile/lib/internal.h trunk/defile/lib/libdefile.c Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/bin/defile.c 2013-03-10 19:40:23 UTC (rev 812) @@ -32,6 +32,7 @@ #include <syslog.h> #include <stdarg.h> #include <arpa/inet.h> +#include <libgen.h> #include <poll.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -940,7 +941,8 @@ DF_WOPT_OUTPUT, DF_WOPT_QUIET, DF_WOPT_SKIP, DF_WOPT_SYNC, DF_WOPT_TYPE, DF_WOPT_VERBOSE, DF_WOPT_REMOTE, DF_WOPT_LOCAL, DF_WOPT_RSH, DF_WOPT_LISTEN, DF_WOPT_NOLISTEN, DF_WOPT_RCMD, DF_WOPT_RDEBUG, DF_WOPT_NORDEBUG, - DF_WOPT_SRVRATE, DF_WOPT_DAEMON + DF_WOPT_SRVRATE, DF_WOPT_DAEMON, DF_WOPT_CURFILE, DF_WOPT_SYMLINK, + DF_WOPT_NOSYMLINK, DF_WOPT_NOCURFILE }; static int DF_OutputOpt(struct df_defile *df, struct df_rc_config *config, @@ -1092,6 +1094,12 @@ SETFLOAT(SRVRATE, srv_rate); SETSTRING(RCMD, remcmd); + + SETSTRING(CURFILE, curfile); + CLRSTRING(NOCURFILE, curfile); + + SETSTRING(SYMLINK, symlink); + CLRSTRING(NOSYMLINK, symlink); } return -1; @@ -1402,6 +1410,170 @@ usleep(10000); } +/* update curfile and/or symlink */ +static int df_curfile(void) +{ + int fd; + char *ptr1, *ptr2, *ptr3; + char *dirfile; + size_t len; + + /* nothing to do */ + if (df->curfile == NULL && df->symlink == NULL) + return 0; + + /* create an absolute pathname to the output dirfile */ +#ifdef HAVE_CANONICALIZE_FILE_NAME + dirfile = canonicalize_file_name(df->dirfile); + if (dirfile == NULL) { + df_dperror(DF_PRN_ERR, "canonicalize_file_name"); + return 1; + } +#elif defined HAVE_REALPATH && defined PATH_MAX + dirfile = malloc(PATH_MAX); + if (dirfile == NULL) { + DF_OOM(DF_PRN_DF); + return 1; + } + if (realpath(df->dirfile, dirfile) == NULL) { + df_dperror(DF_PRN_ERR, "realpath"); + free(dirfile); + return 1; + } +#else + if (df->dirfile[0] == '/') + dirfile = strdup(df->dirfile); + else { + ptr1 = malloc(4096); + if (ptr1 == NULL) { + DF_OOM(DF_PRN_DF); + return 1; + } + if (getcwd(ptr1, 4096) == NULL) { + df_dperror(DF_PRN_ERR, "getcwd"); + free(ptr1); + return 1; + } + dirfile = malloc(strlen(ptr1) + strlen(df->dirfile) + 2); + if (dirfile == NULL) { + df_dperror(DF_PRN_ERR, "getcwd"); + free(ptr1); + return 1; + } + sprintf(dirfile, "%s/%s", ptr1, df->dirfile); + free(ptr1); + } +#endif + len = strlen(dirfile); + + /* update the curfile (out-of-place) */ + if (df->curfile) { + /* temporary file */ + ptr1 = strdup(df->curfile); + if (ptr1 == NULL) { + DF_OOM(DF_PRN_DF); + free(dirfile); + return 1; + } + ptr2 = dirname(ptr1); + ptr3 = malloc(strlen(ptr2) + 6); + if (ptr3 == NULL) { + DF_OOM(DF_PRN_DF); + free(dirfile); + free(ptr1); + return 1; + } + strcat(strcpy(ptr3, ptr2), "XXXXXX"); + free(ptr1); + + /* create temporary file */ + fd = mkstemp(ptr3); + if (fd < 0) { + df_dperror(DF_PRN_ERR, "mkstemp"); + free(dirfile); + free(ptr3); + return 1; + } + + if (write(fd, dirfile, len) < 0) { + df_dperror(DF_PRN_ERR, "write"); + free(dirfile); + free(ptr3); + return 1; + } + if (close(fd)) { + df_dperror(DF_PRN_ERR, "close"); + free(dirfile); + free(ptr3); + return 1; + } + + /* move into place */ + if (rename(ptr3, df->curfile)) { + df_dperror(DF_PRN_ERR, "rename"); + free(dirfile); + /* unlnk on error */ + if (unlink(ptr3)) + df_dperror(DF_PRN_ERR, "unlink"); + free(ptr3); + return 1; + } + free(ptr3); + } + + /* make a symlink (out of place) */ + if (df->symlink) { + /* temporary symlink */ + ptr1 = strdup(df->curfile); + if (ptr1 == NULL) { + DF_OOM(DF_PRN_DF); + free(dirfile); + return 1; + } + ptr2 = dirname(ptr1); + ptr3 = malloc(strlen(ptr2) + 6); + if (ptr3 == NULL) { + DF_OOM(DF_PRN_DF); + free(dirfile); + free(ptr1); + return 1; + } + strcat(strcpy(ptr3, ptr2), "XXXXXX"); + free(ptr1); + + /* create temporary symlink */ + mktemp(ptr3); + if (ptr3[0] == 0) { + df_dperror(DF_PRN_ERR, "mktemp"); + free(dirfile); + free(ptr3); + return 1; + } + + if (symlink(dirfile, ptr3)) { + df_dperror(DF_PRN_ERR, "symlink"); + free(dirfile); + free(ptr3); + return 1; + } + + /* move into place */ + if (rename(ptr3, df->symlink)) { + df_dperror(DF_PRN_ERR, "rename"); + free(dirfile); + /* unlnk on error */ + if (unlink(ptr3)) + df_dperror(DF_PRN_ERR, "unlink"); + free(ptr3); + return 1; + } + free(ptr3); + } + + free(dirfile); + return 0; +} + /* create the output dirfile and then wait while the Input defines the * metadata */ static int DF_MakeOutput(void) @@ -1436,6 +1608,10 @@ if (gd_metaflush(df->D)) return 1; + /* update curfile/symlink */ + if (df_curfile()) + return 1; + /* signal we're ready for data */ DF_OUTSTATE_MX(RUN); @@ -1514,7 +1690,7 @@ /* no data */ if (nf == 0 || have_fd == 0) return df->buflen + 1; - + /* stdout mode has no rate limiting */ if (!listen) return nf; @@ -1856,7 +2032,7 @@ client_done[i] = 2; /* error */ } else { df_dprintf(DF_PRN_DEBUG_O, "sent REINIT(%i) to %s on %i\n", - reinit[5], cli_data[i].name, pfd[i].fd); + reinit[5], cli_data[i].name, pfd[i].fd); client_done[i] = 1; /* success */ } pfd[i].events = 0; @@ -2292,137 +2468,150 @@ struct sigaction action; const struct df_optdef options[] = { - { DF_WOPT_APPEND, DF_OPT_NO_ARG, 'A', "append", "Append", 0, NULL, + { DF_WOPT_APPEND, DF_OPT_NO_ARG, 'A', "append", "Append", NULL, "append data to an already existing output" }, - { DF_WOPT_NOAPPEND, DF_OPT_NO_ARG, 'A', "no-append", "NoAppend", 0, NULL, + { DF_WOPT_NOAPPEND, DF_OPT_NO_ARG, 'A', "no-append", "NoAppend", NULL, "don't append data (default)" }, - { DF_WOPT_ASYNC, DF_OPT_NO_ARG, 'a', "async", "Asynchronous", 0, + { DF_WOPT_ASYNC, DF_OPT_NO_ARG, 'a', "async", "Asynchronous", NULL, "turn on asynchronous mode" }, - { DF_WOPT_SYNC, DF_OPT_NO_ARG, 'a', "sync", "Synchronous", DF_OPT_PLUS, + { DF_WOPT_SYNC, DF_OPT_PLUS | DF_OPT_NO_ARG, 'a', "sync", "Synchronous", NULL, "turn off synchronous mode" }, - { DF_WOPT_CLOBBER, DF_OPT_NO_ARG, 0, "clobber", "Clobber", 0, NULL, + { DF_WOPT_CLOBBER, DF_OPT_NO_ARG, 0, "clobber", "Clobber", NULL, "if the output dirfile already exists, overwrite it; use with caution" }, - { DF_WOPT_NOCLOBBER, DF_OPT_NO_ARG, 0, "no-clobber", "NoClobber", 0, NULL, + { DF_WOPT_NOCLOBBER, DF_OPT_NO_ARG, 0, "no-clobber", "NoClobber", NULL, "don't overwrite an existing dirfile (default)" }, - { DF_WOPT_CUTDIR, DF_OPT_ARG_RQ, 0, "cut-dirs", "CutDirs", 0, "NUM", + { DF_WOPT_CUTDIR, DF_OPT_ARG_RQ, 0, "cut-dirs", "CutDirs", "NUM", "remove path elements from the output name" }, - { DF_WOPT_DIR, DF_OPT_ARG_RQ, 'D', "directory", "Directory", DF_OPT_EXPAND, + { DF_WOPT_DIR, DF_OPT_EXPAND | DF_OPT_ARG_RQ, 'D', "directory", "Directory", "DIR", "write the output dirfile as a subdirectory under DIR" }, - { DF_WOPT_DEBUG, DF_OPT_ARG_OP, 'd', "debug", "Debug", 0, "WHAT", + { DF_WOPT_DEBUG, DF_OPT_ARG_OP, 'd', "debug", "Debug", "WHAT", "print debugging messages, restricted according to WHAT (default: " "everything)" }, - { DF_WOPT_NODEBUG, DF_OPT_NO_ARG, 'd', "no-debug", "NoDebug", DF_OPT_PLUS, + { DF_WOPT_NODEBUG, DF_OPT_PLUS | DF_OPT_NO_ARG, 'd', "no-debug", "NoDebug", NULL, "suppress printing debugging messages (default)" }, - { DF_WOPT_FOLLOW, DF_OPT_NO_ARG, 'f', "follow", "Follow", 0, NULL, + { DF_WOPT_FOLLOW, DF_OPT_NO_ARG, 'f', "follow", "Follow", NULL, "keep monitoring the input and write data to the outpu as it becomes " "available" }, - { DF_WOPT_NOFOLLOW, DF_OPT_NO_ARG, 'f', "no-follow", "NoFollow", - DF_OPT_PLUS, NULL, + { DF_WOPT_NOFOLLOW, DF_OPT_PLUS | DF_OPT_NO_ARG, 'f', "no-follow", + "NoFollow", NULL, "exit successfully upon reaching the end of the input (default)" }, - { DF_WOPT_ADD, DF_OPT_ARG_RQ, 'F', "include", "IncludeField", 0, "FIELD", + { DF_WOPT_ADD, DF_OPT_ARG_RQ, 'F', "include", "IncludeField", "FIELD", "include FIELD in the output dirfile, if available" }, - { DF_WOPT_DEL, DF_OPT_ARG_RQ, 'F', "exclude", "ExcludeField", DF_OPT_PLUS, + { DF_WOPT_DEL, DF_OPT_PLUS | DF_OPT_ARG_RQ, 'F', "exclude", "ExcludeField", "FIELD", "exclude FIELD from the output dirfile" }, - { DF_WOPT_BHEAD, DF_OPT_ARG_RQ, 'h', "buf-head", "BufferHead", 0, "N", + { DF_WOPT_BHEAD, DF_OPT_ARG_RQ, 'h', "buf-head", "BufferHead", "N", "set the length of the output buffer head to N frames; the default " "value is zero" }, - { DF_WOPT_INPUT, DF_OPT_ARG_RQ, 'i', "input", "Input", 0, "NAME", + { DF_WOPT_INPUT, DF_OPT_ARG_RQ, 'i', "input", "Input", "NAME", "read input data from NAME; typically the NAME can be specified as " "a bare argument, without the need for -i; this option is provided " "only for use in situations where NAME begins with - or + (and would, " "therefore, be mistaken for an option)" }, - { DF_WOPT_BLEN, DF_OPT_ARG_RQ, 'l', "buf-len", "BufferLen", 0, "N", + { DF_WOPT_BLEN, DF_OPT_ARG_RQ, 'l', "buf-len", "BufferLen", "N", "set the length of the output buffer to N frames; the default value " "is " DF_STRINGIFY(DF_BUFLEN) "" }, - { DF_WOPT_LIBDIR, DF_OPT_NO_ARG, 0, "lib-dir", NULL, 0, NULL, + { DF_WOPT_LIBDIR, DF_OPT_NO_ARG, 0, "lib-dir", NULL, NULL, "print the default input plugin path and exit" }, - { DF_WOPT_LIST, DF_OPT_NO_ARG, 0, "list-types", NULL, 0, NULL, + { DF_WOPT_LIST, DF_OPT_NO_ARG, 0, "list-types", NULL, NULL, "print a list of available input plugins and exit" }, - { DF_WOPT_OFLCLR, DF_OPT_NO_ARG, 0, "clear-field-list", "ClearFieldList", 0, + { DF_WOPT_OFLCLR, DF_OPT_NO_ARG, 0, "clear-field-list", "ClearFieldList", NULL, "ignore all previous options which modifiy the ouput field list (-F, +F)" }, - { DF_WOPT_OUTPUT, DF_OPT_ARG_RQ, 'o', "output", "Output", DF_OPT_EXPAND, + { DF_WOPT_OUTPUT, DF_OPT_EXPAND | DF_OPT_ARG_RQ, 'o', "output", "Output", "PATH", "write data to a dirfile called PATH" }, - { DF_WOPT_QUIET, DF_OPT_NO_ARG, 'q', "quiet", "Quiet", 0, NULL, + { DF_WOPT_QUIET, DF_OPT_NO_ARG, 'q', "quiet", "Quiet", NULL, "be less verbose" }, - { DF_WOPT_VERBOSE, DF_OPT_NO_ARG, 'q', "verbose", "Verbose", DF_OPT_PLUS, + { DF_WOPT_VERBOSE, DF_OPT_PLUS | DF_OPT_NO_ARG, 'q', "verbose", "Verbose", NULL, "be normally verbose" }, - { DF_WOPT_SKIP, DF_OPT_ARG_RQ, 's', "skip", "SkipFrames", 0, "NUM", + { DF_WOPT_SKIP, DF_OPT_ARG_RQ, 's', "skip", "SkipFrames", "NUM", "skip the first NUM frames of the input (default: 0)" }, - { DF_WOPT_TYPE, DF_OPT_ARG_RQ, 't', "type", "InputType", 0, "TYPE", + { DF_WOPT_TYPE, DF_OPT_ARG_RQ, 't', "type", "InputType", "TYPE", "use TYPE as the input data type" }, - { DF_WOPT_AUTOTYPE, DF_OPT_NO_ARG, 't', "autotype", "AutoType", DF_OPT_PLUS, - NULL, "attempt to automatically determine the data type of the input" + { DF_WOPT_AUTOTYPE, DF_OPT_PLUS | DF_OPT_NO_ARG, 't', "autotype", + "AutoType", NULL, + "attempt to automatically determine the data type of the input" }, #if 0 - { DF_WOPT_GZIP, DF_OPT_NO_ARG, 'z', "gzip", "GZip", 0, NULL, + { DF_WOPT_GZIP, DF_OPT_NO_ARG, 'z', "gzip", "GZip", NULL, "gzip compress the output raw data" }, #endif - { DF_WOPT_REMOTE, DF_OPT_ARG_RQ, 'R', "remote", "RemoteHost", 0, + { DF_WOPT_REMOTE, DF_OPT_ARG_RQ, 'R', "remote", "RemoteHost", "{ HOST:PORT | [USER@]HOST }", "read from remote host HOST. In the first" " form, connect to the server listening on port PORT, otherwise start " "a remote defile (as user USER, if given)" }, - { DF_WOPT_LOCAL, DF_OPT_NO_ARG, 'R', "local", "Local", DF_OPT_PLUS, + { DF_WOPT_LOCAL, DF_OPT_PLUS | DF_OPT_NO_ARG, 'R', "local", "Local", NULL, "do not read data over the network (default)" }, - { DF_WOPT_RSH, DF_OPT_ARG_RQ, 0, "rsh", "RemoteShell", 0, "COMMAND", + { DF_WOPT_RSH, DF_OPT_ARG_RQ, 0, "rsh", "RemoteShell", "COMMAND", "use COMMAND to log in to a remote host; (default: ssh)" }, - { DF_WOPT_RCMD, DF_OPT_ARG_RQ, 0, "remote-command", "RemoteCommand", 0, + { DF_WOPT_RCMD, DF_OPT_ARG_RQ, 0, "remote-command", "RemoteCommand", "PROGRAM", "use PATH as the defile to run on the remote host; (default: " "defile)" }, - { DF_WOPT_LISTEN, DF_OPT_ARG_RQ, 'L', "listen", "Listen", 0, "PORT", + { DF_WOPT_LISTEN, DF_OPT_ARG_RQ, 'L', "listen", "Listen", "PORT", "run a defile server, listening on port PORT; in this case, no output " "dirfile is created on the local system" }, - { DF_WOPT_NOLISTEN, DF_OPT_NO_ARG, 'L', "no-listen", "NoListen", - DF_OPT_PLUS, NULL, "don't run a server (default)" + { DF_WOPT_NOLISTEN, DF_OPT_PLUS | DF_OPT_NO_ARG, 'L', "no-listen", + "NoListen", NULL, "don't run a server (default)" }, - { DF_WOPT_RDEBUG, DF_OPT_ARG_OP, 0, "remote-debug", "RemoteDebug", 0, + { DF_WOPT_RDEBUG, DF_OPT_ARG_OP, 0, "remote-debug", "RemoteDebug", "WHAT", "print debugging messages from the remote defile restricted to " "WHAT (or everything)" }, - { DF_WOPT_NORDEBUG, DF_OPT_NO_ARG, 0, "no-remote-debug", "NoRemoteDebug", 0, + { DF_WOPT_NORDEBUG, DF_OPT_NO_ARG, 0, "no-remote-debug", "NoRemoteDebug", NULL, "don't print debugging messages from the remote defile (default)" }, { DF_WOPT_SRVRATE, DF_OPT_ARG_RQ, 0, "server-bwlimit", "ServerBandwidth", - 0, "RATE", "limit data rate of a server to RATE megabits per second " + "RATE", "limit data rate of a server to RATE megabits per second " "(default: 10)" }, - { DF_WOPT_DAEMON, DF_OPT_NO_ARG, 0, "daemon", "Daemon", 0, NULL, + { DF_WOPT_DAEMON, DF_OPT_NO_ARG, 0, "daemon", "Daemon", NULL, "when running a server, daemonise on start up (default)" }, - { DF_WOPT_NODAEMON, DF_OPT_NO_ARG, 0, "no-daemon", "NoDaemon", 0, NULL, + { DF_WOPT_NODAEMON, DF_OPT_NO_ARG, 0, "no-daemon", "NoDaemon", NULL, "when running a server, don't daemonise on start up" }, + { DF_WOPT_SYMLINK, DF_OPT_ARG_RQ, 'S', "symlink", "Symlink", "PATH", + "maintain a symlink called PATH to the current output dirfile" + }, + { DF_WOPT_NOSYMLINK, DF_OPT_PLUS | DF_OPT_NO_ARG, 'S', "no-symlink", + "NoSymlink", NULL, "don't maintain a symlink (default)" + }, + { DF_WOPT_CURFILE, DF_OPT_ARG_RQ, 'C', "curfile", "CurFile", "PATH", + "write a curfile called PATH" + }, + { DF_WOPT_NOCURFILE, DF_OPT_PLUS | DF_OPT_NO_ARG, 'C', "no-curfile", + "NoCurFile", NULL, "don't write a curfile (default)" + }, DF_OPT_ENDOPT }; Modified: trunk/defile/bin/rc.c =================================================================== --- trunk/defile/bin/rc.c 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/bin/rc.c 2013-03-10 19:40:23 UTC (rev 812) @@ -66,6 +66,14 @@ "this plugin; if not, write to the Free Software Foundation, Inc.,\n" \ "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n" +/* option flags we're not yet prepared to put in the public API */ +#define DF_OPT_SREDIR (DF_OPT_SPECIAL | 0x1) +#define DF_OPT_SH_ONE (DF_OPT_SPECIAL | 0x2) +#define DF_OPT_SH_TGL (DF_OPT_SPECIAL | 0x3) +#define DF_OPT_ANT_OP (DF_OPT_SPECIAL | 0x4) +#define DF_OPT_SHIFT 0x080 /* short option is shifted */ +#define DF_OPT_NOSHIFT 0x100 /* short option ignores shift */ + static const struct df_optdef df_no_opts[] = { DF_OPT_ENDOPT }; @@ -145,10 +153,14 @@ int pos = 7; char sopt[5] = " "; + /* skip specials */ + if (opt->bits & DF_OPT_SPECIAL) + return; + /* short option */ if (opt->sopt) { - sopt[0] = (opt->flags & DF_OPT_PLUS) ? '+' : '-'; - if (opt->flags & DF_OPT_SHIFT) { + sopt[0] = (opt->bits & DF_OPT_PLUS) ? '+' : '-'; + if (opt->bits & DF_OPT_SHIFT) { sopt[1] = shift_char; sopt[2] = opt->sopt; sopt[3] = ','; @@ -163,10 +175,10 @@ /* long option */ if (opt->lopt) { pos += df_iprintf(DF_PRN_CLEAR, DF_PRN_NOTE, "--%s", opt->lopt); - if (opt->type == DF_OPT_ARG_RQ) + if ((opt->bits & DF_OPT_MASK) == DF_OPT_ARG_RQ) pos += df_iprintf(DF_PRN_CLEAR, DF_PRN_NOTE, "=%s", opt->argname ? opt->argname : "ARG"); - else if (opt->type == DF_OPT_ARG_OP) + else if ((opt->bits & DF_OPT_MASK) == DF_OPT_ARG_OP) pos += df_iprintf(DF_PRN_CLEAR, DF_PRN_NOTE, "[=%s]", opt->argname ? opt->argname : "ARG"); } @@ -247,9 +259,9 @@ val = (asopt <= b->lopt[0]) ? -1 : 1; } else if (asopt == bsopt) { if (a->sopt == b->sopt) { - if ((a->flags & DF_OPT_PLUS) && !(b->flags & DF_OPT_PLUS)) + if ((a->bits & DF_OPT_PLUS) && !(b->bits & DF_OPT_PLUS)) val = 1; - else if (!(a->flags & DF_OPT_PLUS) && (b->flags & DF_OPT_PLUS)) + else if (!(a->bits & DF_OPT_PLUS) && (b->bits & DF_OPT_PLUS)) val = -1; else val = 0; /* the same short option! that'll prove problematic later */ @@ -307,8 +319,11 @@ "mandatory for short options too.\n\n"); /* Count the options */ - for (nopt = 0; rcd->options[nopt].type != DF_OPT_END_OO; ++nopt) + for (nopt = 0; (rcd->options[nopt].bits & DF_OPT_MASK) != DF_OPT_END_OO; + ++nopt) + { ; + } /* Sort the options */ opt = malloc(sizeof(struct df_optdef*) * nopt); @@ -385,9 +400,9 @@ char *ptr = message + strlen(message); int len = 1023 - strlen(message); if (config->sopt > 0) { - if (opt->flags & DF_OPT_PLUS) + if (opt->bits & DF_OPT_PLUS) sign = '+'; - if (opt->flags & DF_OPT_SHIFT) + if (opt->bits & DF_OPT_SHIFT) shift[0] = rcd->shift_one; snprintf(ptr, len, " short option %c%s%c", sign, shift, opt->sopt); @@ -451,6 +466,7 @@ { const struct df_optdef *opt = rcd->options + i; const int fac = (rcd->name == NULL) ? DF_PRN_DF : DF_PRN_INPUT; + const unsigned int opt_type = opt ? (opt->bits & DF_OPT_MASK) : 0; if (i < 0) opt = NULL; @@ -458,12 +474,12 @@ logprintf(" Pushing %s for %i(=%i) at %u (%i)\n", val, i, rcd->options[i].value, rcd->confc, line); if (opt) { - if (opt->type == DF_OPT_CONFIG) { + if (opt_type == DF_OPT_CONFIG) { DF_DoRunControl(val, cwd, label, line, rcd); return; } - if (val && opt->flags & DF_OPT_EXPAND) { + if (val && opt->bits & DF_OPT_EXPAND) { char *expanded = df_rc_shell_expand(fac, val); if (expanded) { val = expanded; @@ -484,13 +500,13 @@ } rcd->config[rcd->confc].error = error; - if ((opt == NULL || opt->type != DF_OPT_NO_ARG || opt->type == DF_OPT_SREDIR) + if ((opt == NULL || opt_type != DF_OPT_NO_ARG || opt_type == DF_OPT_SREDIR) && val != NULL) { rcd->config[rcd->confc].argument = (no_dup) ? (char *)val : strdup(val); } else { rcd->config[rcd->confc].argument = NULL; - if (opt && opt->type == DF_OPT_ARG_RQ) + if (opt && opt_type == DF_OPT_ARG_RQ) rcd->config[rcd->confc].error = DF_RC_ERR_NO_ARG; } @@ -629,7 +645,7 @@ /* match directive */ found = 0; - for (i = 0; rcd->options[i].type != DF_OPT_END_OO; ++i) + for (i = 0; (rcd->options[i].bits & DF_OPT_MASK) != DF_OPT_END_OO; ++i) if (strcasecmp(opt, rcd->options[i].directive) == 0) { DF_PushConfig(i, val, DF_RC_ERR_OK, 0, cwd, label, ln, 0, rcd); found = 1; @@ -664,18 +680,19 @@ if (shift & SHIFT_NEXT) shift = SHIFT_THIS | ((shift & SHIFT_ON) ^ SHIFT_ON); - for (k = 0; rcd->options[k].type != DF_OPT_END_OO; ++k) + for (k = 0; (rcd->options[k].bits & DF_OPT_MASK) != DF_OPT_END_OO; ++k) if (c == rcd->options[k].sopt) { + const unsigned int opt_type = rcd->options[k].bits & DF_OPT_MASK;; /* check plus */ - if ((plus && !(rcd->options[k].flags & DF_OPT_PLUS)) || - (!plus && (rcd->options[k].flags & DF_OPT_PLUS))) + if ((plus && !(rcd->options[k].bits & DF_OPT_PLUS)) || + (!plus && (rcd->options[k].bits & DF_OPT_PLUS))) { continue; } /* check shift */ - if (!(rcd->options[k].flags & DF_OPT_NOSHIFT)) { - if (((shift & SHIFT_ON) && !(rcd->options[k].flags & DF_OPT_SHIFT)) || - (!(shift & SHIFT_ON) && (rcd->options[k].flags & DF_OPT_SHIFT))) + if (!(rcd->options[k].bits & DF_OPT_NOSHIFT)) { + if (((shift & SHIFT_ON) && !(rcd->options[k].bits & DF_OPT_SHIFT)) || + (!(shift & SHIFT_ON) && (rcd->options[k].bits & DF_OPT_SHIFT))) { continue; } @@ -685,31 +702,28 @@ j, k, rcd->options[k].sopt, rcd->options[k].lopt, rcd->options[k].directive, anti, shift); - if (rcd->options[k].type == DF_OPT_CONFIG) { + if (opt_type == DF_OPT_CONFIG) { shortarg[*nshortargs].position = DF_OPT_CONFIG; shortarg[*nshortargs].required = 1; shortarg[(*nshortargs)++].option = k; - } else if (rcd->options[k].type == DF_OPT_SH_ONE) + } else if (opt_type == DF_OPT_SH_ONE) shift |= SHIFT_NEXT; - else if (rcd->options[k].type == DF_OPT_SH_TGL) + else if (opt_type == DF_OPT_SH_TGL) shift ^= SHIFT_ON; - else if (rcd->options[k].type == DF_OPT_ANT_OP) + else if (opt_type == DF_OPT_ANT_OP) anti = !anti; else { - if (rcd->options[k].type == DF_OPT_SREDIR) { + if (opt_type == DF_OPT_SREDIR) { DF_PushConfig(k, rcd->options[k].lopt, DF_RC_ERR_REDIR, 0, ".", NULL, i, j, rcd); - k = rcd->options[k].flags; + k = rcd->options[k].lopt[0]; } DF_PushConfig(k, NULL, DF_RC_ERR_OK, 0, ".", NULL, i, j, rcd); - if (rcd->options[k].type == DF_OPT_ARG_RQ || - rcd->options[k].type == DF_OPT_ARG_OP) - { + if (opt_type == DF_OPT_ARG_RQ || opt_type == DF_OPT_ARG_OP) { shortarg[*nshortargs].position = rcd->confc - 1; - shortarg[*nshortargs].required = - (rcd->options[k].type == DF_OPT_ARG_RQ) ? 1 : 0; + shortarg[*nshortargs].required = (opt_type == DF_OPT_ARG_RQ) ? 1 : 0; shortarg[(*nshortargs)++].option = k; } } @@ -741,9 +755,11 @@ const int fac = (rcd->name == NULL) ? DF_PRN_DF : DF_PRN_INPUT; /* Find the shift character */ - for (i = 0; rcd->options[i].type != DF_OPT_END_OO; ++i) - if (rcd->options[i].type == DF_OPT_SH_ONE) + for (i = 0; (rcd->options[i].bits & DF_OPT_MASK) != DF_OPT_END_OO; ++i) + if ((rcd->options[i].bits & DF_OPT_MASK) == DF_OPT_SH_ONE) { rcd->shift_one = rcd->options[i].sopt; + break; + } logprintf(" Shift character is %c\n", rcd->shift_one); shortarg = (struct shortarg*)malloc(argc * sizeof(struct shortarg)); @@ -790,7 +806,9 @@ /* match long option */ found = 0; - for (k = 0; rcd->options[k].type != DF_OPT_END_OO; ++k) { + for (k = 0; (rcd->options[k].bits & DF_OPT_MASK) != DF_OPT_END_OO; + ++k) + { if (rcd->options[k].lopt != 0 && strcmp(&argv[i][2], rcd->options[k].lopt) == 0) { @@ -844,7 +862,7 @@ rcd->config[shortarg[j].position].line = i; rcd->config[shortarg[j].position].error = DF_RC_ERR_OK; - if (rcd->options[shortarg[j].option].flags & DF_OPT_EXPAND) + if (rcd->options[shortarg[j].option].bits & DF_OPT_EXPAND) rcd->config[shortarg[j].position].argument = df_rc_shell_expand(fac, argv[i]); else @@ -920,7 +938,7 @@ else if (rcd->config[i].error == DF_RC_ERR_REDIR) { df_config_error(DF_CERR_INFO, rcd->config + i, rcd, "option %c%c deprecated (translated to %s)", - (rcd->options[rcd->config[i].optind].flags & DF_OPT_PLUS) ? '+' + (rcd->options[rcd->config[i].optind].bits & DF_OPT_PLUS) ? '+' : '-', rcd->options[rcd->config[i].optind].sopt, rcd->config[i].argument); } else Modified: trunk/defile/doc/defile-input.7 =================================================================== --- trunk/defile/doc/defile-input.7 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/doc/defile-input.7 2013-03-10 19:40:23 UTC (rev 812) @@ -195,11 +195,10 @@ .fam C struct df_optdef { int value; - int type; + unsigned int bits; char sopt; const char *lopt; const char *directive; - unsigned int flags; const char *argname; const char *usage; }; @@ -211,9 +210,11 @@ .I value is a positive number used by defile to indentify the option to the input plugin. Bare arguments among the input options (those not associated with an option) are -assigned a value of zero, so that should be avoided in the definition of input +assigned a value of zero, which should be avoided in the definition of input options. Unless two options should be treated as identical, each option should -have a unique value. There is no requirement that consequitive values be used. +have a unique value. There is no requirement that consequitive values be used, +nor that the option records be sorted by value. +.IP After parsing the input options, defile will present the input plugin an array of (value, argument) pairs. See the .B Start State @@ -222,44 +223,39 @@ for information on how the value is used. Negative values are used internally by defile for bookkeeping purposes and should be avoided. .TP -.I type +.I bits should be one of the following symbols indicating the type of option: .RS .TP .B DF_OPT_NO_ARG -an option which takes no argument +an option which takes no argument; .TP .B DF_OPT_ARG_OP -an option which takes an optional argument +an option which takes an optional argument; .TP .B DF_OPT_ARG_RQ -an option which requires an argument +an option which takes a required argument; +.TP +.B DF_OPT_CONFIG +an option which takes the name of a run control file to parse (that is, an +option which behaves identically to the +.B \-\-conf +argument recognised by the +.BR defile (1) +core). .RE -.TP -.I sopt -a character giving the name of the short (one character) command-line option -which matches this option record. This should be a lower or upper-case letter -(case is significant). If no short option is defined, this should be zero. -.TP -.I lopt -a character string giving the name of the long command-line option (excluding -the initial double dash) which matches this option record. If no long option is -defined, this should be NULL. -.TP -.I directive -a character string giving the name of the run control directive which matches -this option record. If no directive is defined, this should be NULL. -.TP -.I flags -zero or more of the following flags, bitwise or'd together, providing further -information on how the option should be interpreted: +.IP +These may be optionally bitwise or'd with zero or more of the following flags +which provide further information on how the option should be interpreted: .RS .TP .B DF_OPT_EXPAND the argument to the option should be shell expanded before being given to the input plugin. This is typically useful for options which take filenames as -arguments. If the option is of type -.BR DF_OPT_NO_ARG , +arguments. If the option is not of type +.BR DF_OPT_ARG_RQ +or +.BR DF_OPT_ARG_OP , this flag is ignored. .TP .B DF_OPT_PLUS @@ -277,6 +273,20 @@ is ignored. .RE .TP +.I sopt +a character giving the name of the short (one character) command-line option +which matches this option record. This should be a lower or upper-case letter +(case is significant). If no short option is defined, this should be zero. +.TP +.I lopt +a character string giving the name of the long command-line option (excluding +the initial double dash) which matches this option record. If no long option is +defined, this should be NULL. +.TP +.I directive +a character string giving the name of the run control directive which matches +this option record. If no directive is defined, this should be NULL. +.TP .I argname the placeholder name of the argument used in usage output. For stylistic consitency, it is recommended this consist of upper case letters only. If the @@ -313,9 +323,8 @@ .BR \-\-conf , and the directive .B Input -which are handled specially, as they are in the defile options. See -.BR defile (1) -for their use. Even if an input plugin provides no input options (by setting +which are handled specially, as they are in the defile options. Even if an +input plugin provides no input options (by setting .I opts to zero, these are always accepted as input options by defile. Briefly, .B \-\-help @@ -327,16 +336,18 @@ .B \-\-conf and .B Include -specify additional run control files to read for more configuration (see -.BR defile (1)). +specify additional run control files to read for more configuration. See +.BR defile (1) +for their use. .SH HELP AND VERSION OUTPUT When .B \-\-help is found among the input options, defile generates a usage text for the input -plugin based on the information provided and writes it on standard error, and -then exits succesfully. This usage text consists of, in order: +plugin based on the information provided by the input plugin, writes it on +standard error, and then exits succesfully. This usage text comprises, in +order: .IP \(bu the name, version and copyright string of the module; .IP \(bu @@ -347,7 +358,7 @@ a sorted and formatted list of the input options, including their usage strings, generated from the input option list .I opts -given in the framework definiition; +given in the framework definiition, if present; .IP \(bu the .I postamble @@ -362,8 +373,8 @@ .B \-\-version is found among the input options, defile generates a version and licensing text for the input plugin based on information provided and writes it on standard -error, and then exits successfully. The version and licensing text consists -of, in order: +error, and then exits successfully. The version and licensing text comprises, +in order: .IP \(bu the name, version and copyright string of the module; .IP \(bu Modified: trunk/defile/input/ascii.c =================================================================== --- trunk/defile/input/ascii.c 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/input/ascii.c 2013-03-10 19:40:23 UTC (rev 812) @@ -64,61 +64,61 @@ }; static const struct df_optdef ascii_opts[] = { - { ASCII_OPT_COMMENT, DF_OPT_ARG_RQ, 'c', "comment", "CommentDelim", 0, + { ASCII_OPT_COMMENT, DF_OPT_ARG_RQ, 'c', "comment", "CommentDelim", "DELIM", "comments start with DELIM (default: \"#\")" }, - { ASCII_OPT_SDELIM, DF_OPT_ARG_RQ, 0, "start-delim", "StarDelimiter", 0, + { ASCII_OPT_SDELIM, DF_OPT_ARG_RQ, 0, "start-delim", "StarDelimiter", "DELIM", "start-of-field is delimited by DELIM" }, - { ASCII_OPT_EDELIM, DF_OPT_ARG_RQ, 0, "end-delim", "EndDelimiter", 0, "DELIM", + { ASCII_OPT_EDELIM, DF_OPT_ARG_RQ, 0, "end-delim", "EndDelimiter", "DELIM", "end-of-field is delimited by DELIM" }, { ASCII_OPT_DELIM_REQ, DF_OPT_NO_ARG, 'd', "delim-req", "DelimitersRequired", - 0, NULL, "field delimiters are mandatory" }, - { ASCII_OPT_DELIM_OPT, DF_OPT_NO_ARG, 'd', "delim-opt", "DelimitersOptional", - DF_OPT_PLUS, NULL, "field delimiters are optional (default)" }, - { ASCII_OPT_ESCAPE, DF_OPT_ARG_RQ, 'e', "escape", "EscapeChar", 0, "CHAR", + NULL, "field delimiters are mandatory" }, + { ASCII_OPT_DELIM_OPT, DF_OPT_PLUS | DF_OPT_NO_ARG, 'd', "delim-opt", + "DelimitersOptional", NULL, "field delimiters are optional (default)" }, + { ASCII_OPT_ESCAPE, DF_OPT_ARG_RQ, 'e', "escape", "EscapeChar", "CHAR", "use CHAR as the character escape (default: \"\\\")" }, { ASCII_OPT_NO_MIC, DF_OPT_NO_ARG, 'm', "no-meta-comments", - "MetadataSkipComments", 0, NULL, "metadata don't appear in comments" }, - { ASCII_OPT_MIC, DF_OPT_NO_ARG, 'm', "meta-comments", - "MetadataInComments", DF_OPT_PLUS, NULL, "metadata appear in comments" }, - { ASCII_OPT_NAMEROW, DF_OPT_NO_ARG, 'n', "names", "Names", 0, NULL, + "MetadataSkipComments", NULL, "metadata don't appear in comments" }, + { ASCII_OPT_MIC, DF_OPT_PLUS | DF_OPT_NO_ARG, 'm', "meta-comments", + "MetadataInComments", NULL, "metadata appear in comments" }, + { ASCII_OPT_NAMEROW, DF_OPT_NO_ARG, 'n', "names", "Names", NULL, "read field names from the first row" }, - { ASCII_OPT_QUOTE, DF_OPT_NO_ARG, 'q', "quoted", "Quoted", 0, NULL, + { ASCII_OPT_QUOTE, DF_OPT_NO_ARG, 'q', "quoted", "Quoted", NULL, "equivalent to --start-delim=\\\" --end-delim=\\\"" }, - { ASCII_OPT_SEPAR, DF_OPT_ARG_RQ, 's', "sep", "Separator", 0, "SEPAR", + { ASCII_OPT_SEPAR, DF_OPT_ARG_RQ, 's', "sep", "Separator", "SEPAR", "fields are separated by SEPAR (default: \",\")" }, - { ASCII_OPT_SEP_SET, DF_OPT_NO_ARG, 'S', "sep-set", "SepSet", 0, NULL, + { ASCII_OPT_SEP_SET, DF_OPT_NO_ARG, 'S', "sep-set", "SepSet", NULL, "the SEPAR specified with -s is a set of characters, not a literal string"}, - { ASCII_OPT_SEP_STR, DF_OPT_NO_ARG, 'S', "sep-literal", "SepLiteral", - DF_OPT_PLUS, NULL, "the SEPAR specified with -s is a literal string, not a " - "set of characters (default)" }, - { ASCII_OPT_SKIP, DF_OPT_ARG_RQ, 0, "skip", "SkipRows", 0, "NUM", + { ASCII_OPT_SEP_STR, DF_OPT_PLUS | DF_OPT_NO_ARG, 'S', "sep-literal", + "SepLiteral", NULL, "the SEPAR specified with -s is a literal string, not " + "a set of characters (default)" }, + { ASCII_OPT_SKIP, DF_OPT_ARG_RQ, 0, "skip", "SkipRows", "NUM", "skip the first NUM rows" }, - { ASCII_OPT_WS, DF_OPT_NO_ARG, 'W', "whitespace", "WhiteSpace", 0, NULL, + { ASCII_OPT_WS, DF_OPT_NO_ARG, 'W', "whitespace", "WhiteSpace", NULL, "use space and tab as a separator set" }, - { ASCII_OPT_WIDTH, DF_OPT_ARG_RQ, 'w', "width", "FixedWidth", 0, + { ASCII_OPT_WIDTH, DF_OPT_ARG_RQ, 'w', "width", "FixedWidth", "NUM1[,NUM2]...", "columns have fixed width of NUM1, NUM2, &c. characters; " "if only NUM1 given, all columns have that width" }, - { ASCII_OPT_CONSTS, DF_OPT_ARG_RQ, 0, "const-row", "ConstRow", 0, - "NAME[,TYPE]", "create CONST metafields called NAME (of type TYPE) " - "from the values in the next header row" }, - { ASCII_OPT_STRINGS, DF_OPT_ARG_RQ, 0, "string-row", "StringRow", 0, "NAME", + { ASCII_OPT_CONSTS, DF_OPT_ARG_RQ, 0, "const-row", "ConstRow", "NAME[,TYPE]", + "create CONST metafields called NAME (of type TYPE) from the values in the " + "next header row" }, + { ASCII_OPT_STRINGS, DF_OPT_ARG_RQ, 0, "string-row", "StringRow", "NAME", "create STRING metafields called NAME from the values in the next header " "row" }, - { ASCII_OPT_FILTER, DF_OPT_ARG_RQ, 'f', "filter", "Filter", 0, "COMMAND", + { ASCII_OPT_FILTER, DF_OPT_ARG_RQ, 'f', "filter", "Filter", "COMMAND", "filter the input though external filter COMMAND before processing" }, - { ASCII_OPT_NO_HEADER, DF_OPT_NO_ARG, 0, "clear-header", "ClearHeader", - DF_OPT_PLUS, NULL, "forget all previous CONST and STRING row definitions" }, - { ASCII_OPT_NO_FILT, DF_OPT_NO_ARG, 'f', "clear-filters", "ClearFilters", - DF_OPT_PLUS, NULL, "forget all previously defined filters" }, - { ASCII_OPT_TAB, DF_OPT_NO_ARG, 'T', "tab", "TabSeparated", 0, NULL, + { ASCII_OPT_NO_HEADER, DF_OPT_PLUS | DF_OPT_NO_ARG, 0, "clear-header", + "ClearHeader", NULL, "ignore any previous header definition" }, + { ASCII_OPT_NO_FILT, DF_OPT_PLUS | DF_OPT_NO_ARG, 'f', "clear-filters", + "ClearFilters", NULL, "forget all previously defined filters" }, + { ASCII_OPT_TAB, DF_OPT_NO_ARG, 'T', "tab", "TabSeparated", NULL, "use tab as separator" }, - { ASCII_OPT_TYPE, DF_OPT_ARG_RQ, 't', "type", "DataType", 0, "[COL,]TYPE", + { ASCII_OPT_TYPE, DF_OPT_ARG_RQ, 't', "type", "DataType", "[COL,]TYPE", "store data in column number COL (or all columns) as TYPE " "(default FLOAT64)" }, - { ASCII_OPT_LAZY, DF_OPT_NO_ARG, 'l', "lazy", "Lazy", 0, NULL, + { ASCII_OPT_LAZY, DF_OPT_NO_ARG, 'l', "lazy", "Lazy", NULL, "allow trailing unrecognised characters in an entry" }, - { ASCII_OPT_STRICT, DF_OPT_NO_ARG, 'l', "strict", "Strict", DF_OPT_PLUS, NULL, - "require a whole entry be parsed as a number (default)" }, + { ASCII_OPT_STRICT, DF_OPT_PLUS | DF_OPT_NO_ARG, 'l', "strict", "Strict", + NULL, "require a whole entry be parsed as a number (default)" }, DF_OPT_ENDOPT }; Modified: trunk/defile/input/dirfile.c =================================================================== --- trunk/defile/input/dirfile.c 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/input/dirfile.c 2013-03-10 19:40:23 UTC (rev 812) @@ -87,36 +87,36 @@ }; static const struct df_optdef opts[] = { - { OPT_EXPAND_ALL, DF_OPT_NO_ARG, 'E', "expand-all", "ExpandAll", 0, NULL, + { OPT_EXPAND_ALL, DF_OPT_NO_ARG, 'E', "expand-all", "ExpandAll", NULL, "expand all derived channels (turn them into RAW channels)" }, - { OPT_EXPAND_NONE, DF_OPT_NO_ARG, 'E', "expand-none", "ExpandNone", - DF_OPT_PLUS, NULL, "keep all derived channels as-is (default)" }, - { OPT_EXPAND, DF_OPT_ARG_RQ, 'e', "expand", "Expand", 0, "FIELD", + { OPT_EXPAND_NONE, DF_OPT_PLUS | DF_OPT_NO_ARG, 'E', "expand-none", + "ExpandNone", NULL, "keep all derived channels as-is (default)" }, + { OPT_EXPAND, DF_OPT_ARG_RQ, 'e', "expand", "Expand", "FIELD", "expand derived channel FIELD (turn it into a RAW channel)" }, - { OPT_NO_EXPAND, DF_OPT_ARG_RQ, 'e', "no-expand", "NoExpand", DF_OPT_PLUS, + { OPT_NO_EXPAND, DF_OPT_PLUS | DF_OPT_ARG_RQ, 'e', "no-expand", "NoExpand", "FIELD", "don't expand derived channel FIELD" }, - { OPT_FLATTEN, DF_OPT_NO_ARG, 'f', "flatten", "Flatten", 0, NULL, + { OPT_FLATTEN, DF_OPT_NO_ARG, 'f', "flatten", "Flatten", NULL, "merge all fragments into one" }, - { OPT_NO_FLATTEN, DF_OPT_NO_ARG, 'f', "no-flatten", "NoFlatten", DF_OPT_PLUS, + { OPT_NO_FLATTEN, DF_OPT_PLUS | DF_OPT_NO_ARG, 'f', "no-flatten", "NoFlatten", NULL, "don't merge all fragments into one (default)" }, - { OPT_LINK_LUT, DF_OPT_NO_ARG, 'L', "link-extern-luts", "LinkExternLUTs", 0, + { OPT_LINK_LUT, DF_OPT_NO_ARG, 'L', "link-extern-luts", "LinkExternLUTs", NULL, "link to LINTERP tables outside the source dirfile instead of " "duplicating them" }, - { OPT_COPY_LUT, DF_OPT_NO_ARG, 'L', "copy-extern-lut", "CopyExternLUTs", - DF_OPT_PLUS, NULL, + { OPT_COPY_LUT, DF_OPT_PLUS | DF_OPT_NO_ARG, 'L', "copy-extern-lut", + "CopyExternLUTs", NULL, "duplicate LINTERP tables outside the source dirfile (default)" }, { OPT_LINK_EXT, DF_OPT_NO_ARG, 'X', "link-extern-frags", "LinkExternFrags", - 0, NULL, + NULL, "link to fragments outside the source dirfile instead of duplicating them" }, - { OPT_COPY_EXT, DF_OPT_NO_ARG, 'X', "copy-extern-frags", "CopyExternFrags", - DF_OPT_PLUS, NULL, + { OPT_COPY_EXT, DF_OPT_PLUS | DF_OPT_NO_ARG, 'X', "copy-extern-frags", + "CopyExternFrags", NULL, "duplicate fragments outside the source dirfile (default)" }, - { OPT_EXT_DIR, DF_OPT_ARG_RQ, 0, "ext-dir", "ExtDir", 0, "DIR", + { OPT_EXT_DIR, DF_OPT_ARG_RQ, 0, "ext-dir", "ExtDir", "DIR", "put external subdirfiles copied into the output in subdirectory DIR. " "The default is \"<ext>\"" }, - { OPT_LUT_DIR, DF_OPT_ARG_RQ, 0, "lut-dir", "LUTDir", 0, "DIR", + { OPT_LUT_DIR, DF_OPT_ARG_RQ, 0, "lut-dir", "LUTDir", "DIR", "put LINTERP lookup tables copied into the output in subdirectory DIR. " "The default is \"<lut>\"" }, DF_OPT_ENDOPT Modified: trunk/defile/lib/defile.h =================================================================== --- trunk/defile/lib/defile.h 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/lib/defile.h 2013-03-10 19:40:23 UTC (rev 812) @@ -29,24 +29,23 @@ #endif #include <getdata.h> -/* command line options */ +/* command line option types */ #define DF_OPT_NO_ARG ( 0) /* option takes no argument */ #define DF_OPT_ARG_OP ( 1) /* option takes optional argument */ #define DF_OPT_ARG_RQ ( 2) /* option takes required argument */ -#define DF_OPT_CONFIG (-1) /* option specifies a config file to read */ -#define DF_OPT_SREDIR (-2) /* deprecated (redirected) short option */ -#define DF_OPT_SH_ONE (-4) /* shift next short option */ -#define DF_OPT_SH_TGL (-5) /* toggle into and out of shift mode */ -#define DF_OPT_ANT_OP (-6) /* togle into and out of antimode */ -#define DF_OPT_END_OO (-7) /* end of options closure */ -#define DF_OPT_EXPAND 0x01 /* option requires shell expansion */ -#define DF_OPT_PLUS 0x02 /* short option is preceded by + not - */ -#define DF_OPT_SHIFT 0x04 /* short option is shifted */ -#define DF_OPT_NOSHIFT 0x08 /* short option ignores shift */ +/* special df_optdef entries */ +#define DF_OPT_MASK 0x1F +#define DF_OPT_SPECIAL 0x10 +#define DF_OPT_CONFIG (DF_OPT_SPECIAL | 0x0) +#define DF_OPT_END_OO (DF_OPT_SPECIAL | 0xF) -#define DF_OPT_FILLED(x,y) 0,x,y,"","",0,NULL,NULL +/* option flags */ +#define DF_OPT_EXPAND 0x020 /* option requires shell expansion */ +#define DF_OPT_PLUS 0x040 /* short option is preceded by + not - */ +#define DF_OPT_FILLED(x,y) 0,x,y,"","",NULL,NULL + #define DF_OPT_SHIFT_ONE(y) DF_OPT_FILLED(DF_OPT_SH_ONE,y) #define DF_OPT_SHIFT_TGL(y) DF_OPT_FILLED(DF_OPT_SH_TGL,y) #define DF_OPT_ANTI(y) DF_OPT_FILLED(DF_OPT_ANT_OP,y) @@ -58,11 +57,10 @@ struct df_optdef { int value; /* option value */ - int type; /* option type */ + unsigned int bits; /* option type and flags */ char sopt; /* short option */ const char *lopt; /* long option */ const char *directive; /* directive */ - unsigned int flags; /* option flags */ const char *argname; /* option argument name (for --help) */ const char *usage; /* option --help string */ }; Modified: trunk/defile/lib/internal.h =================================================================== --- trunk/defile/lib/internal.h 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/lib/internal.h 2013-03-10 19:40:23 UTC (rev 812) @@ -242,6 +242,8 @@ char *type; char *output; char *dirfile; + char *curfile; + char *symlink; char orig_cwd[4096]; int cutdir; Modified: trunk/defile/lib/libdefile.c =================================================================== --- trunk/defile/lib/libdefile.c 2013-03-09 05:08:59 UTC (rev 811) +++ trunk/defile/lib/libdefile.c 2013-03-10 19:40:23 UTC (rev 812) @@ -711,7 +711,7 @@ int fragment, int set_buf) { const int append = df_mode() & DF_MODE_APPEND; - int r, is_new = 0, added = 0; + int r, is_new = 0; void *ptr; /* check the OFL */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-09 05:09:03
|
Revision: 811 http://sourceforge.net/p/getdata/code/811 Author: ketiltrout Date: 2013-03-09 05:08:59 +0000 (Sat, 09 Mar 2013) Log Message: ----------- Defer gd_add_raw if there aren't any samples yet; also don't require an INPUT in client mode. Modified Paths: -------------- trunk/defile/bin/defile.c trunk/defile/doc/defile-ascii.1 trunk/defile/lib/internal.h trunk/defile/lib/libdefile.c Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-03-09 05:07:16 UTC (rev 810) +++ trunk/defile/bin/defile.c 2013-03-09 05:08:59 UTC (rev 811) @@ -2621,7 +2621,9 @@ df_parse(df->iargc, df->iargv, &rcd, &df->config); } - if (df->input == NULL) { + /* Don't need an INPUT if we're connecting to a server */ + if (df->input == NULL && (df->host == NULL || strchr(df->host, ':') == NULL)) + { df_dputs(DF_PRN_ERR, "no input specified.\n"); exit(1); } Modified: trunk/defile/doc/defile-ascii.1 =================================================================== --- trunk/defile/doc/defile-ascii.1 2013-03-09 05:07:16 UTC (rev 810) +++ trunk/defile/doc/defile-ascii.1 2013-03-09 05:08:59 UTC (rev 811) @@ -22,8 +22,9 @@ .hy .ad n .SH DESCRIPTION -The defile-ascii plugin provides support in defile(1) for converting ASCII -tabular data into dirfiles. +The defile-ascii plugin provides support in +.BR defile (1) +for converting ASCII tabular data into dirfiles. For defile-ascii, the input designator, .IR INPUT , @@ -445,8 +446,10 @@ standard input, but the filter is allowed to simply discard this. For example, the defile-ascii plugin can be used to read a dirfile (but see -defile-dirfile(1) for a better alternative), using the dirfile2ascii(1) utility -provided with GetData, by doing something like: +.BR defile-dirfile (1), +provided with defile, for a better alternative), using the +.BR dirfile2ascii (1) +utility provided with GetData, by doing something like: .IP .nh .ad l @@ -455,13 +458,17 @@ .ad n .hy .PP -Here, dirfile2ascii(1) ignores its standard input, producing data based on the -arguments passed to it. A file is still needed by the defile-ascii plugin to -read, so /dev/null has been used for that purpose. Any other readable file -would do. In this example, the dirfile created by defile will have the default +Here, +.BR dirfile2ascii (1) +ignores its standard input, producing data based on the arguments passed to it. +A file is still needed by the defile-ascii plugin to read, so /dev/null has been +used for that purpose. Any other readable file would do. In this example, the +dirfile created by defile will have the default .BI col # -names. It is trivial to replace the direct dirfile2ascii(1) call with a script -with first outputs a name row to defile-ascii to name the fields. +names. It is trivial to replace the direct +.BR dirfile2ascii (1) +call with a script with first outputs a name row to defile-ascii to name the +fields. .SH AUTHOR Defile was written by D. V. Wiebe. Modified: trunk/defile/lib/internal.h =================================================================== --- trunk/defile/lib/internal.h 2013-03-09 05:07:16 UTC (rev 810) +++ trunk/defile/lib/internal.h 2013-03-09 05:08:59 UTC (rev 811) @@ -201,6 +201,7 @@ this buffer and the reference -- only used in synchronous mode */ pthread_mutex_t mx; /* buffer mutex */ + int added; /* have we added it to the output dirfile yet? */ }; struct df_rpc { Modified: trunk/defile/lib/libdefile.c =================================================================== --- trunk/defile/lib/libdefile.c 2013-03-09 05:07:16 UTC (rev 810) +++ trunk/defile/lib/libdefile.c 2013-03-09 05:08:59 UTC (rev 811) @@ -642,9 +642,11 @@ * field name; use GetData's parser to do this. */ name = gd_strtok(df->D, spec); if (name == NULL) { - if (gd_error(df->D) == GD_E_ALLOC) + if (gd_error(df->D) == GD_E_ALLOC) { + df_lprintf(DF_PRN_ERR, "Failed to parse spec: %s\n", spec); return DF_OUTPUT; /* better to just fold this into gd_add_spec failures than return DF_SYSTEM */ + } return DF_INPUT; /* unparseable input */ } @@ -652,7 +654,9 @@ if (df_field_in_output(name)) { /* check the second token to see if it's a RAW field */ type = gd_strtok(df->D, NULL); - if (type && strcmp(type, "RAW") == 0) { + if (gd_error(df->D)) + df_lprintf(DF_PRN_ERR, "Failed to parse spec: %s\n", spec); + else if (type && strcmp(type, "RAW") == 0) { df_lputs(DF_PRN_INERR, "attempt to define RAW field via df_add_spec().\n"); ret = DF_INPUT; @@ -707,7 +711,7 @@ int fragment, int set_buf) { const int append = df_mode() & DF_MODE_APPEND; - int r, is_new = 0; + int r, is_new = 0, added = 0; void *ptr; /* check the OFL */ @@ -726,12 +730,6 @@ return DF_SYSTEM; } - 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 * count, fragment)) - return DF_OUTPUT; - } - /* add a new record */ ptr = realloc(df->raw, sizeof(struct df_raw) * (df->nraw + 1)); if (ptr == NULL) { @@ -750,6 +748,7 @@ /* set up the new record */ df->raw[r].ahead = 0; + df->raw[r].added = 0; df->raw[r].type = f->type; df->raw[r].name = name; df->raw[r].spf = f->spf * count; @@ -759,9 +758,23 @@ } else { /* increase the samples per frame of this raw */ df->raw[r].spf += f->spf * count; - if (!(append || df->mode_flags & DF_MODE_SERVER)) { - if (gd_alter_raw(df->D, f->name, f->type, df->raw[r].spf, 0)) + } + + /* add/modify the field in the output dirfile, if necessary */ + if (!(append || df->mode_flags & DF_MODE_SERVER)) { + if (df->raw[r].spf > 0) { + if (!df->raw[r].added) { + if (gd_add_raw(df->D, df->raw[r].name, df->raw[r].type, df->raw[r].spf, + fragment)) + { + return DF_OUTPUT; + } else + df->raw[r].added = 1; + } else if (gd_alter_raw(df->D, df->raw[r].name, df->raw[r].type, + df->raw[r].spf, 0)) + { return DF_OUTPUT; + } } } @@ -1040,9 +1053,11 @@ if (hello && df_rpc_push(df->srv_slug, DF_RPC_HELLO)) return DF_OUTPUT; - if (df_rpc_push(df->srv_slug, DF_RPC_INIT, length, rate, name ? name - : df->input)) + if (df_rpc_push(df->srv_slug, DF_RPC_INIT, length, rate, name ? name : + df->input)) + { return DF_OUTPUT; + } } return DF_SUCCESS; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-09 05:07:19
|
Revision: 810 http://sourceforge.net/p/getdata/code/810 Author: ketiltrout Date: 2013-03-09 05:07:16 +0000 (Sat, 09 Mar 2013) Log Message: ----------- Always send an input designator to clients. Modified Paths: -------------- trunk/defile/lib/libdefile.c Modified: trunk/defile/lib/libdefile.c =================================================================== --- trunk/defile/lib/libdefile.c 2013-03-09 04:57:19 UTC (rev 809) +++ trunk/defile/lib/libdefile.c 2013-03-09 05:07:16 UTC (rev 810) @@ -1040,7 +1040,8 @@ if (hello && df_rpc_push(df->srv_slug, DF_RPC_HELLO)) return DF_OUTPUT; - if (df_rpc_push(df->srv_slug, DF_RPC_INIT, length, rate, name)) + if (df_rpc_push(df->srv_slug, DF_RPC_INIT, length, rate, name ? name + : df->input)) return DF_OUTPUT; } return DF_SUCCESS; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-09 04:57:23
|
Revision: 809 http://sourceforge.net/p/getdata/code/809 Author: ketiltrout Date: 2013-03-09 04:57:19 +0000 (Sat, 09 Mar 2013) Log Message: ----------- Distinguish serve frame size from outpu frame size -- in theory we could use the same variable for both, but this might be a little clearer. Modified Paths: -------------- trunk/defile/bin/defile.c trunk/defile/lib/internal.h trunk/defile/lib/libdefile.c Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-03-09 03:52:18 UTC (rev 808) +++ trunk/defile/bin/defile.c 2013-03-09 04:57:19 UTC (rev 809) @@ -1528,12 +1528,12 @@ } else { const double delta = (now.tv_sec - then.tv_sec) + (now.tv_usec - then.tv_usec) / 1e6; - if (nf * df->wframesize > delta * df->srv_rate * 1e6 / 8.) - nf = delta * df->srv_rate * 1e6 / 8. / df->wframesize; + if (nf * df->sframesize > delta * df->srv_rate * 1e6 / 8.) + nf = delta * df->srv_rate * 1e6 / 8. / df->sframesize; } - if (nf * df->wframesize > DF_MAX_PACKET) - nf = (df->wframesize > DF_MAX_PACKET) ? 1 : DF_MAX_PACKET / df->wframesize; + if (nf * df->sframesize > DF_MAX_PACKET) + nf = (df->sframesize > DF_MAX_PACKET) ? 1 : DF_MAX_PACKET / df->sframesize; if (nf > 0) memcpy(&then, &now, sizeof(then)); @@ -1737,12 +1737,12 @@ if (nf_out + df->srv_base > df->buflen) n = df->buflen - df->srv_base; - df_rpc_push_mem(&data, df->wframesize * n, - df->srv_buffer + df->srv_base * df->wframesize); + df_rpc_push_mem(&data, df->sframesize * n, + df->srv_buffer + df->srv_base * df->sframesize); /* handle wrap-around */ if (n < nf_out) - df_rpc_push_mem(&data, df->wframesize * (nf_out - n), + df_rpc_push_mem(&data, df->sframesize * (nf_out - n), df->srv_buffer); df_rpc_fini(&data, debug); @@ -1757,12 +1757,12 @@ } else if (wrote < data.len) { /* this is going to result in the client dropping some data */ cli_data[i].partial = -(data.len - wrote); - df_dprintf(DF_PRN_DEBUG_O, + df_dprintf(DF_PRN_WARN, "sent partial data packet (%lu of %lu) to %s\n", wrote, data.len, cli_data[i].name); } else if (debug) df_dprintf(DF_PRN_DEBUG_O, "sent data packet of length %lu " - "(%llu frames) to %s\n", data.len, data.len / df->wframesize, + "(%llu frames) to %s\n", data.len, data.len / df->sframesize, cli_data[i].name); } } Modified: trunk/defile/lib/internal.h =================================================================== --- trunk/defile/lib/internal.h 2013-03-09 03:52:18 UTC (rev 808) +++ trunk/defile/lib/internal.h 2013-03-09 04:57:19 UTC (rev 809) @@ -300,7 +300,7 @@ int nfd; struct df_infdef *fd; - long long rframesize, wframesize; + long long rframesize, wframesize, sframesize; int ref_ind; Modified: trunk/defile/lib/libdefile.c =================================================================== --- trunk/defile/lib/libdefile.c 2013-03-09 03:52:18 UTC (rev 808) +++ trunk/defile/lib/libdefile.c 2013-03-09 04:57:19 UTC (rev 809) @@ -820,6 +820,7 @@ } df->fd = (struct df_infdef*)ptr; df->fd[df->nfd].framesize = fd->framesize; + df->sframesize += fd->framesize; df->fd[df->nfd].foff = 0; df->fd[df->nfd].index = 0; df->fd[df->nfd].boff = 0; @@ -1136,8 +1137,10 @@ if (df_rpc_fini(df->srv_slug, df_mode() & DF_MODE_DEBUG_I)) return DF_OUTPUT; /* make the frame buffer */ + df_lprintf(DF_PRN_DEBUG_O, "server frame size: %lli\n", df->sframesize); + df->srv_base = 0; - df->srv_buffer = (char*)malloc(df->buflen * df->wframesize); + df->srv_buffer = (char*)malloc(df->buflen * df->sframesize); if (df->srv_buffer == NULL) return DF_SYSTEM; pthread_mutex_init(&df->srv_mx, NULL); @@ -1329,7 +1332,7 @@ if (n > nf) n = nf; - memcpy(df->srv_buffer + df->wframesize * r + fd->index * fd->framesize + + memcpy(df->srv_buffer + df->sframesize * r + fd->index * fd->framesize + fd->foff, b, fd->framesize * n); /* update the indices */ @@ -1351,7 +1354,7 @@ while (nf >= fd->count) { while (r >= df->buflen) r -= df->buflen; - memcpy(df->srv_buffer + df->wframesize * r + fd->foff, b, + memcpy(df->srv_buffer + df->sframesize * r + fd->foff, b, fd->framesize * fd->count); nf -= fd->count; fd->boff++; @@ -1361,7 +1364,7 @@ /* now a trailing partial */ if (nf > 0) { - memcpy(df->srv_buffer + df->wframesize * r + fd->foff, b, + memcpy(df->srv_buffer + df->sframesize * r + fd->foff, b, fd->framesize * nf); fd->index = nf; } @@ -1478,7 +1481,7 @@ df->wpartial = 0; df->nread = 0; df->nframes = (uint64_t)length; - df->wframesize = df->rframesize = 0; + df->wframesize = df->rframesize = df->sframesize = 0; pthread_mutex_unlock(&df_rate_mx); /* good to go -- do the server initialisation, if necessary */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-09 03:52:22
|
Revision: 808 http://sourceforge.net/p/getdata/code/808 Author: ketiltrout Date: 2013-03-09 03:52:18 +0000 (Sat, 09 Mar 2013) Log Message: ----------- strto[u]q Modified Paths: -------------- trunk/defile/configure.ac trunk/defile/lib/internal.h Modified: trunk/defile/configure.ac =================================================================== --- trunk/defile/configure.ac 2013-03-09 01:55:11 UTC (rev 807) +++ trunk/defile/configure.ac 2013-03-09 03:52:18 UTC (rev 808) @@ -26,7 +26,8 @@ m4_define(defile_version, defile_major.defile_minor.defile_revision[]defile_extra) -AC_INIT([Defile],[defile_version],[get...@li...]) +AC_INIT([Defile],[defile_version],[get...@li...], + [http://getdata.sourceforge.net/dirfile/]) AC_PREREQ([2.63]) AC_CONFIG_MACRO_DIR([m4]) @@ -174,7 +175,8 @@ echo echo "*** Looking for additional library functions" echo -AC_CHECK_FUNCS([canonicalize_file_name realpath strtoll strtoull wordexp]) +AC_CHECK_FUNCS([canonicalize_file_name realpath strtoll strtoq strtoull \ + strtouq wordexp]) echo echo "*** Looking for external programs" Modified: trunk/defile/lib/internal.h =================================================================== --- trunk/defile/lib/internal.h 2013-03-09 01:55:11 UTC (rev 807) +++ trunk/defile/lib/internal.h 2013-03-09 03:52:18 UTC (rev 808) @@ -133,12 +133,20 @@ /* long long integer conversion */ #ifndef HAVE_STRTOULL +#ifdef HAVE_STRTOUQ +#define strtoull strtouq +#else #define strtoull strtoul #endif +#endif #ifndef HAVE_STRTOLL +#ifdef HAVE_STRTOQ +#define strtoll strtoq +#else #define strtoll strtol #endif +#endif /* state macros */ #define DF_SETSTATE(w,n,s,t) \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-09 01:55:16
|
Revision: 807 http://sourceforge.net/p/getdata/code/807 Author: ketiltrout Date: 2013-03-09 01:55:11 +0000 (Sat, 09 Mar 2013) Log Message: ----------- C89-ify the GD_VERS_... constants. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/src/flush.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2013-03-08 03:45:23 UTC (rev 806) +++ trunk/getdata/ChangeLog 2013-03-09 01:55:11 UTC (rev 807) @@ -1,3 +1,6 @@ +2012-03-09 D. V. Wiebe <ge...@ke...> svn:807 + * src/flush.c: C89-ify the GD_VERS_... constants. + 2012-03-08 D. V. Wiebe <ge...@ke...> svn:806 GetData-0.8.3rc1. Modified: trunk/getdata/src/flush.c =================================================================== --- trunk/getdata/src/flush.c 2013-03-08 03:45:23 UTC (rev 806) +++ trunk/getdata/src/flush.c 2013-03-09 01:55:11 UTC (rev 807) @@ -966,26 +966,26 @@ return ret; } -#define GD_VERS_GE_1 0xFFFFFFFFFFFFFFFELLU -#define GD_VERS_GE_2 0xFFFFFFFFFFFFFFFCLLU -#define GD_VERS_GE_3 0xFFFFFFFFFFFFFFF8LLU -#define GD_VERS_GE_4 0xFFFFFFFFFFFFFFF0LLU -#define GD_VERS_GE_5 0xFFFFFFFFFFFFFFE0LLU -#define GD_VERS_GE_6 0xFFFFFFFFFFFFFFC0LLU -#define GD_VERS_GE_7 0xFFFFFFFFFFFFFF80LLU -#define GD_VERS_GE_8 0xFFFFFFFFFFFFFF00LLU -#define GD_VERS_GE_9 0xFFFFFFFFFFFFFE00LLU +#define GD_VERS_GE_1 0xFFFFFFFEUL +#define GD_VERS_GE_2 0xFFFFFFFCUL +#define GD_VERS_GE_3 0xFFFFFFF8UL +#define GD_VERS_GE_4 0xFFFFFFF0UL +#define GD_VERS_GE_5 0xFFFFFFE0UL +#define GD_VERS_GE_6 0xFFFFFFC0UL +#define GD_VERS_GE_7 0xFFFFFF80UL +#define GD_VERS_GE_8 0xFFFFFF00UL +#define GD_VERS_GE_9 0xFFFFFE00UL -#define GD_VERS_LE_0 0x0000000000000001LLU -#define GD_VERS_LE_1 0x0000000000000003LLU -#define GD_VERS_LE_2 0x0000000000000007LLU -#define GD_VERS_LE_3 0x000000000000000fLLU -#define GD_VERS_LE_4 0x000000000000001fLLU -#define GD_VERS_LE_5 0x000000000000003fLLU -#define GD_VERS_LE_6 0x000000000000007fLLU -#define GD_VERS_LE_7 0x00000000000000ffLLU -#define GD_VERS_LE_8 0x00000000000001ffLLU -#define GD_VERS_LE_9 0x00000000000003ffLLU +#define GD_VERS_LE_0 0x00000001UL +#define GD_VERS_LE_1 0x00000003UL +#define GD_VERS_LE_2 0x00000007UL +#define GD_VERS_LE_3 0x0000000fUL +#define GD_VERS_LE_4 0x0000001fUL +#define GD_VERS_LE_5 0x0000003fUL +#define GD_VERS_LE_6 0x0000007fUL +#define GD_VERS_LE_7 0x000000ffUL +#define GD_VERS_LE_8 0x000001ffUL +#define GD_VERS_LE_9 0x000003ffUL uint64_t _GD_FindVersion(DIRFILE *D) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-08 03:45:26
|
Revision: 806 http://sourceforge.net/p/getdata/code/806 Author: ketiltrout Date: 2013-03-08 03:45:23 +0000 (Fri, 08 Mar 2013) Log Message: ----------- GetData-0.8.3rc1. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/RELEASE_NOTES.in trunk/getdata/m4/version.m4 Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2013-03-08 03:38:17 UTC (rev 805) +++ trunk/getdata/ChangeLog 2013-03-08 03:45:23 UTC (rev 806) @@ -1,3 +1,6 @@ +2012-03-08 D. V. Wiebe <ge...@ke...> svn:806 + GetData-0.8.3rc1. + 2012-03-08 D. V. Wiebe <ge...@ke...> svn:803 * src/internal.h (gd_put_unalinged64): Fix spelling. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2013-03-08 03:38:17 UTC (rev 805) +++ trunk/getdata/NEWS 2013-03-08 03:45:23 UTC (rev 806) @@ -1,4 +1,4 @@ -New in version 0.8.3a: +New in version 0.8.3rc1: Library Changes: @@ -16,6 +16,8 @@ Bindings Changes: * Bindings for MATLAB have been added. + * The IDL, Perl, and Python bindings no longer require a C99 compiler to be + built. |==============================================================================| Modified: trunk/getdata/RELEASE_NOTES.in =================================================================== --- trunk/getdata/RELEASE_NOTES.in 2013-03-08 03:38:17 UTC (rev 805) +++ trunk/getdata/RELEASE_NOTES.in 2013-03-08 03:45:23 UTC (rev 806) @@ -1,8 +1,8 @@ -GetData 0.8.2 is known to compile and pass the test suite on the following +GetData 0.8.3 is known to compile and pass the test suite on the following systems (including C++ and Fortran bindings): Linux: -* x86, x86_64, ARM under (variously) Debian, Slackware, Ubuntu +* x86, x86_64, ARM under (variously) Debian, Slackware, Ubuntu, RHEL MacOS X: * x86 and x86_64, using Xcode 3.2/gcc 4.2, under MacOS X Snow Leopard Cygwin: @@ -14,19 +14,18 @@ * x86, using gcc 4.2 The Python bindings have been tested with Python 2.4 through Python 2.7. +The IDL bindings have been tested with IDL 6.0 and IDL 7.1. +The Perl bindings have been tested with Perl 5.8 through Perl 5.16. +The MATLAB bindings have been tested with MATLAB R2009b and MATLAB R2012a. -The IDL bindings have been tested with IDL 6.0, IDL 7.1. - -The Perl bindings have been tested with Perl 5.8 through Perl 5.12. - --------------------------------------------------------------------------- -Three packages are available: -* getdata-0.8.2.tar.bz2/.gz: the full source code to the library, with +Four packages are available: +* getdata-0.8.3.tar.bz2/.gz: the full source code to the library, with bindings. This package uses the GNU autotools build system, and is designed for POSIX systems (UNIX, Linux, BSD, MacOS X, Cygwin, MSys, &c.) -* getdata_win-0.8.2.zip: a reduced source code package, with the CMake +* getdata_win-0.8.3.zip: a reduced source code package, with the CMake build system designed to be built on Microsoft Windows, either using the free MinGW compiler, or else Microsoft's Visual C++ compiler. (The full source package above can also be built using MinGW, if the @@ -35,11 +34,16 @@ package lacks support for compressed dirfiles, the Legacy API, and a few other features. This build is used in native Microsoft Windows builds of kst2. -* idl_getdata-0.8.2.tar.bz2/.gz: the Interactive Data Language (IDL) +* idl_getdata-0.8.3.tar.bz2/.gz: the Interactive Data Language (IDL) bindings, packaged separately with an autotools build system, designed to be built against an already installed version of GetData. Due to licensing restrictions, pre-built packages rarely come with these bindings, and this package allows end-users to add support for IDL - without having to recompile the whole GetData package. +* matlab_getdata-0.8.3.tar.bz2/.gz: the MATLAB bindings, packaged separately + with an autotools build system, designed to be built against an already + installed version of GetData. Due to licensing restrictions, pre-built + packages rarely come with these bindings, and this package allows end-users + to add support for MATLAB without having to recompile the whole GetData + package. --------------------------------------------------------------------------- Modified: trunk/getdata/m4/version.m4 =================================================================== --- trunk/getdata/m4/version.m4 2013-03-08 03:38:17 UTC (rev 805) +++ trunk/getdata/m4/version.m4 2013-03-08 03:45:23 UTC (rev 806) @@ -21,14 +21,14 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 8) m4_define(getdata_revision, 3) -m4_define(getdata_extra, [a]) +m4_define(getdata_extra, [rc1]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) dnl libgetdata current interface version m4_define(getdata_iface_version, 6) dnl libgetdata current interface implementation revision -m4_define(getdata_impl_revision, 1) +m4_define(getdata_impl_revision, 2) dnl libgetdata interface age (current interface - oldest supported interface) m4_define(getdata_iface_age, 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-08 03:38:20
|
Revision: 805 http://sourceforge.net/p/getdata/code/805 Author: ketiltrout Date: 2013-03-08 03:38:17 +0000 (Fri, 08 Mar 2013) Log Message: ----------- Fix for GD_SIZE(3). Modified Paths: -------------- trunk/getdata/man/make_html.pl Modified: trunk/getdata/man/make_html.pl =================================================================== --- trunk/getdata/man/make_html.pl 2013-03-08 02:21:19 UTC (rev 804) +++ trunk/getdata/man/make_html.pl 2013-03-08 03:38:17 UTC (rev 805) @@ -157,7 +157,7 @@ } #$html .= "[$dl+$#dlstack;$rs]"; - if (/^\.TH (gd_\w*) 3 "(.*?)" "(.*?)"/) { + if (/^\.TH ([Gg][Dd]_\w*) 3 "(.*?)" "(.*?)"/) { $vers = $3; $date = $2; my $func = $a || $1; @@ -365,7 +365,7 @@ $html =~ s/ \* / × /g; $html =~ s/\\~/ /g; -$html =~ s/(<B>(gd_\w*?)<\/B>\(3\))/<A HREF="$2.3.html">$1<\/A>/g; +$html =~ s/(<B>([Gg][Dd]_\w*?)<\/B>\(3\))/<A HREF="$2.3.html">$1<\/A>/g; $html =~ s/(<B>(dirfile[-a-z]*)<\/B>\(5\))/<A HREF="$2.5.html">$1<\/A>/g; $html =~ s/([^>])(dirfile[-a-z]*)<\/B>\(5\)/$1<A HREF="$2.5.html">$2<\/A>/g; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-08 02:21:22
|
Revision: 804 http://sourceforge.net/p/getdata/code/804 Author: ketiltrout Date: 2013-03-08 02:21:19 +0000 (Fri, 08 Mar 2013) Log Message: ----------- svn:ignore Property Changed: ---------------- trunk/getdata/bindings/matlab/ Index: trunk/getdata/bindings/matlab =================================================================== --- trunk/getdata/bindings/matlab 2013-03-08 02:20:38 UTC (rev 803) +++ trunk/getdata/bindings/matlab 2013-03-08 02:21:19 UTC (rev 804) Property changes on: trunk/getdata/bindings/matlab ___________________________________________________________________ Modified: svn:ignore ## -96,3 +96,4 ## gd_uninclude.m gd_validate.m gd_verbose_prefix.m +getdata_constants.m This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-08 02:20:43
|
Revision: 803 http://sourceforge.net/p/getdata/code/803 Author: ketiltrout Date: 2013-03-08 02:20:38 +0000 (Fri, 08 Mar 2013) Log Message: ----------- Remove built source from repo. Removed Paths: ------------- trunk/getdata/bindings/matlab/getdata_constants.m Deleted: trunk/getdata/bindings/matlab/getdata_constants.m =================================================================== --- trunk/getdata/bindings/matlab/getdata_constants.m 2013-03-08 01:38:05 UTC (rev 802) +++ trunk/getdata/bindings/matlab/getdata_constants.m 2013-03-08 02:20:38 UTC (rev 803) @@ -1,221 +0,0 @@ -function GD = getdata_constants() -% GETDATA_CONSTANTS Define GetData symbolic constants -% -% GETDATA_CONSTANTS produces a structure containing the symbolic constants -% used by the GetData bindings. Member names of the structure correspond to -% names of symbolic constants used in the GetData C API. -% -% Although it can be used in immediate context by doing something like -% -% >> GETDATA_CONSTANTS.FLOAT64 -% -% ans = -% -% 136 -% -% it is usually assigned to a variable, which prevents having to evaluate this -% function more than once. We recommend calling this variable GD: -% -% >> GD = GETDATA_CONSTANTS; -% >> GD.FLOAT64 -% -% ans = -% -% 136 -% -% providing more succinct symbol names which closely resemble the cor- -% respondng C API symbol names (e.g. GD_FLOAT64). In the documentation for -% these bindings, we assume such a GD variable has been defined, and refer to -% symbolic constants as GD.<...> when necessary. -% -% See also GETDATA - - GD = struct(... - 'VERSION', '0.8.3a', ... - 'E_OK', int32(0), ... - 'E_OPEN', int32(1), ... - 'E_FORMAT', int32(2), ... - 'E_TRUNC', int32(3), ... - 'E_CREAT', int32(4), ... - 'E_BAD_CODE', int32(5), ... - 'E_BAD_TYPE', int32(6), ... - 'E_RAW_IO', int32(7), ... - 'E_OPEN_FRAGMENT', int32(8), ... - 'E_INTERNAL_ERROR', int32(9), ... - 'E_ALLOC', int32(10), ... - 'E_RANGE', int32(11), ... - 'E_OPEN_LINFILE', int32(12), ... - 'E_RECURSE_LEVEL', int32(13), ... - 'E_BAD_DIRFILE', int32(14), ... - 'E_BAD_FIELD_TYPE', int32(15), ... - 'E_ACCMODE', int32(16), ... - 'E_UNSUPPORTED', int32(17), ... - 'E_UNKNOWN_ENCODING', int32(18), ... - 'E_BAD_ENTRY', int32(19), ... - 'E_DUPLICATE', int32(20), ... - 'E_DIMENSION', int32(21), ... - 'E_BAD_INDEX', int32(22), ... - 'E_BAD_SCALAR', int32(23), ... - 'E_BAD_REFERENCE', int32(24), ... - 'E_PROTECTED', int32(25), ... - 'E_DELETE', int32(26), ... - 'E_ARGUMENT', int32(27), ... - 'E_CALLBACK', int32(28), ... - 'E_EXISTS', int32(29), ... - 'E_UNCLEAN_DB', int32(30), ... - 'E_DOMAIN', int32(31), ... - 'E_BAD_REPR', int32(32), ... - 'E_FLUSH', int32(34), ... - 'E_BOUNDS', int32(35), ... - 'E_LINE_TOO_LONG', int32(36), ... - 'E_OPEN_INCLUDE', int32(8), ... - 'E_BAD_ENDIANNESS', int32(27), ... - 'E_BAD_PROTECTION', int32(27), ... - 'E_BAD_VERSION', int32(27), ... - 'RDONLY', int32(0), ... - 'RDWR', int32(1), ... - 'FORCE_ENDIAN', int32(2), ... - 'BIG_ENDIAN', int32(4), ... - 'LITTLE_ENDIAN', int32(8), ... - 'CREAT', int32(16), ... - 'EXCL', int32(32), ... - 'TRUNC', int32(64), ... - 'PEDANTIC', int32(128), ... - 'FORCE_ENCODING', int32(256), ... - 'VERBOSE', int32(512), ... - 'IGNORE_DUPS', int32(1024), ... - 'IGNORE_REFS', int32(2048), ... - 'PRETTY_PRINT', int32(4096), ... - 'ARM_ENDIAN', int32(8192), ... - 'NOT_ARM_ENDIAN', int32(0), ... - 'PERMISSIVE', int32(16384), ... - 'TRUNCSUB', int32(32768), ... - 'AUTO_ENCODED', int32(0), ... - 'BZIP2_ENCODED', int32(83886080), ... - 'GZIP_ENCODED', int32(67108864), ... - 'LZMA_ENCODED', int32(100663296), ... - 'SIE_ENCODED', int32(117440512), ... - 'SLIM_ENCODED', int32(50331648), ... - 'TEXT_ENCODED', int32(33554432), ... - 'UNENCODED', int32(16777216), ... - 'ZZSLIM_ENCODED', int32(150994944), ... - 'ZZIP_ENCODED', int32(134217728), ... - 'NO_ENTRY', int32(0), ... - 'RAW_ENTRY', int32(1), ... - 'LINCOM_ENTRY', int32(2), ... - 'LINTERP_ENTRY', int32(3), ... - 'BIT_ENTRY', int32(4), ... - 'MULTIPLY_ENTRY', int32(5), ... - 'PHASE_ENTRY', int32(6), ... - 'INDEX_ENTRY', int32(7), ... - 'POLYNOM_ENTRY', int32(8), ... - 'SBIT_ENTRY', int32(9), ... - 'DIVIDE_ENTRY', int32(10), ... - 'RECIP_ENTRY', int32(11), ... - 'WINDOW_ENTRY', int32(12), ... - 'MPLEX_ENTRY', int32(13), ... - 'CONST_ENTRY', int32(16), ... - 'CARRAY_ENTRY', int32(18), ... - 'STRING_ENTRY', int32(17), ... - 'NULL', int32(0), ... - 'UINT8', int32(1), ... - 'INT8', int32(33), ... - 'UINT16', int32(2), ... - 'INT16', int32(34), ... - 'UINT32', int32(4), ... - 'INT32', int32(36), ... - 'UINT64', int32(8), ... - 'INT64', int32(40), ... - 'FLOAT32', int32(132), ... - 'FLOAT64', int32(136), ... - 'COMPLEX64', int32(264), ... - 'COMPLEX128', int32(272), ... - 'DEL_META', int32(1), ... - 'DEL_DATA', int32(2), ... - 'DEL_DEREF', int32(4), ... - 'DEL_FORCE', int32(8), ... - 'REN_DATA', int32(1), ... - 'REN_UPDB', int32(2), ... - 'PROTECT_NONE', int32(0), ... - 'PROTECT_FORMAT', int32(1), ... - 'PROTECT_DATA', int32(2), ... - 'PROTECT_ALL', int32(3), ... - 'SYNTAX_ABORT', int32(0), ... - 'SYNTAX_RESCAN', int32(1), ... - 'SYNTAX_IGNORE', int32(2), ... - 'SYNTAX_CONTINUE', int32(3), ... - 'E_FORMAT_BAD_SPF', int32(1), ... - 'E_FORMAT_N_FIELDS', int32(2), ... - 'E_FORMAT_N_TOK', int32(3), ... - 'E_FORMAT_NUMBITS', int32(4), ... - 'E_FORMAT_BITNUM', int32(5), ... - 'E_FORMAT_BITSIZE', int32(6), ... - 'E_FORMAT_CHARACTER', int32(7), ... - 'E_FORMAT_BAD_LINE', int32(8), ... - 'E_FORMAT_RES_NAME', int32(9), ... - 'E_FORMAT_ENDIAN', int32(10), ... - 'E_FORMAT_BAD_TYPE', int32(11), ... - 'E_FORMAT_BAD_NAME', int32(12), ... - 'E_FORMAT_UNTERM', int32(13), ... - 'E_FORMAT_METARAW', int32(14), ... - 'E_FORMAT_NO_PARENT', int32(15), ... - 'E_FORMAT_DUPLICATE', int32(16), ... - 'E_FORMAT_LOCATION', int32(17), ... - 'E_FORMAT_PROTECT', int32(18), ... - 'E_FORMAT_LITERAL', int32(19), ... - 'E_FORMAT_WINDOP', int32(20), ... - 'E_FORMAT_META_META', int32(21), ... - 'E_FORMAT_ALIAS', int32(22), ... - 'E_FORMAT_MPLEXVAL', int32(23), ... - 'VERSION_CURRENT', int32(-1), ... - 'VERSION_LATEST', int32(-2), ... - 'VERSION_EARLIEST', int32(-3), ... - 'SEEK_SET', int32(0), ... - 'SEEK_CUR', int32(1), ... - 'SEEK_END', int32(2), ... - 'SEEK_WRITE', int32(4), ... - 'WINDOP_UNK', int32(0), ... - 'WINDOP_EQ', int32(1), ... - 'WINDOP_GE', int32(2), ... - 'WINDOP_GT', int32(3), ... - 'WINDOP_LE', int32(4), ... - 'WINDOP_LT', int32(5), ... - 'WINDOP_NE', int32(6), ... - 'WINDOP_SET', int32(7), ... - 'WINDOP_CLR', int32(8), ... - 'DESYNC_PATHCHECK', int32(1), ... - 'DESYNC_REOPEN', int32(2), ... - 'ALL_ENTRIES', int32(0), ... - 'VECTOR_ENTRIES', int32(33), ... - 'SCALAR_ENTRIES', int32(34), ... - 'ALIAS_ENTRIES', int32(-1), ... - 'ENTRIES_HIDDEN', int32(1), ... - 'ENTRIES_NOALIAS', int32(2), ... - 'ALL_FRAGMENTS', int32(-1), ... - 'DEFAULT_LOOKBACK', int32(10), ... - 'DIRFILE_STANDARDS_VERSION', int32(9), ... - 'HERE', int32(-1), ... - 'LOOKBACK_ALL', int32(-1), ... - 'MAX_LINE_LENGTH', int32(4096) ... - ); -end - -% Copyright (C) 2013 D. V. Wiebe -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% This file is part of the GetData project. -% -% GetData 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. -% -% GetData 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 GetData; if not, write to the Free Software Foundation, Inc., -% 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-08 01:38:10
|
Revision: 802 http://sourceforge.net/p/getdata/code/802 Author: ketiltrout Date: 2013-03-08 01:38:05 +0000 (Fri, 08 Mar 2013) Log Message: ----------- Enable fast unaligned access on ARMv6 and later (reported by Dinar Valeev). Also, add a configure option to override the check for same. Minor bugfixes, doc updates. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/configure.ac trunk/getdata/m4/encoding.m4 trunk/getdata/m4/idl.m4 trunk/getdata/m4/matlab.m4 trunk/getdata/m4/perl.m4 trunk/getdata/m4/python.m4 trunk/getdata/man/Makefile.am trunk/getdata/man/gd_getdata.3 trunk/getdata/man/gd_putdata.3 trunk/getdata/src/encoding.c trunk/getdata/src/getdata.h.in trunk/getdata/src/internal.h trunk/getdata/test/gzip_move_to.c Added Paths: ----------- trunk/getdata/man/GD_SIZE.3 Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/ChangeLog 2013-03-08 01:38:05 UTC (rev 802) @@ -1,3 +1,14 @@ +2012-03-08 D. V. Wiebe <ge...@ke...> svn:803 + * src/internal.h (gd_put_unalinged64): Fix spelling. + + * src/encoding.c (_GD_FiniRawIO): Don't pass NULL to gd_UnlinkAt. + + * man/GD_SIZE.3: Added. + + * configure.ac: Turn on fast unaligned access for armv[6789] per Dinar + Valeev. Also add add --enable-fast-unaligned to allow users to override the + check. + 2012-02-15 D. V. Wiebe <ge...@ke...> svn:795 * bindings/matlab/package: Added. * Makefile.am: Add matlabdist and matlabdistcheck Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/configure.ac 2013-03-08 01:38:05 UTC (rev 802) @@ -21,7 +21,8 @@ m4_include([m4/version.m4]) -AC_INIT([GetData],[getdata_version],[get...@li...]) +AC_INIT([GetData],[getdata_version],[get...@li...],, + [http://getdata.sourceforge.net/]) AC_COPYRIGHT( [Parts of this program are copyright (C) 2008-2013 D. V. Wiebe. @@ -297,7 +298,7 @@ dnl LTDL AC_ARG_WITH([ltdl], AS_HELP_STRING([--with-ltdl=PREFIX], [if building modules, use the GNU ltdl library located in - PREFIX [autodetect]]), + PREFIX [default: autodetect]]), [ case "${withval}" in no) ltdl_prefix= ;; @@ -348,15 +349,40 @@ echo echo "*** Checking host environment" echo + +dnl unaligned memory access +dnl user knows best +AC_ARG_ENABLE([fast-unaligned], AS_HELP_STRING([--enable-fast-unaligned], + [use fast loads and stores with non-aligned data. WARNING: Enabling this on ] + [a platform which does not support fast unaligned memory access may cause ] + [the library to silently corrupt data. [default: autodetect]]), + [ + case "${enableval}" in + yes) gd_unaligned_override="yes" ;; + no) gd_unaligned_override="no" ;; + *) gd_unaligned_override="check" ;; + esac + ], [gd_unaligned_override="check"]) + AC_MSG_CHECKING([whether ${host} supports fast unaligned memory access]) -case "${host}" in - i?86-*-*|powerpc*-*-*|x86_64-*-*) gd_unaligned_ok=yes; +if test "x$gd_unaligned_override" = "xyes"; then + gd_unaligned_ok=yes + AC_MSG_RESULT([yes (forced)]) +elif test "x$gd_unaligned_override" = "xno"; then + gd_unaligned_ok=no + AC_MSG_RESULT([no (forced)]) +else + case "${host}" in + i?86-*-*|powerpc*-*-*|x86_64-*-*|armv[6789]*-*-*) gd_unaligned_ok=yes ;; + *) gd_unaligned_ok=no ;; + esac + AC_MSG_RESULT([$gd_unaligned_ok]) +fi + +if test "x$gd_unaligned_ok" = "xyes"; then AC_DEFINE([UNALIGNED_ACCESS_OK], [1], [Define to 1 if the platform supports fast unaligned memory access]) - ;; - *) gd_unaligned_ok=no ;; -esac -AC_MSG_RESULT([$gd_unaligned_ok]) +fi dnl FDIRSEP is used in Fortran, where '\' should not be escaped. AC_MSG_CHECKING([the directory separator]) @@ -367,7 +393,7 @@ AC_SUBST([GD_FDIRSEP]) AC_SUBST([GD_DIRSEP]) AC_DEFINE_UNQUOTED([GD_DIRSEP], ['$GD_DIRSEP'], - [ The separator between directory elements ]) + [ The directory separator between path elements ]) AC_MSG_RESULT([$GD_FDIRSEP]) case "${host}" in @@ -482,6 +508,16 @@ AC_CHECK_HEADERS(ltdl.h) LIBLTDL="-lltdl" fi + + dnl pthread + AC_SEARCH_LIBS([pthread_mutex_lock],[pthread], + [use_pthread=yes + AC_DEFINE([USE_PTHREAD], [], + [Define if you have a POSIX compliant thread ] + [library]) + ], + [use_pthread=no]) + AC_CHECK_HEADERS(pthread.h) fi AC_SUBST([LIBLTDL]) AC_SUBST([LTDLINCL]) @@ -569,17 +605,6 @@ echo AC_SEARCH_LIBS([ceil],[m]) -dnl pthread -if test "x${use_modules}" != "xno"; then - AC_SEARCH_LIBS([pthread_mutex_lock],[pthread], - [use_pthread=yes - AC_DEFINE([USE_PTHREAD], [], - [Define if you have a POSIX compliant thread library]) - ], - [use_pthread=no]) - AC_CHECK_HEADERS(pthread.h) -fi - dnl headers echo echo "*** Looking for additional header files" @@ -734,8 +759,8 @@ getcwd _getcwd getdelim gmtime_r isnan _isnan lseek64 \ _lseeki64 lstat lstat64 _mkdir mkfifo nan _open openat \ pathconf _read readdir_r readlink renameat _rmdir snprintf \ - _snprintf stat64 _stat64 _strtoi64 strtoll _strtoui64 strtoull \ - symlink _unlink unlinkat _write]) + _snprintf stat64 _stat64 _strtoi64 strtoll strtoq _strtoui64 \ + strtoull strtouq symlink _unlink unlinkat _write]) if test "x$disable_c99" = "xno"; then AC_CHECK_FUNCS([cabs]) fi @@ -1133,6 +1158,7 @@ echo " ANSI C compatibility mode: ${disable_c99}" echo " Legacy API: ${include_legacy_api}" echo " Verbose debugging: ${enable_debug}" +echo " Fast unaligned memory access: ${gd_unaligned_ok}" echo " Use modules: ${use_modules}" if test "x${use_modules}" != "xno"; then echo " Thread-safe dynamic loading: ${use_pthread}" Modified: trunk/getdata/m4/encoding.m4 =================================================================== --- trunk/getdata/m4/encoding.m4 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/m4/encoding.m4 2013-03-08 01:38:05 UTC (rev 802) @@ -28,7 +28,7 @@ have_this_lib= m4_define([gd_encoding], [$1]) AC_ARG_WITH([lib$2], AS_HELP_STRING([--with-lib$2=PREFIX], - [use the lib$2 installed in PREFIX [autodetect]]), + [use the lib$2 installed in PREFIX [default: autodetect]]), [ case "${withval}" in no) use_[]gd_encoding="no" ;; Modified: trunk/getdata/m4/idl.m4 =================================================================== --- trunk/getdata/m4/idl.m4 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/m4/idl.m4 2013-03-08 01:38:05 UTC (rev 802) @@ -46,7 +46,7 @@ [ idl_min_version=$1 AC_ARG_WITH([idl], AS_HELP_STRING([--with-idl=PATH], - [use the IDL interpreter located in PATH [autodetect]]), + [use the IDL interpreter located in PATH [default: autodetect]]), [ case "${withval}" in no) have_idl="no" ;; @@ -57,7 +57,7 @@ AC_ARG_WITH([idl-dlm-dir], AS_HELP_STRING([--with-idl-dlm-dir=PATH], - [install the IDL bindings into PATH [autodetect]]), + [install the IDL bindings into PATH [default: autodetect]]), [ case "${withval}" in no) local_idl_dlm_path= ;; Modified: trunk/getdata/m4/matlab.m4 =================================================================== --- trunk/getdata/m4/matlab.m4 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/m4/matlab.m4 2013-03-08 01:38:05 UTC (rev 802) @@ -25,12 +25,13 @@ [ dnl --without-mex basically does the same as --disable-matlab AC_ARG_WITH([mex], AS_HELP_STRING([--with-mex=PATH], - [use the MATLAB MEX compiler located at PATH. [autodetect]]), + [use the MATLAB MEX compiler located at PATH. ] + [[default: autodetect]]), [ case "${withval}" in - (no) have_matlab="no" ;; - (yes) user_mex= ;; - (*) user_mex="${withval}";; + no) have_matlab="no" ;; + yes) user_mex= ;; + *) user_mex="${withval}";; esac ], [ user_mex= ]) @@ -88,12 +89,13 @@ [ dnl --without-matlab basically does the same as --disable-matlab AC_ARG_WITH([matlab], AS_HELP_STRING([--with-matlab=PATH], - [use the MATLAB interpreter located at PATH. [autodetect]]), + [use the MATLAB interpreter located at PATH. ] + [[default: autodetect]]), [ case "${withval}" in - (no) have_matlab="no" ;; - (yes) user_matlab= ; have_matlab= ;; - (*) user_matlab="${withval}"; have_matlab= ;; + no) have_matlab="no" ;; + yes) user_matlab= ; have_matlab= ;; + *) user_matlab="${withval}"; have_matlab= ;; esac ], [ user_matlab=; have_matlab= ]) @@ -131,11 +133,12 @@ dnl installdir default_matlabbasedir=$libdir/getdata/matlab AC_ARG_WITH([matlab-dir], AS_HELP_STRING([--with-matlab-dir=PATH], - [ Install Matlab bindings in PATH/getdata. [LIBDIR/getdata/matlab] ]), + [ Install Matlab bindings in PATH/getdata. ] + [[default: LIBDIR/getdata/matlab]]), [ case "${withval}" in - (no) matlabbasedir=$default_matlabbasedir ;; - (*) matlabbasedir="${withval}" + no) matlabbasedir=$default_matlabbasedir ;; + *) matlabbasedir="${withval}" ;; esac ], [ matlabbasedir=$default_matlabbasedir ]) AC_MSG_CHECKING([matlab install directory]) Modified: trunk/getdata/m4/perl.m4 =================================================================== --- trunk/getdata/m4/perl.m4 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/m4/perl.m4 2013-03-08 01:38:05 UTC (rev 802) @@ -87,12 +87,12 @@ dnl --without-perl basically does the same as --disable-perl AC_ARG_WITH([perl], AS_HELP_STRING([--with-perl=PATH], - [use the Perl interpreter located in PATH. [autodetect]]), + [use the Perl interpreter located in PATH. [default: autodetect]]), [ case "${withval}" in - (no) have_perl="no" ;; - (yes) user_perl= ; have_perl= ;; - (*) user_perl="${withval}"; have_perl= ;; + no) have_perl="no" ;; + yes) user_perl= ; have_perl= ;; + *) user_perl="${withval}"; have_perl= ;; esac ], [ user_perl=; have_perl= ]) @@ -141,12 +141,12 @@ [ Install Perl bindings in PATH. If PATH is the special word `vendor', install Perl bindings into the default vendor-specific module directory (if present). If PATH is the special word `site', install Perl bindings into the default -site-specific module directory. [site] ]), +site-specific module directory. [default: site] ]), [ case "${withval}" in - (vendor|site) perl_inst_type="${withval}" ;; - (no) perl_inst_type="site" ;; - (*) perl_inst_type="local"; local_perl_path="${withval}" + vendor|site) perl_inst_type="${withval}" ;; + no) perl_inst_type="site" ;; + *) perl_inst_type="local"; local_perl_path="${withval}" ;; esac ], [ perl_inst_type="site" ]) Modified: trunk/getdata/m4/python.m4 =================================================================== --- trunk/getdata/m4/python.m4 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/m4/python.m4 2013-03-08 01:38:05 UTC (rev 802) @@ -40,7 +40,7 @@ dnl --without-python basically does the same as --disable-python AC_ARG_WITH([python], AS_HELP_STRING([--with-python=PATH], - [use the Python interpreter located in PATH [autodetect]]), + [use the Python interpreter located in PATH [default: autodetect]]), [ case "${withval}" in no) have_python="no" ;; @@ -50,7 +50,7 @@ ], [ user_python=; have_python= ]) AC_ARG_WITH([python-module-dir], AS_HELP_STRING([--with-python-module-dir=PATH], - [install the Python bindings into PATH [autodetect]]), + [install the Python bindings into PATH [default: autodetect]]), [ case "${withval}" in no) local_python_modpath= ;; Added: trunk/getdata/man/GD_SIZE.3 =================================================================== --- trunk/getdata/man/GD_SIZE.3 (rev 0) +++ trunk/getdata/man/GD_SIZE.3 2013-03-08 01:38:05 UTC (rev 802) @@ -0,0 +1,59 @@ +.\" GD_SIZE.3. The GD_SIZE man page. +.\" +.\" Copyright (C) 2013 D. V. Wiebe +.\" +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" +.\" This file is part of the GetData project. +.\" +.\" Permission is granted to copy, distribute and/or modify this document +.\" under the terms of the GNU Free Documentation License, Version 1.2 or +.\" any later version published by the Free Software Foundation; with no +.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +.\" Texts. A copy of the license is included in the `COPYING.DOC' file +.\" as part of this distribution. +.\" +.TH GD_SIZE 3 "20 February 2013" "Version 0.8.3" "GETDATA" +.SH NAME +GD_SIZE \(em report the size of a GetData data sample +.SH SYNOPSIS +.B #include <getdata.h> +.HP +.nh +.ad l +.BI "int GD_SIZE(gd_type_t " type ); +.hy +.ad n +.SH DESCRIPTION +The +.BR GD_SIZE () +preprocessor macro returns the size (in bytes) of a single sample of data of the type +specified by +.IR type , +which should be one of the symbols +.IP +.nh +.ad l +.BR GD_NULL ", " GD_UINT8 ", " GD_INT8 ", " GD_UINT16 ", " GD_INT16 , +.BR GD_UINT32 ", " GD_INT32 ", " GD_FLOAT32 ", " GD_FLOAT64 ", " GD_COMPLEX64 , +.BR GD_COMPLEX128 ", " GD_UNKNOWN . +.ad n +.hy +.PP +Passing +.B GD_NULL +or +.B GD_UNKNOWN +to this macro will return zero. For the other types, the value returned is simply the bit-size encoded +in the type symbol divided by eight, so, e.g., +.B GD_SIZE(GD_COMPLEX64) +will return 8. +.PP +No error checking is performed on +.IR type : +behaviour resulting from passing something other than the symbols listed above to this macro is unspecified. +See +.BR gd_getdata (3) +for the meaning of the above symbols. +.SH SEE ALSO +.BR gd_getdata (3) Modified: trunk/getdata/man/Makefile.am =================================================================== --- trunk/getdata/man/Makefile.am 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/man/Makefile.am 2013-03-08 01:38:05 UTC (rev 802) @@ -46,7 +46,7 @@ gd_reference.3 gd_rename.3 gd_rewrite_fragment.3 gd_seek.3 \ gd_seek64.3 gd_spf.3 gd_strings.3 gd_strtok.3 gd_tell.3 \ gd_tell64.3 gd_uninclude.3 gd_validate.3 gd_verbose_prefix.3 \ - dirfile.5 dirfile-encoding.5 dirfile-format.5 + GD_SIZE.3 dirfile.5 dirfile-encoding.5 dirfile-format.5 # these are real_file:alias MAN3ALIASES=gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.3 \ Modified: trunk/getdata/man/gd_getdata.3 =================================================================== --- trunk/getdata/man/gd_getdata.3 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/man/gd_getdata.3 2013-03-08 01:38:05 UTC (rev 802) @@ -371,4 +371,5 @@ .BR gd_raw_close (3), .BR gd_seek (3), .BR gd_spf (3), -.BR gd_putdata (3) +.BR gd_putdata (3), +.BR GD_SIZE (3) Modified: trunk/getdata/man/gd_putdata.3 =================================================================== --- trunk/getdata/man/gd_putdata.3 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/man/gd_putdata.3 2013-03-08 01:38:05 UTC (rev 802) @@ -263,4 +263,5 @@ .BR gd_put_carray (3), .BR gd_put_constant (3), .BR gd_seek (3), -.BR gd_spf (3) +.BR gd_spf (3), +.BR GD_SIZE (3) Modified: trunk/getdata/src/encoding.c =================================================================== --- trunk/getdata/src/encoding.c 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/src/encoding.c 2013-03-08 01:38:05 UTC (rev 802) @@ -425,7 +425,8 @@ if (oop_write || clotemp) { if (flags & GD_FINIRAW_DISCARD) { /* Throw away the temporary file */ - if (gd_UnlinkAt(D, D->fragment[fragment].dirfd, E->e->u.raw.file[1].name, + if (E->e->u.raw.file[1].name != NULL && + gd_UnlinkAt(D, D->fragment[fragment].dirfd, E->e->u.raw.file[1].name, 0)) { if (D->error == GD_E_OK) Modified: trunk/getdata/src/getdata.h.in =================================================================== --- trunk/getdata/src/getdata.h.in 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/src/getdata.h.in 2013-03-08 01:38:05 UTC (rev 802) @@ -295,7 +295,7 @@ #define GD_SIZE32 0x004 #define GD_SIZE64 0x008 #define GD_SIZE128 0x010 -#define GD_SIZE(x) (x & 0x01f) +#define GD_SIZE(x) ((x) & 0x01f) #define GD_SIGNED 0x020 #define GD_IEEE754 0x080 Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/src/internal.h 2013-03-08 01:38:05 UTC (rev 802) @@ -313,7 +313,7 @@ #if defined HAVE_DECL_PUT_UNALIGNED && HAVE_DECL_PUT_UNALIGNED == 1 #define gd_put_unaligned64 put_unaligned #else -gd_static_inline_ int64_t gd_put_unalinged64(int64_t v, void *p) +gd_static_inline_ int64_t gd_put_unaligned64(int64_t v, void *p) { memcpy(p, &v, 8); return v; @@ -338,12 +338,12 @@ /* Internal type conventions: * * - samples per frame is always unsigned int - * - variables holding offsets or file sizes should be of type off64_t (which - * may be simply off_t, depending on local LFS support) + * - variables holding offsets or file sizes should be of type gd_off64_t + * (which may be simply off_t, if it's the right size) * - variables holding object sizes or counts of items read or written should * be of type size_t * - public functions taking or returning types of off64_t should have both - * a off_t prototype and an off64_t type prototype. + * a off_t prototype and a gd_off64_t type prototype. */ #ifndef __attribute_malloc__ @@ -464,6 +464,8 @@ # define gd_strtoll _strtoi64 #elif defined(HAVE_STRTOLL) # define gd_strtoll strtoll +#elif defined(HAVE_STRTOQ) +# define gd_strtoll strtoq #else # define gd_strtoll strtol #endif @@ -472,6 +474,8 @@ # define gd_strtoull _strtoi64 #elif defined(HAVE_STRTOULL) # define gd_strtoull strtoull +#elif defined(HAVE_STRTOUQ) +# define gd_strtoll strtouq #else # define gd_strtoull strtoul #endif Modified: trunk/getdata/test/gzip_move_to.c =================================================================== --- trunk/getdata/test/gzip_move_to.c 2013-03-07 04:37:18 UTC (rev 801) +++ trunk/getdata/test/gzip_move_to.c 2013-03-08 01:38:05 UTC (rev 802) @@ -85,6 +85,7 @@ /* uncompress */ snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data_gz); if (gd_system(command)) { + fprintf(stderr, "command failed: %s\n", command); r = 1; } else { fd = open(data_raw, O_RDONLY | O_BINARY); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-07 04:37:22
|
Revision: 801 http://sourceforge.net/p/getdata/code/801 Author: ketiltrout Date: 2013-03-07 04:37:18 +0000 (Thu, 07 Mar 2013) Log Message: ----------- Rename df_update_nframes Modified Paths: -------------- trunk/defile/lib/defile.h trunk/defile/lib/libdefile.c Modified: trunk/defile/lib/defile.h =================================================================== --- trunk/defile/lib/defile.h 2013-03-07 04:31:35 UTC (rev 800) +++ trunk/defile/lib/defile.h 2013-03-07 04:37:18 UTC (rev 801) @@ -134,7 +134,7 @@ #define DF_SUCCESS 0 /* success */ /* can only be used at startup (START state) */ -int df_init(long long nframes, double rate, const char *name); +int df_init(long long length, double rate, const char *name); /* can only be used while building the dirfile (BUILD state) */ int df_add_alias(const char *name, const char *target, int fragment); @@ -158,7 +158,7 @@ /* can only be used while pushing data (RUN state) */ ssize_t df_nframes_allowed(int index); ssize_t df_push_frame(int index, size_t nf, const void *b, int block); -int df_reinit(long long nframes, double rate, const char *name, int mode); +int df_reinit(long long length, double rate, const char *name, int mode); /* can only be used while building or pushing data (BUILD or RUN state) */ long long df_get_offset(void); @@ -166,7 +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); +int df_update_length(long long length, int add); /* the remaining functions declared here can be used at any time */ int df_check_abort(void); Modified: trunk/defile/lib/libdefile.c =================================================================== --- trunk/defile/lib/libdefile.c 2013-03-07 04:31:35 UTC (rev 800) +++ trunk/defile/lib/libdefile.c 2013-03-07 04:37:18 UTC (rev 801) @@ -263,7 +263,7 @@ r = df_rpc_push_string(slug, va_arg(ap, const char*)); /* name */ break; case DF_RPC_INIT: - r = df_rpc_push_int64(slug, va_arg(ap, long long)) /* nframes */ + r = df_rpc_push_int64(slug, va_arg(ap, long long)) /* length */ || df_rpc_push_double(slug, va_arg(ap, double)) /* rate */ || df_rpc_push_string(slug, va_arg(ap, const char*)); /* name */ break; @@ -1025,7 +1025,7 @@ usleep(10000); } -static int df_init_server(long long nframes, double rate, const char *name, +static int df_init_server(long long length, double rate, const char *name, int hello) { if (df->mode_flags & DF_MODE_SERVER) { @@ -1039,13 +1039,13 @@ if (hello && df_rpc_push(df->srv_slug, DF_RPC_HELLO)) return DF_OUTPUT; - if (df_rpc_push(df->srv_slug, DF_RPC_INIT, nframes, rate, name)) + if (df_rpc_push(df->srv_slug, DF_RPC_INIT, length, rate, name)) return DF_OUTPUT; } return DF_SUCCESS; } -int df_update_nframes(long long nframes, int add) +int df_update_length(long long length, int add) { DF_CHECK_SEQUENCE2(DF_ST_BUILD, DF_ST_RUN); @@ -1053,16 +1053,16 @@ if (!(df->mode_flags & DF_MODE_FOLLOW)) { pthread_mutex_lock(&df_config_mx); if (add) - df->nframes += nframes; + df->nframes += length; else - df->nframes = nframes; + df->nframes = length; pthread_mutex_unlock(&df_config_mx); } return DF_SUCCESS; } -int df_init(long long nframes, double rate, const char *name) +int df_init(long long length, double rate, const char *name) { DF_CHECK_SEQUENCE(DF_ST_START); @@ -1078,7 +1078,7 @@ pthread_mutex_lock(&df_config_mx); if (rate >= 0) df->rate = rate; - df->nframes = nframes; + df->nframes = length; pthread_mutex_unlock(&df_config_mx); /* wait for the output thread to create the dirfile */ @@ -1092,7 +1092,7 @@ } /* good to go -- do the server initialisation, if necessary */ - return df_init_server(nframes, rate, name, 1); + return df_init_server(length, rate, name, 1); } const char *df_input_name(int shell_expand) @@ -1426,7 +1426,7 @@ return nf_total; } -int df_reinit(long long nframes, double rate, const char *name, int mode) +int df_reinit(long long length, double rate, const char *name, int mode) { DF_CHECK_SEQUENCE(DF_ST_RUN); @@ -1477,12 +1477,12 @@ df->nwrote = 0; df->wpartial = 0; df->nread = 0; - df->nframes = (uint64_t)nframes; + df->nframes = (uint64_t)length; df->wframesize = df->rframesize = 0; pthread_mutex_unlock(&df_rate_mx); /* good to go -- do the server initialisation, if necessary */ - return df_init_server(nframes, rate, name, 0); + return df_init_server(length, rate, name, 0); } df_abort_func_t df_on_abort(df_abort_func_t abort_func) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-03-07 04:31:39
|
Revision: 800 http://sourceforge.net/p/getdata/code/800 Author: ketiltrout Date: 2013-03-07 04:31:35 +0000 (Thu, 07 Mar 2013) Log Message: ----------- doc updates; fix defile-ascii and defile-dirfile; conditionalise compiling ./test; Modified Paths: -------------- trunk/defile/configure.ac trunk/defile/doc/Makefile.am trunk/defile/doc/defile-input.7 trunk/defile/doc/defile.1.in trunk/defile/doc/df_add_alias.3 trunk/defile/doc/df_add_entry.3 trunk/defile/doc/df_add_fragment.3 trunk/defile/doc/df_add_framedef.3 trunk/defile/doc/df_add_lut.3 trunk/defile/doc/df_check_abort.3 trunk/defile/doc/df_exit.3 trunk/defile/doc/df_field_in_input.3 trunk/defile/doc/df_get_offset.3 trunk/defile/doc/df_hide.3 trunk/defile/doc/df_include.3 trunk/defile/doc/df_init.3 trunk/defile/doc/df_input_name.3 trunk/defile/doc/df_mode.3 trunk/defile/doc/df_nframes_allowed.3 trunk/defile/doc/df_on_abort.3 trunk/defile/doc/df_push_frame.3 trunk/defile/doc/df_puts.3 trunk/defile/doc/df_ready.3 trunk/defile/doc/df_set_const.3 trunk/defile/doc/df_shell_expand.3 trunk/defile/doc/df_subset_contains.3 trunk/defile/doc/df_subset_init.3 trunk/defile/doc/df_subset_reset.3 trunk/defile/doc/df_subset_type.3 trunk/defile/doc/df_subset_update.3 trunk/defile/doc/df_write_file.3 trunk/defile/input/Makefile.am trunk/defile/input/ascii.c trunk/defile/input/dirfile.c trunk/defile/lib/internal.h trunk/defile/test/Makefile.am Added Paths: ----------- trunk/defile/doc/defile-ascii.1 trunk/defile/doc/defile-dirfile.1 trunk/defile/doc/df_update_length.3 Modified: trunk/defile/configure.ac =================================================================== --- trunk/defile/configure.ac 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/configure.ac 2013-03-07 04:31:35 UTC (rev 800) @@ -45,6 +45,17 @@ echo AC_CANONICAL_HOST +AC_ARG_ENABLE(test, AS_HELP_STRING([--enable-test], + [build the defile test programs]), + [ + case "${enable_val}" in + yes) enable_test="yes" ;; + *) enable_test="no" ;; + esac + ], [ enable_test="no" ]) +AC_MSG_CHECKING([whether to build the test programs]) +AC_MSG_RESULT([$enable_test]) + AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debugging messages]), [ @@ -163,7 +174,7 @@ echo echo "*** Looking for additional library functions" echo -AC_CHECK_FUNCS([canonicalize_file_name realpath wordexp]) +AC_CHECK_FUNCS([canonicalize_file_name realpath strtoll strtoull wordexp]) echo echo "*** Looking for external programs" @@ -191,6 +202,9 @@ AC_SUBST([absolute_moduledir]) AC_SUBST([absolute_sysconfdir]) +dnl Automake conditionals +AM_CONDITIONAL(TEST_DEFILE, [test "x$enable_test" == "xyes"]) + echo echo "*** Writing configure output" echo Modified: trunk/defile/doc/Makefile.am =================================================================== --- trunk/defile/doc/Makefile.am 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/Makefile.am 2013-03-07 04:31:35 UTC (rev 800) @@ -20,16 +20,17 @@ # AUTOMAKE_OPTIONS = foreign -nodist_man_MANS = defile.1 +nodist_man1_MANS = defile.1 -man_MANS = defile-input.7 df_add_alias.3 df_add_entry.3 \ - df_add_fragment.3 df_add_framedef.3 df_add_lut.3 df_check_abort.3 \ - df_exit.3 df_field_in_input.3 df_hide.3 df_get_offset.3 \ - df_include.3 df_init.3 df_input_name.3 df_mode.3 \ - df_nframes_allowed.3 df_on_abort.3 df_push_frame.3 df_puts.3 \ - df_ready.3 df_set_const.3 df_shell_expand.3 df_subset_contains.3 \ - df_subset_init.3 df_subset_reset.3 df_subset_update.3 \ - df_write_file.3 +man1_MANS = defile-ascii.1 defile-dirfile.1 +man7_MANS = defile-input.7 +man3_MANS = df_add_alias.3 df_add_entry.3 df_add_fragment.3 df_add_framedef.3 \ + df_add_lut.3 df_check_abort.3 df_exit.3 df_field_in_input.3 \ + df_hide.3 df_get_offset.3 df_include.3 df_init.3 df_input_name.3 \ + df_mode.3 df_nframes_allowed.3 df_on_abort.3 df_push_frame.3 \ + df_puts.3 df_ready.3 df_set_const.3 df_shell_expand.3 \ + df_subset_contains.3 df_subset_init.3 df_subset_reset.3 \ + df_subset_update.3 df_update_length.3 df_write_file.3 # these are real_file:alias MAN3ALIASES=df_add_entry.3:df_add_spec.3 \ @@ -57,4 +58,4 @@ clean-local: rm -f *~ - rm -f $(nodist_man_MANS) + rm -f $(nodist_man1_MANS) Added: trunk/defile/doc/defile-ascii.1 =================================================================== --- trunk/defile/doc/defile-ascii.1 (rev 0) +++ trunk/defile/doc/defile-ascii.1 2013-03-07 04:31:35 UTC (rev 800) @@ -0,0 +1,489 @@ +.\" defile-ascii.1 The ASCII input plugin man page for defile. +.\" +.\" Copyright (C) 2013 D. V. Wiebe +.\" +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" +.\" Permission is granted to copy, distribute and/or modify this document +.\" under the terms of the GNU Free Documentation License, Version 1.2 or +.\" any later version published by the Free Software Foundation; with no +.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +.\" Texts. A copy of the license is included in the `COPYING.DOC' file +.\" as part of this distribution. +.\" +.TH defile-ascii 1 "5 March 2013" "Version 0.0.1" DEFILE +.SH NAME +defile-ascii \(em an ASCII input plugin for Defile +.SH SYNOPSIS +.nh +.ad l +\fBdefile\fR [ \fIDEFILE\-OPTION\fR ]... [ -t \fIascii\fR ] +[ [ -i ] \fIINPUT\fR ] [ \fB\-\-\fR [ \fIINPUT\-OPTION\fR ]... ] +.hy +.ad n +.SH DESCRIPTION +The defile-ascii plugin provides support in defile(1) for converting ASCII +tabular data into dirfiles. + +For defile-ascii, the input designator, +.IR INPUT , +passed to defile should be the pathname to the input file. + +The defile-ascii plugin expects each frame to appear on a single line, with +succuessive frames separated by a newline. Fields are separated into columns. +This input plugin is somewhat configurable for different input formats: either +fixed-width columns, or else separator-delimited columns can be read, with +optional comments and delimiters. + +In separator-delimited mode, a line, representing one frame, is expected to be +of the form: +.IP +\fB[\fISD\fB]\fRfield1\fB[\fIED\fB]\fISEP\fB[\fISD\fB]\fRfield2\fB[\fIED\fB]\fISEP\fB +\fB...\~[\fISD\fB]\fRfield\fIn\fB[\fIED\fB][\fICD\fR \fB...]\\n\fR +.PP +where: +.TP +.I SD +is the start delimiter, if any (see +.BR \-\-start\-delim ); +.TP +.I ED +is the end delimiter, if any (see +.BR \-\-end\-delim ); +.TP +.I SEP +is the separator (see +.BR \-\-separator ); +.TP +.I CD \fB... +is, optionally, a comment delimiter (see +.BR \-\-comment ) +followed by a free-form comment; and +.TP +.B \\\\n +is the newline character. +.PP +The field delimiters, +.I SD +and +.I ED +may be optional or required. The delimiters +.IR SD ", " ED ", and " CD +may be multiple characters long, in which case the whole string must be matched. +The separator, +.IR SEP , +may either be a string or a collection of possible separator characters (see +.BR \-\-sep\-set ). + +In both modes, lines which begin with the comment delimiter (i.e. lines +containing only comments) and blank lines are simply skipped. + +If the configurability of the input plugin is insufficient for the intended +input data source, arbitrary external filters (see +.BR \-\-filter ) +can be employed to convert any arbitrary input data file into something +defile-ascii can cope with. See also the +.B NOTES +section below. + +Numerical values in the input data source are parsed using one of +.BR strtod (3), +.BR strtoul (3), +or +.BR strtol (3), +as appropriate for the data type of the field. (If available, "long long" +versions of the integer conversion functions will be used; C99 and POSIX define +.BR strtoull (3) +and +.BR strtoll (3).) +The default data type is double-precision floating point; use +.BR \-\-type +to change data types. In addition to decimal numbers, octal and hexadecimal +integers are supported, and also special strings representing floating-point +infinities and NANs. If +.BR strtod (3) +is C99-conformant, hexadecimal floating point numbers are also accepted. In +some implementations, these functions are locale-aware. See the listed manual +pages for exact syntax specification for numbers. + +As an extension to the above syntax, defile-ascii can also read complex-valued +floating-point data, which are composed of two floating-point numbers (parsed by +.BR strtod (3)) +separated by a semicolon +.RI ( ; ), +with no intervening whitespace. This is the GetData convension; see +dirfile-format(5). The first floating-point number is the value of the real +part of the complex number and the second is the value of the imaginary part. + +The defile-ascii plugin cannot handle data fields with more than one sample per +frame. + +.SS Metadata +Field names, and limited other field metdatada, can be read from the file in +the form of an optional multi-line header block. Field names, if provided, +must be given in the first line of the header. Subsequent header lines may +contain per-field scalar or string metadata. + +The presence of field names at the top of the header is indicated using the +.B \-\-names +option. The meaning of successive rows of the header are defined by +.BR \-\-const\-row +and +.BR \-\-string\-row , +which are treated in the order they are presented to defile-ascii. For each +header line, including the field names, the line is parsed in the same manner as +the rest of the data: either as fixed-width columns, or else with the same +delimiters specified. By default, these header data may appear as comment lines +Use +.B \-\-no\-meta\-comments +to disable this. + +If no field names are provided, defile-ascii will make generic numbered column +names of the form +.BI col # +will be used, with the zero-padded numerical part an appropriate width for the +number of columns in the file. Column numbering starts at zero. So, for +example, a file containing four fields will start with +.RI """" col0 """" +and end with +.RI """" col3 """," +while file containing twenty-four fields will start with +.RI """" col00 """" +and end with +.RI """" col23 """." + +.SH INPUT OPTIONS + +All these options must be placed after the double-dash in the defile command +line. When used as directives in defile run control files, they must be placed +in the +.IP +[ascii] +.PP +section. Mandatory arguments to long options are mandatory for short options +too. + +.TP +.BR \-c ", " \-\-comment=\fIDELIM\fR +use +.I DELIM +as the comment delimiter: everything from the comment delimiter to the end of +the line is ignored. To disable comments, set this to nothing: +.RS +.IP +.ad l +.nh +\-\-comment= +.hy +.ad n +.RE +.IP +The default is +.RI ' # '. +(Directive: +.BR CommentDelim ) +.TP +.BR \-\-clear\-header +forget any previously defined header rows; that is, ignore any previous +.BR \-\-names , +.BR \-\-const\-row , +or +.B \-\-string\-row +options seen. (Directive: +.BR ClearHeader ) +.TP +.BR \-\-const\-row= \fINAME\fR[,\fITYPE\fR] +for each field in the output, create a metafield called +.IR field / NAME +for each +.I field +in the input of type +.B CONST +(and data type +.IR TYPE , +if given), from data in the first available row in the header. See the +.B Metadata +section above for detals on the header. This option may be given multiple +times (with different +.IR NAME s) +to define multiple +.B CONST +metadata fields. See +.B \-\-type +for details on permitted values for +.IR TYPE . +The default type is +.BR FLOAT64 . +(Directive: +.BR ConstRow ) +.TP +.BR \-d ", " \-\-delim\-req +the start-of-field and end-of-field delimiters are required. (Directive: +.BR DelimitersRequired ) +.TP +.BR +d ", " \-\-delim\-opt +the start-of-field and end-of-field delimiters are option. This is the default. +(Directive: +.BR DelimitersOptional ) +.TP +.BR \-e ", " \-\-escape=\fICHAR +use +.I CHAR +as the escape character: the escape character can be used to include a character +in a item which would otherwise be interpreted as a delimiter. To disable +character escapes, set this to nothing: +.RS +.IP +.ad l +.nh +\-\-escape\-char= +.hy +.ad n +.RE +.IP +The default is +.RI ' \e '. +(Directive: +.BR EscapeChar ) +.TP +.BI \-\-end\-delim= DELIM +use +.I DELIM +as the end-of-field delimiter. The default is nothing. (Directive: +.BR EndDelimiter ) +.TP +.BR \-f ", " \-\-filter=\fICOMMAND +pipe the input file through the filter +.I COMMAND +and parse the filtered output, instead of the file itself. The +.I COMMAND +string specified is interpreted by the shell. This option may be given multiple +times to build up a filter chain. Each filter should read its standard input +and write to its standard output. See the +.B NOTES +section below for a discussion of this feature. A filter which exits with a +non-zero status will cause defile-ascii to abort conversion. (Directive: +.BR Filter ) +.TP +.BR +f ", " \-\-clear\-filters +ignore all previous +.B \-\-filter +definition. (Directive: +.BR ClearFilters ) +.TP +.BR \-l ", " \-\-lazy +allow trailing, non-numerical characters after a numerical value. (Directive: +.BR Lazy ) +.TP +.BR +l ", " \-\-strict +prohibit trailing, non-numerical characters after a numberical value. This +is the default. (Directive: +.BR Strict ) +.TP +.BR \-m ", " \-\-no\-meta\-comments +the metadata header (see +.B Metadata +above) appear without a preceding comment delimiter. In this case, lines +containing only comments within the metadata header are simply skipped. +(Directive: +.BR MetadataSkipComments ) +.TP +.BR +m ", " \-\-meta\-comments +the metadata header (see +.B Metadata +above) +.I may +appear inside comments. This is the default. (Directive: +.BR MetadataInComments ) +.TP +.BR \-n ", " \-\-names +read field names from the first row of the header. See the +.B Metdata +section above for details of the header. (Directive: +.BR Names ) +.TP +.BR \-q ", " \-\-quoted +items are enclosed in quotation marks; equivalent to +.BI \-\-start\-delim= \e" +.BI \-\-end\-delim= \e" +(Directive: +.BR Quoted ) +.TP +.BR \-S ", " \-\-sep\-set +consider the separator provided to +.B \-\-sep +to be a set of characters, and separate items with a run of one or more of these +characters, in any combination. (Directive: +.BR SepSet ) +.TP +.BR +S ", " \-\-sep\-literal +consider the separator provided to +.B \-\-sep +to be a literal string which is found verbatim between items. This is the +default behaviour. (Directive: +.BR SepLiteral ) +.TP +.BR \-s ", " \-\-sep=\fISEPAR +use +.I SEPAR +as the field separator. How this is interpreted is affected by +.BR \-\-sep\-set +and +.BR \-\-sep\-literal +(q.v.). This option also turns off fixed-width mode if it had been previously +enabled. The default separator is the comma +.RI ( , ). +(Directive: +.BR Separator ) +.TP +.BI \-\-skip= NUM +skip the first +.I NUM +lines. The metadata header (see +.B Metadata +above), if present, starts with the next row after the lines skipped. The +default is zero. (Directive: +.BR Skip ) +.TP +.BI \-\-start\-delim= DELIM +use +.I DELIM +as the start-of-field delimiter. The default is nothing. (Directive: +.BR StartDelimiter ) +.TP +.BI \-\-string\-row= NAME +for each field in the output, create a metafield called +.IR field / NAME +for each +.I field +in the input of type +.B STRING +from data in the first available row in the header. See the +.B Metadata +section above for detals on the header. This option may be given multiple +times (with different +.IR NAME s) +to define multiple +.B STRING +metadata fields. (Directive: +.BR StringRow ) +.TP +.BR \-t ", " \-\-type= [\fICOL\fR,]\fITYPE +If a numeric +.I COL +is given, make column +.I COL +of type +.IR TYPE . +If no +.I COL +is given, use +.I TYPE +as the default type for all other columns. This affects both how defile-ascii +parses the input value (see the +.B DISCUSSION +above), and also determines the type of the data in the output dirfile. The +.I TYPE +should be one of the following GetData type codes: +.RS +.IP +.BR NULL , +.BR UINT8 , +.BR INT8 , +.BR UINT16 , +.BR INT16 , +.BR UINT32 , +.BR INT32 , +.BR UINT64 , +.BR INT64 , +.BR FLOAT32 , +.BR FLOAT64 , +.BR COMPLEX64 , +.BR COMPLEX128 +.RE +.IP +The type +.B NULL +indicates a column should be ignored. The remainder are hopefully fairly +self-explanatory; see dirfile-format(5) for their meanings. Columns which +aren't assigned a type via this option default to +.BR FLOAT64 . +(Directive: +.BR Type ) +.TP +.BR \-W ", " \-\-whitespace +use tab and space as a separator set. Turns off fixed-width mode if it had been +previously enabled. (Directive: +.BR WhiteSpace ) +.TP +.BR \-w ", " \-\-fixed\-width=\fIWIDTHS +turn on fixed-width mode with column widths given by +.IR WIDTHS , +which should be a comma-separated list of column widths. If there are more +columns in the file than widths specified, the last width specified is repeated +for all other columns. If all columns have the same width, +.I WIDTHS +may be simply that number. A column width of zero indicates a variable-width +column extending to the end of the row. Any other column widths specified +after a zero are ignored. Fixed-width mode is turned off if a later option +specifies a field separator +.RB ( \-\-sep +or similar). + +.SH NOTES + +The external filter feature (see +.B \-\-filter +above) can be quite powerful. With a suitably crafted external filter, +defile-ascii can be coerced into providing data to defile from +.I any +data source, whatever its type, as long as its fields adhere to the one +sample-per-frame limitation of defile-ascii. The input designator passed to +defile, +.IR INPUT , +must be a readable file, since it is opened, read, and piped into the filter's +standard input, but the filter is allowed to simply discard this. + +For example, the defile-ascii plugin can be used to read a dirfile (but see +defile-dirfile(1) for a better alternative), using the dirfile2ascii(1) utility +provided with GetData, by doing something like: +.IP +.nh +.ad l +defile \-\-output=/output/dirfile \-\-type=ascii /dev/null \-\- +\-\-filter="dirfile2ascii /input/dirfile field1 field2 field3 \-d," +.ad n +.hy +.PP +Here, dirfile2ascii(1) ignores its standard input, producing data based on the +arguments passed to it. A file is still needed by the defile-ascii plugin to +read, so /dev/null has been used for that purpose. Any other readable file +would do. In this example, the dirfile created by defile will have the default +.BI col # +names. It is trivial to replace the direct dirfile2ascii(1) call with a script +with first outputs a name row to defile-ascii to name the fields. + +.SH AUTHOR +Defile was written by D. V. Wiebe. + +.SH REPORTING BUGS +Please send reports of bugs to get...@li.... + +The Defile home page is: <http://getdata.sourceforge.net/defile/> + +.SH COPYRIGHT +Copyright \(co 2012, 2013 D. V. Wiebe +.PP +Defile is free software; you may change and/or redistribute it under the terms +of the GNU General Public License, either version 2 of the license, or (at your +option) any later version. There is no warranty, to the extent permitted by +law. + +.SH SEE ALSO +.BR defile (1) +.BR dirfile2ascii (1) +.BR strtod (3), +.BR strtol (3), +.BR strtoul (3), +defile-format(5) + Added: trunk/defile/doc/defile-dirfile.1 =================================================================== --- trunk/defile/doc/defile-dirfile.1 (rev 0) +++ trunk/defile/doc/defile-dirfile.1 2013-03-07 04:31:35 UTC (rev 800) @@ -0,0 +1,207 @@ +.\" defile-dirfile.1 The dirfile input plugin man page for defile. +.\" +.\" Copyright (C) 2013 D. V. Wiebe +.\" +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" +.\" Permission is granted to copy, distribute and/or modify this document +.\" under the terms of the GNU Free Documentation License, Version 1.2 or +.\" any later version published by the Free Software Foundation; with no +.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +.\" Texts. A copy of the license is included in the `COPYING.DOC' file +.\" as part of this distribution. +.\" +.TH defile-dirfile 1 "5 March 2013" "Version 0.0.1" DEFILE +.SH NAME +defile-dirfile \(em a dirfile input plugin for Defile +.SH SYNOPSIS +.nh +.ad l +\fBdefile\fR [ \fIDEFILE\-OPTION\fR ]... [ -t \fIdirfile\fR ] +[ [ -i ] \fIINPUT\fR ] [ \fB\-\-\fR [ \fIINPUT\-OPTION\fR ]... ] +.hy +.ad n +.SH DESCRIPTION +The defile-dirfile plugin provides support in defile(1) for +.I reading +dirfiles, allowing dirfile to dirfile conversion. + +For defile-dirfile, the input designator, +.IR INPUT , +passed to defile should be the pathname to the input dirfile. + +In addition to being simply an expensive way of recursively copying a dirfile +directory tree from one place to another, this plugin may be useful in other +situations. In the default configuration, runing defile to copy a dirfile +will also copy into the output dirfile directory all fragments and +.B LINTERP +tables outside the directory tree, creating a fully self-contained dirfile (see +.B \-\-copy\-extern\-frags +and +.B \-\-copy\-extern\-luts +below). + +Defile can be used to extract a dirfile subset using the Defile output field +list (see defile(1)): +.IP +.nh +.ad l +defile \-\-include=FOO \-\-include=BAR /path/to/dirfile +.hy +.ad n + +.SH INPUT OPTIONS + +All these options must be placed after the double-dash in the defile command +line. When used as directives in defile run control files, they must be placed +in the +.IP +[dirfile] +.PP +section. Mandatory arguments to long options are mandatory for short options +too. + +.TP +.BR \-E ", " \-\-expand\-all +expand all derived fields (ie. turn them into +.B RAW +fields in the output dirfile). This causes any field list built up with +.B \-\-expand +and +.B \-\-no\-expand +to be forgotten. (Directive: +.BR ExpandAll ) +.TP +.BR +E ", " \-\-expand\-none +don't expand any derived fields: keep them as derived fields in the output +dirfile. This causes any field list built up with +.B \-\-expand +and +.B \-\-no\-expand +to be forgotten. (Directive: +.BR ExpandNone ) +.TP +.BR \-e ", " \-\-expand=\fIFIELD\fR +compute the derived field called +.IR FIELD , +making it a +.B RAW +field in the output dirfile. This option can be specified multiple times to +build up a list of fields to expand. If +.I FIELD +is not in the input dirfile, or is not a derived field, this option is +ignored. (Directive: +.BR Expand ) +.TP +.BR +e ", " \-\-no\-expand=\fIFIELD\fR +don't convert the derived field called +.I FIELD +into a +.B RAW +field in the output dirfile. This is the default behaviour, and this option +does nothing if +.I FIELD +hadn't earlier been flagged for expansion (either implicitly via +.BR \-\-expand\-all , +or explicitly with +.BI \-\-expand= FIELD\fR). +This directive can be used multiple times, usually after +.BR \-\-expand\-all , +to build up a list of fields to skip expansion. If +.I FIELD +is not in the input dirfile, or is not a derived field, this option is +ignored. (Directive: +.BR NoExpand ) +.TP +.BI \-\-ext\-dir= DIR +Put external fragments copied into the output dirfile (see +.BR \-\-copy\-extern\-frags ) +in the subdirectory +.I DIR +under the output dirfile base directory, instead of the default "<ext>". The +directory specified must be relative. (Directive: +.BR ExtDir ) +.TP +.BR \-f ", " \-\-flatten +merge all metadata fragments in the input dirfile into a single fragment in the +output dirfile. External fragments, ie. fragments outside the dirfile tree, +aren't included in this flattening if +.BR \-\-link\-extern\-frags +is specified. (Directive: +.BR Flatten ) +.TP +.BR +f ", " \-\-no\-flatten +keep the same fragment architecture in the output dirfile as the input dirfile. +This is the default behaviour. (Directive: +.BR NoFlatten ) +.TP +.BR \-L ", " \-\-link\-extern\-luts +when +.B LINTERP +entries in the input dirfile refer to look-up tables (LUTs) outside the input +dirfile's directory tree, the corresponding +.B LINTERP +specification in the output dirfile use the same out-of-tree file path. +(Directive: +.BR LinkExternLUTs ) +.TP +.BR +L ", " \-\-copy\-extern\-luts +when +.B LINTERP +entries in the input dirfile refer to look-up tables (LUTs) outside the input +dirfile's directory tree, they will be copied to the output dirfile directory +tree, usually in a special subdirectory called "./<lut>" (but see +.BR \-\-lut\-dir ). +This ensures that the output dirfile is self-contained and is the default +behaviour. (Directive: +.BR CopyExternLUTs ) +.TP +.BI \-\-lut\-dir= DIR +Put external +.B LINTERP +look-up tables (LUTs) copied into the output dirfile (see +.BR \-\-copy\-extern\-luts ) +in the subdirectory +.I DIR +under the output dirfile base directory, instead of the default "<lut>". The +directory specified must be relative. (Directive: +.BR LUTDir ) +.TP +.BR \-X ", " \-\-link\-extern\-frags +fragments outside the input dirfile's directory tree which are included in the +input dirfile will be linked in the output dirfile, instead of copying the +contents of these external fragments. Notably, +.B RAW +fields in these external fragments aren't copied by defile to the output dirfile +since the external inclusion will draw them into the output dirfile from their +external location. (Directive: +.BR LinkExternFrags ) +.TP +.BR +X ", " \-\-copy\-extern\-frags +fragments outside the input dirfile's directory tree which are included in the +input dirfile are copied into the output dirfile tree from their external +location. By default, they will be placed under the subdirectory "./<ext>" +in the output dirfile tree (but see +.BR \-\-ext\-dir ). +This ensures that the output dirfile is self-contained and is the default +behaviour. (Directive: +.BR CopyExternFrags ) + +.SH AUTHOR +Defile was written by D. V. Wiebe. + +.SH REPORTING BUGS +Please send reports of bugs to get...@li.... + +The Defile home page is: <http://getdata.sourceforge.net/defile/> + +.SH COPYRIGHT +Copyright \(co 2012, 2013 D. V. Wiebe +.PP +Defile is free software; you may change and/or redistribute it under the terms +of the GNU General Public License, either version 2 of the license, or (at your +option) any later version. There is no warranty, to the extent permitted by +law. + +.SH SEE ALSO +.BR defile (1) Modified: trunk/defile/doc/defile-input.7 =================================================================== --- trunk/defile/doc/defile-input.7 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/defile-input.7 2013-03-07 04:31:35 UTC (rev 800) @@ -13,12 +13,14 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH defile-input 7 "24 January 2013" "Version 0.0.0" DEFILE +.TH defile-input 7 "24 January 2013" "Version 0.0.1" DEFILE .SH NAME defile-input \(em overview of the defile input plugin API .SH DESCRIPTION -This manual page describes how to write input plugins for defile(1), a program -which can convert data sources in a variety of formats into dirfile(5) +This manual page describes how to write input plugins for +.BR defile (1), +a program which can convert data sources in a variety of formats into +.BR dirfile (5) databases. Defile consists of three parts: a front\-end, which handles I/O with the @@ -28,9 +30,12 @@ input data source and provides data to the back\-end. Input plugins are loaded at runtime, based on options given to defile at the -time of invocation. See defile(1) for information on invoking defile. Because -the input plugin is loaded dynamically, input types available to defile(1) can -be extended easily, without having to modify defile itself. +time of invocation. See +.BR defile (1) +for information on invoking defile. Because the input plugin is loaded +dynamically, input types available to +.BR defile (1) +can be extended easily, without having to modify defile itself. Defile provides a C API for input plugins. Functions provided by the API are described in individual manual pages in section 3 of the manual. A list of @@ -74,7 +79,9 @@ .PP The type name is also the value of the .B \-\-type -option given to defile(1) to indicate which input plugin to use. +option given to +.BR defile (1) +to indicate which input plugin to use. .SH EXPORTED SYMBOLS @@ -130,8 +137,9 @@ .TP .I description is a short string describing the data type read by the plugin (not describing -the plugin itself). This is used when lists of input plugins are printed -by defile(1) (ie., if the +the plugin itself). This is used when lists of input plugins are printed by +.BR defile (1) +(ie., if the .B \-\-list\-types option was given, or when automatic input type detection returns more than one candidate input type). @@ -305,7 +313,8 @@ .BR \-\-conf , and the directive .B Input -which are handled specially, as they are in the defile options. See defile(1) +which are handled specially, as they are in the defile options. See +.BR defile (1) for their use. Even if an input plugin provides no input options (by setting .I opts to zero, these are always accepted as input options by defile. Briefly, @@ -319,7 +328,7 @@ and .B Include specify additional run control files to read for more configuration (see -defile(1)). +.BR defile (1)). .SH HELP AND VERSION OUTPUT @@ -346,7 +355,7 @@ .PP Unless the plugin is simple enough to be summarised in the usage text, plugin developers are encouraged to provide accompanying documentation, if possible a -Unix manual page called defile-<\fItype\fR>(1). Any such other documentation +Unix manual page called \fBdefile-<\fItype\fR>(1). Any such other documentation should be mentioned in the usage preamble or postamble. .PP When @@ -607,8 +616,10 @@ .SH DEFILE DATA MODEL The defile data model is fundamentally rooted in limitations of the Dirfile -Standards (see dirfile(5)). The primarly limitation this imposes on data -presented by an input plugin to defile is that data are composed of +Standards (see +.BR dirfile (5)). +The primarly limitation this imposes on data presented by an input plugin to +defile is that data are composed of .I frames of synchronously sampled data of fixed format. Every frame in the output dirfile must contain one or more samples of every raw field in the dirfile. @@ -694,7 +705,8 @@ .BR df_vprintf (3) which can be used for output to the user. Defile will take care of routing text written with these functions to an appropritate location (typically one of -standard output, standard error, or syslogd(8)). +standard output, standard error, or +.BR syslogd (8)). .SS Standard API Return Semaphores @@ -819,6 +831,7 @@ .BR df_set_carray (3), .BR df_set_offset (3), .BR df_set_string (3), +.BR df_update_length (3), .BR df_write_file (3) .TP Functions which may be called during the \fBRUN\fR state: @@ -828,10 +841,12 @@ .BR df_reinit (3), .BR df_set_const (3), .BR df_set_carray (3), -.BR df_set_string (3) +.BR df_set_string (3), +.BR df_update_length (3) .SH SEE ALSO .BR defile (1), -dirfile(5), as well as the manual pages of the API functions listed above in the +.BR dirfile (5), +as well as the manual pages of the API functions listed above in the .B API REFERENCE section. Modified: trunk/defile/doc/defile.1.in =================================================================== --- trunk/defile/doc/defile.1.in 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/defile.1.in 2013-03-07 04:31:35 UTC (rev 800) @@ -28,11 +28,14 @@ .SH DESCRIPTION Defile converts data in a data source specified by .I INPUT -into a dirfile(5) database. +into a +.BR dirfile (5) +database. Arbitrary input data formats are supported through the use of input plugins which are loaded at runtime. For information on writing input plugins and the -associated defile API, see defile-input(7). +associated defile API, see +.BR defile-input (7). The defile command line consists of a list of defile options (see the section .B OPTIONS @@ -57,7 +60,7 @@ Only the defile options are listed here (those options which appear in the command line before the double dash). For documentation on input options see the manual page associated with that plugin (typically called -.RI defile- TYPE (1), +.BR defile-\fITYPE (1), if present), or else execute .IP .nh @@ -412,8 +415,9 @@ any other program specified must support the defile command-line. The .I COMMAND is interpreted by the shell on the remote host, which (assuming -the shell on the remote machine is sh(1)-compatible) permits doing something -like: +the shell on the remote machine is +.BR sh (1)-compatible) +permits doing something like: .RS .IP .nh @@ -441,7 +445,8 @@ Use .I COMMAND as the remote shell used to log into the remote host. By default this is "ssh" (see -ssh(1)), and +.BR ssh(1)), +and .I COMMAND must be "ssh compatible" in the sense that the second last argument passed to it will be the @@ -793,7 +798,8 @@ .IP \(bu In the .IR "remote shell model" , -the local defile logs into the remote host (using a remote shell such as ssh(1)) +the local defile logs into the remote host (using a remote shell such as +.BR ssh (1)) and starts a one-time-use defile process on the remote host. It is designed for the transmission of a single data source from the remote to the local host. .PP @@ -853,7 +859,9 @@ .B \-\-remote option. A username may also be given if the remote username is different than the local one. In this method, the local defile will log into the remote -host using ssh(1) (or another transparent remote shell specified with +host using +.BR ssh (1) +(or another transparent remote shell specified with .BR \-\-rsh ) and then run an instance of defile on the remote host. In this case, the data rate will be limited both by the input plugin as well as the network connection @@ -899,8 +907,10 @@ allowing the override of input plugins in the default input plugin directory. .TP .B SSH_CONNECTION -this is typically set by by ssh(1) on the remote host. If present, a -remotely-running defile will use it to identify the local interface. +this is typically set by by +.BR ssh (1) +on the remote host. If present, a remotely-running defile will use it to +identify the local interface. .TP .B HOSTNAME if a remotely-running defile can't identify the local interface using Modified: trunk/defile/doc/df_add_alias.3 =================================================================== --- trunk/defile/doc/df_add_alias.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_add_alias.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_add_alias 3 "23 March 2012" "Version 0.0.0" DEFILE +.TH df_add_alias 3 "23 March 2012" "Version 0.0.1" DEFILE .SH NAME df_add_alias \(em add a field alias to defile's output dirfile .SH SYNOPSIS @@ -28,7 +28,8 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) +This function is part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The @@ -37,7 +38,8 @@ .I name pointing to .I target -to the output dirfile produced by defile(1). +to the output dirfile produced by +.BR defile (1). .PP The alias is added to the fragment indicated by .IR fragment , @@ -67,13 +69,15 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .PP All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), +.BR defile-input (7), +.BR defile (1), .BR df_add_entry (3), .BR df_add_fragment (3), .BR df_add_framedef (3), -.BR gd_add_alias (3). +.BR gd_add_alias (3) Modified: trunk/defile/doc/df_add_entry.3 =================================================================== --- trunk/defile/doc/df_add_entry.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_add_entry.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_add_entry 3 "21 July 2012" "Version 0.0.0" DEFILE +.TH df_add_entry 3 "21 July 2012" "Version 0.0.1" DEFILE .SH NAME df_add_entry, df_add_spec \(em add a derived field to defile's output dirfile .SH SYNOPSIS @@ -29,7 +29,8 @@ .ad .hy .SH DESCRIPTION -These functions are part of the defile input plugin C API. See defile-input(7) +These functions are part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The @@ -38,15 +39,17 @@ .RB non- RAW ) field described by .I entry -to the output dirfile produced by defile(1). The gd_entry_t type is described -in +to the output dirfile produced by +.BR defile (1). +The gd_entry_t type is described in .BR gd_entry (3). Similarly, the .BR df_add_spec () function adds a derived field described by the field specification line .I spec to the output dirfile. The syntax of Dirfile field specification lines is -defined in dirfile-format(5). +defined in +.BR dirfile-format (5). .PP The entry is added to the fragment indicated by .I fragment @@ -68,7 +71,9 @@ to initialise the value after defining the field. .PP If the field has been excluded from the output dirfile by the Output Field List -(see defile(1)), these functions do nothing and succeeds. +(see +.BR defile (1)), +these functions do nothing and succeeds. .SH RETURN VALUE Upon success, .BR df_add_entry () @@ -101,12 +106,15 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .PP All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), dirfile-format(5), +.BR defile-input (7), +.BR defile (1), +.BR dirfile-format (5), .BR df_add_carray (3), .BR df_add_fragment (3), .BR df_add_framedef (3), Modified: trunk/defile/doc/df_add_fragment.3 =================================================================== --- trunk/defile/doc/df_add_fragment.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_add_fragment.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_add_fragment 3 "13 August 2012" "Version 0.0.0" DEFILE +.TH df_add_fragment 3 "13 August 2012" "Version 0.0.1" DEFILE .SH NAME df_add_fragment \(em create a new fragment in the defile output dirfile .SH SYNOPSIS @@ -29,12 +29,15 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) for -an overview. +This function is part of the defile input plugin C API. See +.BR defile-input (7) +for an overview. .PP The .BR df_add_fragment () -creates a new format file fragment (see dirfile-format(5)) called +creates a new format file fragment (see +.BR dirfile-format (5)) +called .I name in the defile output dirfile. The .I name @@ -52,8 +55,9 @@ .IR encoding , which should be one of the symbols listed in .BR gd_alter_encoding (3), -although not all encodings provide write capability (see dirfile-encoding(5) for -details). If this is set to +although not all encodings provide write capability (see +.BR dirfile-encoding (5) +for details). If this is set to .BR GD_AUTO_ENCODED , the encoding scheme will be chosen by defile. The byte sex of data files in the new fragment is specified with @@ -102,7 +106,8 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .TP .B DF_SYSTEM A memory allocation error occurred. @@ -110,7 +115,8 @@ All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), +.BR defile-input (7), +.BR defile (1), .BR df_include (3), .BR gd_include_affix (3), .BR gd_alter_encoding (3), Modified: trunk/defile/doc/df_add_framedef.3 =================================================================== --- trunk/defile/doc/df_add_framedef.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_add_framedef.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_add_framedef 3 "27 February 2012" "Version 0.0.0" DEFILE +.TH df_add_framedef 3 "27 February 2012" "Version 0.0.1" DEFILE .SH NAME df_add_framedef \(em define a defile input subframe .SH SYNOPSIS @@ -28,8 +28,9 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) for -an overview. +This function is part of the defile input plugin C API. See +.BR defile-input (7) +for an overview. .PP The .BR df_add_framedef () @@ -38,8 +39,9 @@ and adds .I count copies of the subframe (which need not be contiguous within the full frame) to -the defile data frame (defile-input(7)). The struct df_fdef is defined in -defile.h as: +the defile data frame (see +.BR defile-input (7)). +The struct df_fdef is defined in defile.h as: .IP .nf .fam C @@ -146,7 +148,9 @@ field is actually defined. .PP Fields which have been excluded from the output dirfile by the Output Field List -(see defile(1)) are accepted in subframe definitions and simply ignored. +(see +.BR defile (1)) +are accepted in subframe definitions and simply ignored. .SH RETURN VALUE Upon success, .BR df_add_framedef () @@ -177,7 +181,8 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .TP .B DF_SYSTEM A memory allocation error occurred. @@ -185,7 +190,8 @@ All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), +.BR defile-input (7), +.BR defile (1), .BR df_add_entry (3), .BR df_add_fragment (3), .BR df_add_spec (3), Modified: trunk/defile/doc/df_add_lut.3 =================================================================== --- trunk/defile/doc/df_add_lut.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_add_lut.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_add_lut 3 "13 August 2012" "Version 0.0.0" DEFILE +.TH df_add_lut 3 "13 August 2012" "Version 0.0.1" DEFILE .SH NAME df_add_lut \(em create a look-up table in the defile output dirfile .SH SYNOPSIS @@ -28,8 +28,9 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) for -an overview. +This function is part of the defile input plugin C API. See +.BR defile-input (7) +for an overview. .PP The .BR df_add_lut () @@ -104,7 +105,8 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .TP .B DF_SYSTEM A memory allocation error occurred. @@ -112,5 +114,7 @@ All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), dirfile-format(5), -.BR df_write_file (3) +.BR defile-input (7), +.BR defile (1), +.BR df_write_file (3), +.BR dirfile-format (5) Modified: trunk/defile/doc/df_check_abort.3 =================================================================== --- trunk/defile/doc/df_check_abort.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_check_abort.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_check_abort 3 "27 February 2012" "Version 0.0.0" DEFILE +.TH df_check_abort 3 "27 February 2012" "Version 0.0.1" DEFILE .SH NAME df_check_abort \(em set an abort handler for a defile input plugin .SH SYNOPSIS @@ -27,14 +27,17 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) +This function is part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The .BR df_check_abort () function checks whether defile has entered the .B ABORT -state (see defile-input(7)) and either reports this or else handles the +state (see +.BR defile-input (7)) +and either reports this or else handles the .BR ABORT . .PP This check is automatically performed by any function which can return @@ -63,6 +66,7 @@ .B ABORT state and an abort handler has been registered, this function does not return. .SH SEE ALSO -defile(1), defile-input(7), +.BR defile-input (7), +.BR defile (1), .BR df_exit (3), .BR df_on_abort (3). Modified: trunk/defile/doc/df_exit.3 =================================================================== --- trunk/defile/doc/df_exit.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_exit.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_exit 3 "25 January 2013" "Version 0.0.0" DEFILE +.TH df_exit 3 "25 January 2013" "Version 0.0.1" DEFILE .SH NAME df_exit \(em terminate the input plugin .SH SYNOPSIS @@ -27,7 +27,8 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) +This function is part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The @@ -61,6 +62,7 @@ This function does not return to the caller. .SH SEE ALSO -defile(1), defile-input(7), +.BR defile-input (7), +.BR defile (1), .BR df_check_abort (3), .BR df_on_abort (3). Modified: trunk/defile/doc/df_field_in_input.3 =================================================================== --- trunk/defile/doc/df_field_in_input.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_field_in_input.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_field_in_output 3 "27 February 2012" "Version 0.0.0" DEFILE +.TH df_field_in_output 3 "27 February 2012" "Version 0.0.1" DEFILE .SH NAME df_field_in_output \(em check whether defile is writing a field to its output .SH SYNOPSIS @@ -27,13 +27,15 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) +This function is part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The .BR df_field_in_output () -function consults defile's Output Field List (see defile(1)), and returns -non-zero if the field specified by +function consults defile's Output Field List (see +.BR defile (1)), +and returns non-zero if the field specified by .I name would be writen to the output dirfile were it to be defined at some point by the input plugin. If the field has been excluded from the output dirfile, this @@ -43,8 +45,8 @@ .I name actually has been (or will be) defined. .PP -It is not required that an input plugin self-exclude fields excluded from the -output dirfile by the output field list. Both included and excluded fields may +It is not required that an input plugin self-exclude fields not in the output +dirfile by checking this function. Both included and excluded fields may be defined by the input plugin. Excluded fields will be silently ignored. This function is provided for use in rare cases where knowing a field is to be excluded may speed or simplify the input plugin's operation. @@ -56,5 +58,6 @@ would be included in the output dirfile if provided. It returns zero if a field with such a name would be excluded from the output. .SH SEE ALSO -defile(1), defile-input(7), +.BR defile-input (7), +.BR defile (1), .BR df_add_framedef (3). Modified: trunk/defile/doc/df_get_offset.3 =================================================================== --- trunk/defile/doc/df_get_offset.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_get_offset.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_get_offset 3 "25 January 2013" "Version 0.0.0" DEFILE +.TH df_get_offset 3 "25 January 2013" "Version 0.0.1" DEFILE .SH NAME df_get_offset, df_set_offset \(em get or set the output dirfile starting offset .SH SYNOPSIS @@ -29,7 +29,8 @@ .ad .hy .SH DESCRIPTION -These functions are part of the defile input plugin C API. See defile-input(7) +These functions are part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The @@ -47,7 +48,8 @@ .IP \(bu the frame skip specified by the user at invocation via the .B --skip -command line option (see defile(1)); +command line option (see +.BR defile (1)); .IP \(bu the offset specified by the input plugin with .BR df_set_offset (3); @@ -96,7 +98,9 @@ .BR df_set_offset (), only the .B BUILD -state). (See defile-input(7)). +state). (See +.BR defile-input (7)). .SH SEE ALSO -defile(1), defile-input(7), -.BR df_mode (3). +.BR defile-input (7), +.BR defile (1), +.BR df_mode (3) Modified: trunk/defile/doc/df_hide.3 =================================================================== --- trunk/defile/doc/df_hide.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_hide.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_hide 3 "21 July 2012" "Version 0.0.0" DEFILE +.TH df_hide 3 "21 July 2012" "Version 0.0.1" DEFILE .SH NAME df_hide \(em hide a field in the defile output dirfile .SH SYNOPSIS @@ -27,8 +27,9 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) for -an overview. +This function is part of the defile input plugin C API. See +.BR defile-input (7) +for an overview. .PP The .BR df_hide () @@ -36,14 +37,16 @@ .I name in the output dirfile. The field must have been previously added to the output dirfile using -.B df_add_alias (3), -.B df_add_framedef (3), -.B df_add_entry (3), +.BR df_add_alias (3), +.BR df_add_framedef (3), +.BR df_add_entry (3), or -.B df_add_spec (3). +.BR df_add_spec (3). .PP If the field has been excluded from the output dirfile by the Output Field List -(see defile(1)), this functions does nothing and succeeds. +(see +.BR defile (1)), +this functions does nothing and succeeds. If defile is in append mode (see .BR df_mode (3)), @@ -73,10 +76,12 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .PP All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), +.BR defile-input (7), +.BR defile (1), .BR gd_hide (3) Modified: trunk/defile/doc/df_include.3 =================================================================== --- trunk/defile/doc/df_include.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_include.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_include 3 "25 January 2013" "Version 0.0.0" DEFILE +.TH df_include 3 "25 January 2013" "Version 0.0.1" DEFILE .SH NAME df_include \(em include an existing fragment in the defile output dirfile .SH SYNOPSIS @@ -28,14 +28,17 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) for -an overview. +This function is part of the defile input plugin C API. See +.BR defile-input (7) +for an overview. .PP The .BR df_include () function inserts an .B /INCLUDE -directive (see dirfile-format(5)) into the output dirfile fragment indexed by +directive (see +.BR dirfile-format (5)) +into the output dirfile fragment indexed by .IR parent , which should be zero (for the primary format file) or else a fragment index returned by a previous call to @@ -90,7 +93,8 @@ .B DF_SEQUENCE The function was called while defile was not in the .B BUILD -state. (See defile-input(7)). +state. (See +.BR defile-input (7)). .TP .B DF_SYSTEM A memory allocation error occurred. @@ -98,7 +102,8 @@ All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), +.BR defile-input (7), +.BR defile (1), .BR df_add_fragment (3), .BR df_mode (3), .BR gd_include_affix (3) Modified: trunk/defile/doc/df_init.3 =================================================================== --- trunk/defile/doc/df_init.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_init.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_init 3 "25 January 2013" "Version 0.0.0" DEFILE +.TH df_init 3 "25 January 2013" "Version 0.0.1" DEFILE .SH NAME df_init, df_reinit \(em (re-)intialise defile for input .SH SYNOPSIS @@ -22,37 +22,47 @@ .fam C .B #include <defile.h> .HP -.BI "int df_init(long long " nframes ", double " rate ", const char *" name ); +.BI "int df_init(long long " length ", double " rate ", const char *" name ); .HP -.BI "int df_reinit(long long " nframes ", double " rate ", const char *" name , +.BI "int df_reinit(long long " length ", double " rate ", const char *" name , .BI "int " mode ); .fam .ad .hy .SH DESCRIPTION -These functions are part of the defile input plugin C API. See defile-input(7) +These functions are part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The .BR df_init () -function indicates to defile(1) that the input plugin is ready to start defining -the metadata of the output dirfile. (That is, it signals a transition into the -BUILD state; see defile-input(7).) The input plugin should pass the following -information, all of which is optional, if available and relevant: +function indicates to +.BR defile (1) +that the input plugin is ready to start defining the metadata of the output +dirfile. (That is, it signals a transition into the BUILD state; see +.BR defile-input +(7).) +The input plugin should pass the following information, all of which is +optional, if available and relevant: .TP -.I nframes +.I length the total length, in frames, of the input data. In follow mode (see -defile-input(7)) this is ignored. If the total length is unknown or difficult -to calculate, this should be zero. This is only used for informational purposes -to the user; the input plugin may provide a different number of frames than -specified here without error. +.BR defile-input (7)) +this is ignored. If the total length is unknown or difficult to calculate, this +may be zero. This is only used for informational purposes to the user; the +input plugin may provide a different number of frames than specified here +without error. This value may be updated after calling +.BR df_init (3) +as desired by calling +.BR df_update_length (3). .TP .I rate -the expected frame rate for live data in follow mode (see defile-input(7)). If -unknown or difficult to calculate, this may be -1. This value is used to prime -the IIR filter in the rate calculator in the running information provided to the -user, and does not set actual restictions on the data rate. In no-follow mode, -this number is of limited usefulness, but is still used if provided. +the expected frame rate for live data in follow mode (see +.BR defile-input (7)). +If unknown or difficult to calculate, this may be -1. This value is used to +prime the IIR filter in the rate calculator in the running information provided +to the user, and does not set actual restictions on the data rate. In no-follow +mode, this number is of limited usefulness, but is still used if provided. .TP .I name an updated input designator for the input data source. This might be used to @@ -129,7 +139,8 @@ .I mode is effectively ignored). See the discussion under the .B \-\-output -option in defile(1). +option in +.BR defile (1). .IP NB: Although, when this value is returned by .BR df_reinit (), @@ -138,7 +149,8 @@ state, all other .BR RUN -state-permitted functions are prohibited, and only this function may be called (in addition to -functions which are not sequence restricted; see defile-input(7)). +functions which are not sequence restricted; see +.BR defile-input (7)). .TP .B DF_SEQUENCE The function was called while defile was not in the correct state @@ -156,6 +168,8 @@ All errors are accompanied by a message on standard error. .SH SEE ALSO .PP -defile-input(7), defile(1), +.BR defile-input (7), +.BR defile (1), .BR df_get_offset (3), -.BR df_set_offset (3). +.BR df_set_offset (3), +.BR df_update_length (3) Modified: trunk/defile/doc/df_input_name.3 =================================================================== --- trunk/defile/doc/df_input_name.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_input_name.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_input_name 3 "27 February 2012" "Version 0.0.0" DEFILE +.TH df_input_name 3 "27 February 2012" "Version 0.0.1" DEFILE .SH NAME df_input_name \(em obtain the defile input designator .SH SYNOPSIS @@ -27,19 +27,22 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) +This function is part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The .BR df_input_name () function returns the input designator (name) specified in the arguments passed -to defile(1). If +to +.BR defile (1). +If .I shell_expand is non-zero, the designator will undergo shell expansion before being returned (see .BR df_shell_expand (3)). That is, setting -.I shell-expand +.I shell_expand to a non-zero value is equivalent to .IP .nh @@ -51,8 +54,8 @@ .hy .PP except that defile will manage the memory arising from the expansion. Shell -expansion is typically not suitable if the input designator is not a path on the -local filesystem. +expansion is typically not appropriate if the input designator is not a path on +the local filesystem. .SH RETURN VALUE The @@ -60,5 +63,6 @@ function returns the input designator, optionally after being shell expanded, in a read-only buffer. Memory used by the string is managed by defile. .SH SEE ALSO -defile(1), defile-input(7), +.BR defile-input (7), +.BR defile (1), .BR df_shell_expand (3). Modified: trunk/defile/doc/df_mode.3 =================================================================== --- trunk/defile/doc/df_mode.3 2013-03-05 04:34:19 UTC (rev 799) +++ trunk/defile/doc/df_mode.3 2013-03-07 04:31:35 UTC (rev 800) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH df_mode 3 "25 January 2013" "Version 0.0.0" DEFILE +.TH df_mode 3 "25 January 2013" "Version 0.0.1" DEFILE .SH NAME df_mode \(em obtain the defile operating modes .SH SYNOPSIS @@ -27,7 +27,8 @@ .ad .hy .SH DESCRIPTION -This function is part of the defile input plugin C API. See defile-input(7) +This function is part of the defile input plugin C API. See +.BR defile-input (7) for an overview. .PP The @@ -61,16 +62,21 @@ .TP .B DF_MODE_ASYNC defile is operating in Asynchronous Mode and the input plugin is not required to -adhere to the restrictions of synchronous mode. (See defile-input(7) for a -discussion of the implications of synchronous and asynchronous modes.) An input -plugin is not required to implement asynchronous mode. (Implementing +adhere to the restrictions of synchronous mode. (See +.BR defile-input (7) +for a discussion of the implications of synchronous and asynchronous modes.) An +input plugin is not required to implement asynchronous m... [truncated message content] |
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. |
From: <ket...@us...> - 2013-03-05 01:14:50
|
Revision: 798 http://sourceforge.net/p/getdata/code/798 Author: ketiltrout Date: 2013-03-05 01:14:46 +0000 (Tue, 05 Mar 2013) Log Message: ----------- Docs. Modified Paths: -------------- trunk/defile/doc/df_add_fragment.3 Modified: trunk/defile/doc/df_add_fragment.3 =================================================================== --- trunk/defile/doc/df_add_fragment.3 2013-02-19 02:08:55 UTC (rev 797) +++ trunk/defile/doc/df_add_fragment.3 2013-03-05 01:14:46 UTC (rev 798) @@ -22,7 +22,7 @@ .fam C .B #include <defile.h> .HP -.BI "int df_add_fragment(const char *" name ", int " parent , +.BI "int df_add_fragment(const char *" name ", int " fragment , .BI "unsigned int " encoding ", unsigned long " byte_sex , .BI "const char *" prefix ", const char *" suffix ); .fam @@ -43,7 +43,7 @@ .I name will be created if they do not already exist. The new fragment will be included in the fragment indexed by -.IR parent , +.IR fragment , which should be zero (for the primary format file) or else a fragment index returned by a previous call to .BR df_add_fragment (). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2013-02-19 02:09:01
|
Revision: 797 http://sourceforge.net/p/getdata/code/797 Author: ketiltrout Date: 2013-02-19 02:08:55 +0000 (Tue, 19 Feb 2013) Log Message: ----------- Fix cut-dir. Error reporting in RC. Modified Paths: -------------- trunk/defile/bin/defile.c trunk/defile/bin/rc.c trunk/defile/doc/defile.1.in Modified: trunk/defile/bin/defile.c =================================================================== --- trunk/defile/bin/defile.c 2013-02-19 00:14:17 UTC (rev 796) +++ trunk/defile/bin/defile.c 2013-02-19 02:08:55 UTC (rev 797) @@ -1116,13 +1116,23 @@ /* cut directories */ if (cutleft == 0) ptr2 = ptr_base; - else { - cutleft = df->cutdir; + else if (cutleft < 0) { + cutleft = -cutleft; + /* cut from end */ for (ptr2 = ptr_base + strlen(ptr_base); ptr2 > ptr_base; --ptr2) if (*(ptr2 - 1) == '/') if (--cutleft == 0) break; + } else { + /* cut from start */ + for (ptr2 = ptr_base; *ptr2; ++ptr2) + if (*ptr2 == '/') + if (--cutleft == 0) { + ptr2++; + break; + } } + /* remove forbidden characters */ for (ptr3 = ptr2; *ptr3; ++ptr3) if (*ptr3 == '/') @@ -2301,7 +2311,7 @@ "don't overwrite an existing dirfile (default)" }, { DF_WOPT_CUTDIR, DF_OPT_ARG_RQ, 0, "cut-dirs", "CutDirs", 0, "NUM", - "remove all but the last NUM path elements from the output name" + "remove path elements from the output name" }, { DF_WOPT_DIR, DF_OPT_ARG_RQ, 'D', "directory", "Directory", DF_OPT_EXPAND, "DIR", "write the output dirfile as a subdirectory under DIR" Modified: trunk/defile/bin/rc.c =================================================================== --- trunk/defile/bin/rc.c 2013-02-19 00:14:17 UTC (rev 796) +++ trunk/defile/bin/rc.c 2013-02-19 02:08:55 UTC (rev 797) @@ -76,8 +76,8 @@ int required; }; -static void DF_ReadConfigFile(const char* name, int skip_ok, const char* label, - struct df_rc_data *rcd); +static void DF_ReadConfigFile(const char* name, const char* label, const char *origin, + int origline, struct df_rc_data *rcd); #ifdef DF_DEBUG #define logprintf(...) fprintf(stderr, __VA_ARGS__) @@ -422,8 +422,8 @@ } } -static void DF_DoRunControl (const char *val, const char *cwd, - struct df_rc_data *rcd) +static void DF_DoRunControl (const char *val, const char *cwd, const char *origin, + int origline, struct df_rc_data *rcd) { if (val == NULL) logprintf(" Skipping unspecified configuration file.\n"); @@ -433,7 +433,7 @@ snprintf(file, 4096, "%s/%s", cwd, val); else strcpy(file, val); - DF_ReadConfigFile(file, 0, val, rcd); + DF_ReadConfigFile(file, val, origin, origline, rcd); } } @@ -450,7 +450,7 @@ struct df_rc_data *rcd) { const struct df_optdef *opt = rcd->options + i; - const int fac = (rcd->name == NULL) ? DF_PRN_INPUT : DF_PRN_DF; + const int fac = (rcd->name == NULL) ? DF_PRN_DF : DF_PRN_INPUT; if (i < 0) opt = NULL; @@ -459,7 +459,7 @@ rcd->options[i].value, rcd->confc, line); if (opt) { if (opt->type == DF_OPT_CONFIG) { - DF_DoRunControl(val, cwd, rcd); + DF_DoRunControl(val, cwd, label, line, rcd); return; } @@ -501,8 +501,8 @@ rcd->config[rcd->confc++].optind = i; } -static void DF_ReadConfigFile(const char* name, int skip_ok, const char* label, - struct df_rc_data *rcd) +static void DF_ReadConfigFile(const char* name, const char* label, const char *origin, + int orig_line, struct df_rc_data *rcd) { FILE* stream; char buffer[1024]; @@ -511,16 +511,17 @@ int i, found, ln = 0; char *file, *section = NULL; - const int fac = (rcd->name == NULL) ? DF_PRN_INPUT : DF_PRN_DF; + const int fac = (rcd->name == NULL) ? DF_PRN_DF : DF_PRN_INPUT; /* expand */ file = df_rc_shell_expand(fac, name); if (file == NULL) { - if (skip_ok) + struct df_rc_config cf; + /* missing is okay */ + if (orig_line == -1) return; - df_iprintf(DF_PRN_DF, DF_PRN_ERR, "could not read %s: %s\n", file, - strerror(errno)); + df_config_error(0, &cf, rcd, "could not read %s", name); exit(1); } @@ -530,16 +531,23 @@ /* attempt to open the file */ if ((stream = fopen(file, "rt")) == NULL) { + struct df_rc_config cf; logprintf(" cannot open %s ", file); - if (skip_ok) + if (orig_line == -1) logprintf("(skipping)"); logprintf("\n error returned was: %s\n", strerror(errno)); - if (skip_ok) { + + /* missing is okay */ + if (orig_line == -1) { free(file); return; } - df_iprintf(DF_PRN_DF, DF_PRN_ERR, "could not read %s: %s\n", file, + memset(&cf, 0, sizeof(cf)); + cf.label = origin; + cf.line = orig_line; + + df_config_error(0, &cf, rcd, "could not read %s: %s", file, strerror(errno)); exit(1); } @@ -610,7 +618,8 @@ if (strcasecmp(opt, "Include") == 0 && (section == NULL || (rcd->name && strcmp(section, rcd->name) == 0))) { - DF_DoRunControl(val, cwd, rcd); + DF_DoRunControl(val, cwd, file, ln, rcd); + logprintf(" Continuing with %s...\n", file); continue; } @@ -729,7 +738,7 @@ struct shortarg *shortarg; char* value; - const int fac = (rcd->name == NULL) ? DF_PRN_INPUT : DF_PRN_DF; + const int fac = (rcd->name == NULL) ? DF_PRN_DF : DF_PRN_INPUT; /* Find the shift character */ for (i = 0; rcd->options[i].type != DF_OPT_END_OO; ++i) @@ -775,7 +784,7 @@ /* conf */ if (strcmp(&argv[i][2], "conf") == 0) { - DF_DoRunControl(value, ".", rcd); + DF_DoRunControl(value, ".", NULL, 0, rcd); continue; } @@ -865,16 +874,16 @@ rcd->global_config_fatal = 0; /* Read the initial configuration files */ - if (rcd->local_config != NULL) { - logprintf(" local configuration file: %s\n", rcd->global_config); - DF_ReadConfigFile(rcd->local_config, 1, rcd->global_config, rcd); - } - if (rcd->global_config != NULL) { logprintf(" global configuration file: %s\n", rcd->global_config); - DF_ReadConfigFile(rcd->global_config, 1, rcd->global_config, rcd); + DF_ReadConfigFile(rcd->global_config, rcd->global_config, NULL, -1, rcd); } + if (rcd->local_config != NULL) { + logprintf(" local configuration file: %s\n", rcd->local_config); + DF_ReadConfigFile(rcd->local_config, rcd->local_config, NULL, -1, rcd); + } + /* Parse the command line */ DF_ParseCommandLine(argc, argv, rcd); Modified: trunk/defile/doc/defile.1.in =================================================================== --- trunk/defile/doc/defile.1.in 2013-02-19 00:14:17 UTC (rev 796) +++ trunk/defile/doc/defile.1.in 2013-02-19 02:08:55 UTC (rev 797) @@ -203,8 +203,7 @@ will be provided by the input plugin, or else be based on .IR INPUT . If -.B \-\-output -does specify an absolute path, this option is ignored. (Directive: +.B \-\-output does specify an absolute path, this option is ignored. (Directive: .BR Directory ) .TP .BR \-o ", " \-\-output=\fIPATH @@ -240,15 +239,20 @@ .I INPUT designator (after possible modification by the input plugin). If .I N -is greater than zero, all but the last +is greater than zero, the first .I N -path elements of -.I INPUT -are stripped from it before using it to generate the output dirfile name. -Remaining path separators will be replaced by the underscore character. The -default is zero, indicating no directories are cut. Ignored if +path elements of the designator are stripped from it before using it to generate the +output dirfile name. Remaining path separators will be replaced by the underscore +character. If +.I N +is less than zero, all but the last +.RI \- N +path elements are stripped. + +The default is zero, indicating no directories are cut. Ignored if .B \-\-output -is used to explicitly name the output dirfile. +is used to explicitly name the output dirfile. (Directive: +.BR CutDirs ) .SS Running Mode Options The following options affect the modes in which defile runs. @@ -341,7 +345,7 @@ .BR \-q ", " \-\-quiet .I Quiet Mode on\fR: write nothing to the controlling terminal except error messages. Debugging -messages output as a result of +messages produced by .B \-\-debug ignore this. (Directive: .BR Quiet ) @@ -396,7 +400,9 @@ Read data from the local system. This is the default behaviour, and this option is only needed to cancel a .B \-\-remote -option given earlier in the configuration. (Directive: +option given earlier in the configuration. This is not the same as specifying +.BR \-\-remote=localhost . +(Directive: .BR Local ) .TP .BI \-\-remote\-command= COMMAND @@ -405,7 +411,7 @@ as the defile program on the remote host. The default is simply "defile" and any other program specified must support the defile command-line. The .I COMMAND -is interpreted by the (local) shell on the remote host, which (assuming +is interpreted by the shell on the remote host, which (assuming the shell on the remote machine is sh(1)-compatible) permits doing something like: .RS @@ -417,7 +423,7 @@ .ad n .RE .IP -to set the value of DEFILE_PLUGIN_PATH on the fly. See +to set the value of DEFILE_PLUGIN_PATH on the remote machine on the fly. See .BR ENVIRONMENT below for details on DEFILE_PLUGIN_PATH. (Directive: .BR RemoteCommand ) @@ -434,8 +440,8 @@ .BI \-\-rsh= COMMAND Use .I COMMAND -as the remote shell used to log into the remote host. By default this is "ssh", -and +as the remote shell used to log into the remote host. By default this is "ssh" (see +ssh(1)), and .I COMMAND must be "ssh compatible" in the sense that the second last argument passed to it will be the @@ -494,7 +500,7 @@ .I Note: this option does not change the state of .IR Follow ", " Append ", or " "Asynchronous Mode" . -It is always best to explicitly set these mode to the desired state after using +It is always best to explicitly set these modes to the desired state after using this option. (Directive: .BR NoListen ) .TP @@ -552,10 +558,12 @@ set the length of the output buffer to .I N frames. The default value is 3000 frames. Decreasing this number will reduce -memory usage and may reduce output latency at the expense of read and write +memory usage, and may reduce output latency, at the expense of read and write speed. If this number is smaller than the buffer head (see .BR \-\-buf\-head ), -the output buffer will be exapnded to the size of the buffer head. +the output buffer will be expanded to the size of the buffer head. The buffer can +never be made smaller than two frames. (Directive: +.BR BufferLength ) .SS Output Field List Options A restricted set of fields to write to the output dirfile may be specified with @@ -677,7 +685,7 @@ .SS Miscellaneous options Unless otherwise specified, including these options on the command line will -result defile performing the indicated behaviour and exiting successfully, +result in defile performing the indicated action and exiting successfully, without doing any actual data conversion. In addition to appearing as defile options (before the double dash), the @@ -707,7 +715,7 @@ .B \-\-list\-types print a list of all input plugins available to defile. For each input plugin found, defile will print the plugin name, author, a brief description of the -data format handled (if provided by the plugin), and the location of the plugin +data format handled (if the plugin provides these data), and the location of the plugin on disk. .TP .B \-\-help @@ -726,29 +734,41 @@ .IP \fBDirective\fR [\fIvalue\fR] .PP -A hash mark (#) is used as a comment delimeter; any line starting with a hash -mark is ignored. At the top of every run control file are the defile directives -(which correspond with defile options). After the defile directives may come -sections of directives for various input plugins. Each of these sections is +A hash mark (#) is used as a comment delimeter; everything from the hash mark to +the end of the line is ignored. At the top of every run control file are the defile +directives (which correspond with defile options). After the defile directives may +come sections of directives for various input plugins. Each of these sections is headed by a section heading indicating the input plugin type between square brackets. For example: .IP [ascii] .PP +If a file contains more than one section for the same input plugin, they are +concatenated together into a single section. +.PP Run Control files may themselves include other run control files to arbitrary depth using the .B Include -directive. Unlike all other directives, this directive ignores sections: the -included file is read wherever it appears in the file and the contents of all -it's sections are effectively merged into the appropriate sections of the -parent file. +directive. +.B Include +directives which appear in the top (unnamed) section reserved for Defile options are +always processed, regardless of whether Defile is processing Defile options or input +options (of any type). +.B Include +directives placed inside an input plugin section are only processed when reading +configuration for the specified input plugin. Despite this, these included files +must still contain an appropriate section header to be properly processed. -The default run control file, @absolute_sysconfdir@/defilerc, is read (if +The default global run control file, @absolute_sysconfdir@/defilerc, is read (if present) and all the defile directives found within (plus those in any other -configuration files it includes) are inserted before the first command line -option. The contents of the appropriate input plugin section is also inserted -before the first input option. +configuration files it includes) first. After this, the per-user run control file, +${HOME}/.defilerc, is read (if present) and processed similarly. The local per-user +configuration file is read second to permit it to override the global configuration. +Configuration found in these two default run control files are inserted before the +first command line option. The contents of the appropriate input plugin sections from +these files are also inserted before the first input option. + Parsing of other run control files specified by the .B \-\-conf option on the command line occurs a little differently: in this case, only one @@ -756,7 +776,9 @@ defile directives, or else the input plugin section for the input type in use, depending on whether the .B \-\-conf -option appears before or after the double dash. +option appears before or after the double dash (with the exception of +.I Include +directives in the top section, which are always followed). .SH NETWORKING @@ -766,15 +788,20 @@ In the .IR "server-client model" , the local defile connects to a defile running in server mode on the remote host. -It is designed for tranmitting data from an in-progress data acquisition to a -many client hosts. +It is designed for tranmitting data from an in-progress data acquisition to many client +hosts. .IP \(bu In the .IR "remote shell model" , -the local defile logs into the remote host (using a remote shell such as ssh) +the local defile logs into the remote host (using a remote shell such as ssh(1)) and starts a one-time-use defile process on the remote host. It is designed for the transmission of a single data source from the remote to the local host. .PP +Both methods require defile to be installed on the remote machine, and the +local and remote defiles must speak compatible versions of the defile network +protocol. + +.SS The Server-Client Model A defile server is started by specifying a numeric port to listen on with the .B \-\-listen option. Servers are almost always run in @@ -792,13 +819,16 @@ by the input plugin which, in turn, is typically rate limited by whatever process is producing the data. If a network connection or client is unable to keep up with the data rate, the server will simply discard unsent frames rather -than get backlogged. However, a bandwidth limit is also imposed (this may be +than get backlogged. However, a bandwidth throttle is also imposed (this may be adjusted using the .B \-\-server\-bwlimit -option). A server will rate limit itself to the specified limit, even if that -results in the server not keeping up with the input data rate. Note: at -high input data rates (eg. when reading previously acquired data, where the data -rate is usually limited only by the speed at which the input plugin can extract +option). A server will rate-limit itself to the specified limit, even if that +results in the server not keeping up with the input data rate. This is a global rate, +not a per-client rate: more clients connecting to a throttled server will +effectively increase the amount of per-client throttling. + +Note: at high input data rates (eg. when reading previously acquired data, where the +data rate is usually limited only by the speed at which the input plugin can extract it from the input data source) the server may want to write data faster than the underlying network link allows. In this case data will always be dropped. As a result, it's always a good idea to match the server bandwidth limit to the @@ -807,7 +837,7 @@ To connect to a server, specify the remote host and port using the .B \-\-remote option. When the server detects a connection from a new client, it first sends -the output dirfile metadata, and then sends data frames as they are ready. The +the output dirfile metadata, and then sends data frames as they become ready. The data that the client receives won't start with the first frame of the input data source, but will be whatever frame the server happened to transmit next. As a result, dirfile created using the server-client method almost always have @@ -817,12 +847,13 @@ designator should be given to the server: such arguments to the client defile will be simply ignored. +.SS The Remote Shell Model The remote shell method is instantiated by specifying the remote host, without a port number, using the .B \-\-remote option. A username may also be given if the remote username is different than the local one. In this method, the local defile will log into the remote -host using ssh (or another transparent remote shell specified with +host using ssh(1) (or another transparent remote shell specified with .BR \-\-rsh ) and then run an instance of defile on the remote host. In this case, the data rate will be limited both by the input plugin as well as the network connection @@ -833,20 +864,21 @@ interpretation. The input type need not even be supported by the local, receiving defile. -Both methods require defile to be installed on the remote machine, and the -local and remote defiles must speak compatible versions of the defile network -protocol. +Because this method requires each client to start its own defile process on the +remote machine, the remote host can get quickly bogged down by multiple clients +simultaneously requesting data from it. .SH FILES .TP -.I ${HOME}/.defilerc -the per-user configuration file, which will be read first, before both the -system-wide configuration file, and also options on the command line. See the +.I @absolute_sysconfdir@/defilerc +the defile system-wide configuration file, which will be read first, before both +the per-user configuration file, and also options on the command line. See +the .B RUN CONTROL FILES section above for details on syntax. .TP -.I @absolute_sysconfdir@/defilerc -the defile system-wide configuration file, which will be read after the per-user +.I ${HOME}/.defilerc +the defile per-user configuration file, which will be read after the system-wide configuration file (if any), but before the options on the command line. See the .B RUN CONTROL FILES @@ -879,7 +911,7 @@ Defile was written by D. V. Wiebe. .SH REPORTING BUGS -Please send reports of bugs to get...@li... +Please send reports of bugs to @PACKAGE_BUGREPORT@. The Defile home page is: <http://getdata.sourceforge.net/defile/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |