Thread: [Getdata-commits] SF.net SVN: getdata:[626] trunk/getdata (Page 4)
Scientific Database Format
Brought to you by:
ketiltrout
|
From: <ket...@us...> - 2011-11-13 21:11:18
|
Revision: 626
http://getdata.svn.sourceforge.net/getdata/?rev=626&view=rev
Author: ketiltrout
Date: 2011-11-13 21:11:09 +0000 (Sun, 13 Nov 2011)
Log Message:
-----------
Move OOP write code into the bookkeeping layer. Report write errors.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/src/ascii.c
trunk/getdata/src/bzip.c
trunk/getdata/src/encoding.c
trunk/getdata/src/entry.c
trunk/getdata/src/fpos.c
trunk/getdata/src/gzip.c
trunk/getdata/src/internal.h
trunk/getdata/src/meta_list.c
trunk/getdata/src/mod.c
trunk/getdata/src/move.c
trunk/getdata/src/putdata.c
trunk/getdata/src/raw.c
trunk/getdata/src/sie.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/gzip_move_to.c
trunk/getdata/test/gzip_put.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/ChangeLog 2011-11-13 21:11:09 UTC (rev 626)
@@ -1,3 +1,16 @@
+2011-11-13 D. V. Wiebe <ge...@ke...> svn:626
+ * src/entry.c (gd_raw_filename): Revert r613 changes.
+ * src/gzip.c: Move OOP code out of gzip layer.
+ * src/encoding.c (_GD_FiniRawIO _GD_InitRawIO) src/fpos.c (_GD_WriteSeek):
+ Handle OOP writes.
+ * src/encoding.c (_GD_WriteOut): Added.
+ * src/mod.c (_GD_Change) src/putdata.c (_GD_DoRawOut): Call _GD_WriteSeek and
+ _GD_WriteOut
+
+ * src/putdata.c (_GD_DoRawOut): Correctly handle write errors.
+
+ * configure.ac: Fix x86_64 host check.
+
2011-11-10 D. V. Wiebe <ge...@ke...> svn:622
* configure.ac: Figure out whether unaligned memory access will work.
* src/internal.h: Deal with UNALIGNED_ACCESS_OK
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/configure.ac 2011-11-13 21:11:09 UTC (rev 626)
@@ -59,8 +59,8 @@
echo
dnl Build/Host triplets
+AC_CANONICAL_BUILD
AC_CANONICAL_HOST
-AC_CANONICAL_BUILD
dnl Legacy API
AC_ARG_ENABLE(legacy-api, AS_HELP_STRING([--disable-legacy-api],
@@ -314,7 +314,7 @@
AC_MSG_CHECKING([whether ${host} supports fast unaligned memory access])
case "${host}" in
- i?86-*-*|powerpc-*-*|x86-64) gd_unaligned_ok=yes;
+ i?86-*-*|powerpc-*-*|x86_64-*-*) gd_unaligned_ok=yes;
AC_DEFINE([UNALIGNED_ACCESS_OK], [1],
[Define to 1 if the platform supports fast unaligned memory access])
;;
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/ascii.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -33,10 +33,10 @@
/* The ASCII encoding uses file->edata for the stream pointer */
-int _GD_AsciiOpen(int fd, int fd2 __gd_unused, struct _gd_raw_file* file,
- int swap __gd_unused, unsigned int mode)
+int _GD_AsciiOpen(int fd, struct _gd_raw_file* file, int swap __gd_unused,
+ unsigned int mode)
{
- dtrace("%i, <unused>, %p, <unused>, %u", fd, file, mode);
+ dtrace("%i, %p, <unused>, %u", fd, file, mode);
if (!(mode & GD_FILE_TEMP)) {
if (file->mode & mode) {
Modified: trunk/getdata/src/bzip.c
===================================================================
--- trunk/getdata/src/bzip.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/bzip.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -101,10 +101,10 @@
return ptr;
}
-int _GD_Bzip2Open(int dirfd, int fd2 __gd_unused, struct _gd_raw_file* file,
- int swap __gd_unused, unsigned int mode __gd_unused)
+int _GD_Bzip2Open(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
+ unsigned int mode __gd_unused)
{
- dtrace("%i, <unused>, %p, <unused>, <unused>", dirfd, file);
+ dtrace("%i, %p, <unused>, <unused>", dirfd, file);
file->edata = _GD_Bzip2DoOpen(dirfd, file);
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/encoding.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -321,14 +321,38 @@
{
const int clotemp = (flags & GD_FINIRAW_CLOTEMP) ? 1 : 0;
const int old_mode = E->e->u.raw.file[0].mode;
+ const int oop_write = ((_gd_ef[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP)
+ && (old_mode & GD_FILE_WRITE)) ? 1 : 0;
dtrace("%p, %p, %i, 0x%X", D, E, fragment, flags);
if ((E->e->u.raw.file[clotemp].idata >= 0) ||
- (clotemp == 0 && (_gd_ef[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP) &&
- (E->e->u.raw.file[1].idata >= 0)))
+ (clotemp == 0 && oop_write && (E->e->u.raw.file[1].idata >= 0)))
{
+ /* close the secondary file in write mode (but not temp mode) */
+ if (oop_write && E->e->u.raw.file[1].idata >= 0) {
+ if (E->e->u.raw.file[0].idata >= 0) {
+ /* copy the rest of the input to the output */
+ char buffer[GD_BUFFER_SIZE];
+ int n_read, n_wrote;
+
+ do {
+ n_read = (*_gd_ef[E->e->u.raw.file[0].subenc].read)(E->e->u.raw.file,
+ buffer, E->EN(raw,data_type), GD_BUFFER_SIZE);
+ if (n_read > 0)
+ n_wrote = (*_gd_ef[E->e->u.raw.file[0].subenc].write)(
+ E->e->u.raw.file + 1, buffer, E->EN(raw,data_type), n_read);
+ } while (n_read == GD_BUFFER_SIZE);
+ }
+
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].close)(E->e->u.raw.file + 1)) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ }
+
/* close the file */
- if ((*_gd_ef[E->e->u.raw.file[clotemp].subenc].close)(E->e->u.raw.file +
+ if ((E->e->u.raw.file[clotemp].idata >= 0) &&
+ (*_gd_ef[E->e->u.raw.file[clotemp].subenc].close)(E->e->u.raw.file +
clotemp))
{
if (D->error == GD_E_OK)
@@ -345,16 +369,15 @@
}
/* take care of moving things into place */
- if ((old_mode == GD_FILE_WRITE && (_gd_ef[E->e->u.raw.file[0].subenc].flags
- & GD_EF_OOP)) || flags & GD_FINIRAW_CLOTEMP)
- {
+ 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,
0))
{
if (D->error == GD_E_OK)
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
+ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
+ NULL);
dreturn("%i", -1);
return -1;
}
@@ -374,15 +397,47 @@
return 0;
}
+/* Perform a RAW field write */
+ssize_t _GD_WriteOut(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
+ const void *ptr, gd_type_t type, size_t n, int temp)
+{
+ ssize_t n_wrote;
+
+ dtrace("%p, %p, %p, %p, 0x%X, %zu, %i", D, E, enc, ptr, type, n, temp);
+
+ if (temp)
+ n_wrote = (*enc->write)(E->e->u.raw.file + 1, ptr, type, n);
+ else {
+ if (enc->flags & GD_EF_OOP) {
+ n_wrote = (*enc->write)(E->e->u.raw.file + 1, ptr, type, n);
+
+ if (n_wrote > 0 && E->e->u.raw.file[0].idata >= 0) {
+ /* advance the read pointer by the appropriate amount */
+ if ((*enc->seek)(E->e->u.raw.file, E->e->u.raw.file[0].pos + n_wrote,
+ E->EN(raw,data_type), GD_FILE_READ) < 0)
+ {
+ n_wrote = -1;
+ }
+ }
+ } else
+ n_wrote = (*enc->write)(E->e->u.raw.file, ptr, type, n);
+ }
+
+ dreturn("%zi", n_wrote);
+ return n_wrote;
+}
+
/* Open a raw file, if necessary; also check for required functions */
int _GD_InitRawIO(DIRFILE *D, gd_entry_t *E, const char *filebase,
- int fragment, const struct encoding_t *new_enc, unsigned int funcs,
+ int fragment, const struct encoding_t *enc, unsigned int funcs,
unsigned int mode, int swap)
{
int temp_fd = -1;
const int touch = mode & GD_FILE_TOUCH;
+ int oop_write = 0;
+
dtrace("%p, %p, \"%s\", %i, %p, 0x%X, 0x%X, %i", D, E, filebase, fragment,
- new_enc, funcs, mode, swap);
+ enc, funcs, mode, swap);
if (mode & (GD_FILE_WRITE | GD_FILE_TOUCH))
funcs |= GD_EF_WRITE;
@@ -394,18 +449,33 @@
dreturn("%i", 1);
return 1;
}
- }
- /* close the file, if necessary */
- if ((E->e->u.raw.file[0].idata >= 0 ||
- ((_gd_ef[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP) &&
- (E->e->u.raw.file[1].idata >= 0))) && !(mode & GD_FILE_TEMP) &&
- (E->e->u.raw.file[0].mode & GD_FILE_RDWR) != (mode & GD_FILE_RDWR))
- {
- if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
- dreturn("%i", 1);
- return 1;
+ enc = _gd_ef + E->e->u.raw.file[0].subenc;
+ oop_write = ((enc->flags & GD_EF_OOP) && mode == GD_FILE_WRITE) ? 1 : 0;
+
+ /* Do nothing, if possible */
+ if (!touch && (((mode & GD_FILE_READ) && (E->e->u.raw.file[0].idata >= 0)
+ && (E->e->u.raw.file[0].mode & GD_FILE_READ))
+ || ((mode & GD_FILE_WRITE) && (E->e->u.raw.file[oop_write].idata >= 0)
+ && (E->e->u.raw.file[0].mode & GD_FILE_WRITE))))
+ {
+ dreturn("%i", 0);
+ return 0;
}
+
+ /* close the file, if necessary */
+ if ((E->e->u.raw.file[0].idata >= 0 || ((enc->flags & GD_EF_OOP)
+ && (E->e->u.raw.file[1].idata >= 0)))
+ && ((mode == GD_FILE_READ && (enc->flags & GD_EF_OOP)
+ && (E->e->u.raw.file[0].mode & GD_FILE_WRITE))
+ || (mode == GD_FILE_WRITE
+ && !(E->e->u.raw.file[0].mode & GD_FILE_WRITE))))
+ {
+ if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
+ dreturn("%i", 1);
+ return 1;
+ }
+ }
}
if (filebase == NULL)
@@ -423,7 +493,7 @@
E->e->u.raw.file[1].name)) < 0)
{
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
- } else if ((*new_enc->open)(temp_fd, -1, E->e->u.raw.file + 1, swap,
+ } else if ((*enc->open)(temp_fd, E->e->u.raw.file + 1, swap,
GD_FILE_WRITE | GD_FILE_TEMP))
{
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
@@ -433,39 +503,50 @@
dreturn("%i", 1);
return 1;
}
- } else if (E->e->u.raw.file[0].idata < 0) {
- /* open a regular file, if necessary */
- if ((_gd_ef[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP) &&
- mode == GD_FILE_WRITE)
- {
- /* an out-of-place write requires us to open a temporary file and pass
- * in its fd */
- if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, filebase, 1))
- {
- dreturn("%i", 1);
- return 1;
- } else if ((temp_fd = _GD_MakeTempFile(D,
- D->fragment[E->fragment_index].dirfd, E->e->u.raw.file[1].name))
- < 0)
- {
- dreturn("%i", 1);
- return 1;
- }
- }
+ dreturn("%i", 0);
+ return 0;
+ }
- if (_GD_SetEncodedName(D, E->e->u.raw.file, filebase, 0)) {
+ if (oop_write) {
+ /* an out-of-place write requires us to open a temporary file and pass
+ * in its fd */
+ if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, filebase, 1)) {
dreturn("%i", 1);
return 1;
- } else if ((*_gd_ef[E->e->u.raw.file[0].subenc].open)(
- D->fragment[E->fragment_index].dirfd, temp_fd, E->e->u.raw.file,
- _GD_FileSwapBytes(D, E->fragment_index), mode))
+ } else if ((temp_fd = _GD_MakeTempFile(D,
+ D->fragment[E->fragment_index].dirfd, E->e->u.raw.file[1].name))
+ < 0)
{
+ dreturn("%i", 1);
+ return 1;
+ } else if ((*enc->open)(temp_fd, E->e->u.raw.file + 1, _GD_FileSwapBytes(D,
+ E->fragment_index), GD_FILE_WRITE)) {
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
dreturn("%i", 1);
return 1;
}
+ /* The read file in OOP mode is flagged as RW. */
+ mode = GD_FILE_RDWR;
}
+ /* open a regular file, if necessary */
+ if (E->e->u.raw.file[0].idata < 0) {
+ if (_GD_SetEncodedName(D, E->e->u.raw.file, filebase, 0)) {
+ dreturn("%i", 1);
+ return 1;
+ } else if ((*enc->open)(D->fragment[E->fragment_index].dirfd,
+ E->e->u.raw.file, _GD_FileSwapBytes(D, E->fragment_index), mode))
+ {
+ /* In oop_write mode, it doesn't matter if the old file doesn't exist */
+ if (!oop_write || errno != ENOENT) {
+ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+ dreturn("%i", 1);
+ return 1;
+ }
+ E->e->u.raw.file[0].mode = mode;
+ }
+ }
+
if (touch)
_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP);
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/entry.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -318,13 +318,13 @@
}
}
- filename = malloc(strlen(D->name) + strlen(E->e->u.raw.file->name) + 2);
+ filename = _GD_MakeFullPath(D, D->fragment[E->fragment_index].dirfd,
+ E->e->u.raw.file->name);
if (filename == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%p", NULL);
return NULL;
}
- sprintf(filename, "%s/%s", D->name, E->e->u.raw.file->name);
dreturn("%p", filename);
return filename;
Modified: trunk/getdata/src/fpos.c
===================================================================
--- trunk/getdata/src/fpos.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/fpos.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -155,17 +155,18 @@
return (off_t)gd_tell64(D, field_code);
}
-off64_t _GD_WriteSeek(DIRFILE *D, gd_entry_t *E, off64_t offset,
- unsigned int mode)
+off64_t _GD_WriteSeek(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
+ off64_t offset, unsigned int mode)
{
- off64_t pos;
+ off64_t pos = 0;
+ const int which = (mode & GD_FILE_TEMP) ? 1 : 0;
+ const int oop_write = ((enc->flags & GD_EF_OOP) && (mode & GD_FILE_WRITE))
+ ? 1 : 0;
- dtrace("%p, %p, %lli, 0x%X", D, E, (long long)offset, mode);
+ dtrace("%p, %p, %p, %lli, 0x%X", D, E, enc, (long long)offset, mode);
/* in this case we need to close and then re-open the file */
- if ((offset < E->e->u.raw.file[0].pos) && mode == GD_FILE_WRITE &&
- (_gd_ef[E->e->u.raw.file[0].subenc].flags & GD_EF_OOP))
- {
+ if ((offset < E->e->u.raw.file[which].pos) && oop_write) {
if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_KEEP)) {
dreturn("%i", -1);
return -1;
@@ -176,9 +177,52 @@
}
}
- pos = (*_gd_ef[E->e->u.raw.file[0].subenc].seek)(E->e->u.raw.file, offset,
- E->EN(raw,data_type), mode);
+ if (oop_write && E->e->u.raw.file[0].idata >= 0) {
+ /* read from the old file until we reach the point we're interested in or
+ * run out of data */
+ char buffer[GD_BUFFER_SIZE];
+ ssize_t n_read, n_wrote;
+ while (offset * GD_SIZE(E->EN(raw,data_type)) > GD_BUFFER_SIZE) {
+ n_read = (*enc->read)(E->e->u.raw.file, buffer, E->EN(raw,data_type),
+ GD_BUFFER_SIZE);
+ if (n_read > 0) {
+ n_wrote = (*enc->write)(E->e->u.raw.file + 1, buffer,
+ E->EN(raw,data_type), n_read);
+ if (n_wrote != n_read) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ offset -= n_wrote;
+ pos += n_wrote;
+ } else if (n_read < 0) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ }
+
+ if (offset > 0) {
+ n_read = (*enc->read)(E->e->u.raw.file, buffer, E->EN(raw,data_type),
+ offset);
+ if (n_read > 0) {
+ n_wrote = (*enc->write)(E->e->u.raw.file + 1, buffer,
+ E->EN(raw,data_type), n_read);
+ if (n_wrote != n_read) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ offset -= n_wrote;
+ pos += n_wrote;
+ } else if (n_read < 0) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ }
+ }
+
+ pos += (*enc->seek)(E->e->u.raw.file + which, offset, E->EN(raw,data_type),
+ mode);
+
dreturn("%lli", (long long)pos);
return pos;
}
@@ -213,8 +257,9 @@
break;
}
- if (_GD_WriteSeek(D, E, offset - E->EN(raw,spf) *
- D->fragment[E->fragment_index].frame_offset, mode) == -1)
+ if (_GD_WriteSeek(D, E, _gd_ef + E->e->u.raw.file[0].subenc, offset -
+ E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset, mode)
+ == -1)
{
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
}
Modified: trunk/getdata/src/gzip.c
===================================================================
--- trunk/getdata/src/gzip.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/gzip.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -43,76 +43,33 @@
#define _GD_GzipSize libgetdatagzip_LTX_GD_GzipSize
#endif
-#if SIZEOF_INT < 4
-#define GD_GZIP_BUFFER_SIZE 32767
-#else
-#define GD_GZIP_BUFFER_SIZE 1000000
-#endif
-
/* The gzip encoding scheme uses edata as a gzFile object. If a file is
* open, idata >= 0 otherwise idata = -1. Writes occur out-of-place. */
-int _GD_GzipOpen(int fd, int fd2, struct _gd_raw_file* file,
- int swap __gd_unused, unsigned int mode)
+int _GD_GzipOpen(int fd, struct _gd_raw_file* file, int swap __gd_unused,
+ unsigned int mode)
{
- dtrace("%i, %i, %p, <unused>, %u", fd, fd2, file, mode);
+ const char *gzmode = "w";
+ dtrace("%i, %p, <unused>, %u", fd, file, mode);
- if (!(mode & GD_FILE_TEMP)) {
- if (file->idata > 0 && file->mode != mode) {
- /* need to re-open */
- _GD_GzipClose(file);
- } else if (file->idata > 0 && file->mode == mode) {
- dreturn("%i", 0);
- return 0;
- }
+ if (mode & GD_FILE_READ) {
+ file->idata = gd_OpenAt(file->D, fd, file->name, O_RDONLY | O_BINARY, 0666);
- file[0].idata = gd_OpenAt(file->D, fd, file->name, O_RDONLY | O_BINARY,
- 0666);
-
- if (file[0].idata == -1) {
- /* if we're in write mode, but the old file doesn't exist, it's not a
- * problem */
- if (mode != GD_FILE_WRITE || errno != ENOENT) {
- dreturn("%i", 1);
- return 1;
- }
- file[0].edata = NULL;
- } else {
- /* regardless of mode, in the non-temp situation, file[0] is always
- * opened read-only
- */
- file[0].edata = gzdopen(file[0].idata, "r");
-
- if (file[0].edata == NULL) {
- close(file[0].idata);
- file[0].idata = -1;
- dreturn("%i", 1);
- return 1;
- }
- }
-
- /* also open the out-of-place file in write mode */
- if (mode == GD_FILE_WRITE) {
- file[1].edata = gzdopen(file[1].idata = fd2, "w");
- if (file[1].edata == NULL) {
- close(file[1].idata);
- if (file[0].idata >= 0)
- close(file[0].idata);
- file[1].idata = file[0].idata = -1;
- dreturn("%i", 1);
- return 1;
- }
- }
- } else {
- /* temporary files are always write only */
- file->edata = gzdopen(file->idata = fd, "w");
-
- if (file->edata == NULL) {
- close(file->idata);
- file->idata = -1;
+ if (file->idata == -1) {
dreturn("%i", 1);
return 1;
}
+ gzmode = "r";
+ } else
+ file->idata = fd;
+
+ file->edata = gzdopen(file->idata, gzmode);
+
+ if (file->edata == NULL) {
+ close(file->idata);
+ file->idata = -1;
+ dreturn("%i", 1);
+ return 1;
}
file->mode = mode;
@@ -135,37 +92,6 @@
count *= GD_SIZE(data_type);
- if (mode == GD_FILE_WRITE && file[0].edata != NULL) {
- /* read from the old file until we reach the point we're interested in or
- * run out of data */
- char buffer[GD_GZIP_BUFFER_SIZE];
- int n_read, n_wrote;
-
- while (count > GD_GZIP_BUFFER_SIZE) {
- n_read = gzread(file[0].edata, buffer, GD_GZIP_BUFFER_SIZE);
- if (n_read >= 0) {
- n_wrote = gzwrite(file[1].edata, buffer, n_read);
- count -= n_wrote;
- n += n_wrote;
- } else {
- dreturn("%i", -1);
- return -1;
- }
- }
-
- if (count > 0) {
- n_read = gzread(file[0].edata, buffer, count);
- if (n_read >= 0) {
- n_wrote = gzwrite(file[1].edata, buffer, n_read);
- count -= n_wrote;
- n += n_wrote;
- } else {
- dreturn("%i", -1);
- return -1;
- }
- }
- }
-
if (count > 0) {
n = (off64_t)gzseek(file[(mode == GD_FILE_WRITE) ? 1 : 0].edata,
(off_t)count, SEEK_SET);
@@ -214,20 +140,8 @@
dtrace("%p, %p, 0x%X, %zu", file, ptr, data_type, nmemb);
- if (file->mode & GD_FILE_TEMP) {
- n = gzwrite(file[0].edata, ptr, GD_SIZE(data_type) * nmemb);
- } else {
- n = gzwrite(file[1].edata, ptr, GD_SIZE(data_type) * nmemb);
+ n = gzwrite(file->edata, ptr, GD_SIZE(data_type) * nmemb);
- if (n > 0 && file[0].idata >= 0) {
- /* advance the read pointer by the appropriate amount */
- if (gzseek(file[0].edata, (off_t)n, SEEK_CUR) < 0) {
- gzerror(file[0].edata, &errnum);
- if (errnum < 0)
- n = -1;
- }
- }
- }
if (n >= 0) {
n /= GD_SIZE(data_type);
file->pos += n;
@@ -237,7 +151,7 @@
n = -1;
}
- dreturn("%zu", n);
+ dreturn("%zi", n);
return n;
}
@@ -257,37 +171,12 @@
dtrace("%p", file);
- /* close the secondary file in write mode (but not temp mode) */
- if (file->mode == GD_FILE_WRITE) {
- if (file[0].idata >= 0) {
- /* copy the rest of the input to the output */
- char buffer[GD_GZIP_BUFFER_SIZE];
- int n_read, n_wrote;
-
- do {
- n_read = gzread(file[0].edata, buffer, GD_GZIP_BUFFER_SIZE);
- if (n_read > 0)
- n_wrote = gzwrite(file[1].edata, buffer, n_read);
- } while (n_read == GD_GZIP_BUFFER_SIZE);
- }
-
- ret = gzclose(file[1].edata);
- dwatch("%i", ret);
- if (ret) {
- dreturn("%i", ret);
- return ret;
- }
- file[1].idata = -1;
+ ret = gzclose(file->edata);
+ if (ret) {
+ dreturn("%i", ret);
+ return ret;
}
- if (file[0].idata >= 0) {
- ret = gzclose(file->edata);
- if (ret) {
- dreturn("%i", ret);
- return ret;
- }
- }
-
file->idata = -1;
file->edata = NULL;
file->mode = 0;
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/internal.h 2011-11-13 21:11:09 UTC (rev 626)
@@ -117,6 +117,12 @@
#endif
#endif
+#if SIZEOF_INT < 4
+#define GD_BUFFER_SIZE 32767
+#else
+#define GD_BUFFER_SIZE 1000000
+#endif
+
#ifdef _MSC_VER
# define _gd_static_inline static
#else
@@ -675,7 +681,7 @@
# define SCREWY_FLOATS
#endif
-typedef int (*gd_ef_open_t)(int, int, struct _gd_raw_file*, int, unsigned int);
+typedef int (*gd_ef_open_t)(int, struct _gd_raw_file*, int, unsigned int);
typedef off64_t (*gd_ef_seek_t)(struct _gd_raw_file*, off64_t, gd_type_t,
unsigned int);
typedef off64_t (*gd_ef_size_t)(int, struct _gd_raw_file*, gd_type_t, int);
@@ -903,15 +909,17 @@
int standards, int pedantic);
char* _GD_ValidateField(const gd_entry_t* parent, const char* field_code,
int standards, int pedantic, int* is_dot);
-off64_t _GD_WriteSeek(DIRFILE *D, gd_entry_t *E, off64_t offset,
+off64_t _GD_WriteSeek(DIRFILE*, gd_entry_t*, const struct encoding_t*, off64_t,
unsigned int mode);
+ssize_t _GD_WriteOut(DIRFILE *D, gd_entry_t *E, const struct encoding_t *enc,
+ const void *buf, gd_type_t type, size_t n, int temp);
/* generic I/O methods */
int _GD_GenericMove(int, struct _gd_raw_file* file, int, char* new_path);
int _GD_GenericUnlink(int, struct _gd_raw_file* file);
/* unencoded I/O methods */
-int _GD_RawOpen(int, int, struct _gd_raw_file* file, int swap, unsigned int);
+int _GD_RawOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
off64_t _GD_RawSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
ssize_t _GD_RawRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
@@ -924,7 +932,7 @@
int swap);
/* text I/O methods */
-int _GD_AsciiOpen(int, int, struct _gd_raw_file* file, int swap, unsigned int);
+int _GD_AsciiOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
off64_t _GD_AsciiSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
ssize_t _GD_AsciiRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
@@ -938,7 +946,7 @@
int swap);
/* bzip I/O methods */
-int _GD_Bzip2Open(int, int, struct _gd_raw_file* file, int swap, unsigned int);
+int _GD_Bzip2Open(int, struct _gd_raw_file* file, int swap, unsigned int);
off64_t _GD_Bzip2Seek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
ssize_t _GD_Bzip2Read(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
@@ -948,7 +956,7 @@
int swap);
/* gzip I/O methods */
-int _GD_GzipOpen(int, int, struct _gd_raw_file* file, int swap, unsigned int);
+int _GD_GzipOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
off64_t _GD_GzipSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
ssize_t _GD_GzipRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
@@ -961,7 +969,7 @@
int swap);
/* lzma I/O methods */
-int _GD_LzmaOpen(int, int, struct _gd_raw_file* file, int swap, unsigned int);
+int _GD_LzmaOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
off64_t _GD_LzmaSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
ssize_t _GD_LzmaRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
@@ -971,7 +979,7 @@
int swap);
/* slim I/O methods */
-int _GD_SlimOpen(int, int, struct _gd_raw_file* file, int, unsigned int);
+int _GD_SlimOpen(int, struct _gd_raw_file* file, int, unsigned int);
off64_t _GD_SlimSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
ssize_t _GD_SlimRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
@@ -981,7 +989,7 @@
int swap);
/* SIE I/O methods */
-int _GD_SampIndOpen(int, int, struct _gd_raw_file* file, int swap,
+int _GD_SampIndOpen(int, struct _gd_raw_file* file, int swap,
unsigned int);
off64_t _GD_SampIndSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
Modified: trunk/getdata/src/meta_list.c
===================================================================
--- trunk/getdata/src/meta_list.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/meta_list.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -124,7 +124,6 @@
free(e->carray_value_list);
fl = (gd_carray_t *)malloc(sizeof(gd_carray_t) * (e->n_meta_carray + 1));
- dwatch("%i", e->n_meta_carray);
if (fl == NULL) {
dreturn("%p", NULL);
Modified: trunk/getdata/src/mod.c
===================================================================
--- trunk/getdata/src/mod.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/mod.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -306,11 +306,9 @@
if (_GD_InitRawIO(D, E, NULL, -1, enc, 0, GD_FILE_WRITE | GD_FILE_TEMP,
_GD_FileSwapBytes(D, E->fragment_index)))
break;
- else if ((*enc->seek)(E->e->u.raw.file + 1, 0, E->EN(raw,data_type),
- GD_FILE_WRITE) == -1)
+ else if (_GD_WriteSeek(D, E, enc, 0, GD_FILE_WRITE | GD_FILE_TEMP)
+ == -1)
{
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
- NULL);
_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD |
GD_FINIRAW_CLOTEMP);
break;
@@ -355,8 +353,8 @@
buffer2 = ptr;
}
- nwrote = (*enc->write)(E->e->u.raw.file + 1, buffer1,
- Q.EN(raw,data_type), ns_out);
+ nwrote = _GD_WriteOut(D, E, enc, buffer1, Q.EN(raw,data_type), ns_out,
+ 1);
if (nwrote < ns_out) {
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno,
Modified: trunk/getdata/src/move.c
===================================================================
--- trunk/getdata/src/move.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/move.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -170,21 +170,16 @@
GD_FILE_WRITE) == -1)
{
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
- } else if ((*enc_out->seek)(E->e->u.raw.file + 1, -offset * E->EN(raw,spf),
- E->EN(raw,data_type), GD_FILE_WRITE) == -1)
- {
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
- }
+ } else
+ _GD_WriteSeek(D, E, enc_out, -offset * E->EN(raw,spf), GD_FILE_WRITE
+ | GD_FILE_TEMP);
} else { /* new offset is more, truncate old file */
if ((*enc_in->seek)(E->e->u.raw.file, offset * E->EN(raw,spf),
E->EN(raw,data_type), GD_FILE_READ) == -1)
{
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
- } else if ((*enc_out->seek)(E->e->u.raw.file + 1, 0, E->EN(raw,data_type),
- GD_FILE_WRITE) == -1)
- {
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
- }
+ } else
+ _GD_WriteSeek(D, E, enc_out, 0, GD_FILE_WRITE | GD_FILE_TEMP);
}
if (D->error) {
@@ -226,8 +221,8 @@
_GD_FixEndianness((char *)buffer, E->e->u.raw.size, nread);
}
- nwrote = (*enc_out->write)(E->e->u.raw.file + 1, buffer,
- E->EN(raw,data_type), nread);
+ nwrote = _GD_WriteOut(D, E, enc_out, buffer, E->EN(raw,data_type), nread,
+ 1);
if (nwrote < nread) {
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
Modified: trunk/getdata/src/putdata.c
===================================================================
--- trunk/getdata/src/putdata.c 2011-11-11 02:42:05 UTC (rev 625)
+++ trunk/getdata/src/putdata.c 2011-11-13 21:11:09 UTC (rev 626)
@@ -33,7 +33,7 @@
static size_t _GD_DoRawOut(DIRFILE *D, gd_entry_t *E, off64_t s0,
size_t ns, gd_type_t data_type, const void *data_in)
{
- size_t n_wrote;
+ ssize_t n_wrote;
void *databuffer;
/* check protect...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-01 16:31:42
|
Revision: 628
http://getdata.svn.sourceforge.net/getdata/?rev=628&view=rev
Author: ketiltrout
Date: 2011-12-01 16:31:32 +0000 (Thu, 01 Dec 2011)
Log Message:
-----------
Fix writing of /PROTECT directives.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/flush.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-11-17 01:48:56 UTC (rev 627)
+++ trunk/getdata/ChangeLog 2011-12-01 16:31:32 UTC (rev 628)
@@ -1,3 +1,7 @@
+2011-12-01 D. V. Wiebe <ge...@ke...> svn:628
+ * src/flush.c (_GD_FlushFragment): Write "/PROTECT data" when appropriate.
+ Bug report from Alexandra Rahlin.
+
2011-11-13 D. V. Wiebe <ge...@ke...> svn:626
* src/entry.c (gd_raw_filename): Revert r613 changes.
* src/gzip.c: Move OOP code out of gzip layer.
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2011-11-17 01:48:56 UTC (rev 627)
+++ trunk/getdata/src/flush.c 2011-12-01 16:31:32 UTC (rev 628)
@@ -522,7 +522,7 @@
fputs("/PROTECT none\n", stream);
else if (D->fragment[i].protection == GD_PROTECT_FORMAT)
fputs("/PROTECT format\n", stream);
- else if (D->fragment[i].protection == GD_PROTECT_FORMAT)
+ else if (D->fragment[i].protection == GD_PROTECT_DATA)
fputs("/PROTECT data\n", stream);
else
fputs("/PROTECT all\n", stream);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-12-04 00:32:21
|
Revision: 629
http://getdata.svn.sourceforge.net/getdata/?rev=629&view=rev
Author: ketiltrout
Date: 2011-12-04 00:32:11 +0000 (Sun, 04 Dec 2011)
Log Message:
-----------
Canonicalise paths to avoid getting tripped up by symlinks. Also a bunch of library include fixes.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/src/add.c
trunk/getdata/src/ascii.c
trunk/getdata/src/bzip.c
trunk/getdata/src/close.c
trunk/getdata/src/common.c
trunk/getdata/src/compat.c
trunk/getdata/src/constant.c
trunk/getdata/src/debug.c
trunk/getdata/src/del.c
trunk/getdata/src/encoding.c
trunk/getdata/src/endian.c
trunk/getdata/src/entry.c
trunk/getdata/src/errors.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/fpos.c
trunk/getdata/src/fragment.c
trunk/getdata/src/getdata.c
trunk/getdata/src/globals.c
trunk/getdata/src/gzip.c
trunk/getdata/src/include.c
trunk/getdata/src/index.c
trunk/getdata/src/internal.h
trunk/getdata/src/legacy.c
trunk/getdata/src/lzma.c
trunk/getdata/src/meta_list.c
trunk/getdata/src/mod.c
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/native.c
trunk/getdata/src/nframes.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/src/protect.c
trunk/getdata/src/putdata.c
trunk/getdata/src/raw.c
trunk/getdata/src/sie.c
trunk/getdata/src/slim.c
trunk/getdata/src/spf.c
trunk/getdata/src/types.c
trunk/getdata/test/file.c
trunk/getdata/test/fragment_name.c
trunk/getdata/test/test.h
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/ChangeLog 2011-12-04 00:32:11 UTC (rev 629)
@@ -1,3 +1,20 @@
+2011-12-03 D. V. Wiebe <ge...@ke...> svn:629
+ * test/test.h (CHECKEOS): Added.
+ * test/file.c test/fragment_name.c: Only check the end of the returned
+ string since we don't know what the full path is.
+
+ * src/internal.h: Define PATH_MAX, if necessary.
+ * src/common.c (_GD_CanonicalPath): Added.
+ * src/open.c (gd_cbopen): Canonicalise filedir.
+ * src/common.c (_GD_MakeFullPath): Canonicalise path. Handle dirfd < 0.
+ * src/common.c (_GD_GrabDir): Let _GD_MakeFullPath hande canonicalising
+ absolute paths.
+
+ * configure.ac: Check for lstat(3).
+ * src/compat.c (gd_StatAt): Don't use lstat if the platform doesn't have it.
+
+ * src/internal.h: Move library includes into header.
+
2011-12-01 D. V. Wiebe <ge...@ke...> svn:628
* src/flush.c (_GD_FlushFragment): Write "/PROTECT data" when appropriate.
Bug report from Alexandra Rahlin.
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/configure.ac 2011-12-04 00:32:11 UTC (rev 629)
@@ -673,9 +673,10 @@
AC_CHECK_FUNCS([_chsize _chsize_s _commit fchmod _fdopen fdopendir fseeko \
fseeko64 _fstat fstat64 _fstat64 fstatat fstatat64 fsync \
ftello ftello64 ftruncate ftruncate64 getcwd _getcwd getdelim \
- gmtime_r lseek64 _lseeki64 lstat _mkdir nan _open openat _read \
- renameat _rmdir snprintf _snprintf stat64 _stat64 _strtoi64 \
- strtoll _strtoui64 strtoull _unlink unlinkat _write])
+ gmtime_r lseek64 _lseeki64 lstat lstat64 _mkdir nan _open \
+ openat _read readlink renameat _rmdir snprintf _snprintf \
+ stat64 _stat64 _strtoi64 strtoll _strtoui64 strtoull _unlink \
+ unlinkat _write])
if test "x$disable_c99" = "xno"; then
AC_CHECK_FUNCS([cabs])
fi
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/add.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,16 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
/* add an entry */
static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
{
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/ascii.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,17 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
/* The ASCII encoding uses file->edata for the stream pointer */
int _GD_AsciiOpen(int fd, struct _gd_raw_file* file, int swap __gd_unused,
Modified: trunk/getdata/src/bzip.c
===================================================================
--- trunk/getdata/src/bzip.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/bzip.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,14 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
#ifdef HAVE_BZLIB_H
#include <bzlib.h>
#endif
Modified: trunk/getdata/src/close.c
===================================================================
--- trunk/getdata/src/close.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/close.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,10 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
/* _GD_FreeD: free the DIRFILE and its subordinates
*/
static void _GD_FreeD(DIRFILE* D)
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/common.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -21,19 +21,11 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+/* This is defined on BSD */
+#ifndef MAXSYMLINKS
+#define MAXSYMLINKS 20
#endif
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
#ifdef GETDATA_DEBUG
int gd_col_count = 0;
char gd_debug_col[GD_COL_SIZE + 1] = "";
@@ -918,26 +910,285 @@
return D->name;
}
+/* This is effectively the POSIX.1 realpath(3) function, but with some
+ * optimisation due to the fact that we know that the front part of the
+ * path (car) has already been canonicalised */
+char *_GD_CanonicalPath(const char *car, const char *cdr)
+{
+ int last_element = 0, loop_count = 0;
+ size_t res_len, res_size, len;
+ char *res = NULL, *ptr, *work, *cur, *end;
+ dtrace("\"%s\", \"%s\"", car, cdr);
+
+ if (car && !_GD_AbsPath(cdr)) {
+ if (car[0] != '/') {
+ /* car is not abosulte -- don't bother trying to do anything fancy */
+ res = malloc(strlen(car) + strlen(cdr) + 2);
+ if (res == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ sprintf(res, "%s/%s", car, cdr);
+ return res;
+ }
+ /* car is nonnull and cdr is not absolute: copy car into res and
+ * cdr into work */
+ res = strdup(car);
+ if (res == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ res_size = (res_len = strlen(car)) + 1;
+
+ cur = work = strdup(cdr);
+ if (work == NULL) {
+ free(res);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ } else if (cdr[0] == '/') {
+ /* cdr is absolute: make res "/" and copy cdr relative to / into work;
+ * ignore car */
+ res_len = 1;
+ res = (char*)malloc(res_size = PATH_MAX);
+ if (res == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ res[0] = '/';
+ res[1] = '\0';
+
+ if (cdr[0] == '/' && cdr[1] == '\0') {
+ dreturn("\"%s\"", res);
+ return res;
+ }
+
+ cur = work = strdup(cdr + 1);
+ if (work == NULL) {
+ free(res);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ } else {
+ /* car is not present and cdr is relative: try to get the CWD; and make
+ * work CWD/cdr, relative to / if getcwd returned an absolute path. If
+ * getcwd fails, just use cdr, and abandon hope of an absolute path.
+ */
+ res = (char*)malloc(res_size = PATH_MAX);
+ work = (char*)malloc(PATH_MAX);
+ if (res == NULL || work == NULL) {
+ free(res);
+ free(res);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ if (gd_getcwd(work, PATH_MAX) == NULL) {
+ /* if getcwd fails, we're stuck with a relative path, oh well. */
+ free(work);
+ cur = work = strdup(cdr);
+ if (work == NULL) {
+ free(res);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ res[0] = '\0';
+ res_len = 0;
+ } else {
+ if ((len = strlen(work) + 2 + strlen(cdr)) < PATH_MAX) {
+ ptr = (char*)realloc(work, len);
+ if (ptr == NULL) {
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ work = ptr;
+ }
+ ptr = work + strlen(work);
+ *(ptr++) = '/';
+ strcpy(ptr, cdr);
+
+ if (work[0] == '/') {
+ res[0] = '/';
+ res[1] = '\0';
+ res_len = 1;
+ cur = work + 1;
+ } else {
+ res[0] = '\0';
+ res_len = 0;
+ cur = work;
+ }
+ }
+ }
+
+ /* now step through work, building up res as appropriate */
+ for (end = cur ; !last_element; cur = end) {
+ /* look for the next '/' or NUL */
+ for (; *end != '\0' && *end != '/'; ++end)
+ ;
+
+ /* end of string */
+ if (*end == '\0' && cur == end)
+ break;
+ else if (*end == '\0')
+ last_element = 1;
+
+ *(end++) = '\0';
+ if (cur[0] == '\0')
+ /* consecutive /s */
+ ;
+ else if (cur[0] == '.' && cur[1] == '\0') {
+ /* discard . */
+ continue;
+ } else if (cur[0] == '.' && cur[1] == '.' && cur[2] == '\0') {
+ /* don't strip the leading '/' */
+ if (res_len > 1) {
+ /* find the last '/', but don't strip the leading '/' */
+ for(ptr = res + res_len - 1; *ptr != '/' && ptr > res + 1; --ptr)
+ ;
+
+ /* strip the .. if possible, otherwise append it */
+ *ptr = '\0';
+ res_len = ptr - res;
+ }
+ } else {
+ /* a path element, copy it to res */
+ len = strlen(cur) + 1;
+ if (res_len + len >= res_size) {
+ ptr = (char*)realloc(res, res_size += (len < 1000) ? 1000 : len);
+ if (ptr == NULL) {
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ res = ptr;
+ }
+ if (res_len > 1 && res[res_len - 1] != '/')
+ res[res_len++] = '/';
+ strcpy(res + res_len, cur);
+ res_len += len - 1;
+#if defined HAVE_READLINK && defined HAVE_LSTAT64
+ {
+ gd_stat64_t statbuf;
+
+ /* check if it's a symlink */
+ if (lstat64(res, &statbuf)) {
+ if (errno == ENOENT && *end == '\0') {
+ /* the leaf doesn't exist. I guess that means we're done. */
+ goto _GD_CanonicalPath_DONE;
+ }
+ perror("lstat64");
+ /* doesn't exist */
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ if (S_ISLNK(statbuf.st_mode)) {
+ char target[PATH_MAX], *new;
+ ssize_t slen;
+
+ /* check for symlink loop */
+ if (loop_count++ > MAXSYMLINKS) {
+ errno = ELOOP;
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ /* get the link target */
+ slen = readlink(res, target, PATH_MAX);
+ if (slen == -1) {
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ /* now we have to start all over again */
+ ptr = target;
+ if (target[0] == '/') {
+ res[1] = '\0';
+ res_len = 1;
+ ptr++;
+ slen--;
+ } else if (res_len > 1) {
+ /* strip the symlink name from res */
+ for (ptr = res + res_len - 1; *ptr != '/'; --ptr)
+ ;
+ *(ptr + 1) = '\0';
+ res_len = res - ptr + 1;
+ }
+
+ /* now make a new work buffer of "target/remaining", asusming
+ * remaining is non-null, otherwise, just use target */
+ if (*end == '\0') {
+ free(work);
+ end = work = strdup(target);
+ if (work == NULL) {
+ free(res);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ } else {
+ char slash[2] = "/";
+ len = strlen(end) + slen + 2;
+
+ if (*(ptr + slen - 1) == '/') {
+ slash[0] = '\0';
+ len--;
+ }
+
+ new = (char*)malloc(len);
+ if (new == NULL) {
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ sprintf(new, "%s%s%s", ptr, slash, end);
+ free(work);
+ end = work = new;
+ }
+ }
+ }
+#endif
+ }
+ }
+
+_GD_CanonicalPath_DONE:
+ free(work);
+
+ /* trim */
+ ptr = realloc(res, res_len + 1);
+ if (ptr)
+ res = ptr;
+
+ dreturn("\"%s\"", res);
+ return res;
+}
+
char *_GD_MakeFullPath(const DIRFILE *D, int dirfd, const char *name)
{
const char *dir;
char *filepath;
dtrace("%p, %i, \"%s\"", D, dirfd, name);
- dir = _GD_DirName(D, dirfd);
- if (dir == NULL) {
- dreturn("%p", NULL);
- return NULL;
- }
+ if (dirfd >= 0) {
+ dir = _GD_DirName(D, dirfd);
+ if (dir == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ } else
+ dir = NULL;
- filepath = (char *)malloc(strlen(dir) + strlen(name) + 2);
- if (filepath == NULL) {
- dreturn("%p", NULL);
- return NULL;
- }
+ filepath = _GD_CanonicalPath(dir, name);
- strcat(strcat(strcpy(filepath, dir), "/"), name);
-
dreturn("\"%s\"", filepath);
return filepath;
}
@@ -951,10 +1202,7 @@
dtrace("%p, %i, \"%s\"", D, dirfd, name);
- if (abs)
- path = strdup(name);
- else
- path = _GD_MakeFullPath(D, dirfd, name);
+ path = _GD_MakeFullPath(D, dirfd, name);
if (path == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
Modified: trunk/getdata/src/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/compat.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,20 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <time.h>
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
/* The MSVCRT gmtime() is threadsafe */
#ifndef HAVE_GMTIME_R
struct tm *gmtime_r(const time_t *timep, struct tm *result)
@@ -111,9 +97,11 @@
dtrace("%p, %i, \"%s\", %p, %x", D, dirfd, name, buf, flags);
path = _GD_MakeFullPath(D, dirfd, name);
+#ifdef HAVE_LSTAT
if (flags & AT_SYMLINK_NOFOLLOW)
ret = lstat(path, buf);
else
+#endif
ret = stat(path, buf);
free(path);
Modified: trunk/getdata/src/constant.c
===================================================================
--- trunk/getdata/src/constant.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/constant.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,10 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
/* this function is little more than a public boilerplate for _GD_DoField */
int gd_get_constant(DIRFILE* D, const char *field_code_in,
gd_type_t return_type, void *data_out) gd_nothrow
Modified: trunk/getdata/src/debug.c
===================================================================
--- trunk/getdata/src/debug.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/debug.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,7 +20,6 @@
*/
#include "internal.h"
-#include <string.h>
extern char gd_debug_col[GD_COL_SIZE + 1];
extern int gd_col_count;
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/del.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,12 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
static void _GD_ClearDerived(DIRFILE* D, gd_entry_t* E, const gd_entry_t* C,
int check)
{
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/encoding.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,17 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
#ifdef USE_MODULES
#ifdef USE_PTHREAD
#ifdef HAVE_PTHREAD_H
Modified: trunk/getdata/src/endian.c
===================================================================
--- trunk/getdata/src/endian.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/endian.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,12 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
static void _GD_ByteSwapFragment(DIRFILE* D, unsigned long byte_sex,
int fragment, int move)
{
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/entry.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,15 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
void _GD_FreeE(DIRFILE *D, gd_entry_t* entry, int priv)
{
int i;
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/errors.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -21,12 +21,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
/* Error strings. */
static const struct {
int error;
Modified: trunk/getdata/src/field_list.c
===================================================================
--- trunk/getdata/src/field_list.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/field_list.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,10 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
/* zero length lists */
static const char* zero_list[1] = { NULL };
static const gd_carray_t zero_carrays[1] = { {0, NULL} };
Modified: trunk/getdata/src/flimits.c
===================================================================
--- trunk/getdata/src/flimits.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/flimits.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,12 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
static void _GD_ShiftFragment(DIRFILE* D, off64_t offset, int fragment,
int move)
{
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/flush.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,20 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <time.h>
-#include <limits.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
#define GD_MAX_PRETTY_FIELD_WIDTH 80
void _GD_Flush(DIRFILE* D, gd_entry_t *E, int clo)
Modified: trunk/getdata/src/fpos.c
===================================================================
--- trunk/getdata/src/fpos.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/fpos.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,11 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
off64_t _GD_GetFilePos(DIRFILE *D, gd_entry_t *E, off64_t index_pos)
{
int i;
Modified: trunk/getdata/src/fragment.c
===================================================================
--- trunk/getdata/src/fragment.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/fragment.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,10 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
const char *gd_fragmentname(DIRFILE* D, int index) gd_nothrow
{
dtrace("%p, %i", D, index);
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/getdata.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -21,16 +21,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <inttypes.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#endif
-
#include "nan.h"
#define EXTRACT_REPR(it,ot,f) \
Modified: trunk/getdata/src/globals.c
===================================================================
--- trunk/getdata/src/globals.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/globals.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,11 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#endif
-
/* This is nothing other than what the caller gave us. Presumably it should
* be better at keeping track of such things than us, but this is present in
* the event that it is not. */
Modified: trunk/getdata/src/gzip.c
===================================================================
--- trunk/getdata/src/gzip.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/gzip.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,15 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
Modified: trunk/getdata/src/include.c
===================================================================
--- trunk/getdata/src/include.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/include.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,19 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
/* Include a format file fragment -- returns the include index, or
* -1 on error */
int _GD_Include(DIRFILE* D, const char* ename, const char* format_file,
Modified: trunk/getdata/src/index.c
===================================================================
--- trunk/getdata/src/index.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/index.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,11 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#endif
-
#include "nan.h"
static double _GD_Extrapolate(DIRFILE *D, gd_entry_t *E, int repr, double value,
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/internal.h 2011-12-04 00:32:11 UTC (rev 629)
@@ -27,17 +27,38 @@
#endif
#include "getdata.h"
+
+/* library headers */
+#ifdef STDC_HEADERS
+#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#include <errno.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <fcntl.h>
-#include <sys/stat.h>
+#include <ctype.h>
+#include <limits.h>
+#include <math.h>
+#include <time.h>
+#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
#endif
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
/* MSVC types */
#ifdef _MSC_VER
@@ -117,6 +138,21 @@
#endif
#endif
+#ifndef PATH_MAX
+# ifdef _POSIX_PATH_MAX
+# define PATH_MAX _POSIX_PATH_MAX
+# elif defined MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else
+/* POSIX says we're supposed to check _pathconf in this case, but it goes on to
+ * say that the PATH_MAX value reported isn't guaranteed to be suitable for
+ * mallocing, so its not clear what they're trying to do there. The following
+ * will have to do.
+ */
+# define PATH_MAX 4096
+# endif
+#endif
+
#if SIZEOF_INT < 4
#define GD_BUFFER_SIZE 32767
#else
@@ -158,9 +194,6 @@
#endif
#endif
-/* For FILE */
-#include <stdio.h>
-
/* For the C99 integer types */
#ifdef HAVE_INTTYPES_H
# ifndef __STDC_FORMAT_MACROS
@@ -261,8 +294,10 @@
#ifdef HAVE__GETCWD
# define gd_getcwd _getcwd
+#elif defined HAVE_GETCWD
+# define gd_getcwd getcwd
#else
-# define gd_getcwd getcwd
+# define gd_getcwd(...) (NULL)
#endif
#ifndef HAVE_SNPRINTF
@@ -279,8 +314,11 @@
# endif
#endif
-#ifndef HAVE_LSTAT
-# define lstat stat
+#ifndef HAVE_LSTAT64
+# ifdef HAVE_LSTAT
+# define lstat64 lstat
+# define HAVE_LSTAT64
+# endif
#endif
#ifdef HAVE__STRTOI64
@@ -825,10 +863,11 @@
extern const gd_entype_t _gd_entype_index[GD_N_ENTYPES];
-void* _GD_Alloc(DIRFILE* D, gd_type_t type, size_t n);
+void *_GD_Alloc(DIRFILE*, gd_type_t, size_t) __attribute_malloc__;
void _GD_ArmEndianise(uint64_t* databuffer, int is_complex, size_t ns);
int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i);
int _GD_CalculateEntry(DIRFILE* D, gd_entry_t* E);
+char *_GD_CanonicalPath(const char*, const char*);
void _GD_CInvertData(DIRFILE* D, void* data, gd_type_t return_type,
GD_DCOMPLEXA(dividend), size_t n_read);
Modified: trunk/getdata/src/legacy.c
===================================================================
--- trunk/getdata/src/legacy.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/legacy.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -22,11 +22,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#endif
-
static struct {
unsigned int n;
DIRFILE** D;
Modified: trunk/getdata/src/lzma.c
===================================================================
--- trunk/getdata/src/lzma.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/lzma.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,14 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <errno.h>
-#include <time.h>
-#include <stdio.h>
-#include <string.h>
-#endif
-
#ifdef HAVE_LZMA_H
#include <lzma.h>
#endif
Modified: trunk/getdata/src/meta_list.c
===================================================================
--- trunk/getdata/src/meta_list.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/meta_list.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,11 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#endif
-
/* a zero length list */
static const char *zero_list[1] = { NULL };
static const gd_carray_t zero_carrays[1] = { {0, NULL} };
Modified: trunk/getdata/src/mod.c
===================================================================
--- trunk/getdata/src/mod.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/mod.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,16 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
-#ifdef HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
static unsigned int _gd_max(unsigned int A, unsigned int B)
{
return (A > B) ? A : B;
Modified: trunk/getdata/src/move.c
===================================================================
--- trunk/getdata/src/move.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/move.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,12 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long encoding,
unsigned long byte_sex, off64_t offset, int finalise, int new_fragment,
char* new_filebase)
Modified: trunk/getdata/src/name.c
===================================================================
--- trunk/getdata/src/name.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/name.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -20,12 +20,6 @@
*/
#include "internal.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#endif
-
/* Check for a valid field name -- returns input on error */
char* _GD_ValidateField(const gd_entry_t* parent, const char* field_code,
int standards, int strict, int* is_dot)
Modified: trunk/getdata/src/native.c
===================================================================
--- trunk/getdata/src/native.c 2011-12-01 16:31:32 UTC (rev 628)
+++ trunk/getdata/src/native.c 2011-12-04 00:32:11 UTC (rev 629)
@@ -19,7 +19,6 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "internal.h"
-#include <stdlib.h>
gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr)
{
Modified: trunk/getdata/src/nframes.c
===============...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-05 21:57:23
|
Revision: 630
http://getdata.svn.sourceforge.net/getdata/?rev=630&view=rev
Author: ketiltrout
Date: 2011-12-05 21:57:14 +0000 (Mon, 05 Dec 2011)
Log Message:
-----------
Fix OSX lstat64. Fix bindings path checks. Fix off-by-one in _GD_CanonicalPath. Converted Fortran tests to use check functions.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/cxx/test/big_test.cpp
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/f77/test/big_test.f
trunk/getdata/bindings/f77/test/big_test95.f90
trunk/getdata/bindings/python/test/big_test.py
trunk/getdata/bindings/python/test/callback.py
trunk/getdata/configure.ac
trunk/getdata/src/common.c
trunk/getdata/src/flush.c
trunk/getdata/src/internal.h
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-04 00:32:11 UTC (rev 629)
+++ trunk/getdata/ChangeLog 2011-12-05 21:57:14 UTC (rev 630)
@@ -1,3 +1,17 @@
+2011-12-05 D. V. Wiebe <ge...@ke...> svn:630
+ * python/test/callback.pl python/test/big_test.py cxx/test/big_test.cpp
+ f77/test/big_test.f f77/test/big_test95.f90: Fix path checks.
+
+ * f77/test/big_test.f f77/test/big_test95.f90: Use check functions.
+
+ * src/flush.c (_GD_Flush): Don't call sync on a file opened read-only.
+
+ * configure.ac: Look for Availability.h
+ * src/internal.h: Fix lstat64 on OS X 10.6+
+
+ * src/common.c (_GD_CanonicalPath): Don't run past the end of the work
+ buffer.
+
2011-12-03 D. V. Wiebe <ge...@ke...> svn:629
* test/test.h (CHECKEOS): Added.
* test/file.c test/fragment_name.c: Only check the end of the returned
Modified: trunk/getdata/bindings/cxx/test/big_test.cpp
===================================================================
--- trunk/getdata/bindings/cxx/test/big_test.cpp 2011-12-04 00:32:11 UTC (rev 629)
+++ trunk/getdata/bindings/cxx/test/big_test.cpp 2011-12-05 21:57:14 UTC (rev 630)
@@ -89,6 +89,10 @@
for (i = 0; i < m; ++i) if (strcmp((v), (g))) { \
ne++; cerr << "s(" << i << ")[" << t << "] = \"" << (v) << "\"" << endl; }
+#define CHECK_EOSTRING(t,v,g) \
+ if (strcmp((v) + strlen(v) - sizeof(g) + 1, (g))) { ne++; cerr << "s[" << t << "] = \"" << (v) << "\"" \
+ << endl; }
+
#define CHECK_COMPLEX2(t,m,v,g) \
if (abs((v) - (g)) > 1e-10) { \
ne++; cerr << "c[" << t << ", " << m << "] = " << (v).real() << ";" \
@@ -587,7 +591,7 @@
// 39: Fragment check
frag = d->Fragment(0);
CHECK_OK(39);
- CHECK_STRING(39,frag->Name(),__TEST__ "dirfile/format");
+ CHECK_EOSTRING(39,frag->Name(), "dirfile/format");
delete frag;
// 40: Dirfile::NFragments check
@@ -972,7 +976,7 @@
// 84: RawEntry::FileName check
str = rep->FileName();
CHECK_OK(84);
- CHECK_STRING(84,str,__TEST__ "dirfile/new1");
+ CHECK_EOSTRING(84,str, "dirfile/new1");
delete rep;
// 85: Dirfile::Reference check
@@ -984,7 +988,7 @@
// 135: Dirfile::ReferenceFilename check
str = d->ReferenceFilename();
CHECK_OK(135);
- CHECK_STRING(135,str,__TEST__ "dirfile/new1");
+ CHECK_EOSTRING(135,str, "dirfile/new1");
// 87: Fragment::SetEncoding check
frag->SetEncoding(SlimEncoding,0);
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2011-12-04 00:32:11 UTC (rev 629)
+++ trunk/getdata/bindings/f77/fgetdata.c 2011-12-05 21:57:14 UTC (rev 630)
@@ -374,11 +374,17 @@
const int* first_sample, const int* num_frames, const int* num_samples,
const int* data_type, const void* data_in)
{
+ dtrace("%p, %i, %p, %i, %i, %i, %i, %i, 0x%x, %p", n_wrote, *dirfile,
+ field_code, *field_code_l, *first_frame, *first_sample, *num_frames,
+ *num_samples, *data_type, data_in);
+
char* out = (char *)malloc(*field_code_l + 1);
*n_wrote = gd_putdata(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
*field_code_l), *first_frame, *first_sample, *num_frames,
*num_samples, (gd_type_t)*data_type, data_in);
free(out);
+
+ dreturn("%i", *n_wrote);
}
/* return the error number */
@@ -1276,8 +1282,10 @@
void F77_FUNC(gdfrgn, GDFRGN) (char* filename, int* filename_l,
const int* dirfile, const int* index)
{
+ dtrace("%p, %i, %i, %i", filename, *filename_l, *dirfile, *index);
_GDF_FString(filename, filename_l, gd_fragmentname(_GDF_GetDirfile(*dirfile),
*index));
+ dreturnvoid();
}
/* gd_nfragments wrapper */
Modified: trunk/getdata/bindings/f77/test/big_test.f
===================================================================
--- trunk/getdata/bindings/f77/test/big_test.f 2011-12-04 00:32:11 UTC (rev 629)
+++ trunk/getdata/bindings/f77/test/big_test.f 2011-12-05 21:57:14 UTC (rev 630)
@@ -1,4 +1,4 @@
-C Copyright (C) 2009-2010 D. V. Wiebe
+C Copyright (C) 2009-2011 D. V. Wiebe
C
C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
@@ -25,6 +25,148 @@
C F77 bindings. Procedures not tested include: GDCOPN GDMFLS GDFLSH
C GDDSCD GDCLBK GDCLOS (although this last one is used)
+C Check functions
+ SUBROUTINE CHKERR(NE, T, D, V)
+ INCLUDE "getdata.f"
+ INTEGER NE, T, D, V, E
+ CALL GDEROR(E, D)
+
+ IF (E .NE. V) THEN
+ NE = NE + 1
+ WRITE(*, 9001) T, E, V
+ ENDIF
+ 9001 FORMAT('e[', i3, '] = ', i4, ', expected ', i4)
+ END SUBROUTINE
+
+ SUBROUTINE CHKINT(NE, T, N, V)
+ INTEGER NE, T, N, V
+
+ IF (N .NE. V) THEN
+ NE = NE + 1
+ WRITE(*, 9002) T, N, V
+ ENDIF
+ 9002 FORMAT('n[', i3, '] = ', i4, ', expected ', i4)
+ END SUBROUTINE
+
+ SUBROUTINE CHKER2(NE, T, I, D, V)
+ INCLUDE "getdata.f"
+ INTEGER NE, T, I, D, V, E
+ CALL GDEROR(E, D)
+
+ IF (E .NE. V) THEN
+ NE = NE + 1
+ WRITE(*, 9006) I, T, E, V
+ ENDIF
+ 9006 FORMAT('e(', i3, ')[', i3, '] = ', i4, ', expected ', i4)
+ END SUBROUTINE
+
+ SUBROUTINE CHKIN2(NE, T, I, N, V)
+ INTEGER NE, T, I, N, V
+
+ IF (N .NE. V) THEN
+ NE = NE + 1
+ WRITE(*, 9007) I, T, N, V
+ ENDIF
+ 9007 FORMAT('n(', i3, ')[', i3, '] = ', i4, ', expected ', i4)
+ END SUBROUTINE
+
+ SUBROUTINE CHKST2(NE, T, I, N, V)
+ INTEGER NE, T, I
+ CHARACTER*(*) N, V
+
+ IF (N .NE. V) THEN
+ NE = NE + 1
+ WRITE(*, 9008) I, T, N, V
+ ENDIF
+ 9008 FORMAT('s(', i3, ')[', i3, '] = "', a, '", expected "', a, '"')
+ END SUBROUTINE
+
+ SUBROUTINE CHKSTR(NE, T, N, V)
+ INTEGER NE, T
+ CHARACTER*(*) N, V
+
+ IF (N .NE. V) THEN
+ NE = NE + 1
+ WRITE(*, 9009) T, N, V
+ ENDIF
+ 9009 FORMAT('s[', i3, '] = "', a, '", expected "', a, '"')
+ END SUBROUTINE
+
+ SUBROUTINE CHKDB2(NE, T, I, N, V)
+ INTEGER NE, T, I
+ REAL*8 N, V
+
+ IF (ABS(N - V) .GT. 1E-5) THEN
+ NE = NE + 1
+ WRITE(*, 9010) I, T, N, V
+ ENDIF
+ 9010 FORMAT('d(', i3, ')[', i3, '] = ', d16.10, ', expected ', d16.10)
+ END SUBROUTINE
+
+ SUBROUTINE CHKCP2(NE, T, I, N, V)
+ INTEGER NE, T, I
+ COMPLEX*16 N, V
+
+ IF (ABS(N - V) .GT. 1E-5) THEN
+ NE = NE + 1
+ WRITE(*, 9011) I, T, REAL(REAL(N)), REAL(AIMAG(N)),
+ +REAL(REAL(V)), REAL(AIMAG(V))
+ ENDIF
+ 9011 FORMAT('x(', i3, ')[', i3, '] = ', d16.10, ';', d16.10,
+ +', expected ', d16.10, ';', d16.10)
+ END SUBROUTINE
+
+ SUBROUTINE CHKDBL(NE, T, N, V)
+ INTEGER NE, T
+ REAL*8 N, V
+
+ IF (ABS(N - V) .GT. 1E-5) THEN
+ NE = NE + 1
+ WRITE(*, 9012) T, N, V
+ ENDIF
+ 9012 FORMAT('d[', i3, '] = ', d16.10, ', expected ', d16.10)
+ END SUBROUTINE
+
+ SUBROUTINE CHKCPX(NE, T, N, V)
+ INTEGER NE, T
+ COMPLEX*16 N, V
+
+ IF (ABS(N - V) .GT. 1E-5) THEN
+ NE = NE + 1
+ WRITE(*, 9013) T, REAL(REAL(N)), REAL(AIMAG(N)),
+ +REAL(REAL(V)), REAL(AIMAG(V))
+ ENDIF
+ 9013 FORMAT('x[', i3, '] = ', d16.10, ';', d16.10,
+ +', expected ', d16.10, ';', d16.10)
+ END SUBROUTINE
+
+ SUBROUTINE CHKEOS(NE, T, N, V)
+ INTEGER NE, T, F
+ CHARACTER*(*) N, V
+
+ F = INDEX(N, V)
+ IF (F .EQ. 0) THEN
+ F = 1
+ ENDIF
+
+ CALL CHKSTR(NE, T, N(F:), V)
+ END SUBROUTINE
+
+ SUBROUTINE CHKEOK(NE, T, D)
+ INTEGER NE, T, D
+ INCLUDE "getdata.f"
+ CALL CHKERR(NE, T, D, GD_EOK)
+ END SUBROUTINE
+
+ SUBROUTINE CHKOK2(NE, T, I, D)
+ INTEGER NE, T, I, D
+ INCLUDE "getdata.f"
+ CALL CHKER2(NE, T, I, D, GD_EOK)
+ END SUBROUTINE
+
+
+
+
PROGRAM BIGTST
INCLUDE "getdata.f"
@@ -42,17 +184,19 @@
PARAMETER (nfields = 14)
INTEGER slen
PARAMETER (slen = 26)
+ INTEGER plen
+ PARAMETER (plen = 4096)
CHARACTER*26 strings(3)
CHARACTER*7 fields(nfields + 7)
CHARACTER*7 fn
CHARACTER*26 str
+ CHARACTER*4096 path
INTEGER*1 c(8)
INTEGER*1 datdat(80)
INTEGER*1 k
INTEGER i
INTEGER d
- INTEGER e
INTEGER m
INTEGER n
INTEGER l
@@ -117,153 +261,64 @@
WRITE(1, REC=1) datdat
CLOSE(1, STATUS='KEEP')
+ ne = 0
C 0: GDEROR check
CALL GDOPEN(d, "x", 1, GD_RO)
- CALL GDEROR(e, d)
+ CALL CHKERR(ne, 0, d, GD_EOP)
- ne = 0
- IF (e .NE. GD_EOP) THEN
- ne = ne + 1
- WRITE(*, 9001) 0, e
- ENDIF
-
C 1: GDOPEN check
CALL GDOPEN(d, fildir, 12, GD_RW)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 1, d)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 1, e
- ENDIF
-
C 2: GDGETD check
CALL GDGETD(n, d, 'data', 4, 5, 0, 1, 0, GD_I8, c)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 2, d)
+ CALL CHKINT(ne, 2, n, 8)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 2, e
- ENDIF
-
- IF (n .NE. 8) THEN
- ne = ne + 1
- WRITE(*, 9002) 2, n
- ENDIF
-
DO 20 i = 1, 8
- IF (c(i) .NE. 40 + i) THEN
- ne = ne + 1
- WRITE(*, 9004) i, 2, c(i)
- ENDIF
+ CALL CHKIN2(ne, 2, i, INT(c(i)), 40 + i)
20 CONTINUE
C 3: GDGTCO check
CALL GDGTCO(d, 'const', 5, GD_F32, fl)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 3, d)
+ CALL CHKDBL(ne, 3, 1d0 * fl, 5.5d0)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 3, e
- ENDIF
-
- IF (abs(fl - 5.5) .gt. 0.001) THEN
- ne = ne + 1
- WRITE(*, 9005) 3, fl
- ENDIF
-
C 4: GDFDNX check
CALL GDFDNX(i, d)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 4, d)
+ CALL CHKINT(ne, 4, i, flen)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 4, e
- ENDIF
-
- IF (i .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9002) 4, i
- ENDIF
-
C 5: GDMFNX check
CALL GDMFNX(i, d, 'data', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 5, d)
+ CALL CHKINT(ne, 5, i, 6)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 5, e
- ENDIF
-
- IF (i .NE. 6) THEN
- ne = ne + 1
- WRITE(*, 9002) 5, i
- ENDIF
-
C 6: GDNFLD check
CALL GDNFLD(n, d)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 6, d)
+ CALL CHKINT(ne, 6, n, nfields)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 6, e
- ENDIF
-
- IF (n .NE. nfields) THEN
- ne = ne + 1
- WRITE(*, 9002) 6, n
- ENDIF
-
C 7: This is a check of (one of many instances of) _GDF_FString
l = 2
CALL GDFLDN(fn, l, d, 1)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 7, d)
+ CALL CHKINT(ne, 7, l, 5)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 7, e
- ENDIF
-
- IF (l .NE. 5) THEN
- ne = ne + 1
- WRITE(*, 9002) 7, l
- ENDIF
-
C 8: GDFLDN check
DO 80 i = 1, n
l = flen
CALL GDFLDN(fn, l, d, i)
- CALL GDEROR(e, d)
-
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 8, i, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 8, i, l
- ENDIF
-
- IF (fn .NE. fields(i)) THEN
- ne = ne + 1
- WRITE(*, 9008) i, 8, fn
- ENDIF
+ CALL CHKOK2(ne, 8, i, d)
+ CALL CHKIN2(ne, 8, i, l, flen)
+ CALL CHKST2(ne, 8, i, fn, fields(i))
80 CONTINUE
C 9: GDNMFD check
CALL GDNMFD(n, d, 'data', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 9, d)
+ CALL CHKINT(ne, 9, n, 3)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 9, e
- ENDIF
-
- IF (n .NE. 3) THEN
- ne = ne + 1
- WRITE(*, 9002) 9, n
- ENDIF
-
C 10: GDMFDN check
fields(1) = 'mstr'
fields(2) = 'mconst'
@@ -271,52 +326,21 @@
DO 100 i = 1, n
l = flen
CALL GDMFDN(fn, l, d, 'data', 4, i)
- CALL GDEROR(e, d)
-
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 10, i, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 10, i, l
- ENDIF
-
- IF (fn .NE. fields(i)) THEN
- ne = ne + 1
- WRITE(*, 9008) i, 10, fn
- ENDIF
+ CALL CHKOK2(ne, 10, i, d)
+ CALL CHKIN2(ne, 10, i, l, flen)
+ CALL CHKST2(ne, 10, i, fn, fields(i))
100 CONTINUE
C 11: GDNFRM check
CALL GDNFRM(n, d)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 11, d)
+ CALL CHKINT(ne, 11, n, 10)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 11, e
- ENDIF
-
- IF (n .NE. 10) THEN
- ne = ne + 1
- WRITE(*, 9002) 11, n
- ENDIF
-
C 12: GDGSPF check
CALL GDGSPF(n, d, 'data', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 12, d)
+ CALL CHKINT(ne, 12, n, 8)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 12, e
- ENDIF
-
- IF (n .NE. 8) THEN
- ne = ne + 1
- WRITE(*, 9002) 12, n
- ENDIF
-
C 13: GDPUTD check
c(1) = 13
c(2) = 14
@@ -327,116 +351,49 @@
c(7) = 19
c(8) = 20
CALL GDPUTD(n, d, 'data', 4, 5, 1, 0, 4, GD_I8, c)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 13, d)
+ CALL CHKINT(ne, 13, n, 4)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 13, e
- ENDIF
-
- IF (n .NE. 4) THEN
- ne = ne + 1
- WRITE(*, 9002) 13, n
- ENDIF
-
CALL GDGETD(n, d, 'data', 4, 5, 0, 1, 0, GD_I8, c)
DO 130 i = 1, 8
- IF (((i .EQ. 1 .OR. i .GT. 5) .AND. c(i) .NE. 40 + i) .OR.
- +(i .GT. 1 .AND. i .LT. 6) .AND. c(i) .NE. 11 + i) THEN
- ne = ne + 1
- WRITE(*, 9004) i, 13, c(i)
+ IF (i .EQ. 1 .OR. i .GT. 5) THEN
+ n = 40 + i
+ ELSE
+ n = 11 + i
ENDIF
+ CALL CHKIN2(ne, 13, i, INT(c(i)), n)
130 CONTINUE
C 14: GDESTR check
CALL GDGETD(n, d, 'x', 1, 5, 0, 1, 0, GD_I8, c)
CALL GDESTR(d, str, slen)
+ CALL CHKSTR(ne, 14, str, 'Field not found: x')
- IF (str .NE. 'Field not found: x ') THEN
- ne = ne + 1
- WRITE(*, 9009) 14, str
- ENDIF
-
C 15: GDENTY check
CALL GDENTY(n, d, 'data', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 15, d)
+ CALL CHKINT(ne, 15, n, GD_RWE)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 15, e
- ENDIF
-
- IF (n .NE. GD_RWE) THEN
- ne = ne + 1
- WRITE(*, 9002) 15, n
- ENDIF
-
C 16: GDGERW check
CALL GDGERW(l, i, n, d, 'data', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 16, d)
+ CALL CHKIN2(ne, 16, 1, n, 0)
+ CALL CHKIN2(ne, 16, 2, l, 8)
+ CALL CHKIN2(ne, 16, 3, i, GD_I8)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 16, e
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 16, 1, n
- ENDIF
-
- IF (l .NE. 8) THEN
- ne = ne + 1
- WRITE(*, 9007) 16, 2, l
- ENDIF
-
- IF (i .NE. GD_I8) THEN
- ne = ne + 1
- WRITE(*, 9007) 16, 3, i
- ENDIF
-
C 17: GDGELC check
l = flen
CALL GDGELC(i, fields(1), l, p(1), p(2), fields(2), l, p(3),
+p(4), fields(3), l, p(5), p(6), n, d, 'lincom', 6)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 17, d)
+ CALL CHKIN2(ne, 17, 1, l, flen)
+ CALL CHKIN2(ne, 17, 2, i, 3)
+ CALL CHKIN2(ne, 17, 3, n, 0)
+ CALL CHKST2(ne, 17, 4, fields(1), 'data')
+ CALL CHKST2(ne, 17, 5, fields(2), 'INDEX')
+ CALL CHKST2(ne, 17, 6, fields(3), 'linterp')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 17, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 17, 1, l
- ENDIF
-
- IF (i .NE. 3) THEN
- ne = ne + 1
- WRITE(*, 9007) 17, 2, i
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 17, 3, n
- ENDIF
-
- IF (fields(1) .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 17, 4, fields(1)
- ENDIF
-
- IF (fields(2) .NE. 'INDEX') THEN
- ne = ne + 1
- WRITE(*, 9008) 17, 5, fields(2)
- ENDIF
-
- IF (fields(3) .NE. 'linterp') THEN
- ne = ne + 1
- WRITE(*, 9008) 17, 6, fields(3)
- ENDIF
-
q(1) = 1.1
q(2) = 2.2
q(3) = 2.2
@@ -444,53 +401,21 @@
q(5) = 5.5
q(6) = 5.5
DO 170 i=1,6
- IF (abs(p(i) - q(i)) .gt. 0.001) THEN
- ne = ne + 1
- WRITE(*, 9010) i, 17, p(i)
- ENDIF
+ CALL CHKDB2(ne, 17, i, p(i), q(i))
170 CONTINUE
C 18: GDGECL check
l = flen
CALL GDGECL(i, fields(1), l, cp(1), cp(2), fields(2), l, cp(3),
+cp(4), fields(3), l, cp(5), cp(6), n, d, 'lincom', 6)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 18, d)
+ CALL CHKIN2(ne, 18, 1, l, flen)
+ CALL CHKIN2(ne, 18, 2, i, 3)
+ CALL CHKIN2(ne, 18, 3, n, 0)
+ CALL CHKST2(ne, 18, 4, fields(1), 'data')
+ CALL CHKST2(ne, 18, 5, fields(2), 'INDEX')
+ CALL CHKST2(ne, 18, 6, fields(3), 'linterp')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 18, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 18, 1, l
- ENDIF
-
- IF (i .NE. 3) THEN
- ne = ne + 1
- WRITE(*, 9007) 18, 2, i
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 18, 3, n
- ENDIF
-
- IF (fields(1) .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 18, 4, fields(1)
- ENDIF
-
- IF (fields(2) .NE. 'INDEX') THEN
- ne = ne + 1
- WRITE(*, 9008) 18, 5, fields(2)
- ENDIF
-
- IF (fields(3) .NE. 'linterp') THEN
- ne = ne + 1
- WRITE(*, 9008) 18, 6, fields(3)
- ENDIF
-
cq(1) = cmplx(1.1, 0.0)
cq(2) = cmplx(2.2, 0.0)
cq(3) = cmplx(2.2, 0.0)
@@ -498,43 +423,19 @@
cq(5) = cmplx(5.5, 0.0)
cq(6) = cmplx(5.5, 0.0)
DO 180 i=1,6
- IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
- ne = ne + 1
- WRITE(*, 9011) i, 18, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
- ENDIF
+ CALL CHKCP2(ne, 18, i, cp(i), cq(i))
180 CONTINUE
C 19: GDGEPN check
l = flen
CALL GDGEPN(i, fn, l, p(1), p(2), p(3), p(4), p(5), p(6),
+n, d, 'polynom', 7)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 19, d)
+ CALL CHKIN2(ne, 19, 1, l, flen)
+ CALL CHKIN2(ne, 19, 2, i, 5)
+ CALL CHKIN2(ne, 19, 3, n, 0)
+ CALL CHKST2(ne, 19, 4, fn, 'data')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 19, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 19, 1, l
- ENDIF
-
- IF (i .NE. 5) THEN
- ne = ne + 1
- WRITE(*, 9007) 19, 2, i
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 19, 3, n
- ENDIF
-
- IF (fn .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 19, 4, fn
- ENDIF
-
q(1) = 1.1
q(2) = 2.2
q(3) = 2.2
@@ -542,43 +443,19 @@
q(5) = 5.5
q(6) = 5.5
DO 190 i=1,6
- IF (abs(p(i) - q(i)) .gt. 0.001) THEN
- ne = ne + 1
- WRITE(*, 9010) i, 19, p(i)
- ENDIF
+ CALL CHKDB2(ne, 19, i, p(i), q(i))
190 CONTINUE
C 20: GDGECP check
l = flen
CALL GDGECP(i, fn, l, cp(1), cp(2), cp(3), cp(4), cp(5), cp(6),
+n, d, 'polynom', 7)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 20, d)
+ CALL CHKIN2(ne, 20, 1, l, flen)
+ CALL CHKIN2(ne, 20, 2, i, 5)
+ CALL CHKIN2(ne, 20, 3, n, 0)
+ CALL CHKST2(ne, 20, 4, fn, 'data')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 20, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 20, 1, l
- ENDIF
-
- IF (i .NE. 5) THEN
- ne = ne + 1
- WRITE(*, 9007) 20, 2, i
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 20, 3, n
- ENDIF
-
- IF (fn .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 20, 4, fn
- ENDIF
-
cq(1) = cmplx(1.1, 0.0)
cq(2) = cmplx(2.2, 0.0)
cq(3) = cmplx(2.2, 0.0)
@@ -586,282 +463,92 @@
cq(5) = cmplx(5.5, 0.0)
cq(6) = cmplx(5.5, 0.0)
DO 200 i=1,6
- IF (abs(cp(i) - cq(i)) .gt. 0.001) THEN
- ne = ne + 1
- WRITE(*, 9011) i, 30, REAL(REAL(cp(i))), REAL(AIMAG(cp(i)))
- ENDIF
+ CALL CHKCP2(ne, 20, i, cp(i), cq(i))
200 CONTINUE
C 21: GDGELT check
l = flen
CALL GDGELT(fn, l, str, slen, n, d, 'linterp', 7)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 21, d)
+ CALL CHKIN2(ne, 21, 1, l, flen)
+ CALL CHKIN2(ne, 22, 2, n, 0)
+ CALL CHKST2(ne, 22, 3, fn, 'data')
+ CALL CHKST2(ne, 22, 4, str, '/look/up/file')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 21, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 21, 1, l
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 21, 2, n
- ENDIF
-
- IF (fn .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 21, 3, fn
- ENDIF
-
- IF (str .NE. '/look/up/file') THEN
- ne = ne + 1
- WRITE(*, 9008) 21, 4, str
- ENDIF
-
C 22: GDGEBT check
l = flen
CALL GDGEBT(fn, l, m, i, n, d, 'bit', 3)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 22, d)
+ CALL CHKIN2(ne, 22, 1, l, flen)
+ CALL CHKIN2(ne, 22, 2, n, 0)
+ CALL CHKIN2(ne, 22, 3, i, 4)
+ CALL CHKIN2(ne, 22, 4, m, 3)
+ CALL CHKST2(ne, 22, 5, fn, 'data')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 22, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 22, 1, l
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 22, 2, n
- ENDIF
-
- IF (i .NE. 4) THEN
- ne = ne + 1
- WRITE(*, 9007) 22, 3, i
- ENDIF
-
- IF (m .NE. 3) THEN
- ne = ne + 1
- WRITE(*, 9007) 22, 4, m
- ENDIF
-
- IF (fn .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 22, 5, fn
- ENDIF
-
C 23: GDGESB check
l = flen
CALL GDGESB(fn, l, m, i, n, d, 'sbit', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 23, d)
+ CALL CHKIN2(ne, 23, 1, l, flen)
+ CALL CHKIN2(ne, 23, 2, n, 0)
+ CALL CHKIN2(ne, 23, 3, i, 6)
+ CALL CHKIN2(ne, 23, 4, m, 5)
+ CALL CHKST2(ne, 23, 5, fn, 'data')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 23, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 23, 1, l
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 23, 2, n
- ENDIF
-
- IF (i .NE. 6) THEN
- ne = ne + 1
- WRITE(*, 9007) 23, 3, i
- ENDIF
-
- IF (m .NE. 5) THEN
- ne = ne + 1
- WRITE(*, 9007) 23, 4, m
- ENDIF
-
- IF (fn .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 23, 5, fn
- ENDIF
-
C 24: GDGEMT check
l = flen
CALL GDGEMT(fields(1), l, fields(2), l, n, d, 'mult', 4)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 24, d)
+ CALL CHKIN2(ne, 24, 1, l, flen)
+ CALL CHKIN2(ne, 24, 2, n, 0)
+ CALL CHKST2(ne, 24, 3, fields(1), 'data')
+ CALL CHKST2(ne, 24, 4, fields(2), 'sbit')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 24, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 24, 1, l
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 24, 2, n
- ENDIF
-
- IF (fields(1) .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 24, 3, fields(1)
- ENDIF
-
- IF (fields(2) .NE. 'sbit') THEN
- ne = ne + 1
- WRITE(*, 9008) 24, 4, fields(2)
- ENDIF
-
C 25: GDGEPH check
l = flen
CALL GDGEPH(fn, l, i, n, d, 'phase', 5)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 25, d)
+ CALL CHKIN2(ne, 25, 1, l, flen)
+ CALL CHKIN2(ne, 25, 2, n, 0)
+ CALL CHKIN2(ne, 25, 3, i, 11)
+ CALL CHKST2(ne, 25, 4, fn, 'data')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 25, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 25, 1, l
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 25, 2, n
- ENDIF
-
- IF (i .NE. 11) THEN
- ne = ne + 1
- WRITE(*, 9007) 25, 3, i
- ENDIF
-
- IF (fn .NE. 'data') THEN
- ne = ne + 1
- WRITE(*, 9008) 25, 4, fn
- ENDIF
-
C 26: GDGECO check
CALL GDGECO(i, n, d, 'const', 5)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 26, d)
+ CALL CHKIN2(ne, 26, 1, n, 0)
+ CALL CHKIN2(ne, 26, 2, i, GD_F64)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 26, e
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 26, 1, n
- ENDIF
-
- IF (i .NE. GD_F64) THEN
- ne = ne + 1
- WRITE(*, 9007) 26, 2, i
- ENDIF
-
C 27: GDFRGI check
CALL GDFRGI(n, d, 'const', 5)
- CALL GDEROR(e, d)
+ CALL CHKEOK(ne, 27, d)
+ CALL CHKINT(ne, 27, n, 0)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9001) 27, e
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9002) 27, n
- ENDIF
-
C 28: GDADRW check
CALL GDADRW(d, 'new1', 4, GD_F64, 3, 0)
- CALL GDEROR(e, d)
+ CALL CHKOK2(ne, 28, 1, d)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 28, 1, e
- ENDIF
-
CALL GDGERW(l, i, n, d, 'new1', 4)
- CALL GDEROR(e, d)
+ CALL CHKOK2(ne, 28, 2, d)
+ CALL CHKIN2(ne, 28, 3, n, 0)
+ CALL CHKIN2(ne, 28, 4, l, 3)
+ CALL CHKIN2(ne, 28, 5, i, GD_F64)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 28, 2, e
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 28, 3, n
- ENDIF
-
- IF (l .NE. 3) THEN
- ne = ne + 1
- WRITE(*, 9007) 28, 4, l
- ENDIF
-
- IF (i .NE. GD_F64) THEN
- ne = ne + 1
- WRITE(*, 9007) 28, 5, i
- ENDIF
-
C 29: GDADLC check
CALL GDADLC(d, 'new2', 4, 2, 'in1', 3, 9.9d0, 8.8d0, 'in2', 3,
+7.7d0, 6.6d0, '', 0, 0d0, 0d0, 0)
- CALL GDEROR(e, d)
+ CALL CHKOK2(ne, 29, 1, d)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 29, 1, e
- ENDIF
-
l = flen
CALL GDGELC(i, fields(1), l, p(1), p(2), fields(2), l, p(3),
+p(4), fields(3), l, p(5), p(6), n, d, 'new2', 4)
- CALL GDEROR(e, d)
+ CALL CHKOK2(ne, 29, 2, d)
+ CALL CHKIN2(ne, 29, 3, l, flen)
+ CALL CHKIN2(ne, 29, 4, i, 2)
+ CALL CHKIN2(ne, 29, 5, n, 0)
+ CALL CHKST2(ne, 29, 6, fields(1), 'in1')
+ CALL CHKST2(ne, 29, 7, fields(2), 'in2')
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 29, 2, e
- ENDIF
-
- IF (l .NE. flen) THEN
- ne = ne + 1
- WRITE(*, 9007) 29, 3, l
- ENDIF
-
- IF (i .NE. 2) THEN
- ne = ne + 1
- WRITE(*, 9007) 29, 4, i
- ENDIF
-
- IF (n .NE. 0) THEN
- ne = ne + 1
- WRITE(*, 9007) 29, 5, n
- ENDIF
-
- IF (fields(1) .NE. 'in1') THEN
- ne = ne + 1
- WRITE(*, 9008) 29, 6, fields(1)
- ENDIF
-
- IF (fields(2) .NE. 'in2') THEN
- ne = ne + 1
- WRITE(*, 9008) 29, 7, fields(2)
- ENDIF
-
q(1) = 9.9
q(2) = 8.8
q(3) = 7.7
@@ -869,10 +556,7 @@
q(5) = 5.5
q(6) = 5.5
DO 290 i=1,4
- IF (abs(p(i) - q(i)) .gt. 0.001) THEN
- ne = ne + 1
- WRITE(*, 9010) i, 29, p(i)
- ENDIF
+ CALL CHKDB2(ne, 29, i, p(i), q(i))
290 CONTINUE
C 30: GDADCL check
@@ -882,99 +566,40 @@
cq(4) = cmplx(1.6, 1.7)
CALL GDADCL(d, 'new3', 4, 2, 'in1', 3, cq(1), cq(2), 'in2', 3,
+cq(3), cq(4), '', 0, cq(5), cq(6), 0)
- CALL GDEROR(e, d)
+ CALL CHKOK2(ne, 30, 1, d)
- IF (e .NE. GD_EOK) THEN
- ne = ne + 1
- WRITE(*, 9006) 30, 1, e
- ENDIF
-
l = flen
CALL GDGECL(i, fields(1), l, cp(1), cp(2), fields(2), l, cp(3),
+cp(4), fields(3), l, cp(5), cp(6), n, d, 'new3', 4)
- CALL GDEROR(e, d)
+ CALL CHKOK2(ne, 30, 2, d)
+ CALL CHKIN2(ne, 30, 1, l, flen)
+ CALL CHKIN2(ne, 30, 2, i, 2)
+ CALL CHKIN2(ne, 30, 3, n, 0)
+ CALL CHKST2(ne, 30, 4, fields(1), 'in1')
+ CALL CHKST2(ne, 30, 5, fields(2), 'in2')
- IF (e .NE. GD_E...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-06 23:36:29
|
Revision: 632
http://getdata.svn.sourceforge.net/getdata/?rev=632&view=rev
Author: ketiltrout
Date: 2011-12-06 23:36:19 +0000 (Tue, 06 Dec 2011)
Log Message:
-----------
Dirfile Standards Version 9.
* [DSV 9] WINDOW derived field.
* [DSV 9] Allow octal (0...) and hex (0[Xx]...) literals in format file.
* [bug] return error genenerated by _GD_SetScalar from _GD_ParseRecip _GD_ParsePhase.
* [bug] correctly write RECIP fields to format.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/cmake/CMakeLists.txt
trunk/getdata/configure.ac
trunk/getdata/man/gd_getdata.3
trunk/getdata/src/add.c
trunk/getdata/src/del.c
trunk/getdata/src/entry.c
trunk/getdata/src/errors.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/fpos.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/internal.h
trunk/getdata/src/legacy.c
trunk/getdata/src/mod.c
trunk/getdata/src/native.c
trunk/getdata/src/parse.c
trunk/getdata/src/putdata.c
trunk/getdata/src/spf.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/get_phase.c
trunk/getdata/test/madd_phase.c
trunk/getdata/test/version_6.c
trunk/getdata/test/version_7.c
trunk/getdata/test/version_8.c
Added Paths:
-----------
trunk/getdata/test/add_window.c
trunk/getdata/test/add_window_op.c
trunk/getdata/test/alter_window.c
trunk/getdata/test/entry_window.c
trunk/getdata/test/entry_window_scalar.c
trunk/getdata/test/get_window.c
trunk/getdata/test/get_window_clr.c
trunk/getdata/test/get_window_ge.c
trunk/getdata/test/get_window_gt.c
trunk/getdata/test/get_window_le.c
trunk/getdata/test/get_window_lt.c
trunk/getdata/test/get_window_ne.c
trunk/getdata/test/get_window_set.c
trunk/getdata/test/madd_window.c
trunk/getdata/test/parse_window.c
trunk/getdata/test/parse_window_ncols.c
trunk/getdata/test/parse_window_op.c
trunk/getdata/test/parse_window_scalar.c
trunk/getdata/test/put_window.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/ChangeLog 2011-12-06 23:36:19 UTC (rev 632)
@@ -1,3 +1,45 @@
+2011-12-06 D. V. Wiebe <ge...@ke...> svn:632
+ * test/get_window_ne.c test/get_window.c test/parse_window_scalar.c
+ test/alter_window.c test/parse_window.c test/madd_window.c
+ test/parse_window_ncols.c test/add_window.c test/put_window.c
+ test/get_window_set.c test/get_window_gt.c test/get_window_ge.c
+ test/parse_window_op.c test/entry_window.c test/entry_window_scalar.c
+ test/add_window_op.c test/get_window_lt.c test/get_window_clr.c
+ test/get_window_le.c: Added.
+
+ * test/madd_phase.c: Fix check.
+
+ * test/version_6.c test/version_7.c test/version_8.c: Update for Version 9.
+
+ * cmake/CMakeLists.txt configure.ac: Define gd_int64_t.
+
+ * src/getdata.h.in: Add GD_WINDOW_ENTRY, gd_windop_t, gd_triplet_t.
+ * src/entry.c (_GD_FreeE _GD_CalculateEntry gd_entry) legacy.c (GetFormat)
+ src/getdata.c (_GD_DoField) src/errors.c src/flush.c (_GD_Flush
+ _GD_FieldSpec) src/native.c (_GD_NativeType) src/spf.c (_GD_GetSPF)
+ src/putdata.c (_GD_DoFieldOut) src/del.c (_GD_ClearDerived _GD_DeReference)
+ src/flimits.c (_GD_GetEOF _GD_GetBOF) src/fpos.c (_GD_GetFilePos _GD_Seek)
+ src/parse.c (_GD_ParseFieldSpec) src/field_list.c src/mod.c (_GD_Change)
+ src/add.c (_GD_Add): Update for WINDOW.
+ * src/legacy.c (CopyWindowEntry) src/getdata.c (_GD_WindowData _GD_DoWindow)
+ src/flush.c (_GD_WindopName) src/parse.c (_GD_WindOp _GD_ParseWindow)
+ src/mod.c (gd_alter_window) src/internal.h (_GD_BadWindop) src/add.c
+ (gd_add_window gd_madd_window): Added.
+ * src/flush.c (_GD_WriteConst): Write GD_UINT64.
+
+ * src/flush.c (_GD_WriteConst): Fix writing of RECIP fields.
+
+ * src/parse.c (_GD_ParseRecip _GD_ParsePhase): Fail if SetScalar fails.
+
+ * src/parse.c (_GD_SetScalar): Don't bother trying to decode an imaginary
+ part before failing if we're not interested in complex numbers.
+
+ * src/parse.c (_GD_SetScalar): Call strto[u]ll with base=0 for Version >= 9 to
+ allow automatic parsing of 0x[hex] and 0[octal] numbers in format files.
+
+ * src/getdata.h.in: Increment GD_DIRFILE_STANDARDS_VERSION.
+ * src/flush.c (_GD_FindVersion): Update for Version 9.
+
2011-12-05 D. V. Wiebe <ge...@ke...> svn:630
* python/test/callback.pl python/test/big_test.py cxx/test/big_test.cpp
f77/test/big_test.f f77/test/big_test95.f90: Fix path checks.
Modified: trunk/getdata/cmake/CMakeLists.txt
===================================================================
--- trunk/getdata/cmake/CMakeLists.txt 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/cmake/CMakeLists.txt 2011-12-06 23:36:19 UTC (rev 632)
@@ -40,6 +40,7 @@
set(DEFINE_gd_int16_t "#define gd_int16_t short int")
set(DEFINE_gd_uint16_t "#define gd_uint16_t unsigned short int")
set(DEFINE_gd_int64_t "#define gd_int64_t __int64")
+set(DEFINE_gd_uint64_t "#define gd_int64_t __uint64")
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/configure.ac 2011-12-06 23:36:19 UTC (rev 632)
@@ -660,12 +660,24 @@
gd_int64_t="long long int"
fi
-DEFINE_gd_int16_t="#define gd_int16_t $gd_int16_t";
-DEFINE_gd_uint16_t="#define gd_uint16_t $gd_uint16_t";
-DEFINE_gd_int64_t="#define gd_int64_t $gd_int64_t";
+if test $ac_cv_sizeof_unsigned_int -eq 8; then
+ gd_uint64_t="int"
+elif test $ac_cv_sizeof_unsigned_short_int -eq 8; then
+ gd_uint64_t="short int"
+elif test $ac_cv_sizeof_unsigned_long_int -eq 8; then
+ gd_uint64_t="long int"
+elif test $ac_cv_sizeof_unsigned_long_long_int -eq 8; then
+ gd_uint64_t="long long int"
+fi
+
+DEFINE_gd_int16_t="# define gd_int16_t $gd_int16_t";
+DEFINE_gd_uint16_t="# define gd_uint16_t $gd_uint16_t";
+DEFINE_gd_int64_t="# define gd_int64_t $gd_int64_t";
+DEFINE_gd_uint64_t="# define gd_uint64_t $gd_uint64_t";
AC_SUBST([DEFINE_gd_int16_t])
AC_SUBST([DEFINE_gd_uint16_t])
AC_SUBST([DEFINE_gd_int64_t])
+AC_SUBST([DEFINE_gd_uint64_t])
dnl library functions
echo
Modified: trunk/getdata/man/gd_getdata.3
===================================================================
--- trunk/getdata/man/gd_getdata.3 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/man/gd_getdata.3 2011-12-06 23:36:19 UTC (rev 632)
@@ -255,6 +255,16 @@
A descriptive error string for the last error encountered can be obtained from
a call to
.BR gd_error_string (3).
+.SH NOTES
+To save memory,
+.BR gd_getdata ()
+uses the memory pointed to by
+.I data_out
+as scratch space while computing derived fields. As a result, if an error is
+encountered during the computation, the contents of this memory buffer are
+unspecified, and may have been modified by this call, even though
+.BR gd_getdata ()
+will report zero data returned on error.
.SH LIMITATIONS
The
.B PHASE
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/add.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -113,6 +113,7 @@
entry->field_type != GD_SBIT_ENTRY &&
entry->field_type != GD_DIVIDE_ENTRY &&
entry->field_type != GD_RECIP_ENTRY &&
+ entry->field_type != GD_WINDOW_ENTRY &&
entry->field_type != GD_CARRAY_ENTRY &&
entry->field_type != GD_STRING_ENTRY)
{
@@ -309,6 +310,19 @@
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
copy_scalar[0] = 1;
break;
+ case GD_WINDOW_ENTRY:
+ E->EN(window,windop) = entry->EN(window,windop);
+ E->EN(window,threshold) = entry->EN(window,threshold);
+
+ if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ else if ((E->in_fields[1] = strdup(entry->in_fields[1])) == NULL)
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ else if (_GD_BadWindop(E->EN(window,windop)))
+ _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_WINDOP, NULL,
+ entry->EN(window,windop), NULL);
+ copy_scalar[0] = 1;
+ break;
case GD_CONST_ENTRY:
E->EN(scalar,const_type) = entry->EN(scalar,const_type);
E->EN(scalar,array_len) = -1;
@@ -1094,6 +1108,38 @@
return error;
}
+/* add a WINDOW entry */
+int gd_add_window(DIRFILE *D, const char *field_code, const char *in_field,
+ const char *check_field, gd_windop_t windop, gd_triplet_t threshold,
+ int fragment_index) gd_nothrow
+{
+ gd_entry_t E;
+ int error;
+
+ dtrace("%p, \"%s\", \"%s\", \"%s\", %i, {%g,%llx,%lli}, %i", D, field_code,
+ in_field, check_field, windop, threshold.r,
+ (unsigned long long)threshold.u, (long long)threshold.i, fragment_index);
+
+ if (D->flags & GD_INVALID) {/* don't crash */
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ memset(&E, 0, sizeof(gd_entry_t));
+ E.field = (char *)field_code;
+ E.field_type = GD_WINDOW_ENTRY;
+ E.EN(window,threshold) = threshold;
+ E.EN(window,windop) = windop;
+ E.in_fields[0] = (char *)in_field;
+ E.in_fields[1] = (char *)check_field;
+ E.fragment_index = fragment_index;
+ error = _GD_Add(D, &E, NULL);
+
+ dreturn("%i", error);
+ return error;
+}
+
/* add a STRING entry */
int gd_add_string(DIRFILE* D, const char* field_code, const char* value,
int fragment_index) gd_nothrow
@@ -1652,6 +1698,37 @@
return error;
}
+/* add a META WINDOW entry */
+int gd_madd_window(DIRFILE *D, const char *parent, const char *field_code,
+ const char *in_field, const char *check_field, gd_windop_t windop,
+ gd_triplet_t threshold) gd_nothrow
+{
+ int error;
+ gd_entry_t E;
+
+ dtrace("%p, \"%s\", \"%s\", \"%s\", \"%s\", %i, {%g,%llx,%lli}", D, parent,
+ field_code, in_field, check_field, windop, threshold.r,
+ (unsigned long long)threshold.u, (long long)threshold.i);
+
+ if (D->flags & GD_INVALID) {/* don't crash */
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ memset(&E, 0, sizeof(gd_entry_t));
+ E.field = (char *)field_code;
+ E.field_type = GD_WINDOW_ENTRY;
+ E.EN(window,threshold) = threshold;
+ E.EN(window,windop) = windop;
+ E.in_fields[0] = (char *)in_field;
+ E.in_fields[1] = (char *)check_field;
+ error = _GD_Add(D, &E, parent);
+
+ dreturn("%i", error);
+ return error;
+}
+
/* add a META STRING entry */
int gd_madd_string(DIRFILE* D, const char* parent,
const char* field_code, const char* value) gd_nothrow
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/del.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -40,6 +40,7 @@
break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
+ case GD_WINDOW_ENTRY:
if (strcmp(E->in_fields[1], C->field) == 0) {
if (check)
_GD_SetError(D, GD_E_DELETE, GD_E_DEL_DERIVED, E->field, 0,
@@ -170,6 +171,24 @@
case GD_PHASE_ENTRY:
_GD_DeReferenceOne(D, E, C, check, 0, GD_INT64, &E->EN(phase,shift));
break;
+ case GD_WINDOW_ENTRY:
+ switch (E->EN(window,windop)) {
+ case GD_WINDOP_EQ:
+ case GD_WINDOP_NE:
+ _GD_DeReferenceOne(D, E, C, check, 0, GD_INT64,
+ &E->EN(window,threshold.i));
+ break;
+ case GD_WINDOP_SET:
+ case GD_WINDOP_CLR:
+ _GD_DeReferenceOne(D, E, C, check, 0, GD_UINT64,
+ &E->EN(window,threshold.u));
+ break;
+ default:
+ _GD_DeReferenceOne(D, E, C, check, 0, GD_FLOAT64,
+ &E->EN(window,threshold.r));
+ break;
+ }
+ break;
case GD_NO_ENTRY:
case GD_LINTERP_ENTRY:
case GD_MULTIPLY_ENTRY:
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/entry.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -51,10 +51,6 @@
free(entry->e->u.linterp.lut);
}
break;
- case GD_RECIP_ENTRY:
- free(entry->in_fields[0]);
- free(entry->scalar[0]);
- break;
case GD_DIVIDE_ENTRY:
case GD_MULTIPLY_ENTRY:
free(entry->in_fields[1]);
@@ -65,6 +61,7 @@
free(entry->scalar[1]);
/* fallthrough */
case GD_PHASE_ENTRY:
+ case GD_RECIP_ENTRY:
free(entry->scalar[0]);
free(entry->in_fields[0]);
break;
@@ -92,6 +89,11 @@
free(entry->e->u.raw.file[1].name);
}
break;
+ case GD_WINDOW_ENTRY:
+ free(entry->scalar[0]);
+ free(entry->in_fields[0]);
+ free(entry->in_fields[1]);
+ break;
case GD_INDEX_ENTRY:
case GD_NO_ENTRY:
break;
@@ -240,6 +242,21 @@
case GD_PHASE_ENTRY:
_GD_GetScalar(D, E, 0, GD_INT64, &E->EN(phase,shift));
break;
+ case GD_WINDOW_ENTRY:
+ switch (E->EN(window,windop)) {
+ case GD_WINDOP_EQ:
+ case GD_WINDOP_NE:
+ _GD_GetScalar(D, E, 0, GD_INT64, &E->EN(window,threshold.i));
+ break;
+ case GD_WINDOP_SET:
+ case GD_WINDOP_CLR:
+ _GD_GetScalar(D, E, 0, GD_UINT64, &E->EN(window,threshold.u));
+ break;
+ default:
+ _GD_GetScalar(D, E, 0, GD_FLOAT64, &E->EN(window,threshold.r));
+ break;
+ }
+ break;
case GD_NO_ENTRY:
case GD_LINTERP_ENTRY:
case GD_MULTIPLY_ENTRY:
@@ -409,6 +426,12 @@
if (E->scalar[0])
entry->scalar[0] = strdup(E->scalar[0]);
break;
+ case GD_WINDOW_ENTRY:
+ entry->in_fields[0] = strdup(E->in_fields[0]);
+ entry->in_fields[1] = strdup(E->in_fields[1]);
+ if (E->scalar[0])
+ entry->scalar[0] = strdup(E->scalar[0]);
+ break;
case GD_INDEX_ENTRY:
case GD_CONST_ENTRY:
case GD_CARRAY_ENTRY:
@@ -522,6 +545,7 @@
break;
case GD_DIVIDE_ENTRY:
case GD_MULTIPLY_ENTRY:
+ case GD_WINDOW_ENTRY:
_GD_BadInput(D, E, 1);
/* fallthrough */
case GD_LINTERP_ENTRY:
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/errors.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -70,6 +70,8 @@
"Bad protection level on line {3} of {2}: {4}", 0 },
{ GD_E_FORMAT, GD_E_FORMAT_LITERAL,
"Unexpected characters in scalar literal ({4}) on line {3} of {2}", 0 },
+ { GD_E_FORMAT, GD_E_FORMAT_WINDOP,
+ "Unrecognised operator ({4}) on line {3} of {2}", 0 },
/* GD_E_TRUNC: 1 = suberror, 2 = filename. 3 = errno */
{ GD_E_TRUNC, 0, "Error truncating {2}: ", 1 },
/* GD_E_CREAT: 1 = suberror, 2 = filename, 3 = errno */
@@ -130,6 +132,8 @@
{ GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_METARAW, "Invalid metafield type: {3}", 0 },
{ GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_POLYORD, "POLYNOM order out of range: {3}",
0 },
+ { GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_WINDOP, "Unrecognised WINDOW operator: {3}",
+ 0 },
/* GD_E_DUPLICATE: 4 = name */
{ GD_E_DUPLICATE, 0, "Field code already present: {4}", 0 },
/* GD_E_DIMENSION: 2 = parent field (if any), 4 = field code */
Modified: trunk/getdata/src/field_list.c
===================================================================
--- trunk/getdata/src/field_list.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/field_list.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -29,8 +29,8 @@
{
GD_RAW_ENTRY, GD_LINCOM_ENTRY, GD_LINTERP_ENTRY, GD_BIT_ENTRY,
GD_MULTIPLY_ENTRY, GD_PHASE_ENTRY, GD_INDEX_ENTRY, GD_POLYNOM_ENTRY,
- GD_SBIT_ENTRY, GD_DIVIDE_ENTRY, GD_RECIP_ENTRY, GD_CONST_ENTRY,
- GD_STRING_ENTRY, GD_CARRAY_ENTRY
+ GD_SBIT_ENTRY, GD_DIVIDE_ENTRY, GD_RECIP_ENTRY, GD_WINDOW_ENTRY,
+ GD_CONST_ENTRY, GD_STRING_ENTRY, GD_CARRAY_ENTRY
};
const void *gd_constants(DIRFILE* D, gd_type_t return_type) gd_nothrow
Modified: trunk/getdata/src/flimits.c
===================================================================
--- trunk/getdata/src/flimits.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/flimits.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -211,12 +211,8 @@
case GD_LINTERP_ENTRY:
case GD_SBIT_ENTRY:
case GD_POLYNOM_ENTRY:
- if (_GD_BadInput(D, E, 0))
- break;
-
- ns = _GD_GetEOF(D, E->e->entry[0], E->field, is_index);
- break;
case GD_RECIP_ENTRY:
+ case GD_WINDOW_ENTRY:
if (_GD_BadInput(D, E, 0))
break;
@@ -415,6 +411,8 @@
case GD_SBIT_ENTRY:
case GD_LINTERP_ENTRY:
case GD_POLYNOM_ENTRY:
+ case GD_RECIP_ENTRY:
+ case GD_WINDOW_ENTRY:
if (_GD_BadInput(D, E, 0))
break;
@@ -445,12 +443,6 @@
}
break;
- case GD_RECIP_ENTRY:
- if (_GD_BadInput(D, E, 0))
- break;
-
- bof = _GD_GetBOF(D, E->e->entry[0], E->field, spf, ds);
- break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1))
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/flush.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -60,6 +60,7 @@
/* fallthrough */
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
+ case GD_WINDOW_ENTRY:
_GD_Flush(D, E->e->entry[1], clo);
/* fallthrough */
case GD_LINTERP_ENTRY:
@@ -172,6 +173,47 @@
return ptr;
}
+static const char *_GD_WindopName(DIRFILE *D, gd_windop_t op)
+{
+ const char *ptr;
+
+ dtrace("%p, %i", D, op);
+
+ switch(op) {
+ case GD_WINDOP_EQ:
+ ptr = "EQ";
+ break;
+ case GD_WINDOP_GE:
+ ptr = "GE";
+ break;
+ case GD_WINDOP_GT:
+ ptr = "GT";
+ break;
+ case GD_WINDOP_LE:
+ ptr = "LE";
+ break;
+ case GD_WINDOP_LT:
+ ptr = "LT";
+ break;
+ case GD_WINDOP_NE:
+ ptr = "NE";
+ break;
+ case GD_WINDOP_SET:
+ ptr = "SET";
+ break;
+ case GD_WINDOP_CLR:
+ ptr = "CLR";
+ break;
+ default:
+ _GD_InternalError(D);
+ ptr = "";
+ break;
+ }
+
+ dreturn("\"%s\"", ptr);
+ return ptr;
+}
+
static size_t _GD_StringEscapeise(FILE* stream, const char* in, int permissive,
int standards)
{
@@ -231,7 +273,7 @@
static void _GD_WriteConst(DIRFILE *D, FILE* stream, int type,
const void* value, const char* scalar, int index, const char* postamble)
{
- dtrace("%p, %p, %i, %p, \"%s\", %i, \"%s\"", D, stream, type, value, scalar,
+ dtrace("%p, %p, 0x%X, %p, \"%s\", %i, \"%s\"", D, stream, type, value, scalar,
index, postamble);
if (scalar != NULL) {
@@ -241,6 +283,8 @@
fprintf(stream, "%s<%i>%s", scalar, index, postamble);
} else if (type == GD_UINT16)
fprintf(stream, "%" PRIu16 "%s", *(uint16_t *)value, postamble);
+ else if (type == GD_UINT64)
+ fprintf(stream, "%" PRIu64 "%s", *(uint64_t *)value, postamble);
else if (type == GD_INT64)
fprintf(stream, "%" PRIi64 "%s", *(uint64_t *)value, postamble);
else if (type == GD_INT16)
@@ -332,10 +376,9 @@
E->in_fields[0]);
break;
case GD_RECIP_ENTRY:
- fprintf(stream, " RECIP%s ", pretty ? " " : "");
+ fprintf(stream, " RECIP%s %s ", pretty ? " " : "", E->in_fields[0]);
_GD_WriteConst(D, stream, GD_COMPLEX128, &E->EN(recip,cdividend),
E->scalar[0], E->scalar_ind[0], "");
- fprintf(stream, " %s", E->in_fields[0]);
break;
case GD_MULTIPLY_ENTRY:
fprintf(stream, " MULTIPLY %s %s\n", E->in_fields[0], E->in_fields[1]);
@@ -364,6 +407,27 @@
_GD_WriteConst(D, stream, GD_INT16, &E->EN(bit,numbits), E->scalar[1],
E->scalar_ind[1], "\n");
break;
+ case GD_WINDOW_ENTRY:
+ fprintf(stream, " WINDOW%s %s %s %s ", pretty ? " " : "",
+ E->in_fields[0], E->in_fields[1],
+ _GD_WindopName(D, E->EN(window,windop)));
+ switch (E->EN(window,windop)) {
+ case GD_WINDOP_EQ:
+ case GD_WINDOP_NE:
+ _GD_WriteConst(D, stream, GD_INT64, &E->EN(window,threshold.i),
+ E->scalar[0], E->scalar_ind[0], "");
+ break;
+ case GD_WINDOP_SET:
+ case GD_WINDOP_CLR:
+ _GD_WriteConst(D, stream, GD_UINT64, &E->EN(window,threshold.u),
+ E->scalar[0], E->scalar_ind[0], "");
+ break;
+ default:
+ _GD_WriteConst(D, stream, GD_FLOAT64, &E->EN(window,threshold.r),
+ E->scalar[0], E->scalar_ind[0], "");
+ break;
+ }
+ break;
case GD_CONST_ENTRY:
fprintf(stream, " CONST%s %s ", pretty ? " " : "", _GD_TypeName(D,
E->EN(scalar,const_type)));
@@ -742,6 +806,7 @@
#define GD_VERS_GE_6 0xFFFFFFFFFFFFFFC0LU
#define GD_VERS_GE_7 0xFFFFFFFFFFFFFF80LU
#define GD_VERS_GE_8 0xFFFFFFFFFFFFFF00LU
+#define GD_VERS_GE_9 0xFFFFFFFFFFFFFE00LU
#define GD_VERS_LE_0 0x0000000000000001LU
#define GD_VERS_LE_1 0x0000000000000003LU
@@ -752,6 +817,7 @@
#define GD_VERS_LE_6 0x000000000000007fLU
#define GD_VERS_LE_7 0x00000000000000ffLU
#define GD_VERS_LE_8 0x00000000000001ffLU
+#define GD_VERS_LE_9 0x00000000000003ffLU
uint64_t _GD_FindVersion(DIRFILE *D)
{
@@ -841,6 +907,9 @@
D->av &= GD_VERS_GE_5;
}
break;
+ case GD_WINDOW_ENTRY:
+ D->av &= GD_VERS_GE_9;
+ break;
case GD_LINTERP_ENTRY:
case GD_LINCOM_ENTRY:
case GD_INDEX_ENTRY:
Modified: trunk/getdata/src/fpos.c
===================================================================
--- trunk/getdata/src/fpos.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/fpos.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -73,6 +73,7 @@
break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
+ case GD_WINDOW_ENTRY:
if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1))
break;
pos = _GD_GetFilePos(D, E->e->entry[0], 0);
@@ -268,6 +269,7 @@
break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
+ case GD_WINDOW_ENTRY:
if (_GD_BadInput(D, E, 1))
break;
if (_GD_Seek(D, E->e->entry[1], offset, mode))
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/getdata.c 2011-12-06 23:36:19 UTC (rev 632)
@@ -821,6 +821,78 @@
dreturnvoid();
}
+#define WINDOP(ot,ct,bo,op,tt,z) \
+ for (i = 0; i < n; i++) \
+ if (!((bo(((ct*)B)[i * spfB / spfA])) op threshold.tt)) \
+ ((ot*)A)[i] = (ot)(z)
+
+#define WINDOPC(ot,ct,bo,op,tt,z) \
+ for (i = 0; i < n; i++) \
+ if (!((bo(((ct*)B)[i * spfB / spfA])) op threshold.tt)) \
+ ((ot*)A)[i * 2] = ((ot*)A)[i * 2 + 1] = (ot)(z)
+
+#define WINDOW(t,z) \
+ switch (op) { \
+ case GD_WINDOP_EQ: WINDOP(t, int64_t, ,==,i,z); break; \
+ case GD_WINDOP_GE: WINDOP(t, double, ,>=,r,z); break; \
+ case GD_WINDOP_GT: WINDOP(t, double, ,> ,r,z); break; \
+ case GD_WINDOP_LE: WINDOP(t, double, ,<=,r,z); break; \
+ case GD_WINDOP_LT: WINDOP(t, double, ,< ,r,z); break; \
+ case GD_WINDOP_NE: WINDOP(t, int64_t, ,!=,i,z); break; \
+ case GD_WINDOP_SET: WINDOP(t,uint64_t, ,& ,u,z); break; \
+ case GD_WINDOP_CLR: WINDOP(t,uint64_t,~,& ,u,z); break; \
+ default: \
+ _GD_InternalError(D); \
+ }
+
+#define WINDOWC(t,z) \
+ switch (op) { \
+ case GD_WINDOP_EQ: WINDOPC(t, int64_t, ,==,i,z); break; \
+ case GD_WINDOP_GE: WINDOPC(t, double, ,>=,r,z); break; \
+ case GD_WINDOP_GT: WINDOPC(t, double, ,> ,r,z); break; \
+ case GD_WINDOP_LE: WINDOPC(t, double, ,<=,r,z); break; \
+ case GD_WINDOP_LT: WINDOPC(t, double, ,< ,r,z); break; \
+ case GD_WINDOP_NE: WINDOPC(t, int64_t, ,!=,i,z); break; \
+ case GD_WINDOP_SET: WINDOPC(t,uint64_t, ,& ,u,z); break; \
+ case GD_WINDOP_CLR: WINDOPC(t,uint64_t,~,& ,u,z); break; \
+ default: \
+ _GD_InternalError(D); \
+ }
+
+/* WindowData: Zero data in A where the condition is false. B is unchanged.
+*/
+static void _GD_WindowData(DIRFILE* D, void *A, gd_spf_t spfA, void *B,
+ gd_spf_t spfB, gd_windop_t op, gd_triplet_t threshold, gd_type_t type,
+ size_t n)
+{
+ size_t i;
+ const double NaN = NAN;
+
+ dtrace("%p, %p, %u, %p, %u, 0x%X, %i, {%g,%llx,%lli}, %zu", D, A, spfA, B,
+ spfB, type, op, threshold.r, (unsigned long long)threshold.u,
+ (long long)threshold.i, n);
+
+ switch (type) {
+ case GD_NULL: break;
+ case GD_UINT8: WINDOW( uint8_t, 0) break;
+ case GD_INT8: WINDOW( int8_t, 0) break;
+ case GD_UINT16: WINDOW(uint16_t, 0) break;
+ case GD_INT16: WINDOW( int16_t, 0) break;
+ case GD_UINT32: WINDOW(uint32_t, 0) break;
+ case GD_INT32: WINDOW( int32_t, 0) break;
+ case GD_UINT64: WINDOW(uint64_t, 0) break;
+ case GD_INT64: WINDOW( int64_t, 0) break;
+ case GD_FLOAT32: WINDOW( float,NaN) break;
+ case GD_FLOAT64: WINDOW( double,NaN) break;
+ case GD_COMPLEX64: WINDOWC( float,NaN) break;
+ case GD_COMPLEX128: WINDOWC( double,NaN) break;
+ default: _GD_SetError(D, GD_E_BAD_TYPE, type, NULL, 0, NULL);
+ break;
+ }
+
+ dreturnvoid();
+}
+
/* _GD_DoLincom: Read from a lincom. Returns number of samples read.
*/
static size_t _GD_DoLincom(DIRFILE *D, gd_entry_t *E, off64_t first_samp,
@@ -1360,6 +1432,110 @@
return n_read;
}
+/* _GD_DoWindow: Read from a window. Returns number of samples read.
+*/
+static size_t _GD_DoWindow(DIRFILE *D, gd_entry_t* E, off64_t first_samp,
+ size_t num_samp, gd_type_t return_type, void *data_out)
+{
+ void *tmpbuf = NULL;
+ gd_spf_t spf1, spf2;
+ size_t n_read, n_read2, num_samp2;
+ off64_t first_samp2;
+ gd_type_t type2;
+
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
+ data_out);
+
+ /* Check input fields */
+ if (_GD_BadInput(D, E, 0)) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ if (_GD_BadInput(D, E, 1)) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ /* find the samples per frame of the input field */
+ spf1 = _GD_GetSPF(D, E->e->entry[0]);
+ if (D->error != GD_E_OK) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ /* read the input field and record the number of samples returned */
+ n_read = _GD_DoField(D, E->e->entry[0], E->e->repr[0], first_samp, num_samp,
+ return_type, data_out);
+
+ if (D->error != GD_E_OK) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ /* Nothing to window */
+ if (n_read == 0) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ /* find the samples per frame of the check field */
+ spf2 = _GD_GetSPF(D, E->e->entry[1]);
+ if (D->error != GD_E_OK) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ /* calculate the first sample and number of samples to read of the
+ * check field */
+ num_samp2 = (int)ceil((double)n_read * spf2 / spf1);
+ first_samp2 = first_samp * spf2 / spf1;
+
+ switch(E->EN(window,windop)) {
+ case GD_WINDOP_EQ:
+ case GD_WINDOP_NE:
+ type2 = GD_INT64;
+ break;
+ case GD_WINDOP_SET:
+ case GD_WINDOP_CLR:
+ type2 = GD_UINT64;
+ break;
+ default:
+ type2 = GD_FLOAT64;
+ break;
+ }
+
+ /* Allocate a temporary buffer for the check field */
+ tmpbuf = (double *)_GD_Alloc(D, type2, num_samp2);
+
+ if (D->error != GD_E_OK) {
+ free(tmpbuf);
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ /* read the check field */
+ n_read2 = _GD_DoField(D, E->e->entry[1], E->e->repr[1], first_samp2,
+ num_samp2, type2, tmpbuf);
+
+ if (D->error != GD_E_OK) {
+ free(tmpbuf);
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ if (n_read2 > 0 && n_read2 * spf1 < n_read * spf2)
+ n_read = n_read2 * spf1 / spf2;
+
+ _GD_WindowData(D, data_out, spf1, tmpbuf, spf2, E->EN(window,windop),
+ E->EN(window,threshold), return_type, n_read);
+
+ free(tmpbuf);
+
+ dreturn("%zu", n_read);
+ return n_read;
+}
+
/* _GD_DoConst: Read from a const. Returns number of samples read (ie. 1).
*/
static size_t _GD_DoConst(DIRFILE *D, const gd_entry_t *E, off64_t first,
@@ -1500,6 +1676,9 @@
case GD_SBIT_ENTRY:
n_read = _GD_DoBit(D, E, 1, first_samp, num_samp, return_type, data_out);
break;
+ case GD_WINDOW_ENTRY:
+ n_read = _GD_DoWindow(D, E, first_samp, num_samp, return_type, data_out);
+ break;
case GD_CONST_ENTRY:
case GD_CARRAY_ENTRY:
n_read = _GD_DoConst(D, E, first_samp, num_samp, return_type, data_out);
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2011-12-06 01:30:29 UTC (rev 631)
+++ trunk/getdata/src/getdata.h.in 2011-12-06 23:36:19 UTC (rev 632)
@@ -50,7 +50,7 @@
#endif
/* The most recent standards version supported by this library */
-#define GD_DIRFILE_STANDARDS_VERSION 8
+#define GD_DIRFILE_STANDARDS_VERSION 9
#include <math.h>
#include <sys/types.h>
@@ -144,6 +144,7 @@
#define GD_E_DELETE 26
#define GD_E_ARGUMENT 27
#define GD_E_CALLBACK 28
+/* unused 29 */
#define GD_E_UNCLEAN_DB 30
#define GD_E_DOMAIN 31
#define GD_E_BAD_REPR 32
@@ -184,6 +185,7 @@
#define GD_E_FORMAT_LOCATION 17
#define GD_E_FORMAT_PROTECT 18
#define GD_E_FORMAT_LITERAL 19
+#define GD_E_FORMAT_WINDOP 20
/* parser callback return values */
#define GD_SYNTAX_ABORT 0
@@ -220,30 +222,36 @@
GD_SBIT_ENTRY = 0x09,
GD_DIVIDE_ENTRY = 0x0A,
GD_RECIP_ENTRY = 0x0B,
+ GD_WINDOW_ENTRY = 0x0C,
GD_CONST_ENTRY = GD_SCALAR_ENTRY | 0x00,
GD_STRING_ENTRY = GD_SCALAR_ENTRY | 0x01,
GD_CARRAY_ENTRY = GD_SCALAR_ENTRY | 0x02
} gd_entype_t;
...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-08 02:30:50
|
Revision: 633
http://getdata.svn.sourceforge.net/getdata/?rev=633&view=rev
Author: ketiltrout
Date: 2011-12-08 02:30:40 +0000 (Thu, 08 Dec 2011)
Log Message:
-----------
* Add /HIDDEN directive.
* Fix version leakage. For backwards compatibility, this only occurs with DSV >= 9.
* [bug]: "/META parent/child granchild ..." is now reported as a syntax error. (It would previously half-work, causing a segfault on close.)
* Store counts of each # of each entry type.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/TODO
trunk/getdata/src/add.c
trunk/getdata/src/del.c
trunk/getdata/src/entry.c
trunk/getdata/src/errors.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flush.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/include.c
trunk/getdata/src/internal.h
trunk/getdata/src/meta_list.c
trunk/getdata/src/mod.c
trunk/getdata/src/nfields.c
trunk/getdata/src/nmeta.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/test/Makefile.am
Added Paths:
-----------
trunk/getdata/test/alter_entry_hidden.c
trunk/getdata/test/cvlist_array_hidden.c
trunk/getdata/test/cvlist_array_meta_hidden.c
trunk/getdata/test/cvlist_hidden.c
trunk/getdata/test/cvlist_meta_hidden.c
trunk/getdata/test/flist_hidden.c
trunk/getdata/test/flist_meta_hidden.c
trunk/getdata/test/flist_type_hidden.c
trunk/getdata/test/flist_type_meta_hidden.c
trunk/getdata/test/hide.c
trunk/getdata/test/hide_unhide.c
trunk/getdata/test/nfields_hidden.c
trunk/getdata/test/nfields_type_hidden.c
trunk/getdata/test/nfields_vector.c
trunk/getdata/test/nfields_vector_hidden.c
trunk/getdata/test/nfields_vector_invalid.c
trunk/getdata/test/nmeta_hidden.c
trunk/getdata/test/nmeta_type_hidden.c
trunk/getdata/test/nmeta_vectors_hidden.c
trunk/getdata/test/parse_hidden.c
trunk/getdata/test/parse_hidden_field.c
trunk/getdata/test/parse_hidden_meta.c
trunk/getdata/test/parse_meta_meta.c
trunk/getdata/test/parse_version_89.c
trunk/getdata/test/parse_version_98.c
trunk/getdata/test/parse_version_p8.c
trunk/getdata/test/parse_version_p9.c
trunk/getdata/test/svlist_hidden.c
trunk/getdata/test/svlist_meta_hidden.c
trunk/getdata/test/vlist_hidden.c
trunk/getdata/test/vlist_meta_hidden.c
Removed Paths:
-------------
trunk/getdata/test/nvectors.c
trunk/getdata/test/nvectors_invalid.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/ChangeLog 2011-12-08 02:30:40 UTC (rev 633)
@@ -1,3 +1,52 @@
+2011-12-08 D. V. Wiebe <ge...@ke...> svn:633
+ * test/svlist_hidden.c test/svlist_meta_hidden.c test/hide.c
+ test/flist_hidden.c test/nfields_hidden.c test/parse_version_89.c
+ test/nmeta_type_hidden.c test/parse_version_98.c test/nmeta_vectors_hidden.c
+ test/nmeta_hidden.c test/alter_entry_hidden.c test/parse_version_p8.c
+ test/parse_version_p9.c test/hide_unhide.c test/cvlist_meta_hidden.c
+ test/nfields_type_hidden.c test/vlist_hidden.c test/flist_meta_hidden.c
+ test/vlist_meta_hidden.c test/flist_type_meta_hidden.c
+ test/parse_hidden_meta.c test/cvlist_array_hidden.c test/parse_meta_meta.c
+ test/nfields_vector_hidden.c test/parse_hidden.c test/parse_hidden_field.c
+ test/cvlist_hidden.c test/cvlist_array_meta_hidden.c
+ test/flist_type_hidden.c: Added.
+
+ * test/nfields_vector.c test/nfields_vector_invalid.c: Renamed from nvectors*
+
+ * src/parse.c (_GD_ParseDirective): Parse /HIDDEN directives.
+ * src/entry.c (gd_hide gd_unhide): Added.
+ * src/nmeta.c (gd_nmfields gd_nmvectors gd_nmfields_by_type) src/nfields.c
+ (gd_nfields gd_nvectors gd_nfields_by_type) src/field_list.c (gd_constants
+ gd_carrays gd_strings gd_field_list_by_type gd_vector_list gd_field_list)
+ src/meta_list (gd_mconstants gd_mcarrays gd_mstrings gd_mfield_list_by_type
+ gd_mvector_list gd_mfield_list): Compensate for hidden fields.
+ * src/flush.c (_GD_FieldSpec): Write /HIDDEN directives.
+ * src/flush.c (_GD_FindVersion): Consider hidden entries.
+ * src/mod.c (_GD_Change): Prohibit changing hiddenness via gd_alter_entry().
+
+ * src/parse.c (_GD_ParseDirective): Forbid a metafield code from appearing
+ as a parent in /META directives.
+
+ * src/internal.h: Record the number of each type of field, rather than just
+ for the scalar field types.
+ * src/internal.h (_GD_EntryIndex): Added.
+ * src/open.c (gd_cbopen): Initialise D->n[INDEX_ENTRY].
+ * src/nmeta.c (gd_nmvectors gd_nmfields_by_type) src/nfields.c (gd_nvectors
+ gd_nfields_by_type) src/field_list.c (gd_constants gd_carrays gd_strings
+ gd_field_list_by_type gd_vector_list) src/meta_list.c (gd_mconstants
+ gd_mcarrays gd_mstrings gd_mfield_list_by_type gd_mvector_list): Use type
+ counts.
+ * src/del.c (gd_delete) src/parse.c (_GD_ParseFieldSpec) src/include.c
+ (gd_uninclude) src/add.c (_GD_Add): Update type counts.
+ * src/field_list.c (_gd_entype_index): Deleted.
+
+ * src/include.c (_GD_Include): Remember incoming Standards Version and
+ parser mode, and restore them on exit if the new DSV >=9 or the old mode is
+ pedantic and the old DSV >= 9. This is an attempt to stave the "version
+ leak" problem experienced in earlier DSVs.
+
+ * src/internal.h: Renamed GD_E_FORMAT_NO_PARENT to GD_E_FORMAT_NO_FIELD.
+
2011-12-06 D. V. Wiebe <ge...@ke...> svn:632
* test/get_window_ne.c test/get_window.c test/parse_window_scalar.c
test/alter_window.c test/parse_window.c test/madd_window.c
Modified: trunk/getdata/TODO
===================================================================
--- trunk/getdata/TODO 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/TODO 2011-12-08 02:30:40 UTC (rev 633)
@@ -3,6 +3,5 @@
* linterp table path munging [MH]
* Make webpage suck less
-* Fix VERSION leakage / Fragment encapsulation [MT/CBN]
* INCLUDE name munging [RW/MT]
* aliasing [MT]
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/add.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -163,10 +163,14 @@
return -1;
}
- /* Set meta indicies */
+ /* Set meta indices */
if (parent != NULL)
E->e->n_meta = -1;
+ /* Hidden */
+ if (entry->hidden)
+ E->hidden = 1;
+
/* Validate entry and add auxiliary data */
switch(entry->field_type)
{
@@ -464,22 +468,13 @@
}
- if (E->field_type == GD_STRING_ENTRY) {
- if (P)
- P->e->n_meta_string++;
- else
- D->n_string++;
- } else if (E->field_type == GD_CONST_ENTRY) {
- if (P)
- P->e->n_meta_const++;
- else
- D->n_const++;
- } else if (E->field_type == GD_CARRAY_ENTRY) {
- if (P)
- P->e->n_meta_carray++;
- else
- D->n_carray++;
- } else if (E->field_type == GD_RAW_ENTRY) {
+ /* increment entry type count */
+ if (P)
+ P->e->n[_GD_EntryIndex(E->field_type)]++;
+ else
+ D->n[_GD_EntryIndex(E->field_type)]++;
+
+ if (E->field_type == GD_RAW_ENTRY) {
if (new_ref != NULL) {
/* This is the first raw field in this fragment; propagate it upwards */
for (i = E->fragment_index; i != -1; i = D->fragment[i].parent) {
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/del.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -451,12 +451,8 @@
D->n_entries -= last - first + 1;
}
- if (E->field_type == GD_CONST_ENTRY)
- D->n_const--;
- else if (E->field_type == GD_CARRAY_ENTRY)
- D->n_carray--;
- else if (E->field_type == GD_STRING_ENTRY)
- D->n_string--;
+ /* Decrement entry type count */
+ D->n[_GD_EntryIndex(E->field_type)]--;
} else {
/* If this is a metafield, update its parent's lists */
struct _gd_private_entry *Pe = E->e->p.parent->e;
@@ -468,13 +464,9 @@
break;
}
+ /* Decrement entry type counts */
Pe->n_meta--;
- if (E->field_type == GD_CONST_ENTRY)
- Pe->n_meta_const--;
- else if (E->field_type == GD_CARRAY_ENTRY)
- Pe->n_meta_carray--;
- else if (E->field_type == GD_STRING_ENTRY)
- Pe->n_meta_string--;
+ Pe->n[_GD_EntryIndex(E->field_type)]--;
}
/* Remove the entry from the list -- we need not worry about the way we've
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/entry.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -506,6 +506,120 @@
return E->fragment_index;
}
+int gd_hide(DIRFILE *D, const char *field_code_in) gd_nothrow
+{
+ gd_entry_t *E;
+ int repr;
+ char *field_code;
+
+ dtrace("%p, \"%s\"", D, field_code_in);
+
+ if (D->flags & GD_INVALID) {
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ } else if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+ _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ClearError(D);
+
+ /* get rid of the representation, if any */
+ E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+
+ if (D->error) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+ _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+ D->fragment[E->fragment_index].cname);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (field_code != field_code_in)
+ free(field_code);
+
+ if (!E->hidden) {
+ E->hidden = 1;
+ D->fragment[E->fragment_index].modified = 1;
+
+ /* update counts */
+ if (E->e->n_meta == -1) {
+ gd_entry_t *P = (gd_entry_t*)E->e->p.parent;
+ P->e->n_hidden++;
+ P->e->n[_GD_EntryIndex(E->field_type)]--;
+ } else {
+ D->n_hidden++;
+ D->n[_GD_EntryIndex(E->field_type)]--;
+ }
+ }
+
+ dreturn("%i", 0);
+ return 0;
+}
+
+int gd_unhide(DIRFILE *D, const char *field_code_in) gd_nothrow
+{
+ gd_entry_t *E;
+ int repr;
+ char *field_code;
+
+ dtrace("%p, \"%s\"", D, field_code_in);
+
+ if (D->flags & GD_INVALID) {
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ } else if ((D->flags & GD_ACCMODE) != GD_RDWR) {
+ _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ClearError(D);
+
+ /* get rid of the representation, if any */
+ E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+
+ if (D->error) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (field_code != field_code_in)
+ free(field_code);
+
+ if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
+ _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+ D->fragment[E->fragment_index].cname);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (E->hidden) {
+ E->hidden = 0;
+ D->fragment[E->fragment_index].modified = 1;
+
+ /* update counts */
+ if (E->e->n_meta == -1) {
+ gd_entry_t *P = (gd_entry_t*)E->e->p.parent;
+ P->e->n_hidden--;
+ P->e->n[_GD_EntryIndex(E->field_type)]++;
+ } else {
+ D->n_hidden--;
+ D->n[_GD_EntryIndex(E->field_type)]++;
+ }
+ }
+
+ dreturn("%i", 0);
+ return 0;
+}
+
int gd_validate(DIRFILE *D, const char *field_code_in) gd_nothrow
{
int i, repr;
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/errors.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -60,8 +60,8 @@
"Unterminated token on line {3} of {2}", 0 },
{ GD_E_FORMAT, GD_E_FORMAT_METARAW,
"Invalid metafield type on line {3} of {2}", 0 },
- { GD_E_FORMAT, GD_E_FORMAT_NO_PARENT,
- "Meta field defined before parent ({4}) on line {3} of {2}", 0 },
+ { GD_E_FORMAT, GD_E_FORMAT_NO_FIELD,
+ "Field code not found on line {3} of {2}: {4}", 0 },
{ GD_E_FORMAT, GD_E_FORMAT_DUPLICATE,
"Field code on line {3} of {2} already defined: {4}", 0 },
{ GD_E_FORMAT, GD_E_FORMAT_LOCATION,
@@ -72,6 +72,8 @@
"Unexpected characters in scalar literal ({4}) on line {3} of {2}", 0 },
{ GD_E_FORMAT, GD_E_FORMAT_WINDOP,
"Unrecognised operator ({4}) on line {3} of {2}", 0 },
+ { GD_E_FORMAT, GD_E_FORMAT_META_META,
+ "Cannot attach meta field to meta field {4} on line {3} of {2}", 0 },
/* GD_E_TRUNC: 1 = suberror, 2 = filename. 3 = errno */
{ GD_E_TRUNC, 0, "Error truncating {2}: ", 1 },
/* GD_E_CREAT: 1 = suberror, 2 = filename, 3 = errno */
Modified: trunk/getdata/src/field_list.c
===================================================================
--- trunk/getdata/src/field_list.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/field_list.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -24,15 +24,6 @@
static const char* zero_list[1] = { NULL };
static const gd_carray_t zero_carrays[1] = { {0, NULL} };
-/* correspondence between type_list index and gd_enttype_t */
-const gd_entype_t _gd_entype_index[GD_N_ENTYPES] =
-{
- GD_RAW_ENTRY, GD_LINCOM_ENTRY, GD_LINTERP_ENTRY, GD_BIT_ENTRY,
- GD_MULTIPLY_ENTRY, GD_PHASE_ENTRY, GD_INDEX_ENTRY, GD_POLYNOM_ENTRY,
- GD_SBIT_ENTRY, GD_DIVIDE_ENTRY, GD_RECIP_ENTRY, GD_WINDOW_ENTRY,
- GD_CONST_ENTRY, GD_STRING_ENTRY, GD_CARRAY_ENTRY
-};
-
const void *gd_constants(DIRFILE* D, gd_type_t return_type) gd_nothrow
{
unsigned int i, n;
@@ -48,13 +39,13 @@
_GD_ClearError(D);
- if (D->n_const == 0) {
+ if ((n = D->n[_GD_EntryIndex(GD_CONST_ENTRY)]) == 0) {
dreturn("%p", NULL);
return NULL;
}
free(D->const_value_list);
- fl = (char *)_GD_Alloc(D, return_type, D->n_const);
+ fl = (char *)_GD_Alloc(D, return_type, n);
if (fl == NULL) {
dreturn("%p", NULL);
@@ -63,7 +54,7 @@
for (i = n = 0; i < D->n_entries; ++i) {
if (D->entry[i]->field_type == GD_CONST_ENTRY &&
- D->entry[i]->e->n_meta != -1)
+ D->entry[i]->e->n_meta != -1 && !D->entry[i]->hidden)
if (_GD_DoField(D, D->entry[i], 0, 0, 1, return_type,
fl + n++ * GD_SIZE(return_type)) != 1)
break;
@@ -90,7 +81,7 @@
_GD_ClearError(D);
- if (D->n_carray == 0) {
+ if ((n = D->n[_GD_EntryIndex(GD_CARRAY_ENTRY)]) == 0) {
dreturn("%p", zero_carrays);
return zero_carrays;
}
@@ -99,8 +90,8 @@
for (i = 0; D->carray_value_list[i].n != 0; ++i)
free(D->carray_value_list[i].d);
free(D->carray_value_list);
- fl = (gd_carray_t *)malloc(sizeof(gd_carray_t) * (D->n_carray + 1));
- memset(fl, 0, sizeof(gd_carray_t) * (D->n_carray + 1));
+ fl = (gd_carray_t *)malloc(sizeof(gd_carray_t) * (n + 1));
+ memset(fl, 0, sizeof(gd_carray_t) * (n + 1));
if (fl == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
@@ -110,7 +101,8 @@
for (i = n = 0; i < D->n_entries; ++i) {
if (D->entry[i]->field_type == GD_CARRAY_ENTRY &&
- D->entry[i]->e->n_meta != -1) {
+ D->entry[i]->e->n_meta != -1 && !D->entry[i]->hidden)
+ {
fl[n].n = D->entry[i]->EN(scalar,array_len);
fl[n].d = _GD_Alloc(D, return_type, fl[n].n);
if (D->error || _GD_DoField(D, D->entry[i], 0, 0, fl[n].n, return_type,
@@ -142,7 +134,7 @@
_GD_ClearError(D);
- if (D->n_string == 0) {
+ if ((n = D->n[_GD_EntryIndex(GD_STRING_ENTRY)]) == 0) {
dreturn("%p", zero_list);
return zero_list;
}
@@ -154,7 +146,7 @@
}
fl = (char **)realloc((char **)D->string_value_list, sizeof(const char*) *
- (D->n_string + 1));
+ (n + 1));
if (fl == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
@@ -164,7 +156,7 @@
for (i = n = 0; i < D->n_entries; ++i) {
if (D->entry[i]->field_type == GD_STRING_ENTRY &&
- D->entry[i]->e->n_meta != -1)
+ D->entry[i]->e->n_meta != -1 && !D->entry[i]->hidden)
fl[n++] = D->entry[i]->e->u.string;
}
fl[n] = NULL;
@@ -180,7 +172,7 @@
{
unsigned int i, n;
char** fl;
- int index = -1;
+ const int index = _GD_EntryIndex(type);
dtrace("%p, %x", D, type);
@@ -204,20 +196,6 @@
return zero_list;
}
- /* find the index -- get_nfields_by_type should have already tripped up
- * if the type is invalid */
- for (i = 0; i < GD_N_ENTYPES; ++i)
- if (_gd_entype_index[i] == type) {
- index = i;
- break;
- }
-
- if (index == -1) {
- _GD_InternalError(D);
- dreturn("%p", NULL);
- return NULL;
- }
-
if (D->type_list_validity & (1 << index)) {
/* list already made */
dreturn("%p", D->type_list[index]);
@@ -234,8 +212,11 @@
}
for (i = n = 0; i < D->n_entries; ++i) {
- if (D->entry[i]->field_type == type && D->entry[i]->e->n_meta != -1)
+ if (D->entry[i]->field_type == type && D->entry[i]->e->n_meta != -1 &&
+ !D->entry[i]->hidden)
+ {
fl[n++] = D->entry[i]->field;
+ }
}
fl[n] = NULL;
@@ -261,7 +242,7 @@
_GD_ClearError(D);
- n = D->n_entries - D->n_meta - D->n_string - D->n_const - D->n_carray;
+ n = gd_nvectors(D);
if (n == 0) {
dreturn("%p", zero_list);
@@ -284,7 +265,7 @@
for (i = n = 0; i < D->n_entries; ++i) {
if (!(D->entry[i]->field_type & GD_SCALAR_ENTRY) &&
- D->entry[i]->e->n_meta != -1)
+ D->entry[i]->e->n_meta != -1 && !D->entry[i]->hidden)
fl[n++] = D->entry[i]->field;
}
fl[n] = NULL;
@@ -311,7 +292,7 @@
_GD_ClearError(D);
- if (D->n_entries == 0) {
+ if (D->n_entries - D->n_hidden - D->n_meta == 0) {
dreturn("%p", zero_list);
return zero_list;
}
@@ -323,7 +304,7 @@
}
fl = (char **)realloc((char **)D->field_list, sizeof(const char*) *
- (D->n_entries + 1 - D->n_meta));
+ (D->n_entries + 1 - D->n_meta - D->n_hidden));
if (fl == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
@@ -332,7 +313,7 @@
}
for (i = n = 0; i < D->n_entries; ++i)
- if (D->entry[i]->e->n_meta != -1)
+ if (D->entry[i]->e->n_meta != -1 && !D->entry[i]->hidden)
fl[n++] = D->entry[i]->field;
fl[n] = NULL;
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/flush.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -470,6 +470,9 @@
break;
}
+ if (!D->error && E->hidden && (permissive || D->standards >= 9))
+ fprintf(stream, "/HIDDEN %s\n", E->field);
+
dreturnvoid();
}
@@ -858,6 +861,9 @@
}
for (i = 0; D->av && i < D->n_entries; ++i) {
+ if (D->entry[i]->hidden)
+ D->av &= GD_VERS_GE_9;
+
switch (D->entry[i]->field_type) {
case GD_RAW_ENTRY:
switch (D->entry[i]->EN(raw,data_type)) {
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/getdata.h.in 2011-12-08 02:30:40 UTC (rev 633)
@@ -180,13 +180,17 @@
#define GD_E_FORMAT_BAD_NAME 12
#define GD_E_FORMAT_UNTERM 13
#define GD_E_FORMAT_METARAW 14
-#define GD_E_FORMAT_NO_PARENT 15
+#define GD_E_FORMAT_NO_FIELD 15
#define GD_E_FORMAT_DUPLICATE 16
#define GD_E_FORMAT_LOCATION 17
#define GD_E_FORMAT_PROTECT 18
#define GD_E_FORMAT_LITERAL 19
#define GD_E_FORMAT_WINDOP 20
+#define GD_E_FORMAT_META_META 21
+/* deprecated names */
+#define GD_E_FORMAT_NO_PARENT GD_E_FORMAT_NO_FIELD
+
/* parser callback return values */
#define GD_SYNTAX_ABORT 0
#define GD_SYNTAX_RESCAN 1
@@ -324,6 +328,7 @@
int scalar_ind[GD_MAX_POLYORD + 1];
int fragment_index;
int comp_scal;
+ int hidden;
union {
struct { /* RAW */
gd_spf_t spf;
@@ -641,6 +646,9 @@
extern const char *gd_fragmentname(DIRFILE *dirfile,
int index) gd_nothrow gd_nonnull ((1));
+extern int gd_hide(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
+
extern DIRFILE *gd_invalid_dirfile(void) gd_nothrow;
extern int gd_madd(DIRFILE *dirfile, const gd_entry_t *entry,
@@ -796,6 +804,9 @@
extern const char **gd_strings(DIRFILE *dirfile) gd_nothrow gd_nonnull ((1));
+extern int gd_unhide(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
+
extern int gd_validate(DIRFILE *dirfile, const char *field_code) gd_nothrow
gd_nonnull((1,2));
Modified: trunk/getdata/src/include.c
===================================================================
--- trunk/getdata/src/include.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/include.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -26,6 +26,8 @@
int linenum, char** ref_name, int me, int* standards, unsigned long *flags)
{
int i;
+ int old_standards = *standards;
+ int old_pedantic = *flags & GD_PEDANTIC;
int found = 0;
int dirfd = -1;
char *temp_buf1, *temp_buf2;
@@ -158,6 +160,13 @@
fclose(new_fp);
+ /* prevent /VERSION leak in DSV >= 9 */
+ if ((old_standards >= 9 && old_pedantic) || *standards >= 9) {
+ *standards = old_standards;
+ if (!old_pedantic)
+ *flags &= ~GD_PEDANTIC;
+ }
+
dreturn("%i", D->n_fragment - 1);
return D->n_fragment - 1;
}
@@ -381,12 +390,7 @@
if (_GD_ContainsFragment(f, nf, D->entry[i]->fragment_index)) {
if (D->entry[i]->e->n_meta >= 0) {
D->n_entries--;
- if (D->entry[i]->field_type == GD_CONST_ENTRY)
- D->n_const--;
- else if (D->entry[i]->field_type == GD_CARRAY_ENTRY)
- D->n_carray--;
- else if (D->entry[i]->field_type == GD_STRING_ENTRY)
- D->n_string--;
+ D->n[_GD_EntryIndex(D->entry[i]->field_type)]--;
} else
D->n_meta--;
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/internal.h 2011-12-08 02:30:40 UTC (rev 633)
@@ -662,9 +662,8 @@
int calculated;
int n_meta;
- int n_meta_string;
- int n_meta_carray;
- int n_meta_const;
+ unsigned int n_hidden;
+ unsigned int n[GD_N_ENTYPES];
union {
gd_entry_t** meta_entry;
const gd_entry_t* parent;
@@ -833,9 +832,8 @@
/* field counts */
unsigned int n_entries;
- unsigned int n_string;
- unsigned int n_carray;
- unsigned int n_const;
+ unsigned int n_hidden;
+ unsigned int n[GD_N_ENTYPES];
unsigned int n_meta;
unsigned int n_dot;
@@ -875,8 +873,6 @@
void* sehandler_extra;
};
-extern const gd_entype_t _gd_entype_index[GD_N_ENTYPES];
-
void *_GD_Alloc(DIRFILE*, gd_type_t, size_t) __attribute_malloc__;
void _GD_ArmEndianise(uint64_t* databuffer, int is_complex, size_t ns);
int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i);
@@ -903,6 +899,19 @@
void *data_out, gd_type_t out_type, size_t n) gd_nothrow;
gd_type_t _GD_ConstType(DIRFILE *D, gd_type_t type);
const char *_GD_DirName(const DIRFILE *D, int dirfd);
+
+#define _GD_EntryIndex(t) \
+ ( \
+ ((t) == GD_RAW_ENTRY) ? 0 : ((t) == GD_LINCOM_ENTRY) ? 1 : \
+ ((t) == GD_LINTERP_ENTRY) ? 2 : ((t) == GD_BIT_ENTRY) ? 3 : \
+ ((t) == GD_MULTIPLY_ENTRY) ? 4 : ((t) == GD_PHASE_ENTRY) ? 5 : \
+ ((t) == GD_INDEX_ENTRY) ? 6 : ((t) == GD_POLYNOM_ENTRY) ? 7 : \
+ ((t) == GD_SBIT_ENTRY) ? 8 : ((t) == GD_DIVIDE_ENTRY) ? 9 : \
+ ((t) == GD_RECIP_ENTRY) ? 10 : ((t) == GD_WINDOW_ENTRY) ? 11 : \
+ ((t) == GD_CONST_ENTRY) ? 12 : ((t) == GD_STRING_ENTRY) ? 13 : \
+ ((t) == GD_CARRAY_ENTRY) ? 14 : -1 \
+ )
+
size_t _GD_DoField(DIRFILE*, gd_entry_t*, int, off64_t, size_t, gd_type_t,
void*);
size_t _GD_DoFieldOut(DIRFILE*, gd_entry_t*, int, off64_t, size_t, gd_type_t,
Modified: trunk/getdata/src/meta_list.c
===================================================================
--- trunk/getdata/src/meta_list.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/meta_list.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -52,13 +52,13 @@
e = P->e;
- if (e->n_meta_const == 0) {
+ if ((n = e->n[_GD_EntryIndex(GD_CONST_ENTRY)]) == 0) {
dreturn("%p", NULL);
return NULL;
}
free(e->const_value_list);
- fl = (char *)_GD_Alloc(D, return_type, e->n_meta_const);
+ fl = (char *)_GD_Alloc(D, return_type, n);
if (fl == NULL) {
dreturn("%p", NULL);
@@ -68,10 +68,13 @@
/* DoField will implicitly choose GD_REPR_AUTO for complex data being returned
* as purely real */
for (i = n = 0; i < e->n_meta; ++i) {
- if (e->p.meta_entry[i]->field_type == GD_CONST_ENTRY)
+ if (e->p.meta_entry[i]->field_type == GD_CONST_ENTRY &&
+ !e->p.meta_entry[i]->hidden)
+ {
if (_GD_DoField(D, e->p.meta_entry[i], 0, 0, 1, return_type,
fl + n++ * GD_SIZE(return_type)) != 1)
break;
+ }
}
e->const_value_list = fl;
@@ -108,7 +111,7 @@
e = P->e;
- if (e->n_meta_carray == 0) {
+ if ((n = e->n[_GD_EntryIndex(GD_CARRAY_ENTRY)]) == 0) {
dreturn("%p", zero_carrays);
return zero_carrays;
}
@@ -118,7 +121,7 @@
free(e->carray_value_list[i].d);
free(e->carray_value_list);
- fl = (gd_carray_t *)malloc(sizeof(gd_carray_t) * (e->n_meta_carray + 1));
+ fl = (gd_carray_t *)malloc(sizeof(gd_carray_t) * (n + 1));
if (fl == NULL) {
dreturn("%p", NULL);
@@ -128,7 +131,9 @@
/* DoField will implicitly choose GD_REPR_AUTO for complex data being returned
* as purely real */
for (i = n = 0; i < e->n_meta; ++i) {
- if (e->p.meta_entry[i]->field_type == GD_CARRAY_ENTRY) {
+ if (e->p.meta_entry[i]->field_type == GD_CARRAY_ENTRY &&
+ !e->p.meta_entry[i]->hidden)
+ {
fl[n].n = e->p.meta_entry[i]->EN(scalar,array_len);
fl[n].d = _GD_Alloc(D, return_type, fl[n].n);
if (D->error || _GD_DoField(D, e->p.meta_entry[i], 0, 0, fl[n].n,
@@ -172,13 +177,13 @@
e = P->e;
- if (e->n_meta_string == 0) {
+ if ((n = e->n[_GD_EntryIndex(GD_STRING_ENTRY)]) == 0) {
dreturn("%p", zero_list);
return zero_list;
}
fl = (char **)realloc((char **)e->string_value_list, sizeof(const char*) *
- (e->n_meta_string + 1));
+ (n + 1));
if (fl == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
@@ -186,10 +191,12 @@
return NULL;
}
- for (i = n = 0; i < e->n_meta; ++i) {
- if (e->p.meta_entry[i]->field_type == GD_STRING_ENTRY)
+ for (i = n = 0; i < e->n_meta; ++i)
+ if (e->p.meta_entry[i]->field_type == GD_STRING_ENTRY &&
+ !e->p.meta_entry[i]->hidden)
+ {
fl[n++] = e->p.meta_entry[i]->e->u.string;
- }
+ }
fl[n] = NULL;
e->string_value_list = (const char **)fl;
@@ -201,7 +208,8 @@
const char **gd_mfield_list_by_type(DIRFILE* D, const char* parent,
gd_entype_t type) gd_nothrow
{
- int i, index = -1;
+ int i;
+ const int index = _GD_EntryIndex(type);
unsigned int n;
char **fl;
gd_entry_t *P;
@@ -241,14 +249,6 @@
return zero_list;
}
- /* find the index -- get_nfields_by_type should have already tripped up
- * if the type is invalid */
- for (i = 0; i < GD_N_ENTYPES; ++i)
- if (_gd_entype_index[i] == type) {
- index = i;
- break;
- }
-
if (index == -1) {
_GD_InternalError(D);
dreturn("%p", NULL);
@@ -263,10 +263,9 @@
return NULL;
}
- for (i = n = 0; i < e->n_meta; ++i) {
- if (e->p.meta_entry[i]->field_type == type)
+ for (i = n = 0; i < e->n_meta; ++i)
+ if (e->p.meta_entry[i]->field_type == type && !e->p.meta_entry[i]->hidden)
fl[n++] = e->p.meta_entry[i]->field + offs;
- }
fl[n] = NULL;
e->type_list[index] = fl;
@@ -304,7 +303,9 @@
e = P->e;
offs = strlen(P->field) + 1;
- n = e->n_meta - e->n_meta_string - e->n_meta_const - e->n_meta_carray;
+ n = e->n_meta - e->n_hidden - e->n[_GD_EntryIndex(GD_STRING_ENTRY)]
+ - e->n[_GD_EntryIndex(GD_CONST_ENTRY)]
+ - e->n[_GD_EntryIndex(GD_CARRAY_ENTRY)];
if (n == 0) {
dreturn("%p", zero_list);
@@ -319,10 +320,12 @@
return NULL;
}
- for (i = n = 0; i < e->n_meta; ++i) {
- if (!(e->p.meta_entry[i]->field_type & GD_SCALAR_ENTRY))
+ for (i = n = 0; i < e->n_meta; ++i)
+ if (!(e->p.meta_entry[i]->field_type & GD_SCALAR_ENTRY) &&
+ !e->p.meta_entry[i]->hidden)
+ {
fl[n++] = e->p.meta_entry[i]->field + offs;
- }
+ }
fl[n] = NULL;
e->vector_list = (const char **)fl;
@@ -361,13 +364,13 @@
offs = strlen(P->field) + 1;
- if (e->n_meta == 0) {
+ if (e->n_meta - e->n_hidden == 0) {
dreturn("%p", zero_list);
return zero_list;
}
fl = (char **)realloc((char **)e->field_list, sizeof(const char*) *
- (e->n_meta + 1));
+ (e->n_meta + 1 - e->n_hidden));
if (fl == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
@@ -376,7 +379,8 @@
}
for (i = n = 0; i < e->n_meta; ++i)
- fl[n++] = e->p.meta_entry[i]->field + offs;
+ if (!e->p.meta_entry[i]->hidden)
+ fl[n++] = e->p.meta_entry[i]->field + offs;
fl[n] = NULL;
e->field_list = (const char **)fl;
Modified: trunk/getdata/src/mod.c
===================================================================
--- trunk/getdata/src/mod.c 2011-12-06 23:36:19 UTC (rev 632)
+++ trunk/getdata/src/mod.c 2011-12-08 02:30:40 UTC (rev 633)
@@ -221,6 +221,9 @@
memcpy(&Qe, E->e, sizeof(struct _gd_private_entry));
memcpy(&Q, E, sizeof(gd_entry_t));
+ /* hiddenness isn't changeable with this interface */
+ Q.hidden = E->hidden;
+
switch(E->field_type) {
case GD_RAW_ENTRY:
j = _GD_AlterScalar(D, N->EN(raw,spf) && N->EN(raw,spf) != E->EN(raw,spf),
Modified: trunk/getdata/src/nfields...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-10 02:09:33
|
Revision: 634
http://getdata.svn.sourceforge.net/getdata/?rev=634&view=rev
Author: ketiltrout
Date: 2011-12-10 02:09:23 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
* /INCLUDE name mungeing. This involved dumping the old, easily broken filename based include file detector for a simple recursion counter.
* fixed a couple of bugs in the tokeniser dealing with escapes.
* fixed a couple of bugs in the fragment writer involving insufficient escaping of tokens
* correctly determine DSV after being confused by the new DSV version scoping.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/TODO
trunk/getdata/src/add.c
trunk/getdata/src/common.c
trunk/getdata/src/compat.c
trunk/getdata/src/entry.c
trunk/getdata/src/errors.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/fpos.c
trunk/getdata/src/getdata.c
trunk/getdata/src/include.c
trunk/getdata/src/internal.h
trunk/getdata/src/name.c
trunk/getdata/src/native.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/src/putdata.c
trunk/getdata/src/slim.c
trunk/getdata/src/spf.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/add_code.c
trunk/getdata/test/add_format.c
trunk/getdata/test/add_invalid.c
trunk/getdata/test/add_scalar.c
trunk/getdata/test/add_scalar_carray.c
trunk/getdata/test/add_sort.c
trunk/getdata/test/add_type.c
trunk/getdata/test/bzip_get_get.c
trunk/getdata/test/flush_spec.c
trunk/getdata/test/madd.c
trunk/getdata/test/put_carray.c
trunk/getdata/test/test.h
trunk/getdata/test/version_6_write.c
trunk/getdata/test/version_8_strict.c
Added Paths:
-----------
trunk/getdata/test/get_phase_affix.c
trunk/getdata/test/parse_include_loop.c
trunk/getdata/test/parse_include_prefix.c
trunk/getdata/test/parse_include_prefix_dup.c
trunk/getdata/test/parse_include_preprefix.c
trunk/getdata/test/parse_include_suffix.c
trunk/getdata/test/parse_include_sufsuffix.c
trunk/getdata/test/version_9.c
trunk/getdata/test/version_9_strict.c
trunk/getdata/test/version_9_write.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/ChangeLog 2011-12-10 02:09:23 UTC (rev 634)
@@ -1,3 +1,71 @@
+2011-12-09 D. V. Wiebe <ge...@ke...> svn:635
+ * test/parse_include_preprefix.c test/version_9_strict.c test/version_9.c
+ test/parse_include_suffix.c test/parse_include_loop.c test/version_9_write.c
+ test/parse_include_sufsuffix.c test/parse_include_prefix.c
+ test/parse_include_prefix_dup.c test/get_phase_affix.c: Added.
+
+ * test/add_sort.c test/add_scalar_carray.c test/add_code.c test/add_type.c
+ test/add_invalid.c test/put_carray.c test/add_scalar.c test/madd.c
+ test/add_format.c: Remove dirfile before starting.
+
+ * test/version_8_strict.c: Fix initialisation.
+
+ * test/version_6_write.c: Test whitespace in field names.
+
+ * test/test.h: Armour plate macros.
+
+ * src/internal.h: Add prefix and suffix to gd_fragment_t.
+ * src/name.c (_GD_MungeCode) src/flush.c (_GD_DeMungeCode) src/include.c
+ (_GD_SetFieldAffixes): Added.
+ * src/flush.c (_GD_StringEscapeise): Handle null tokens. Escape spaces
+ rather than assuming the caller will quote the token (which it wasn't
+ doing).
+ * src/entry.c (_GD_GetScalar) src/name.c (gd_rename) src/add.c (_GD_Add)
+ src/commonc. (_GD_BadInput): Munge field code before use.
+ * src/flush.c (_GD_PadField): Demunge field code before writing.
+ * src/flush.c (_GD_WriteConst): Properly demunge and escapeise scalar names.
+ * src/name.c (_GD_ValidateField): This function no longer takes care of
+ malloc'ing. Modified to return integer true on error.
+ * src/name.c (_GD_FlushFragment): Add prefix and suffix to INCLUDE when
+ present.
+ * src/parse.c (_GD_ParseRaw _GD_ParseLincom _GD_ParseLinterp
+ _GD_ParseMultiply _GD_ParseRecip _GD_ParseLincom _GD_ParseWindow
+ _GD_ParseDivide _GD_ParseBit _GD_ParsePhase _GD_ParsePolynom _GD_ParseConst
+ _GD_ParseCarray _GD_ParseString): Munge field code on parsing.
+ * include.c (_GD_Include): Handle affixes.
+
+ * src/common.c (_GD_EntryCmp): Moved from src/internal.h and deinlined,
+ destatickified. Given that the only use of this function is to pass it to
+ qsort, making it static inline only ensured that it got replaced once per
+ translation unit that referred to it.
+
+ * include.c (_GD_Include): Replaced the old filename comparison stage with a
+ simple recursion counter.
+
+ * src/parse.c (_GD_Tokenise): Handle token-initial escaped character.
+ Handle "\[ux#]##\...".
+
+ * src/flush.c (_GD_FindVersion): Prefix or suffix implies DSV >= 9.
+
+ * src/parse.c (_GD_SetScalar): Handle bad malloc.
+
+ * src/name.c (_GD_FieldSpec): Properly escapeise input field codes.
+
+ * src/errors.c: Distinguish GD_E_RECURSE_CODE from GD_E_RECURSE_INCLUDE.
+
+ * src/internal.h (_GD_Malloc _GD_Realloc _GD_Strdup): Added.
+ * src/commonc. (_GD_MakeFullPath): Set error if requested.
+ * src/common.c (_GD_MakeFullPathOnly): Added. This is a wrapper around
+ _GD_MakeFullPath which ensures the DIRFILE is not modified. Used by the
+ compatibility functions and the slim encoding framework (ie. things that have
+ at best a tenuous connection to the DIRFILE object).
+
+ * src/internal.h: Define GD_MULTISTANDARD.
+ * src/include.c (_GD_Include): Set GD_MULTISTANDARD if moving into/out of
+ DSV >= 9.
+ * src/open.c (gd_cbopen): If the metadata contain multiple standards, figure
+ out a single one for the whole dirfile.
+
2011-12-08 D. V. Wiebe <ge...@ke...> svn:633
* test/svlist_hidden.c test/svlist_meta_hidden.c test/hide.c
test/flist_hidden.c test/nfields_hidden.c test/parse_version_89.c
Modified: trunk/getdata/TODO
===================================================================
--- trunk/getdata/TODO 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/TODO 2011-12-10 02:09:23 UTC (rev 634)
@@ -3,5 +3,4 @@
* linterp table path munging [MH]
* Make webpage suck less
-* INCLUDE name munging [RW/MT]
* aliasing [MT]
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/add.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -24,7 +24,7 @@
static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
{
char *temp_buffer;
- int i, is_dot;
+ int i, is_dot, offset;
int copy_scalar[GD_MAX_POLYORD + 1];
void* new_list;
void* new_ref = NULL;
@@ -78,14 +78,14 @@
return -1;
}
- temp_buffer = (char *)malloc(strlen(parent) + strlen(entry->field) + 2);
+ temp_buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(entry->field)
+ + 2);
if (temp_buffer)
strcat(strcat(strcpy(temp_buffer, parent), "/"), entry->field);
} else
- temp_buffer = strdup(entry->field);
+ temp_buffer = _GD_Strdup(D, entry->field);
if (temp_buffer == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -124,9 +124,8 @@
}
/* New entry */
- E = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+ E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
if (E == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -136,28 +135,28 @@
else
E->fragment_index = entry->fragment_index;
- E->e = (struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
+ E->e = (struct _gd_private_entry *)_GD_Malloc(D,
+ sizeof(struct _gd_private_entry));
if (E->e == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
free(E);
dreturn("%i", -1);
return -1;
}
memset(E->e, 0, sizeof(struct _gd_private_entry));
E->e->calculated = 0;
-
- /* Validate field code */
E->field_type = entry->field_type;
- E->field = _GD_ValidateField(P, entry->field, D->standards, 1, &is_dot);
- if (E->field == entry->field) {
- _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, entry->field);
- E->field = NULL;
+ /* Apply prefix and suffix */
+ E->field = _GD_MungeCode(D, P, entry->fragment_index, entry->field, &offset);
+ if (E->field == NULL) {
_GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
- } else if (E->field == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ }
+
+ /* Check */
+ if (_GD_ValidateField(E->field + offset, D->standards, 1, 0, &is_dot)) {
+ _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, entry->field);
_GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
@@ -194,10 +193,8 @@
E->e->u.raw.file[0].idata = E->e->u.raw.file[1].idata = -1;
E->e->u.raw.file[0].subenc = GD_ENC_UNKNOWN;
- if ((E->e->u.raw.filebase = strdup(E->field)) == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ if ((E->e->u.raw.filebase = _GD_Strdup(D, E->field)) == NULL)
break;
- }
if ((E->EN(raw,spf) = entry->EN(raw,spf)) == 0)
_GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_SPF, NULL,
@@ -211,9 +208,7 @@
;
} else if (D->fragment[E->fragment_index].ref_name == NULL) {
/* This is the first raw field in this fragment */
- new_ref = strdup(E->field);
- if (new_ref == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ new_ref = _GD_Strdup(D, E->field);
}
copy_scalar[0] = 1;
break;
@@ -250,8 +245,7 @@
}
for (i = 0; i < E->EN(lincom,n_fields); ++i) {
- if ((E->in_fields[i] = strdup(entry->in_fields[i])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ E->in_fields[i] = _GD_Strdup(D, entry->in_fields[i]);
copy_scalar[i] = copy_scalar[i + GD_MAX_LINCOM] = 1;
}
}
@@ -259,24 +253,16 @@
case GD_LINTERP_ENTRY:
E->e->u.linterp.table_len = -1;
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else if ((E->EN(linterp,table) = strdup(entry->EN(linterp,table)))
- == NULL)
- {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- }
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+ E->EN(linterp,table) = _GD_Strdup(D, entry->EN(linterp,table));
break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else if ((E->in_fields[1] = strdup(entry->in_fields[1])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+ E->in_fields[1] = _GD_Strdup(D, entry->in_fields[1]);
break;
case GD_RECIP_ENTRY:
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
copy_scalar[0] = 1;
if (entry->comp_scal) {
@@ -294,9 +280,8 @@
E->EN(bit,numbits) = entry->EN(bit,numbits);
E->EN(bit,bitnum) = entry->EN(bit,bitnum);
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else if (E->EN(bit,numbits) < 1)
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+ if (E->EN(bit,numbits) < 1)
_GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NUMBITS, NULL,
entry->EN(bit,numbits), NULL);
else if (E->EN(bit,bitnum) < 0)
@@ -310,19 +295,16 @@
case GD_PHASE_ENTRY:
E->EN(phase,shift) = entry->EN(phase,shift);
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
copy_scalar[0] = 1;
break;
case GD_WINDOW_ENTRY:
E->EN(window,windop) = entry->EN(window,windop);
E->EN(window,threshold) = entry->EN(window,threshold);
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else if ((E->in_fields[1] = strdup(entry->in_fields[1])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else if (_GD_BadWindop(E->EN(window,windop)))
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
+ E->in_fields[1] = _GD_Strdup(D, entry->in_fields[1]);
+ if (_GD_BadWindop(E->EN(window,windop)))
_GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_WINDOP, NULL,
entry->EN(window,windop), NULL);
copy_scalar[0] = 1;
@@ -337,10 +319,9 @@
_GD_SetError(D, GD_E_BAD_TYPE, E->EN(scalar,const_type), NULL, 0, NULL);
} else {
size_t size = GD_SIZE(_GD_ConstType(D, E->EN(scalar,const_type)));
- E->e->u.scalar.d = malloc(size);
- if (!D->error && E->e->u.scalar.d == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else
+ if (!D->error)
+ E->e->u.scalar.d = _GD_Malloc(D, size);
+ if (E->e->u.scalar.d)
memset(E->e->u.scalar.d, 0, size);
}
break;
@@ -357,17 +338,14 @@
else {
size_t size = GD_SIZE(_GD_ConstType(D, E->EN(scalar,const_type))) *
E->EN(scalar,array_len);
- E->e->u.scalar.d = malloc(size);
- if (!D->error && E->e->u.scalar.d == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else
+ if (!D->error)
+ E->e->u.scalar.d = _GD_Malloc(D, size);
+ if (E->e->u.scalar.d)
memset(E->e->u.scalar.d, 0, size);
}
break;
case GD_STRING_ENTRY:
- E->e->u.string = strdup("");
- if (E->e->u.string == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ E->e->u.string = _GD_Strdup(D, "");
break;
case GD_POLYNOM_ENTRY:
E->EN(polynom,poly_ord) = entry->EN(polynom,poly_ord);
@@ -397,8 +375,7 @@
E->comp_scal = 0;
}
- if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ E->in_fields[0] = _GD_Strdup(D, entry->in_fields[0]);
}
for (i = 0; i < E->EN(polynom,poly_ord); ++i)
@@ -415,10 +392,8 @@
if (!copy_scalar[i] || entry->scalar[i] == NULL)
E->scalar[i] = NULL;
else {
- E->scalar[i] = strdup(entry->scalar[i]);
+ E->scalar[i] = _GD_Strdup(D, entry->scalar[i]);
E->scalar_ind[i] = entry->scalar_ind[i];
- if (E->scalar[i] == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
}
}
@@ -494,7 +469,7 @@
/* add the entry to the dot list, if needed */
if (is_dot) {
D->dot_list[D->n_dot++] = E;
- qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), entry_cmp);
+ qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
}
/* add the entry and resort the entry list */
@@ -1748,9 +1723,8 @@
/* Actually store the string, now */
if (!error) {
- buffer = (char *)malloc(strlen(parent) + strlen(field_code) + 2);
+ buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(field_code) + 2);
if (buffer == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -1798,9 +1772,8 @@
/* Actually store the constant, now */
if (!error) {
- buffer = (char *)malloc(strlen(parent) + strlen(field_code) + 2);
+ buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(field_code) + 2);
if (buffer == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -1850,9 +1823,8 @@
/* Actually store the carray, now */
if (!error) {
- buffer = (char *)malloc(strlen(parent) + strlen(field_code) + 2);
+ buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(field_code) + 2);
if (buffer == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/common.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -31,6 +31,11 @@
char gd_debug_col[GD_COL_SIZE + 1] = "";
#endif
+int _GD_EntryCmp(const void *a, const void *b)
+{
+ return strcmp((*(gd_entry_t**)a)->field, (*(gd_entry_t**)b)->field);
+}
+
/* _GD_GetLine: read non-comment line from format file. The line is newly
* malloc'd. Returns a pointer if successful, NULL if unsuccessful.
* The length read is provided in *n. Increments *linenum as appropriate;
@@ -164,11 +169,8 @@
return NULL;
}
- ptr = malloc(n * GD_SIZE(type));
+ ptr = _GD_Malloc(D, n * GD_SIZE(type));
- if (ptr == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
-
dreturn("%p", ptr);
return ptr;
}
@@ -183,18 +185,16 @@
e->u.linterp.table_dirfd = _GD_GrabDir(D,
D->fragment[E->fragment_index].dirfd, E->EN(linterp,table));
- temp_buffer = strdup(E->EN(linterp,table));
+ temp_buffer = _GD_Strdup(D, E->EN(linterp,table));
if (temp_buffer == NULL) {
_GD_ReleaseDir(D, e->u.linterp.table_dirfd);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", 1);
return 1;
}
- e->u.linterp.table_file = strdup(basename(temp_buffer));
+ e->u.linterp.table_file = _GD_Strdup(D, basename(temp_buffer));
if (e->u.linterp.table_file == NULL) {
_GD_ReleaseDir(D, e->u.linterp.table_dirfd);
free(temp_buffer);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", 1);
return 1;
}
@@ -269,11 +269,10 @@
return;
}
- E->e->u.linterp.lut = (struct _gd_lut *)malloc(buf_len *
+ E->e->u.linterp.lut = (struct _gd_lut *)_GD_Malloc(D, buf_len *
sizeof(struct _gd_lut));
if (E->e->u.linterp.lut == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
fclose(fp);
dreturnvoid();
return;
@@ -301,12 +300,11 @@
i++;
if (i >= buf_len) {
buf_len += 100;
- ptr = (struct _gd_lut *)realloc(E->e->u.linterp.lut, buf_len *
+ ptr = (struct _gd_lut *)_GD_Realloc(D, E->e->u.linterp.lut, buf_len *
sizeof(struct _gd_lut));
if (ptr == NULL) {
free(E->e->u.linterp.lut);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
fclose(fp);
dreturnvoid();
return;
@@ -327,12 +325,11 @@
}
/* Free unused memory */
- ptr = (struct _gd_lut *)realloc(E->e->u.linterp.lut, i
+ ptr = (struct _gd_lut *)_GD_Realloc(D, E->e->u.linterp.lut, i
* sizeof(struct _gd_lut));
if (ptr == NULL) {
free(E->e->u.linterp.lut);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
fclose(fp);
dreturnvoid();
return;
@@ -804,10 +801,8 @@
}
/* make a copy of the field code without the representation */
- *field_code = strdup(field_code_in);
- if (*field_code == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- else
+ *field_code = _GD_Strdup(D, field_code_in);
+ if (*field_code)
(*field_code)[field_code_len - 2] = '\0';
}
@@ -818,21 +813,28 @@
/* Ensure that an input field has been identified (with error checking) */
int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i)
{
- char* code;
+ char *code, *munged_code;
+ int offset;
dtrace("%p, %p, %i", D, E, i);
if (E->e->entry[i] == NULL) {
- E->e->entry[i] = _GD_FindFieldAndRepr(D, E->in_fields[i], &code,
- &E->e->repr[i], NULL, 1);
+ munged_code = _GD_MungeCode(D, NULL, E->fragment_index, E->in_fields[i],
+ &offset);
+ if (munged_code)
+ E->e->entry[i] = _GD_FindFieldAndRepr(D, munged_code, &code,
+ &E->e->repr[i], NULL, 1);
if (D->error) {
+ free(munged_code);
dreturn("%i", 1);
return 1;
}
- if (code != E->in_fields[i])
+ if (code != munged_code)
free(code);
+
+ free(munged_code);
}
/* scalar entries not allowed */
@@ -1173,11 +1175,11 @@
return res;
}
-char *_GD_MakeFullPath(const DIRFILE *D, int dirfd, const char *name)
+char *_GD_MakeFullPath(DIRFILE *D, int dirfd, const char *name, int seterr)
{
const char *dir;
char *filepath;
- dtrace("%p, %i, \"%s\"", D, dirfd, name);
+ dtrace("%p, %i, \"%s\", %i", D, dirfd, name, seterr);
if (dirfd >= 0) {
dir = _GD_DirName(D, dirfd);
@@ -1190,10 +1192,39 @@
filepath = _GD_CanonicalPath(dir, name);
+ if (seterr && filepath == NULL) {
+ if (errno == ENOMEM)
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ else {
+ /* a last ditch attempt */
+ if (dir) {
+ filepath = (char*)_GD_Malloc(D, strlen(dir) + strlen(name) + 2);
+ if (filepath)
+ sprintf(filepath, "%s/%s", dir, name);
+ } else
+ filepath = _GD_Strdup(D, name);
+ }
+ }
+
dreturn("\"%s\"", filepath);
return filepath;
}
+char *_GD_MakeFullPathOnly(const DIRFILE *D, int dirfd, const char *name)
+{
+ char *filepath;
+
+ dtrace("%p, %i, \"%s\"", D, dirfd, name);
+
+ /* although we cast away the constness, seterr=0 ensures nothing gets
+ * modified
+ */
+ filepath = _GD_MakeFullPath((DIRFILE*)D, dirfd, name, 0);
+
+ dreturn("\"%s\"", filepath);
+ return filepath;
+}
+
int _GD_GrabDir(DIRFILE *D, int dirfd, const char *name)
{
unsigned int i;
@@ -1203,10 +1234,9 @@
dtrace("%p, %i, \"%s\"", D, dirfd, name);
- path = _GD_MakeFullPath(D, dirfd, name);
+ path = _GD_MakeFullPath(D, dirfd, name, 1);
if (path == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
Modified: trunk/getdata/src/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/compat.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -48,7 +48,7 @@
dtrace("%p, %i, \"%s\", %x, 0%o", D, dirfd, name, flags, mode);
- path = _GD_MakeFullPath(D, dirfd, name);
+ path = _GD_MakeFullPathOnly(D, dirfd, name);
ret = open(path, flags | O_BINARY, mode);
free(path);
@@ -66,7 +66,7 @@
dtrace("%p, %i, \"%s\", %i, \"%s\"", D, olddirfd, oldname, newdirfd, newname);
- newpath = _GD_MakeFullPath(D, newdirfd, newname);
+ newpath = _GD_MakeFullPathOnly(D, newdirfd, newname);
#ifdef __MSVCRT__
if (unlink(newpath)) {
if (errno != ENOENT) {
@@ -77,7 +77,7 @@
}
#endif
- oldpath = _GD_MakeFullPath(D, olddirfd, oldname);
+ oldpath = _GD_MakeFullPathOnly(D, olddirfd, oldname);
ret = rename(oldpath, newpath);
free(newpath);
free(oldpath);
@@ -96,7 +96,7 @@
dtrace("%p, %i, \"%s\", %p, %x", D, dirfd, name, buf, flags);
- path = _GD_MakeFullPath(D, dirfd, name);
+ path = _GD_MakeFullPathOnly(D, dirfd, name);
#ifdef HAVE_LSTAT
if (flags & AT_SYMLINK_NOFOLLOW)
ret = lstat(path, buf);
@@ -119,7 +119,7 @@
dtrace("%p, %i, \"%s\", %p, <unused>", D, dirfd, name, buf);
- path = _GD_MakeFullPath(D, dirfd, name);
+ path = _GD_MakeFullPathOnly(D, dirfd, name);
ret = gd_stat64(path, buf);
free(path);
@@ -137,7 +137,7 @@
dtrace("%p, %i, \"%s\", <unused>", D, dirfd, name);
- path = _GD_MakeFullPath(D, dirfd, name);
+ path = _GD_MakeFullPathOnly(D, dirfd, name);
ret = unlink(path);
free(path);
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/entry.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -134,18 +134,21 @@
void* data)
{
void *ptr = NULL;
- gd_entry_t* C;
- int repr;
- char* field_code;
+ gd_entry_t* C = NULL;
+ int repr, offset;
+ char* field_code, *munged_code;
const char* scalar = E->scalar[i];
int index = E->scalar_ind[i];
dtrace("%p, %p, %i, %i, %p", D, E, i, type, data);
if (scalar != NULL) {
- C = _GD_FindFieldAndRepr(D, scalar, &field_code, &repr, NULL, 0);
+ munged_code = _GD_MungeCode(D, NULL, E->fragment_index, scalar, &offset);
+ if (munged_code)
+ C = _GD_FindFieldAndRepr(D, munged_code, &field_code, &repr, NULL, 0);
if (D->error) {
+ free(munged_code);
dreturnvoid();
return;
}
@@ -163,12 +166,9 @@
E->scalar_ind[i] = -1;
}
- if ((D->flags & GD_ACCMODE) == GD_RDWR) {
- ptr = realloc(C->e->u.scalar.client, (C->e->u.scalar.n_client + 1) *
- sizeof(gd_entry_t*));
- if (ptr == NULL)
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- }
+ if ((D->flags & GD_ACCMODE) == GD_RDWR)
+ ptr = _GD_Realloc(D, C->e->u.scalar.client,
+ (C->e->u.scalar.n_client + 1) * sizeof(gd_entry_t*));
_GD_DoField(D, C, repr, index, 1, type, data);
@@ -178,8 +178,10 @@
}
}
- if (field_code != scalar)
+ if (field_code != munged_code)
free(field_code);
+
+ free(munged_code);
}
dreturnvoid();
@@ -327,12 +329,7 @@
}
filename = _GD_MakeFullPath(D, D->fragment[E->fragment_index].dirfd,
- E->e->u.raw.file->name);
- if (filename == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- dreturn("%p", NULL);
- return NULL;
- }
+ E->e->u.raw.file->name, 1);
dreturn("%p", filename);
return filename;
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/errors.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -86,7 +86,7 @@
{ GD_E_BAD_CODE, 0, "Field not found: {4}", 0 },
/* GD_E_BAD_TYPE: 1 = data type */
{ GD_E_BAD_TYPE, 0, "Unsupported data type: {1}", 0 },
- /* GD_E_RAW_IO: 1 = suberror, 2 = filename, 3 = errno */
+ /* GD_E_RAW_IO: 2 = filename, 3 = errno */
{ GD_E_RAW_IO, 0, "Error accessing {2}: ", 1 },
/* GD_E_OPEN_FRAGMENT: 1 = errno, 2 = format file, 3 = line, 4 = includefile*/
{ GD_E_OPEN_FRAGMENT, 0,
@@ -102,8 +102,11 @@
/* GD_E_OPEN_LINFILE: 1 = suberror, 2 = errno, 4 = lutfile */
{ GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, "LINTERP table {4} too short", 0 },
{ GD_E_OPEN_LINFILE, 0, "Error opening LINTERP table {4}: ", 2 },
- /* GD_E_RECURSE_LEVEL: 4 = fieldcode */
- { GD_E_RECURSE_LEVEL, 0, "Recursion too deep resolving field {4}", 0 },
+ /* GD_E_RECURSE_LEVEL: 2 = file; 3 = line; 4 = name */
+ { GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE,
+ "Recursion too deep resolving field {4}", 0 },
+ { GD_E_RECURSE_LEVEL, GD_E_RECURSE_INCLUDE,
+ "Recursion too deep including {4} on line {3} of {2}", 0 },
/* GD_E_BAD_DIRFILE: (nothing) */
{ GD_E_BAD_DIRFILE, 0, "Invalid dirfile", 0 },
/* GD_E_BAD_FIELD_TYPE: 4 = fieldcode */
Modified: trunk/getdata/src/flimits.c
===================================================================
--- trunk/getdata/src/flimits.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/flimits.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -36,11 +36,10 @@
}
if (move && offset != D->fragment[fragment].frame_offset) {
- gd_entry_t **raw_entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*) *
+ gd_entry_t **raw_entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
D->n_entries);
if (raw_entry == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturnvoid();
return;
}
@@ -180,7 +179,7 @@
dtrace("%p, %p, \"%s\", %p", D, E, parent, is_index);
if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
- _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+ _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
D->recurse_level--;
dreturn("%i ?", -1);
return -1;
@@ -395,7 +394,7 @@
dtrace("%p, %p, \"%s\", %p, %p", D, E, parent, spf, ds);
if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
- _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+ _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
D->recurse_level--;
dreturn("%i", -1);
return -1;
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2011-12-08 02:30:40 UTC (rev 633)
+++ trunk/getdata/src/flush.c 2011-12-10 02:09:23 UTC (rev 634)
@@ -22,6 +22,51 @@
#define GD_MAX_PRETTY_FIELD_WIDTH 80
+/* remove the prefix and suffix from a field code */
+static char *_GD_DeMungeCode(const char *prefix, const char *suffix,
+ const char *code)
+{
+ size_t i, len, slen;
+ char *ptr;
+
+ dtrace("\"%s\", \"%s\", \"%s\"", prefix, suffix, code);
+
+ if (code == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ /* Verify the prefix is present */
+ if (prefix) {
+ for (i = 0; prefix[i]; ++i) {
+ if (prefix[i] != code[i]) {
+ /* prefix missing */
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ }
+ ptr = strdup(code + i);
+ } else
+ ptr = strdup(code);
+
+ /* Verify the suffix is present */
+ if (suffix) {
+ len = strlen(ptr);
+ slen = strlen(suffix);
+ for (i = 0; i < slen; ++i) {
+ if (suffix[i] != ptr[len - slen + i]) {
+ /* suffix missing */
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ }
+ ptr[len - slen] = '\0';
+ }
+
+ dreturn("\"%s\"", ptr);
+ return ptr;
+}
+
void _GD_Flush(DIRFILE* D, gd_entry_t *E, int clo)
{
int i;
@@ -29,7 +74,7 @@
dtrace("%p, %p, %i", D, E, clo);
if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
- _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+ _GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
D->recurse_level--;
dreturnvoid();
return;
@@ -222,6 +267,12 @@
dtrace("%p, \"%s\", %i, %i", stream, in, permissive, standards);
+ if (in == NULL || in[0] == '\0') {
+ fputs("\"\"", stream);
+ dreturn("%zu", 2);
+ return 2;
+ }
+
if (!permissive && standards < 6) {
...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-11 23:35:16
|
Revision: 635
http://getdata.svn.sourceforge.net/getdata/?rev=635&view=rev
Author: ketiltrout
Date: 2011-12-11 23:35:07 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
* Fix gd_move(), gd_rename() gd_alter_[m]spec() gd_add_*() for affixes.
* [bug]: Flag fragment as modified after gd_rename().
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/add.c
trunk/getdata/src/common.c
trunk/getdata/src/compat.c
trunk/getdata/src/del.c
trunk/getdata/src/encoding.c
trunk/getdata/src/endian.c
trunk/getdata/src/errors.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flush.c
trunk/getdata/src/globals.c
trunk/getdata/src/internal.h
trunk/getdata/src/meta_list.c
trunk/getdata/src/mod.c
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/native.c
trunk/getdata/src/nmeta.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/src/spf.c
trunk/getdata/src/string.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/add_window_op.c
trunk/getdata/test/version_9_strict.c
trunk/getdata/test/version_9_write.c
Added Paths:
-----------
trunk/getdata/test/add_affix.c
trunk/getdata/test/add_string_affix.c
trunk/getdata/test/alter_entry_affix.c
trunk/getdata/test/alter_mspec_affix.c
trunk/getdata/test/alter_spec_affix.c
trunk/getdata/test/madd_affix.c
trunk/getdata/test/madd_index.c
trunk/getdata/test/move_affix.c
trunk/getdata/test/move_affix_dup.c
trunk/getdata/test/name_affix.c
trunk/getdata/test/name_affix_bad.c
trunk/getdata/test/name_dup.c
trunk/getdata/test/parse_meta_affix.c
trunk/getdata/test/parse_meta_implicit_affix.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/ChangeLog 2011-12-11 23:35:07 UTC (rev 635)
@@ -1,4 +1,41 @@
-2011-12-09 D. V. Wiebe <ge...@ke...> svn:635
+2011-12-11 D. V. Wiebe <ge...@ke...> svn:635
+ * test/add_string_affix.c test/name_affix_bad.c test/move_affix.c
+ test/alter_entry_affix.c test/alter_entry_affix.c test/madd_affix.c
+ test/parse_meta_affix.c test/madd_index.c test/name_affix.c
+ test/alter_mspec_affix.c test/name_dup.c test/parse_meta_implicit_affix.c
+ test/add_affix.c test/alter_spec_affix.c: Added.
+
+ * test/version_9_strict.c test/version_9_write.c: Expanded.
+
+ * src/open.c (gd_cbopen): Set errors for _GD_CanonicalPath.
+
+ * src/errors.c: Distingish missing codes from invalid codes for
+ GD_E_BAD_CODE.
+
+ * src/name.c (gd_rename): Validate the new name first and then DeMunge it
+ if it's not a meta field.
+
+ * src/move.c (gd_move): Compose the new field name by remunging it for the
+ new fragment. Also compose the new names of all its metafield early, if
+ necessary.
+
+ * src/parse.c (_GD_ParseFieldSpec _GD_ParseDirective): Munge field codes
+ before lookup. Also munge the reference field.
+
+ * src/mod.c (gd_alter_spec gd_malter_spec): The parser will end up
+ reapplying affixes to the field name, so undo that.
+
+ * src/add.c (_GD_Add gd_add_string gd_add_const gd_add_const gd_madd_string
+ gd_madd_const gd_madd_carray): _GD_Add() returns the added entry on success.
+ This saves a field lookup in the others.
+
+ * src/add.c (_GD_Add): Munge field name earlier.
+
+ * src/name.c (gd_rename): Flag fragment as modified.
+
+ * src/flush.c (_GD_FieldSpec): Properly write /HIDDEN directives.
+
+2011-12-09 D. V. Wiebe <ge...@ke...> svn:634
* test/parse_include_preprefix.c test/version_9_strict.c test/version_9.c
test/parse_include_suffix.c test/parse_include_loop.c test/version_9_write.c
test/parse_include_sufsuffix.c test/parse_include_prefix.c
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/src/add.c 2011-12-11 23:35:07 UTC (rev 635)
@@ -20,8 +20,9 @@
*/
#include "internal.h"
-/* add an entry */
-static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
+/* add an entry - returns the added entry on success. */
+static gd_entry_t *_GD_Add(DIRFILE* D, const gd_entry_t* entry,
+ const char* parent)
{
char *temp_buffer;
int i, is_dot, offset;
@@ -41,53 +42,58 @@
/* check access mode */
if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
_GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* check for include index out of range */
- if (P == NULL && (entry->fragment_index < 0 ||
+ if (parent == NULL && (entry->fragment_index < 0 ||
entry->fragment_index >= D->n_fragment))
{
_GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, entry->fragment_index, NULL);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* check protection */
if (D->fragment[entry->fragment_index].protection & GD_PROTECT_FORMAT) {
_GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
D->fragment[entry->fragment_index].cname);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* check parent */
if (parent != NULL) {
/* make sure it's not a meta field already */
if (strchr(parent, '/') != NULL) {
- _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
- dreturn("%i", -1);
- return -1;
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+ dreturn("%p", NULL);
+ return NULL;
}
P = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
if (P == NULL) {
- _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
- dreturn("%i", -1);
- return -1;
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+ dreturn("%p", NULL);
+ return NULL;
}
- temp_buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(entry->field)
- + 2);
- if (temp_buffer)
- strcat(strcat(strcpy(temp_buffer, parent), "/"), entry->field);
+ offset = strlen(parent) + 1;
+ temp_buffer = (char *)_GD_Malloc(D, offset + strlen(entry->field) + 1);
+ if (temp_buffer) {
+ strcpy(temp_buffer, parent);
+ temp_buffer[offset - 1] = '/';
+ strcpy(temp_buffer + offset, entry->field);
+ }
} else
- temp_buffer = _GD_Strdup(D, entry->field);
+ /* Apply prefix and suffix */
+ temp_buffer = _GD_MungeCode(D, NULL, entry->fragment_index, entry->field,
+ &offset);
if (temp_buffer == NULL) {
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* check for duplicate field */
@@ -96,10 +102,9 @@
if (E != NULL) { /* matched */
_GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, temp_buffer);
free(temp_buffer);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
- free(temp_buffer);
/* check for bad field type */
if (entry->field_type != GD_RAW_ENTRY &&
@@ -119,15 +124,15 @@
{
_GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_TYPE, NULL,
entry->field_type, NULL);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* New entry */
E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
if (E == NULL) {
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
memset(E, 0, sizeof(gd_entry_t));
if (P)
@@ -139,27 +144,21 @@
sizeof(struct _gd_private_entry));
if (E->e == NULL) {
free(E);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
memset(E->e, 0, sizeof(struct _gd_private_entry));
E->e->calculated = 0;
E->field_type = entry->field_type;
- /* Apply prefix and suffix */
- E->field = _GD_MungeCode(D, P, entry->fragment_index, entry->field, &offset);
- if (E->field == NULL) {
- _GD_FreeE(D, E, 1);
- dreturn("%i", -1);
- return -1;
- }
+ E->field = temp_buffer;
/* Check */
if (_GD_ValidateField(E->field + offset, D->standards, 1, 0, &is_dot)) {
- _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, entry->field);
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, entry->field);
_GD_FreeE(D, E, 1);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* Set meta indices */
@@ -185,8 +184,7 @@
if (D->fragment[entry->fragment_index].protection & GD_PROTECT_DATA) {
_GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_DATA, NULL, 0,
D->fragment[entry->fragment_index].cname);
- dreturn("%i", -1);
- return -1;
+ break;
}
E->EN(raw,data_type) = entry->EN(raw,data_type);
@@ -400,16 +398,16 @@
if (D->error != GD_E_OK) {
free(new_ref);
_GD_FreeE(D, E, 1);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
new_list = realloc(D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
if (new_list == NULL) {
free(new_ref);
_GD_FreeE(D, E, 1);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
D->entry = (gd_entry_t **)new_list;
@@ -418,8 +416,8 @@
if (new_list == NULL) {
free(new_ref);
_GD_FreeE(D, E, 1);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
D->dot_list = (gd_entry_t **)new_list;
}
@@ -430,8 +428,8 @@
if (ptr == NULL) {
free(new_ref);
_GD_FreeE(D, E, 1);
- dreturn("%i", -1);
- return -1;
+ dreturn("%p", NULL);
+ return NULL;
}
/* From here on, nothing may fail */
@@ -482,8 +480,8 @@
D->list_validity = 0;
D->type_list_validity = 0;
- dreturn("%i", 0);
- return 0;
+ dreturn("%p", E);
+ return E;
}
/* add a META field by parsing a field spec */
@@ -513,9 +511,11 @@
_GD_ClearError(D);
+ /* Find parent -- we don't do code mungeing here because we don't know
+ * which fragment this is yet. */
E = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
if (E == NULL) {
- _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, parent);
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
dreturn("%i", -1);
return -1;
}
@@ -626,7 +626,7 @@
return -1;
}
- ret = _GD_Add(D, entry, NULL);
+ ret = (_GD_Add(D, entry, NULL) == NULL) ? -1 : 0;
dreturn("%i", ret);
return ret;
@@ -654,7 +654,7 @@
R.EN(raw,spf) = spf;
R.EN(raw,data_type) = data_type;
R.fragment_index = fragment_index;
- error = _GD_Add(D, &R, NULL);
+ error = (_GD_Add(D, &R, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -696,7 +696,7 @@
L.EN(lincom,m)[i] = m[i];
L.EN(lincom,b)[i] = b[i];
}
- error = _GD_Add(D, &L, NULL);
+ error = (_GD_Add(D, &L, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -738,7 +738,7 @@
_gd_ca2c(L.EN(lincom,cm)[i], cm, i);
_gd_ca2c(L.EN(lincom,cb)[i], cb, i);
}
- error = _GD_Add(D, &L, NULL);
+ error = (_GD_Add(D, &L, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -766,7 +766,7 @@
L.in_fields[0] = (char *)in_field;
L.EN(linterp,table) = (char *)table;
L.fragment_index = fragment_index;
- error = _GD_Add(D, &L, NULL);
+ error = (_GD_Add(D, &L, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -795,7 +795,7 @@
B.EN(bit,bitnum) = bitnum;
B.EN(bit,numbits) = numbits;
B.fragment_index = fragment_index;
- error = _GD_Add(D, &B, NULL);
+ error = (_GD_Add(D, &B, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -824,7 +824,7 @@
B.EN(bit,bitnum) = bitnum;
B.EN(bit,numbits) = numbits;
B.fragment_index = fragment_index;
- error = _GD_Add(D, &B, NULL);
+ error = (_GD_Add(D, &B, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -852,7 +852,7 @@
M.in_fields[0] = (char *)in_field1;
M.in_fields[1] = (char *)in_field2;
M.fragment_index = fragment_index;
- error = _GD_Add(D, &M, NULL);
+ error = (_GD_Add(D, &M, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -880,7 +880,7 @@
E.in_fields[0] = (char *)in_field1;
E.in_fields[1] = (char *)in_field2;
E.fragment_index = fragment_index;
- error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -909,7 +909,7 @@
E.comp_scal = 0;
E.in_fields[0] = (char *)in_field;
E.fragment_index = fragment_index;
- error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -919,6 +919,8 @@
int gd_add_crecip(DIRFILE* D, const char* field_code, const char* in_field,
double complex cdividend, int fragment_index) gd_nothrow
{
+ int error;
+
dtrace("%p, \"%s\", \"%s\", %g;%g, %i", D, field_code, in_field,
creal(cdividend), cimag(cdividend), fragment_index);
@@ -936,7 +938,7 @@
E.comp_scal = 1;
E.in_fields[0] = (char *)in_field;
E.fragment_index = fragment_index;
- int error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -965,7 +967,7 @@
E.comp_scal = 1;
E.in_fields[0] = (char *)in_field;
E.fragment_index = fragment_index;
- error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1005,7 +1007,7 @@
for (i = 0; i <= poly_ord; ++i)
E.EN(polynom,a)[i] = a[i];
- error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1044,7 +1046,7 @@
for (i = 0; i <= poly_ord; ++i)
_gd_ca2c(E.EN(polynom,ca)[i], ca, i);
- error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1072,7 +1074,7 @@
P.in_fields[0] = (char *)in_field;
P.EN(phase,shift) = shift;
P.fragment_index = fragment_index;
- error = _GD_Add(D, &P, NULL);
+ error = (_GD_Add(D, &P, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1104,7 +1106,7 @@
E.in_fields[0] = (char *)in_field;
E.in_fields[1] = (char *)check_field;
E.fragment_index = fragment_index;
- error = _GD_Add(D, &E, NULL);
+ error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1116,7 +1118,6 @@
{
gd_entry_t *entry;
gd_entry_t S;
- int error;
dtrace("%p, \"%s\", \"%s\", %i", D, field_code, value, fragment_index);
@@ -1130,23 +1131,14 @@
S.field = (char *)field_code;
S.field_type = GD_STRING_ENTRY;
S.fragment_index = fragment_index;
- error = _GD_Add(D, &S, NULL);
+ entry = _GD_Add(D, &S, NULL);
/* Actually store the string, now */
- if (!error) {
- entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+ if (entry)
+ _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, value);
- if (entry == NULL)
- _GD_InternalError(D); /* We should be able to find it: we just added it */
- else
- _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, value);
-
- if (D->error)
- error = -1;
- }
-
- dreturn("%i", error);
- return error;
+ dreturn("%i", D->error ? -1 : 0);
+ return D->error ? -1 : 0;
}
/* add a CONST entry */
@@ -1155,7 +1147,6 @@
{
gd_entry_t *entry;
gd_entry_t C;
- int error;
dtrace("%p, \"%s\", 0x%X, 0x%X, %p, %i", D, field_code, const_type, data_type,
value, fragment_index);
@@ -1171,23 +1162,14 @@
C.field_type = GD_CONST_ENTRY;
C.EN(scalar,const_type) = const_type;
C.fragment_index = fragment_index;
- error = _GD_Add(D, &C, NULL);
+ entry = _GD_Add(D, &C, NULL);
/* Actually store the constant, now */
- if (!error) {
- entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+ if (entry)
+ _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
- if (entry == NULL)
- _GD_InternalError(D); /* We should be able to find it: we just added it */
- else
- _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
-
- if (D->error)
- error = -1;
- }
-
- dreturn("%i", error);
- return error;
+ dreturn("%i", D->error ? -1 : 0);
+ return D->error ? -1 : 0;
}
/* add a CARRAY entry */
@@ -1197,7 +1179,6 @@
{
gd_entry_t *entry;
gd_entry_t C;
- int error;
dtrace("%p, \"%s\", 0x%X, %zi, 0x%X, %p, %i", D, field_code, const_type,
array_len, data_type, values, fragment_index);
@@ -1214,23 +1195,14 @@
C.EN(scalar,const_type) = const_type;
C.EN(scalar,array_len) = array_len;
C.fragment_index = fragment_index;
- error = _GD_Add(D, &C, NULL);
+ entry = _GD_Add(D, &C, NULL);
/* Actually store the carray, now */
- if (!error) {
- entry = _GD_FindField(D, field_code, D->entry, D->n_entries, NULL);
+ if (entry)
+ _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
- if (entry == NULL)
- _GD_InternalError(D); /* We should be able to find it: we just added it */
- else
- _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
-
- if (D->error)
- error = -1;
- }
-
- dreturn("%i", error);
- return error;
+ dreturn("%i", D->error ? -1 : 0);
+ return D->error ? -1 : 0;
}
int gd_madd(DIRFILE* D, const gd_entry_t* entry, const char* parent) gd_nothrow
@@ -1245,7 +1217,7 @@
return -1;
}
- ret = _GD_Add(D, entry, parent);
+ ret = (_GD_Add(D, entry, parent) == NULL) ? -1 : 0;
dreturn("%i", ret);
return ret;
@@ -1288,7 +1260,7 @@
L.scalar[i] = NULL;
L.scalar[i + GD_MAX_LINCOM] = NULL;
}
- error = _GD_Add(D, &L, parent);
+ error = (_GD_Add(D, &L, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1331,7 +1303,7 @@
L.scalar[i] = NULL;
L.scalar[i + GD_MAX_LINCOM] = NULL;
}
- error = _GD_Add(D, &L, parent);
+ error = (_GD_Add(D, &L, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1358,7 +1330,7 @@
L.in_fields[0] = (char *)in_field;
L.EN(linterp,table) = (char *)table;
L.fragment_index = 0;
- error = _GD_Add(D, &L, parent);
+ error = (_GD_Add(D, &L, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1387,7 +1359,7 @@
B.EN(bit,numbits) = numbits;
B.fragment_index = 0;
B.scalar[0] = B.scalar[1] = NULL;
- error = _GD_Add(D, &B, parent);
+ error = (_GD_Add(D, &B, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1416,7 +1388,7 @@
B.EN(bit,numbits) = numbits;
B.fragment_index = 0;
B.scalar[0] = B.scalar[1] = NULL;
- error = _GD_Add(D, &B, parent);
+ error = (_GD_Add(D, &B, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1443,7 +1415,7 @@
M.in_fields[0] = (char *)in_field1;
M.in_fields[1] = (char *)in_field2;
M.fragment_index = 0;
- error = _GD_Add(D, &M, parent);
+ error = (_GD_Add(D, &M, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1471,7 +1443,7 @@
P.EN(phase,shift) = shift;
P.fragment_index = 0;
P.scalar[0] = NULL;
- error = _GD_Add(D, &P, parent);
+ error = (_GD_Add(D, &P, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1512,7 +1484,7 @@
E.scalar[i] = NULL;
}
- error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1553,7 +1525,7 @@
E.scalar[i] = NULL;
}
- error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1580,7 +1552,7 @@
E.field_type = GD_DIVIDE_ENTRY;
E.in_fields[0] = (char *)in_field1;
E.in_fields[1] = (char *)in_field2;
- error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1608,7 +1580,7 @@
E.EN(recip,dividend) = dividend;
E.comp_scal = 0;
E.in_fields[0] = (char *)in_field;
- error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1618,6 +1590,8 @@
int gd_madd_crecip(DIRFILE* D, const char *parent, const char* field_code, const
char* in_field, double complex cdividend)
{
+ int error;
+
dtrace("%p, \"%s\", \"%s\", \"%s\", %g;%g", D, parent, field_code, in_field,
creal(cdividend), cimag(cdividend));
@@ -1634,7 +1608,7 @@
E.EN(recip,cdividend) = cdividend;
E.comp_scal = 1;
E.in_fields[0] = (char *)in_field;
- int error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1662,7 +1636,7 @@
_gd_a2c(E.EN(recip,cdividend), cdividend);
E.comp_scal = 1;
E.in_fields[0] = (char *)in_field;
- error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1693,7 +1667,7 @@
E.EN(window,windop) = windop;
E.in_fields[0] = (char *)in_field;
E.in_fields[1] = (char *)check_field;
- error = _GD_Add(D, &E, parent);
+ error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
dreturn("%i", error);
return error;
@@ -1703,8 +1677,6 @@
int gd_madd_string(DIRFILE* D, const char* parent,
const char* field_code, const char* value) gd_nothrow
{
- char *buffer;
- int error;
gd_entry_t *entry;
gd_entry_t S;
@@ -1719,39 +1691,20 @@
S.field = (char *)field_code;
S.field_type = GD_STRING_ENTRY;
S.fragment_index = 0;
- error = _GD_Add(D, &S, parent);
+ entry = _GD_Add(D, &S, parent);
/* Actually store the string, now */
- if (!error) {
- buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(field_code) + 2);
- if (buffer == NULL) {
- dreturn("%i", -1);
- return -1;
- }
+ if (entry)
+ _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, value);
- sprintf(buffer, "%s/%s", parent, field_code);
- entry = _GD_FindField(D, buffer, D->entry, D->n_entries, NULL);
- free(buffer);
-
- if (entry == NULL)
- _GD_InternalError(D); /* We should be able to find it: we just added it */
- else
- _GD_DoFieldOut(D, entry, 0, 0, 0, GD_NULL, value);
-
- if (D->error)
- error = -1;
- }
-
- dreturn("%i", error);
- return error;
+ dreturn("%i", D->error ? -1 : 0);
+ return D->error ? -1 : 0;
}
/* add a META CONST entry */
int gd_madd_const(DIRFILE* D, const char* parent, const char* field_code,
gd_type_t const_type, gd_type_t data_type, const void* value) gd_nothrow
{
- char *buffer;
- int error;
gd_entry_t *entry;
gd_entry_t C;
@@ -1768,31 +1721,14 @@
C.field_type = GD_CONST_ENTRY;
C.EN(scalar,const_type) = const_type;
C.fragment_index = 0;
- error = _GD_Add(D, &C, parent);
+ entry = _GD_Add(D, &C, parent);
/* Actually store the constant, now */
- if (!error) {
- buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(field_code) + 2);
- if (buffer == NULL) {
- dreturn("%i", -1);
- return -1;
- }
+ if (entry)
+ _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
- sprintf(buffer, "%s/%s", parent, field_code);
- entry = _GD_FindField(D, buffer, D->entry, D->n_entries, NULL);
- free(buffer);
-
- if (entry == NULL)
- _GD_InternalError(D); /* We should be able to find it: we just added it */
- else
- _GD_DoFieldOut(D, entry, 0, 0, 1, data_type, value);
-
- if (D->error)
- error = -1;
- }
-
- dreturn("%i", error);
- return error;
+ dreturn("%i", D->error ? -1 : 0);
+ return D->error ? -1 : 0;
}
/* add a META CARRAY entry */
@@ -1800,8 +1736,6 @@
gd_type_t const_type, size_t array_len, gd_type_t data_type,
const void* values) gd_nothrow
{
- char *buffer;
- int error;
gd_entry_t *entry;
gd_entry_t C;
@@ -1819,29 +1753,12 @@
C.EN(scalar,const_type) = const_type;
C.EN(scalar,array_len) = array_len;
C.fragment_index = 0;
- error = _GD_Add(D, &C, parent);
+ entry = _GD_Add(D, &C, parent);
/* Actually store the carray, now */
- if (!error) {
- buffer = (char *)_GD_Malloc(D, strlen(parent) + strlen(field_code) + 2);
- if (buffer == NULL) {
- dreturn("%i", -1);
- return -1;
- }
+ if (entry)
+ _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
- sprintf(buffer, "%s/%s", parent, field_code);
- entry = _GD_FindField(D, buffer, D->entry, D->n_entries, NULL);
- free(buffer);
-
- if (entry == NULL)
- _GD_InternalError(D); /* We should be able to find it: we just added it */
- else
- _GD_DoFieldOut(D, entry, 0, 0, array_len, data_type, values);
-
- if (D->error)
- error = -1;
- }
-
- dreturn("%i", error);
- return error;
+ dreturn("%i", D->error ? -1 : 0);
+ return D->error ? -1 : 0;
}
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/src/common.c 2011-12-11 23:35:07 UTC (rev 635)
@@ -876,7 +876,7 @@
E = _GD_FindField(D, *field_code, D->entry, D->n_entries, index);
if (E == NULL && set) {
- _GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, field_code_in);
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code_in);
if (field_code_in != *field_code)
free(*field_code);
}
@@ -1252,22 +1252,20 @@
}
/* new one */
- ptr = realloc(D->dir, sizeof(struct gd_dir_t) * (D->ndir + 1));
+ ptr = _GD_Realloc(D, D->dir, sizeof(struct gd_dir_t) * (D->ndir + 1));
if (ptr == NULL) {
free(path);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
D->dir = ptr;
D->dir[D->ndir].rc = 1;
- D->dir[D->ndir].path = strdup(dir);
+ D->dir[D->ndir].path = _GD_Strdup(D, dir);
if (D->dir[D->ndir].path == NULL) {
free(path);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -1280,10 +1278,9 @@
D->dir[D->ndir].fd = open(dir, O_RDONLY);
} else {
free(path);
- path = strdup(name);
+ path = _GD_Strdup(D, name);
if (path == NULL) {
free(D->dir[D->ndir].path);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
Modified: trunk/getdata/src/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/src/compat.c 2011-12-11 23:35:07 UTC (rev 635)
@@ -39,6 +39,9 @@
}
#endif
+/* ...at() functions for platforms lacking them. These are originally Solaris
+ * extensions which have subsequently been included in POSIX.1-2008.
+ */
#ifndef HAVE_OPENAT
int gd_OpenAt(const DIRFILE *D, int dirfd, const char *name, int flags,
mode_t mode)
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/src/del.c 2011-12-11 23:35:07 UTC (rev 635)
@@ -289,11 +289,10 @@
free(field_code);
/* gather a list of fields */
- del_list = (gd_entry_t **)malloc(sizeof(gd_entry_t*) * ((E->e->n_meta == -1) ?
- 1 : 1 + E->e->n_meta));
+ del_list = (gd_entry_t **)_GD_Malloc(D,
+ sizeof(gd_entry_t*) * ((E->e->n_meta == -1) ? 1 : 1 + E->e->n_meta));
if (del_list == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -363,10 +362,9 @@
/* Fix up reference fields */
if (E->field_type == GD_RAW_ENTRY) {
- new_ref = (char **)malloc(sizeof(char*) * D->n_fragment);
+ new_ref = (char **)_GD_Malloc(D, sizeof(char*) * D->n_fragment);
if (new_ref == NULL) {
free(del_list);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -392,13 +390,12 @@
}
if (in_scope) {
- new_ref[i] = strdup(D->entry[j]->field);
+ new_ref[i] = _GD_Strdup(D, D->entry[j]->field);
if (new_ref == NULL) {
for (f = 0; f < i; ++f)
free(new_ref[f]);
free(new_ref);
free(del_list);
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/src/encoding.c 2011-12-11 23:35:07 UTC (rev 635)
@@ -630,10 +630,9 @@
if (file->name == NULL) {
file->D = D;
- file->name = (char *)malloc(strlen(base) + (temp ? 8 :
+ file->name = (char *)_GD_Malloc(D, strlen(base) + (temp ? 8 :
strlen(_gd_ef[file->subenc].ext) + 1));
if (file->name == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
@@ -662,11 +661,10 @@
}
if (move && encoding != D->fragment[fragment].encoding) {
- gd_entry_t **raw_entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*) *
+ gd_entry_t **raw_entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
D->n_entries);
if (raw_entry == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturnvoid();
return;
}
Modified: trunk/getdata/src/endian.c
===================================================================
--- trunk/getdata/src/endian.c 2011-12-10 02:09:23 UTC (rev 634)
+++ trunk/getdata/src/endian.c 2011-12-11 23:35:07 UTC (rev 635)
@@ -44,11 +44,10 @@
}
if (move && byte_sex != D->fragment[fragment].byte_sex) {
- gd_entry_t **raw_entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*) *
+ gd_entry_t **raw_entry = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
D->n_entries);
if (raw_entry == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturnvoid();
return;
}
Modified: trun...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-13 02:53:33
|
Revision: 637
http://getdata.svn.sourceforge.net/getdata/?rev=637&view=rev
Author: ketiltrout
Date: 2011-12-13 02:53:25 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Added gd_fragment_affixes(), gd_alter_affixes(), gd_include_affixes() to the API.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/add.c
trunk/getdata/src/common.c
trunk/getdata/src/entry.c
trunk/getdata/src/flush.c
trunk/getdata/src/fragment.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/include.c
trunk/getdata/src/internal.h
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/parse.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/alter_spec_affix.c
trunk/getdata/test/name_affix.c
Added Paths:
-----------
trunk/getdata/test/fragment_affix.c
trunk/getdata/test/fragment_affix_alter.c
trunk/getdata/test/fragment_affix_alter2.c
trunk/getdata/test/fragment_affix_dup.c
trunk/getdata/test/include_affix.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/ChangeLog 2011-12-13 02:53:25 UTC (rev 637)
@@ -1,3 +1,21 @@
+2011-12-13 D. V. Wiebe <ge...@ke...> svn:637
+ * test/fragment_affix_alter2.c test/fragment_affix_alter.c
+ test/fragment_affix_dup.c test/fragment_affix.c test/include_affix.c: Added.
+
+ * src/move.c (_GD_StrCmpNull): Renamed from strcmpnull and de-statickified.
+
+ * src/name.c (_GD_MungeFromFrag): Added.
+ * src/name.c (_GD_MungeCode): Converted into a swiss army munger handling
+ both enmunging and demunging. Most old, simple, uses of this function now
+ call _GD_MungeFromFrag (which calls this) instead.
+ * src/flush.c (_GD_DeMungeCode): Deleted in favour of the new _GD_MungeCode.
+
+ * src/fragment.c (gd_fragment_affixes _GD_CheckAffixes _GD_ChangeAffixes
+ gd_alter_affixes): Added.
+
+ * src/include.c (gd_include_affix): Renamed from gd_include.
+ * src/include.c (gd_include): Added.
+
2011-12-11 D. V. Wiebe <ge...@ke...> svn:635
* test/add_string_affix.c test/name_affix_bad.c test/move_affix.c
test/alter_entry_affix.c test/alter_entry_affix.c test/madd_affix.c
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/add.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -88,8 +88,8 @@
}
} else
/* Apply prefix and suffix */
- temp_buffer = _GD_MungeCode(D, NULL, entry->fragment_index, entry->field,
- &offset);
+ temp_buffer = _GD_MungeFromFrag(D, NULL, entry->fragment_index,
+ entry->field, &offset);
if (temp_buffer == NULL) {
dreturn("%p", NULL);
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/common.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -819,7 +819,7 @@
dtrace("%p, %p, %i", D, E, i);
if (E->e->entry[i] == NULL) {
- munged_code = _GD_MungeCode(D, NULL, E->fragment_index, E->in_fields[i],
+ munged_code = _GD_MungeFromFrag(D, NULL, E->fragment_index, E->in_fields[i],
&offset);
if (munged_code)
E->e->entry[i] = _GD_FindFieldAndRepr(D, munged_code, &code,
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/entry.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -143,7 +143,8 @@
dtrace("%p, %p, %i, %i, %p", D, E, i, type, data);
if (scalar != NULL) {
- munged_code = _GD_MungeCode(D, NULL, E->fragment_index, scalar, &offset);
+ munged_code = _GD_MungeFromFrag(D, NULL, E->fragment_index, scalar,
+ &offset);
if (munged_code)
C = _GD_FindFieldAndRepr(D, munged_code, &field_code, &repr, NULL, 0);
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/flush.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -22,50 +22,6 @@
#define GD_MAX_PRETTY_FIELD_WIDTH 80
-/* remove the prefix and suffix from a field code */
-char *_GD_DeMungeCode(const char *prefix, const char *suffix, const char *code)
-{
- size_t i, len, slen;
- char *ptr;
-
- dtrace("\"%s\", \"%s\", \"%s\"", prefix, suffix, code);
-
- if (code == NULL) {
- dreturn("%p", NULL);
- return NULL;
- }
-
- /* Verify the prefix is present */
- if (prefix) {
- for (i = 0; prefix[i]; ++i) {
- if (prefix[i] != code[i]) {
- /* prefix missing */
- dreturn("%p", NULL);
- return NULL;
- }
- }
- ptr = strdup(code + i);
- } else
- ptr = strdup(code);
-
- /* Verify the suffix is present */
- if (suffix) {
- len = strlen(ptr);
- slen = strlen(suffix);
- for (i = 0; i < slen; ++i) {
- if (suffix[i] != ptr[len - slen + i]) {
- /* suffix missing */
- dreturn("%p", NULL);
- return NULL;
- }
- }
- ptr[len - slen] = '\0';
- }
-
- dreturn("\"%s\"", ptr);
- return ptr;
-}
-
void _GD_Flush(DIRFILE* D, gd_entry_t *E, int clo)
{
int i;
@@ -306,16 +262,18 @@
return len;
}
-static void _GD_PadField(FILE* stream, const char *prefix, const char *suffix,
- const char* in, size_t len, int permissive, int standards)
+static void _GD_PadField(DIRFILE *D, FILE* stream, const char *prefix,
+ const char *suffix, const char* in, size_t len, int permissive,
+ int standards)
{
size_t i;
+ int dummy;
char *ptr;
- dtrace("%p, \"%s\", \"%s\", \"%s\", %zu, %i, %i", stream, prefix, suffix, in,
- len, permissive, standards);
+ dtrace("%p, %p, \"%s\", \"%s\", \"%s\", %zu, %i, %i", D, stream, prefix,
+ suffix, in, len, permissive, standards);
- ptr = _GD_DeMungeCode(prefix, suffix, in);
+ ptr = _GD_MungeCode(D, NULL, prefix, suffix, NULL, NULL, in, &dummy);
for (i = _GD_StringEscapeise(stream, ptr, permissive, standards); i < len;
++i)
@@ -332,12 +290,13 @@
int type, const void* value, const char* scalar, int index,
const char* postamble)
{
+ int dummy;
dtrace("%p, %p, %i, %i, 0x%X, %p, \"%s\", %i, \"%s\"", D, stream, me,
permissive, type, value, scalar, index, postamble);
if (scalar != NULL) {
- char *ptr = _GD_DeMungeCode(D->fragment[me].prefix, D->fragment[me].suffix,
- scalar);
+ char *ptr = _GD_MungeCode(D, NULL, D->fragment[me].prefix,
+ D->fragment[me].suffix, NULL, NULL, scalar, &dummy);
_GD_StringEscapeise(stream, ptr, permissive, D->standards);
if (index == -1)
fprintf(stream, "%s", postamble);
@@ -392,7 +351,7 @@
}
/* field name */
- _GD_PadField(stream, D->fragment[me].prefix, D->fragment[me].suffix, ptr,
+ _GD_PadField(D, stream, D->fragment[me].prefix, D->fragment[me].suffix, ptr,
max_len, permissive, D->standards);
switch(E->field_type) {
@@ -561,7 +520,7 @@
if (!D->error && E->hidden && (permissive || D->standards >= 9)) {
fputs("/HIDDEN ", stream);
- _GD_PadField(stream, D->fragment[me].prefix, D->fragment[me].suffix,
+ _GD_PadField(D, stream, D->fragment[me].prefix, D->fragment[me].suffix,
E->field, 0, permissive, D->standards);
fputc('\n', stream);
}
@@ -577,7 +536,7 @@
char temp_file[] = "format_XXXXXX";
char* ptr;
struct tm now;
- int fd;
+ int fd, dummy;
int pretty = 0;
size_t max_len = 0;
unsigned int u;
@@ -712,10 +671,10 @@
if (permissive || D->standards >= 3)
for (j = 0; j < D->n_fragment; ++j)
if (D->fragment[j].parent == i) {
- char *prefix = _GD_DeMungeCode(D->fragment[i].prefix, NULL,
- D->fragment[j].prefix);
- char *suffix = _GD_DeMungeCode(NULL, D->fragment[i].suffix,
- D->fragment[j].suffix);
+ char *prefix = _GD_MungeCode(D, NULL, D->fragment[i].prefix, NULL, NULL,
+ NULL, D->fragment[j].prefix, &dummy);
+ char *suffix = _GD_MungeCode(D, NULL, NULL, D->fragment[i].suffix, NULL,
+ NULL, D->fragment[j].suffix, &dummy);
fprintf(stream, "%sINCLUDE ", (D->standards >= 5) ? "/" : "");
_GD_StringEscapeise(stream, D->fragment[j].ename, permissive,
Modified: trunk/getdata/src/fragment.c
===================================================================
--- trunk/getdata/src/fragment.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/fragment.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008,2010 D. V. Wiebe
+/* Copyright (C) 2008,2010,2011 D. V. Wiebe
*
***************************************************************************
*
@@ -42,6 +42,207 @@
return D->fragment[index].cname;
}
+int gd_fragment_affixes(DIRFILE *D, int index, char **prefix, char **suffix)
+ gd_nothrow
+{
+ char *p = NULL, *s = NULL;
+ dtrace("%p, %i, %p, %p", D, index, prefix, suffix);
+
+ _GD_ClearError(D);
+
+ if (D->flags & GD_INVALID) {
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (index < 0 || index >= D->n_fragment) {
+ _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (D->fragment[index].prefix)
+ p = _GD_Strdup(D, D->fragment[index].prefix);
+ if (D->fragment[index].suffix)
+ s = _GD_Strdup(D, D->fragment[index].suffix);
+
+ if (D->error) {
+ free(p);
+ free(s);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ *prefix = p;
+ *suffix = s;
+ dreturn("%i", 0);
+ return 0;
+}
+
+static char **_GD_CheckAffixes(DIRFILE *D, int i, const char *prefix,
+ const char *suffix, char **codes, unsigned *n)
+{
+ int j, dummy;
+ unsigned u, nn = *n;
+ char **new_codes = codes, **ptr;
+
+ dtrace("%p, %i, \"%s\", \"%s\", %p, %p", D, i, prefix, suffix, new_codes, n);
+
+ ptr = _GD_Realloc(D, codes, sizeof(char*) * (nn + 2));
+ if (!ptr) {
+ dreturn("%p (%i)", codes, *n);
+ return codes;
+ }
+ new_codes = ptr;
+
+ /* push the new prefix and suffix onto the code stack */
+ new_codes[nn++] = prefix ? _GD_Strdup(D, prefix) : NULL;
+ new_codes[nn++] = suffix ? _GD_Strdup(D, suffix) : NULL;
+ *n = nn;
+
+ if (D->error) {
+ dreturn("%p (%i)", new_codes, *n);
+ return new_codes;
+ }
+
+ /* Propagate changes downward */
+ for (j = 0; j < D->n_fragment; ++j)
+ if (D->fragment[j].parent == i) {
+ char *subprefix = _GD_MungeCode(D, NULL, D->fragment[i].prefix, NULL,
+ prefix, NULL, D->fragment[j].prefix, &dummy);
+ char *subsuffix = _GD_MungeCode(D, NULL, NULL, D->fragment[i].suffix,
+ NULL, suffix, D->fragment[j].suffix, &dummy);
+ if (D->error) {
+ dreturn("%p (%i)", new_codes, *n);
+ return new_codes;
+ }
+
+ new_codes = _GD_CheckAffixes(D, j, subprefix, subsuffix, new_codes, n);
+ nn = *n;
+
+ if (D->error) {
+ dreturn("%p (%i)", new_codes, *n);
+ return new_codes;
+ }
+ }
+
+ /* Check for namespace clashes in our files */
+ for (u = 0; u < D->n_entries; ++u)
+ if (D->entry[u]->fragment_index == i && D->entry[u]->e->n_meta != -1) {
+ ptr = _GD_Realloc(D, new_codes, sizeof(char*) * ++nn);
+ if (ptr) {
+ new_codes = ptr;
+ /* remunge the code */
+ new_codes[nn - 1] = _GD_MungeCode(D, NULL, D->fragment[i].prefix,
+ D->fragment[i].suffix, prefix, suffix, D->entry[u]->field, &dummy);
+
+ /* look for a duplicate and validate */
+ if (new_codes[nn - 1] && _GD_FindField(D, new_codes[nn - 1], D->entry,
+ D->n_entries, (unsigned int*)&dummy))
+ {
+ _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, new_codes[nn - 1]);
+ } else if (_GD_ValidateField(new_codes[nn - 1], D->standards, 1, 0,
+ &dummy))
+ {
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0,
+ new_codes[nn - 1]);
+ }
+ } else
+ nn--;
+
+ if (D->error)
+ break;
+ }
+
+ *n = nn;
+ dreturn("%p (%i)", new_codes, *n);
+ return new_codes;
+}
+
+static int _GD_ChangeAffixes(DIRFILE *D, int i, char **codes, int *resort)
+{
+ int j;
+ unsigned u, n = 2;
+
+ dtrace("%p, %i, %p, %p", D, i, codes, resort);
+
+ free(D->fragment[i].prefix);
+ free(D->fragment[i].suffix);
+ D->fragment[i].prefix = codes[0];
+ D->fragment[i].suffix = codes[1];
+
+ /* Propagate changes downward */
+ for (j = 0; j < D->n_fragment; ++j)
+ if (D->fragment[j].parent == i)
+ n += _GD_ChangeAffixes(D, j, codes + n, resort);
+
+ /* rename all the fields */
+ for (u = 0; u < D->n_entries; ++u)
+ if (D->entry[u]->fragment_index == i && D->entry[u]->e->n_meta != -1) {
+ *resort = 1;
+ free(D->entry[u]->field);
+ D->entry[u]->field = codes[n++];
+ }
+
+ dreturn("%i", n);
+ return n;
+}
+
+int gd_alter_affixes(DIRFILE *D, int index, const char *prefix,
+ const char *suffix) gd_nothrow
+{
+ unsigned u, n = 0;
+ char **new_codes;
+ int resort = 0;
+ dtrace("%p, %i, \"%s\", \"%s\"", D, index, prefix, suffix);
+
+ _GD_ClearError(D);
+
+ if (D->flags & GD_INVALID) {
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (index <= 0 || index >= D->n_fragment) {
+ _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ /* nothing to do */
+ if (_GD_StrCmpNull(prefix, D->fragment[index].prefix) == 0 &&
+ _GD_StrCmpNull(suffix, D->fragment[index].suffix) == 0)
+ {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ new_codes = _GD_CheckAffixes(D, index, prefix, suffix, NULL, &n);
+
+ if (D->error) {
+ for (u = 0; u < n; ++u)
+ free(new_codes[u]);
+ free(new_codes);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ChangeAffixes(D, index, new_codes, &resort);
+
+ free(new_codes);
+
+ if (resort) {
+ /* resort */
+ qsort(D->entry, D->n_entries, sizeof(gd_entry_t*), _GD_EntryCmp);
+ qsort(D->dot_list, D->n_dot, sizeof(gd_entry_t*), _GD_EntryCmp);
+ }
+
+ dreturn("%i", 0);
+ return 0;
+}
+
int gd_nfragments(DIRFILE* D) gd_nothrow
{
dtrace("%p", D);
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/getdata.h.in 2011-12-13 02:53:25 UTC (rev 637)
@@ -527,6 +527,9 @@
gd_triplet_t threshold, int fragment_index) gd_nothrow
gd_nonnull ((1,2,3,4));
+extern int gd_alter_affixes(DIRFILE *dirfile, int index, const char *prefix,
+ const char *suffix) gd_nothrow gd_nonnull ((1));
+
extern int gd_alter_bit(DIRFILE *dirfile, const char *field_code,
const char *in_field, gd_bit_t bitnum, gd_bit_t numbits) gd_nothrow
gd_nonnull((1,2));
@@ -640,6 +643,9 @@
extern const char **gd_field_list_by_type(DIRFILE *dirfile,
gd_entype_t type) gd_nothrow gd_nonnull ((1));
+extern int gd_fragment_affixes(DIRFILE *dirfile, int index, char **prefix,
+ char **suffix) gd_nonnull ((1,3,4)) gd_nothrow;
+
extern int gd_fragment_index(DIRFILE *dirfile,
const char *field_code) gd_nothrow gd_nonnull ((1));
@@ -856,6 +862,10 @@
extern int gd_include(DIRFILE *dirfile, const char *file, int fragment_index,
unsigned long int flags) gd_nonnull ((1,2));
+extern int gd_include_affix(DIRFILE *dirfile, const char *file,
+ int fragment_index, const char *prefix, const char *suffix,
+ unsigned long int flags) gd_nonnull ((1,2));
+
extern double gd_framenum(DIRFILE *dirfile, const char *field_code,
double value) gd_nonnull ((1,2));
Modified: trunk/getdata/src/include.c
===================================================================
--- trunk/getdata/src/include.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/include.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -257,14 +257,15 @@
return D->n_fragment - 1;
}
-int gd_include(DIRFILE* D, const char* file, int fragment_index,
- unsigned long flags)
+int gd_include_affix(DIRFILE* D, const char* file, int fragment_index,
+ const char *prefix, const char *suffix, unsigned long flags)
{
int standards = GD_DIRFILE_STANDARDS_VERSION;
char* ref_name = NULL;
int i, new_fragment;
- dtrace("%p, \"%s\", %i, %lx", D, file, fragment_index, (unsigned long)flags);
+ dtrace("%p, \"%s\", %i, \"%s\", \"%s\", 0x%lX", D, file, fragment_index,
+ prefix, suffix, flags);
if (~D->flags & GD_HAVE_VERSION)
_GD_FindVersion(D);
@@ -308,7 +309,7 @@
flags |= D->flags & GD_ENCODING;
new_fragment = _GD_Include(D, file, "dirfile_include()", 0, &ref_name,
- fragment_index, NULL, NULL, &standards, &flags);
+ fragment_index, prefix, suffix, &standards, &flags);
if (!D->error) {
D->fragment[fragment_index].modified = 1;
@@ -353,6 +354,19 @@
return new_fragment;
}
+int gd_include(DIRFILE* D, const char* file, int fragment_index,
+ unsigned long flags)
+{
+ int new_fragment;
+
+ dtrace("%p, \"%s\", %i, 0x%lX", D, file, fragment_index, flags);
+
+ new_fragment = gd_include_affix(D, file, fragment_index, NULL, NULL, flags);
+
+ dreturn("%i", new_fragment);
+ return new_fragment;
+}
+
static int _GD_CollectFragments(DIRFILE* D, int** f, int fragment, int nf)
{
int i;
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/internal.h 2011-12-13 02:53:25 UTC (rev 637)
@@ -911,7 +911,6 @@
void _GD_ConvertType(DIRFILE* D, const void *data_in, gd_type_t in_type,
void *data_out, gd_type_t out_type, size_t n) gd_nothrow;
gd_type_t _GD_ConstType(DIRFILE *D, gd_type_t type);
-char *_GD_DeMungeCode(const char *prefix, const char *suffix, const char *code);
const char *_GD_DirName(const DIRFILE *D, int dirfd);
#define _GD_EntryIndex(t) \
@@ -979,7 +978,9 @@
int _GD_MogrifyFile(DIRFILE* D, gd_entry_t* E, unsigned long int encoding,
unsigned long int byte_sex, off64_t offset, int finalise, int new_fragment,
char* new_filebase);
-char *_GD_MungeCode(DIRFILE*, const gd_entry_t*, int, const char*, int*);
+char *_GD_MungeCode(DIRFILE*, const gd_entry_t*, const char *, const char*,
+ const char*, const char*, const char*, int*);
+char *_GD_MungeFromFrag(DIRFILE*, const gd_entry_t*, int, const char*, int*);
gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr);
gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols,
const gd_entry_t* P, const char* format_file, int linenum, int me,
@@ -994,6 +995,7 @@
void _GD_SetError(DIRFILE* D, int error, int suberror, const char* format_file,
int line, const char* token);
int _GD_SetTablePath(DIRFILE *D, gd_entry_t *E, struct _gd_private_entry *e);
+int _GD_StrCmpNull(const char *, const char *);
int _GD_Supports(DIRFILE* D, gd_entry_t* E, unsigned int funcs);
int _GD_Tokenise(DIRFILE *D, const char* instring, char **outstring,
const char **pos, char** in_cols, const char* format_file, int linenum,
Modified: trunk/getdata/src/move.c
===================================================================
--- trunk/getdata/src/move.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/move.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -282,7 +282,7 @@
return 0;
}
-static int strcmpnull(const char *s1, const char *s2)
+int _GD_StrCmpNull(const char *s1, const char *s2)
{
int r;
@@ -369,8 +369,8 @@
}
/* Compose the field's new name */
- new_filebase = _GD_DeMungeCode(D->fragment[E->fragment_index].prefix,
- D->fragment[E->fragment_index].suffix, E->field);
+ new_filebase = _GD_MungeCode(D, NULL, D->fragment[E->fragment_index].prefix,
+ D->fragment[E->fragment_index].suffix, NULL, NULL, E->field, &dummy);
if (!new_filebase) {
_GD_InternalError(D); /* the prefix/suffix wasn't found */
@@ -378,7 +378,7 @@
return -1;
}
- new_code = _GD_MungeCode(D, NULL, new_fragment, new_filebase, &dummy);
+ new_code = _GD_MungeFromFrag(D, NULL, new_fragment, new_filebase, &dummy);
if (strcmp(new_code, E->field)) {
/* duplicate check */
@@ -436,7 +436,7 @@
D->fragment[new_fragment].byte_sex ||
D->fragment[E->fragment_index].frame_offset !=
D->fragment[new_fragment].frame_offset ||
- strcmpnull(D->fragment[E->fragment_index].sname,
+ _GD_StrCmpNull(D->fragment[E->fragment_index].sname,
D->fragment[new_fragment].sname)))
{
if (_GD_MogrifyFile(D, E, D->fragment[new_fragment].encoding,
Modified: trunk/getdata/src/name.c
===================================================================
--- trunk/getdata/src/name.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/name.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -20,59 +20,117 @@
*/
#include "internal.h"
-/* Munge a field code or field name using the prefix and suffix of the current
- * fragment. Returns a newly malloc'd munged code, or NULL on error */
-char *_GD_MungeCode(DIRFILE *D, const gd_entry_t *P, int me, const char *code,
- int *offset)
+/* add/remove/modify the prefix and suffix from a field code */
+char *_GD_MungeCode(DIRFILE *D, const gd_entry_t *P, const char *old_prefix,
+ const char *old_suffix, const char *new_prefix, const char *new_suffix,
+ const char *code, int *offset)
{
- char *ptr, *slash;
- size_t len = strlen(code);
- size_t slen;
- size_t plen;
+ size_t len, oplen = 0, oslen = 0, nplen = 0, nslen = 0, plen = 0, mlen = 0;
+ const char *ptr, *slash;
+ char *new_code;
- dtrace("%p, %p, %i, \"%s\", %p", D, P, me, code, offset);
+ dtrace("%p, %p, \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", %p", D, P, old_prefix,
+ old_suffix, new_prefix, new_suffix, code, offset);
+ if (code == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ len = strlen(code);
+
+ /* Verify the old prefix is present */
+ if (old_prefix) {
+ oplen = strlen(old_prefix);
+ if (strncmp(old_prefix, code, oplen)) {
+ /* prefix missing */
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, code);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ ptr = code + oplen;
+ len -= oplen;
+ } else
+ ptr = code;
+
+ /* look for a /, which could indicate this is a metafield code. If it is
+ * just an illegal name with a / in it, mungeing will screw up, but
+ * validation will catch the illegal name later anyways.
+ */
+ if ((slash = memchr(ptr, '/', len))) {
+ mlen = len + (ptr - slash);
+ len = slash++ - ptr;
+ }
+
+ /* Verify the suffix is present */
+ if (old_suffix) {
+ oslen = strlen(old_suffix);
+ if (strncmp(old_suffix, ptr + len - oslen, oslen)) {
+ /* suffix missing */
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, code);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ len -= oslen;
+ }
+
+ if (new_prefix)
+ nplen = strlen(new_prefix);
+
+ if (new_suffix)
+ nslen = strlen(new_suffix);
+
+ if (P)
+ plen = strlen(P->field) + 1;
+
+ if ((new_code = _GD_Malloc(D, plen + nplen + len + nslen + mlen + 1)) == NULL)
+ {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
if (P) {
- plen = strlen(P->field);
- ptr = (char*)_GD_Malloc(D, len + plen + 2);
- if (ptr) {
- strcpy(ptr, P->field);
- ptr[plen] = '/';
- strcpy(ptr + plen + 1, code);
- }
- *offset = plen + 1;
+ strcpy(new_code, P->field);
+ new_code[plen - 1] = '/';
+ strcpy(new_code + plen, ptr);
} else {
- *offset = 0;
- slen = (D->fragment[me].suffix) ? strlen(D->fragment[me].suffix) : 0;
- plen = (D->fragment[me].prefix) ? strlen(D->fragment[me].prefix) : 0;
- ptr = (char*)_GD_Malloc(D, len + slen + plen + 1);
- if (ptr) {
- /* look for a /, which could indicate this is a field code, not just a
- * field name. If it is just an illegal name with a / in it, mungeing
- * will fail, but validation will catch the illegal name later anyways.
- */
- if ((slash = strchr(code, '/')))
- len = slash++ - code;
+ if (nplen > 0)
+ strcpy(new_code, new_prefix);
- if (plen > 0)
- strcpy(ptr, D->fragment[me].prefix);
+ strncpy(new_code + nplen, ptr, len);
- strncpy(ptr + plen, code, len + 1);
+ if (nslen > 0)
+ strcpy(new_code + nplen + len, new_suffix);
- if (slen > 0)
- strcpy(ptr + plen + len, D->fragment[me].suffix);
+ if (slash) {
+ new_code[nplen + len + nslen] = '/';
+ strcpy(new_code + nplen + len + nslen + 1, slash);
+ }
- if (slash) {
- ptr[plen + len + slen] = '/';
- strcpy(ptr + plen + len + slen + 1, slash);
- }
- }
+ new_code[nplen + len + nslen + mlen] = '\0';
}
- dreturn("\"%s\" (%i)", ptr, *offset);
- return ptr;
+ *offset = plen;
+
+ dreturn("\"%s\" (%i)", new_code, *offset);
+ return new_code;
}
+/* Munge a field code or field name using the prefix and suffix of the current
+ * fragment. Returns a newly malloc'd munged code, or NULL on error */
+char *_GD_MungeFromFrag(DIRFILE *D, const gd_entry_t *P, int me,
+ const char *code, int *offset)
+{
+ char *new_code;
+ dtrace("%p, %p, %i, \"%s\", %p", D, P, me, code, offset);
+
+ new_code = _GD_MungeCode(D, P, NULL, NULL, D->fragment[me].prefix,
+ D->fragment[me].suffix, code, offset);
+
+ dreturn("\"%s\"", new_code);
+ return new_code;
+}
+
/* Check for a valid field name -- returns 1 on error */
int _GD_ValidateField(const char* field_code, int standards, int strict,
int affix, int* is_dot)
@@ -96,9 +154,9 @@
dreturn("%i", 1);
return 1;
} else if (strict && ((standards >= 5 && (field_code[i] == '<' ||
- field_code[i] == '>' || field_code[i] == ';' ||
- field_code[i] == '|' || field_code[i] == '&')) ||
- (standards == 5 && (field_code[i] == '\\' || field_code[i] == '#'))))
+ field_code[i] == '>' || field_code[i] == ';' ||
+ field_code[i] == '|' || field_code[i] == '&')) ||
+ (standards == 5 && (field_code[i] == '\\' || field_code[i] == '#'))))
{
/* these characters are sometimes forbidden */
dreturn("%i", 1);
@@ -138,7 +196,7 @@
{
gd_entry_t *E, *Q;
char* name;
- int new_dot, old_dot = 0;
+ int dummy, new_dot, old_dot = 0;
unsigned int dot_ind;
dtrace("%p, \"%s\", \"%s\", %i", D, old_code, new_name, move_data);
@@ -198,8 +256,9 @@
}
sprintf("%s/%s", E->e->p.parent->field, new_name);
} else {
- name = _GD_DeMungeCode(D->fragment[E->fragment_index].prefix,
- D->fragment[E->fragment_index].suffix, new_name);
+ /* Verify prefix and suffix */
+ name = _GD_MungeCode(D, NULL, D->fragment[E->fragment_index].prefix,
+ D->fragment[E->fragment_index].suffix, NULL, NULL, new_name, &dummy);
if (name == NULL || name[0] == '\0') {
_GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, new_name);
dreturn("%i", -1);
Modified: trunk/getdata/src/parse.c
===================================================================
--- trunk/getdata/src/parse.c 2011-12-11 23:48:27 UTC (rev 636)
+++ trunk/getdata/src/parse.c 2011-12-13 02:53:25 UTC (rev 637)
@@ -294,7 +294,7 @@
E->e->u.raw.file[0].subenc = GD_ENC_UNKNOWN; /* don't know the encoding
subscheme yet */
- E->field = _GD_MungeCode(D, NULL, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, NULL, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -368,7 +368,7 @@
E->field_type = GD_LINCOM_ENTRY;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -469,7 +469,7 @@
E->e->calculated = 1;
E->EN(linterp,table) = NULL;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -533,7 +533,7 @@
E->e->entry[0] = E->e->entry[1] = NULL;
E->e->calculated = 1;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -595,7 +595,7 @@
E->e->entry[0] = NULL;
E->e->calculated = 0;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -662,7 +662,7 @@
E->e->entry[0] = NULL;
E->e->calculated = 0;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -753,7 +753,7 @@
E->e->entry[0] = E->e->entry[1] = NULL;
E->e->calculated = 0;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -818,7 +818,7 @@
E->e->entry[0] = NULL;
E->e->calculated = 1;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field && _GD_ValidateField(E->field + offset, standards, pedantic, 0,
is_dot))
{
@@ -896,7 +896,7 @@
E->in_fields[0] = NULL;
E->e->entry[0] = NULL;
- E->field = _GD_MungeCode(D, parent, me, in_cols[0], &offset);
+ E->field = _GD_MungeFromFrag(D, parent, me, in_cols[0], &offset);
if (E->field...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-20 20:49:15
|
Revision: 638
http://getdata.svn.sourceforge.net/getdata/?rev=638&view=rev
Author: ketiltrout
Date: 2011-12-20 20:49:05 +0000 (Tue, 20 Dec 2011)
Log Message:
-----------
Added /ALIAS. Fix post rename screw-ups. Fix bug in _GD_GetSPF.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/src/add.c
trunk/getdata/src/common.c
trunk/getdata/src/constant.c
trunk/getdata/src/del.c
trunk/getdata/src/entry.c
trunk/getdata/src/errors.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/fpos.c
trunk/getdata/src/fragment.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/globals.c
trunk/getdata/src/include.c
trunk/getdata/src/index.c
trunk/getdata/src/internal.h
trunk/getdata/src/meta_list.c
trunk/getdata/src/mod.c
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/native.c
trunk/getdata/src/nmeta.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/src/putdata.c
trunk/getdata/src/spf.c
trunk/getdata/src/string.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/lzma_get.c
trunk/getdata/test/name_move.c
trunk/getdata/test/version_6_write.c
trunk/getdata/test/version_9_write.c
trunk/getdata/test/xz_get.c
Added Paths:
-----------
trunk/getdata/test/add_alias.c
trunk/getdata/test/add_resolv.c
trunk/getdata/test/add_spec_resolv.c
trunk/getdata/test/alias_list.c
trunk/getdata/test/alias_list_alias.c
trunk/getdata/test/alias_list_missing.c
trunk/getdata/test/alias_num.c
trunk/getdata/test/alias_num_alias.c
trunk/getdata/test/alias_num_missing.c
trunk/getdata/test/alias_target.c
trunk/getdata/test/alias_target_alias.c
trunk/getdata/test/alias_target_missing.c
trunk/getdata/test/del_derived_after.c
trunk/getdata/test/entry_type_alias.c
trunk/getdata/test/fragment_index_alias.c
trunk/getdata/test/fragment_num.c
trunk/getdata/test/fragment_parent.c
trunk/getdata/test/hide_hidden.c
trunk/getdata/test/madd_alias.c
trunk/getdata/test/madd_spec_resolv.c
trunk/getdata/test/move_alias.c
trunk/getdata/test/name_after.c
trunk/getdata/test/name_after_const.c
trunk/getdata/test/name_update.c
trunk/getdata/test/name_update_const.c
trunk/getdata/test/parse_alias.c
trunk/getdata/test/parse_alias_code.c
trunk/getdata/test/parse_alias_dup.c
trunk/getdata/test/parse_alias_meta.c
trunk/getdata/test/parse_alias_missing.c
trunk/getdata/test/parse_malias.c
trunk/getdata/test/parse_malias_dup.c
trunk/getdata/test/parse_meta_alias.c
trunk/getdata/test/parse_meta_jump.c
trunk/getdata/test/parse_meta_malias.c
trunk/getdata/test/spf_alias.c
trunk/getdata/test/spf_alias_meta.c
trunk/getdata/test/spf_alias_missing.c
Removed Paths:
-------------
trunk/getdata/test/nfragments.c
trunk/getdata/test/parent.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/ChangeLog 2011-12-20 20:49:05 UTC (rev 638)
@@ -1,3 +1,61 @@
+2011-12-20 D. V. Wiebe <ge...@ke...> svn:638
+ * src/entry.c (_GD_GetScalar _GD_CalculateEntry) src/common.c (_GD_GetRepr
+ _GD_BadInput _GD_FindFieldAndRepr: Optionally prohibit setting errors (for
+ use by the post-rename update stuff).
+ * src/errors.c: Added GD_E_FORMAT_ALIAS, GD_E_DEL_ALIAS.
+ * src/flush.c (_GD_FieldSpec): Write aliases. Also tweaked to allow slashed
+ metafield specification with DSV7.
+ * src/del.c (_GD_ClearDerived): Handle aliases.
+ * src/parse.c (_GD_CheckParent _GD_ParseAlias _GD_ResolveAlias
+ _GD_UpdateAliases) src/add.c (_GD_AddAlias gd_add_alias gd_madd_alias): Added.
+ * src/parse.c (_GD_ParseFieldSpec): Call _GD_CheckParent.
+ * src/parse.c (_GD_ParseDirective): Use a switch to reduce the number of
+ strcmps done. Handle /ALIAS.
+ * src/parse.c (_GD_ParseFragment): Optionally call _GD_UpdateAliases to
+ resolve aliases.
+ * src/add.c (_GD_Add gd_madd_spec gd_add_spec): Update aliases after addition.
+
+ * src/common.c (_GD_FindField): Optionally dealias names.
+
+ * src/del.c (_GD_Delete): Renamed from gd_delete().
+ * src/del.c (gd_delete gd_delete_alias): Added.
+
+ * src/name.c (_GD_UpdateScalar _GD_InvalidateConst _GD_UpdateInField
+ _GD_InvalidateVect): Added.
+ * src/name.c (_GD_Rename): Renamed from gd_rename(). Handle cleaning up
+ after the rename.
+
+ * src/move.c (_GD_Move): Renamed from gd_move().
+
+ * src/name.c (_GD_ValidateField): Permit is_dot = NULL.
+
+ * src/entry.c (gd_alias_target gd_aliases gd_naliases gd_hidden) src/move.c
+ (gd_move gd_move_alias) src/name.c (gd_rename gd_rename_alias): Added.
+
+ * src/alias.c (gd_fragment_index gd_hide gd_unhide): Call _GD_FindField
+ instead of _GD_FindFieldAndRepr to avoid resolving aliases. As a side effect,
+ these function will no long ignore representation suffices.
+
+ * src/flush.c (_GD_StringEscapeise): Handle writing slashed meta-fields.
+
+ * src/spf.c (_GD_GetSPF): Ensure return is zero on error.
+
+ * test/alias_num_missing.c alias_target_missing.c spf_alias_missing.c
+ alias_list.c del_derived_after.c madd_spec_resolv.c parse_alias_meta.c
+ entry_type_alias.c spf_alias.c name_after_const.c parse_malias_dup.c
+ add_alias.c alias_target.c alias_list_alias.c add_resolv.c spf_alias_meta.c
+ move_alias.c name_after.c parse_meta_jump.c parse_alias_missing.c
+ name_update_const.c madd_alias.c parse_alias_dup.c fragment_index_alias.c
+ add_spec_resolv.c alias_target_alias.c name_update.c hide_hidden.c
+ alias_num_alias.c parse_malias.c parse_alias_code.c parse_alias.c
+ alias_num.c parse_meta_malias.c parse_meta_alias.c alias_list_missing.c:
+ Added.
+
+ * test/fragment_parent.c: Renamed from test/parent.c.
+ * test/fragment_num.c: Renamed from test/nfragments.c.
+
+ * test/version_9_write.c: Update.
+
2011-12-13 D. V. Wiebe <ge...@ke...> svn:637
* test/fragment_affix_alter2.c test/fragment_affix_alter.c
test/fragment_affix_dup.c test/fragment_affix.c test/include_affix.c: Added.
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/configure.ac 2011-12-20 20:49:05 UTC (rev 638)
@@ -536,7 +536,8 @@
echo "*** Looking for additional header files"
echo
AC_CHECK_HEADERS([asm/unaligned.h Availability.h byteswap.h direct.h fcntl.h \
- io.h libgen.h libkern/OSByteOrder.h stdint.h sys/endian.h \
+ inttypes.h io.h libgen.h libkern/OSByteOrder.h stdint.h \
+ sys/endian.h sys/file.h sys/param.h sys/stat.h sys/types.h \
unistd.h])
if test "x$disable_c99" = "xno"; then
AC_CHECK_HEADERS([complex.h])
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/src/add.c 2011-12-20 20:49:05 UTC (rev 638)
@@ -65,16 +65,16 @@
/* check parent */
if (parent != NULL) {
- /* make sure it's not a meta field already */
- if (strchr(parent, '/') != NULL) {
+ P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+ if (P == NULL) {
_GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
dreturn("%p", NULL);
return NULL;
}
- P = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
- if (P == NULL) {
- _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+ /* make sure it's not a meta field already */
+ if (P->e->n_meta == -1) {
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
dreturn("%p", NULL);
return NULL;
}
@@ -97,9 +97,7 @@
}
/* check for duplicate field */
- E = _GD_FindField(D, temp_buffer, D->entry, D->n_entries, &u);
-
- if (E != NULL) { /* matched */
+ if (_GD_FindField(D, temp_buffer, D->entry, D->n_entries, 1, &u)) {
_GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, temp_buffer);
free(temp_buffer);
dreturn("%p", NULL);
@@ -480,6 +478,9 @@
D->list_validity = 0;
D->type_list_validity = 0;
+ /* Update aliases */
+ _GD_UpdateAliases(D);
+
dreturn("%p", E);
return E;
}
@@ -513,7 +514,7 @@
/* Find parent -- we don't do code mungeing here because we don't know
* which fragment this is yet. */
- E = _GD_FindField(D, parent, D->entry, D->n_entries, NULL);
+ E = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
if (E == NULL) {
_GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
dreturn("%i", -1);
@@ -546,6 +547,9 @@
return -1;
}
+ /* Update aliases */
+ _GD_UpdateAliases(D);
+
D->fragment[me].modified = 1;
D->flags &= ~GD_HAVE_VERSION;
dreturn("%i", 0);
@@ -608,6 +612,9 @@
return -1;
}
+ /* Update aliases */
+ _GD_UpdateAliases(D);
+
D->fragment[fragment_index].modified = 1;
D->flags &= ~GD_HAVE_VERSION;
dreturn("%i", 0);
@@ -1762,3 +1769,159 @@
dreturn("%i", D->error ? -1 : 0);
return D->error ? -1 : 0;
}
+
+/* add an alias */
+static int _GD_AddAlias(DIRFILE *D, const char *parent, const char *field_code,
+ const char *target, int fragment_index)
+{
+ unsigned u;
+ int offset;
+ char *munged_code;
+ gd_entry_t *E, *P = NULL;
+ dtrace("%p, \"%s\", \"%s\", \"%s\", %i", D, parent, field_code, target,
+ fragment_index);
+
+ /* Early checks */
+ if (D->flags & GD_INVALID)
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ else if ((D->flags & GD_ACCMODE) == GD_RDONLY)
+ _GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+ else if (fragment_index < 0 || fragment_index >= D->n_fragment)
+ _GD_SetError(D, GD_E_BAD_INDEX, 0, NULL, fragment_index, NULL);
+ else if (D->fragment[fragment_index].protection & GD_PROTECT_FORMAT)
+ _GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
+ D->fragment[fragment_index].cname);
+
+ if (D->error) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ClearError(D);
+
+ if (parent != NULL) {
+ /* look for parent */
+ P = _GD_FindField(D, parent, D->entry, D->n_entries, 1, NULL);
+ if (P == NULL) {
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, parent);
+ dreturn("%i", -1);
+ return -1;
+ }
+ fragment_index = P->fragment_index;
+
+ /* make sure it's not a meta field already */
+ if (P->e->n_meta == -1) {
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, parent);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ offset = strlen(parent) + 1;
+ munged_code = (char *)_GD_Malloc(D, offset + strlen(field_code) + 1);
+ if (munged_code) {
+ strcpy(munged_code, parent);
+ munged_code[offset - 1] = '/';
+ strcpy(munged_code + offset, field_code);
+ }
+ } else
+ /* Apply prefix and suffix */
+ munged_code = _GD_MungeFromFrag(D, NULL, fragment_index, field_code,
+ &offset);
+
+ if (D->error) {
+ free(munged_code);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ /* check alias name */
+ if (munged_code && _GD_ValidateField(munged_code + offset, D->standards, 1, 0,
+ NULL))
+ {
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_INVALID, NULL, 0, field_code);
+ } else if (_GD_FindField(D, munged_code, D->entry, D->n_entries, 1, &u))
+ _GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, munged_code);
+
+ if (D->error) {
+ free(munged_code);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ /* create and store */
+ E = (gd_entry_t *)_GD_Malloc(D, sizeof(gd_entry_t));
+ if (E == NULL) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ memset(E, 0, sizeof(gd_entry_t));
+ E->e = (struct _gd_private_entry *)_GD_Malloc(D,
+ sizeof(struct _gd_private_entry));
+ if (E->e == NULL) {
+ free(E);
+ dreturn("%i", -1);
+ return -1;
+ }
+ memset(E->e, 0, sizeof(struct _gd_private_entry));
+
+ E->field = munged_code;
+ E->fragment_index = fragment_index;
+ E->in_fields[0] = _GD_Strdup(D, target);
+ E->field_type = GD_ALIAS_ENTRY;
+ E->e->calculated = 1;
+
+ if (D->error) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ /* add the entry and resort the entry list */
+ _GD_InsertSort(D, E, u);
+ D->n_entries++;
+ D->fragment[fragment_index].modified = 1;
+ D->flags &= ~GD_HAVE_VERSION;
+
+ /* Invalidate the field lists */
+ D->list_validity = 0;
+ D->type_list_validity = 0;
+
+ /* Update aliases */
+ _GD_UpdateAliases(D);
+
+ dreturn("%i", 0);
+ return 0;
+}
+
+int gd_add_alias(DIRFILE *D, const char *alias_name, const char *target_code,
+ int fragment_index) gd_nothrow
+{
+ int ret;
+
+ dtrace("%p, \"%s\", \"%s\", %i", D, alias_name, target_code, fragment_index);
+
+ if (D->flags & GD_INVALID) {
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ClearError(D);
+
+ ret = _GD_AddAlias(D, NULL, alias_name, target_code, fragment_index);
+
+ dreturn("%i", ret);
+ return ret;
+}
+
+int gd_madd_alias(DIRFILE *D, const char *parent, const char *alias_name,
+ const char *target_code) gd_nothrow
+{
+ int ret;
+
+ dtrace("%p, \"%s\", \"%s\", \"%s\"", D, parent, alias_name, target_code);
+
+ ret = _GD_AddAlias(D, parent, alias_name, target_code, 0);
+
+ dreturn("%i", ret);
+ return ret;
+}
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/src/common.c 2011-12-20 20:49:05 UTC (rev 638)
@@ -96,13 +96,16 @@
}
/* Binary search to find the field */
-gd_entry_t* _GD_FindField(DIRFILE* D, const char* field_code,
- gd_entry_t** list, unsigned int u, unsigned int *index)
+gd_entry_t *_GD_FindField(const DIRFILE *D, const char *field_code,
+ gd_entry_t **list, unsigned int u, int dealias, unsigned int *index)
{
int c;
+ char *ptr;
+ gd_entry_t *E = NULL;
unsigned int i, l = 0;
+ const unsigned int ou = u;
- dtrace("%p, \"%s\", %p, %u, %p", D, field_code, list, u, index);
+ dtrace("%p, \"%s\", %p, %u, %i, %p", D, field_code, list, u, dealias, index);
/* handle FILEFRAM */
if (D->standards < 6 && (D->flags & GD_PEDANTIC) &&
@@ -117,19 +120,48 @@
else if (c > 0)
l = i + 1;
else {
- if (index != NULL)
+ E = list[i];
+ if (dealias && E && E->field_type == GD_ALIAS_ENTRY)
+ E = E->e->entry[0];
+
+ if (index != NULL)
*index = i;
- dreturn("%p", list[i]);
- return list[i];
+ dreturn("%p", E);
+ return E;
}
}
- if (index != NULL)
+ if (index != NULL)
*index = u;
- dreturn("%p", NULL);
- return NULL;
+ /* not found perhaps it's an subfield of an aliased field? */
+ if ((ptr = strchr(field_code, '/'))) {
+ char *new_code = strdup(field_code);
+ if (new_code) {
+ new_code[ptr - field_code] = '\0';
+ E = _GD_FindField(D, new_code, list, ou, 0, NULL);
+ free(new_code);
+
+ if (E && E->field_type == GD_ALIAS_ENTRY && E->e->entry[0]) {
+ size_t plen = strlen(E->e->entry[0]->field);
+ new_code = malloc(plen + strlen(ptr));
+ if (new_code) {
+ strcpy(new_code, E->e->entry[0]->field);
+ new_code[plen] = '/';
+ strcpy(new_code + plen + 1, ptr + 1);
+
+ E = _GD_FindField(D, new_code, list, ou, 1, NULL);
+
+ free(new_code);
+ }
+ } else
+ E = NULL;
+ }
+ }
+
+ dreturn("%p", E);
+ return E;
}
/* Insertion sort the entry list */
@@ -770,12 +802,13 @@
dreturnvoid();
}
-int _GD_GetRepr(DIRFILE* D, const char* field_code_in, char** field_code)
+int _GD_GetRepr(DIRFILE *D, const char *field_code_in, char **field_code,
+ int err)
{
int repr = GD_REPR_NONE;
const int field_code_len = strlen(field_code_in);
- dtrace("%p, \"%s\", %p", D, field_code_in, field_code);
+ dtrace("%p, \"%s\", %p, %i", D, field_code_in, field_code, err);
*field_code = (char *)field_code_in;
/* find the representation, if any */
@@ -794,8 +827,9 @@
repr = GD_REPR_ARG;
break;
default:
- _GD_SetError(D, GD_E_BAD_REPR, GD_E_REPR_UNKNOWN, NULL, 0,
- field_code_in + field_code_len - 1);
+ if (err)
+ _GD_SetError(D, GD_E_BAD_REPR, GD_E_REPR_UNKNOWN, NULL, 0,
+ field_code_in + field_code_len - 1);
dreturn("%i", 0);
return 0;
}
@@ -811,21 +845,21 @@
}
/* Ensure that an input field has been identified (with error checking) */
-int _GD_BadInput(DIRFILE* D, gd_entry_t* E, int i)
+int _GD_BadInput(DIRFILE *D, gd_entry_t *E, int i, int err)
{
char *code, *munged_code;
int offset;
- dtrace("%p, %p, %i", D, E, i);
+ dtrace("%p, %p, %i, %i", D, E, i, err);
if (E->e->entry[i] == NULL) {
munged_code = _GD_MungeFromFrag(D, NULL, E->fragment_index, E->in_fields[i],
&offset);
if (munged_code)
E->e->entry[i] = _GD_FindFieldAndRepr(D, munged_code, &code,
- &E->e->repr[i], NULL, 1);
+ &E->e->repr[i], NULL, 1, err);
- if (D->error) {
+ if (E->e->entry[i] == NULL) {
free(munged_code);
dreturn("%i", 1);
return 1;
@@ -850,18 +884,19 @@
}
/* Find the entry and the representation */
-gd_entry_t* _GD_FindFieldAndRepr(DIRFILE* D, const char* field_code_in,
- char** field_code, int* repr, unsigned int *index, int set)
+gd_entry_t *_GD_FindFieldAndRepr(DIRFILE *D, const char *field_code_in,
+ char **field_code, int *repr, unsigned int *index, int set, int err)
{
- gd_entry_t* E = NULL;
+ gd_entry_t *E = NULL;
- dtrace("%p, \"%s\", %p, %p, %p, %i", D, field_code_in, field_code, repr,
- index, set);
+ dtrace("%p, \"%s\", %p, %p, %p, %i, %i", D, field_code_in, field_code, repr,
+ index, set, err);
- E = _GD_FindField(D, field_code_in, D->dot_list, D->n_dot, NULL);
+ if (D->n_dot > 0)
+ E = _GD_FindField(D, field_code_in, D->dot_list, D->n_dot, 1, NULL);
if (E == NULL) {
- *repr = _GD_GetRepr(D, field_code_in, field_code);
+ *repr = _GD_GetRepr(D, field_code_in, field_code, err);
if (D->error) {
dreturn("%p", NULL);
@@ -873,10 +908,11 @@
}
if (E == NULL || index != NULL)
- E = _GD_FindField(D, *field_code, D->entry, D->n_entries, index);
+ E = _GD_FindField(D, *field_code, D->entry, D->n_entries, 1, index);
if (E == NULL && set) {
- _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code_in);
+ if (err)
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code_in);
if (field_code_in != *field_code)
free(*field_code);
}
Modified: trunk/getdata/src/constant.c
===================================================================
--- trunk/getdata/src/constant.c 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/src/constant.c 2011-12-20 20:49:05 UTC (rev 638)
@@ -38,7 +38,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", -1);
@@ -81,7 +82,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", -1);
@@ -124,7 +126,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", -1);
@@ -165,7 +168,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", 0);
@@ -212,7 +216,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", -1);
@@ -271,7 +276,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", -1);
@@ -330,7 +336,8 @@
_GD_ClearError(D);
- entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1,
+ 1);
if (D->error) {
dreturn("%i", -1);
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/src/del.c 2011-12-20 20:49:05 UTC (rev 638)
@@ -71,6 +71,14 @@
case GD_CARRAY_ENTRY:
case GD_STRING_ENTRY:
break;
+ default:
+ if (E->field_type == GD_ALIAS_ENTRY)
+ if (E->e->entry[0] == C) {
+ if (check)
+ _GD_SetError(D, GD_E_DELETE, GD_E_DEL_ALIAS, E->field, 0, C->field);
+ else
+ E->e->entry[0] = NULL;
+ }
}
dreturnvoid();
@@ -85,7 +93,7 @@
dtrace("%p, %p, %p, %i, %i, 0x%03x, %p", D, E, C, check, i, type, data);
if (E->scalar[i] != NULL) {
- repr = _GD_GetRepr(D, E->scalar[i], &field_code);
+ repr = _GD_GetRepr(D, E->scalar[i], &field_code, 1);
if (D->error) {
dreturn("%i", 1);
@@ -203,42 +211,26 @@
dreturnvoid();
}
-int gd_delete(DIRFILE* D, const char* field_code_in, int flags)
+static int _GD_Delete(DIRFILE *D, gd_entry_t *E, unsigned int index,
+ unsigned int flags)
{
- unsigned int index;
unsigned int first, last = 0;
- int n_del, i, repr, len;
+ int n_del, i, len;
unsigned int j;
- char *field_code;
char **new_ref = NULL;
- gd_entry_t *reference = NULL, *E;
+ gd_entry_t *reference = NULL;
gd_entry_t **del_list;
- dtrace("%p, \"%s\", 0x%X", D, field_code_in, flags);
+ dtrace("%p, %p, %u, 0x%X", D, E, index, flags);
- if (D->flags & GD_INVALID) {/* don't crash */
- _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
- dreturn("%i", -1);
- return -1;
- }
-
if ((D->flags & GD_ACCMODE) != GD_RDWR) {
_GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
- _GD_ClearError(D);
+ len = strlen(E->field);
- E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, &index, 1);
-
- if (D->error) {
- dreturn("%i", -1);
- return -1;
- }
-
- len = strlen(field_code);
-
/* check protection */
if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT) {
_GD_SetError(D, GD_E_PROTECTED, GD_E_PROTECTED_FORMAT, NULL, 0,
@@ -250,18 +242,16 @@
/* If this field has metafields, and we weren't asked to delete those too,
* complain */
if (E->e->n_meta > 0 && ~flags & GD_DEL_META) {
- _GD_SetError(D, GD_E_DELETE, GD_E_DEL_META, NULL, 0, field_code);
+ _GD_SetError(D, GD_E_DELETE, GD_E_DEL_META, NULL, 0, E->field);
dreturn("%i", -1);
return -1;
} else if (E->e->n_meta > 0) {
/* find one of the meta fields -- it's not true that metafields are
* necessarily sorted directly after their parent */
if (_GD_FindField(D, E->e->p.meta_entry[0]->field, D->entry, D->n_entries,
- &first) == NULL)
+ 0, &first) == NULL)
{
_GD_InternalError(D);
- if (field_code != field_code_in)
- free(field_code);
dreturn("%i", -1);
return -1;
}
@@ -271,26 +261,23 @@
* search linearly in both directions until we find something that isn't a
* meta field of our parent */
while (first > 0)
- if (strncmp(D->entry[first - 1]->field, field_code, len) == 0 &&
+ if (strncmp(D->entry[first - 1]->field, E->field, len) == 0 &&
D->entry[first - 1]->field[len] == '/')
first--;
else
break;
while (last < D->n_entries - 1)
- if (strncmp(D->entry[last + 1]->field, field_code, len) == 0 &&
+ if (strncmp(D->entry[last + 1]->field, E->field, len) == 0 &&
D->entry[last + 1]->field[len] == '/')
last++;
else
break;
}
- if (field_code != field_code_in)
- free(field_code);
-
/* gather a list of fields */
- del_list = (gd_entry_t **)_GD_Malloc(D,
- sizeof(gd_entry_t*) * ((E->e->n_meta == -1) ? 1 : 1 + E->e->n_meta));
+ del_list = (gd_entry_t **)_GD_Malloc(D, sizeof(gd_entry_t*) *
+ (((E->e->n_meta == -1) ? 0 : E->e->n_meta) + 1));
if (del_list == NULL) {
dreturn("%i", -1);
@@ -311,7 +298,7 @@
del_list[i]->field_type == GD_CARRAY_ENTRY) &&
~flags & GD_DEL_DEREF)
_GD_DeReference(D, D->entry[j], del_list[i], 1);
- else if (~del_list[i]->field_type & GD_SCALAR_ENTRY)
+ else if (del_list[i]->field_type != GD_STRING_ENTRY)
_GD_ClearDerived(D, D->entry[j], del_list[i], 1);
if (D->error) {
@@ -391,7 +378,7 @@
if (in_scope) {
new_ref[i] = _GD_Strdup(D, D->entry[j]->field);
- if (new_ref == NULL) {
+ if (new_ref[i] == NULL) {
for (f = 0; f < i; ++f)
free(new_ref[f]);
free(new_ref);
@@ -430,7 +417,7 @@
if ((del_list[i]->field_type == GD_CONST_ENTRY ||
del_list[i]->field_type == GD_CARRAY_ENTRY) && flags & GD_DEL_DEREF)
_GD_DeReference(D, D->entry[j], del_list[i], 0);
- else if (~del_list[i]->field_type & GD_SCALAR_ENTRY)
+ else if (del_list[i]->field_type != GD_STRING_ENTRY)
_GD_ClearDerived(D, D->entry[j], del_list[i], 0);
free(del_list);
@@ -469,6 +456,7 @@
/* Remove the entry from the list -- we need not worry about the way we've
* already modified D->entry, since E is guaranteed to be before the stuff
* we've already removed */
+ D->fragment[E->fragment_index].modified = 1;
_GD_FreeE(D, E, 1);
memmove(D->entry + index, D->entry + index + 1,
@@ -482,3 +470,74 @@
dreturn("%i", 0);
return 0;
}
+
+int gd_delete(DIRFILE *D, const char *field_code_in, unsigned int flags)
+{
+ unsigned index;
+ int repr, ret;
+ char *field_code;
+ gd_entry_t *E;
+
+ dtrace("%p, \"%s\", 0x%X", D, field_code_in, flags);
+
+ if (D->flags & GD_INVALID) {/* don't crash */
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ClearError(D);
+
+ E = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, &index, 1, 1);
+
+ if (field_code != field_code_in)
+ free(field_code);
+
+ if (D->error) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ ret = _GD_Delete(D, E, index, flags);
+
+ dreturn("%i", ret);
+ return ret;
+}
+
+
+int gd_delete_alias(DIRFILE *D, const char *field_code, unsigned int flags)
+ gd_nothrow
+{
+ unsigned index;
+ int ret;
+ gd_entry_t *E;
+
+ dtrace("%p, \"%s\", 0x%X", D, field_code, flags);
+
+ if (D->flags & GD_INVALID) {
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ _GD_ClearError(D);
+
+ E = _GD_FindField(D, field_code, D->entry, D->n_entries, 0, &index);
+
+ if (!E) {
+ _GD_SetError(D, GD_E_BAD_CODE, GD_E_CODE_MISSING, NULL, 0, field_code);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (E->field_type != GD_ALIAS_ENTRY) {
+ _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ ret = _GD_Delete(D, E, index, flags);
+
+ dreturn("%i", ret);
+ return ret;
+}
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-13 02:53:25 UTC (rev 637)
+++ trunk/getdata/src/entry.c 2011-12-20 20:49:05 UTC (rev 638)
@@ -100,6 +100,7 @@
}
if (priv) {
+ free(entry->e->alias_list);
free(entry->e->field_list);
free(entry->e->vector_list);
free(entry->e->string_value_list);
@@ -130,8 +131,8 @@
return entry;
}
-static void _GD_GetScalar(DIRFILE* D, gd_entry_t* E, int i, gd_type_t type,
- void* data)
+static void _GD_GetScalar(DIRFILE *D, gd_entry_t *E, int i, gd_type_t type,
+ void *data, int err)
{
void *ptr = NULL;
gd_entry_t* C = NULL;
@@ -140,13 +141,13 @@
const char* scalar = E->scalar[i];
int index = E->scalar_ind[i];
- dtrace("%p, %p, %i, %i, %p", D, E, i, type, data);
+ dtrace("%p, %p, %i, %i, %p, %i", D, E, i, type, data, err);
if (scalar != NULL) {
munged_code = _GD_MungeFromFrag(D, NULL, E->fragment_index, scalar,
&offset);
if (munged_code)
- C = _GD_FindFieldAndRepr(D, munged_code, &field_code, &repr, NULL, 0);
+ C = _GD_FindFieldAndRepr(D, munged_code, &field_code, &repr, NULL, 0, 1);
if (D->error) {
free(munged_code);
@@ -154,14 +155,17 @@
return;
}
- if (C == NULL)
- _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_CODE, E->field, 0,
- field_code);
- else if (C->field_type != GD_CONST_ENTRY &&
- C->field_type != GD_CARRAY_ENTRY)
- _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_TYPE, E->field, 0,
- field_code);
- else {
+ if (C == NULL) {
+ if (err)
+ _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_CODE, E->field, 0,
+ field_code);
+ } else if (C->field_type != GD_CONST_ENTRY &&
+ C->field_type != GD_CARRAY_ENTRY)
+ {
+ if (err)
+ _GD_SetError(D, GD_E_BAD_SCALAR, GD_E_SCALAR_TYPE, E->field, 0,
+ field_code);
+ } else {
if (C->field_type == GD_CONST_ENTRY) {
index = 0;
E->scalar_ind[i] = -1;
@@ -171,7 +175,9 @@
ptr = _GD_Realloc(D, C->e->u.scalar.client,
(C->e->u.scalar.n_client...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-27 06:37:51
|
Revision: 639
http://getdata.svn.sourceforge.net/getdata/?rev=639&view=rev
Author: ketiltrout
Date: 2011-12-27 06:37:42 +0000 (Tue, 27 Dec 2011)
Log Message:
-----------
Update bindings for DSV9. Fix field list inclusion tests.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/TODO
trunk/getdata/bindings/cxx/Makefile.am
trunk/getdata/bindings/cxx/bitentry.cpp
trunk/getdata/bindings/cxx/carrayentry.cpp
trunk/getdata/bindings/cxx/constentry.cpp
trunk/getdata/bindings/cxx/dirfile.cpp
trunk/getdata/bindings/cxx/divideentry.cpp
trunk/getdata/bindings/cxx/entry.cpp
trunk/getdata/bindings/cxx/fragment.cpp
trunk/getdata/bindings/cxx/getdata/dirfile.h
trunk/getdata/bindings/cxx/getdata/entry.h
trunk/getdata/bindings/cxx/getdata/fragment.h
trunk/getdata/bindings/cxx/getdata/rawentry.h
trunk/getdata/bindings/cxx/indexentry.cpp
trunk/getdata/bindings/cxx/lincomentry.cpp
trunk/getdata/bindings/cxx/linterpentry.cpp
trunk/getdata/bindings/cxx/multiplyentry.cpp
trunk/getdata/bindings/cxx/phaseentry.cpp
trunk/getdata/bindings/cxx/polynomentry.cpp
trunk/getdata/bindings/cxx/rawentry.cpp
trunk/getdata/bindings/cxx/recipentry.cpp
trunk/getdata/bindings/cxx/sbitentry.cpp
trunk/getdata/bindings/cxx/stringentry.cpp
trunk/getdata/bindings/cxx/test/Makefile.am
trunk/getdata/bindings/cxx/test/big_test.cpp
trunk/getdata/bindings/f77/Makefile.am
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/f77/getdata.f.in
trunk/getdata/bindings/f77/getdata.f90.in
trunk/getdata/bindings/f77/test/big_test.f
trunk/getdata/bindings/f77/test/big_test95.f90
trunk/getdata/bindings/idl/Makefile.am
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/idl/test/big_test.pro
trunk/getdata/bindings/make_parameters.c
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/bindings/perl/simple_funcs.pl
trunk/getdata/bindings/perl/simple_funcs.xsin
trunk/getdata/bindings/perl/t/big_test.t
trunk/getdata/bindings/perl/t/callback.t
trunk/getdata/bindings/perl/typemap
trunk/getdata/bindings/python/pydirfile.c
trunk/getdata/bindings/python/pyentry.c
trunk/getdata/bindings/python/pyfragment.c
trunk/getdata/bindings/python/pygetdata.c
trunk/getdata/bindings/python/pygetdata.h
trunk/getdata/bindings/python/test/big_test.py
trunk/getdata/doc/README.cxx
trunk/getdata/doc/README.f77
trunk/getdata/doc/README.f95
trunk/getdata/doc/README.idl
trunk/getdata/doc/list.tests
trunk/getdata/src/add.c
trunk/getdata/src/close.c
trunk/getdata/src/debug.c
trunk/getdata/src/entry.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flush.c
trunk/getdata/src/fragment.c
trunk/getdata/src/internal.h
trunk/getdata/src/meta_list.c
trunk/getdata/src/mod.c
trunk/getdata/src/name.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/add_alias.c
trunk/getdata/test/add_resolv.c
trunk/getdata/test/add_spec_resolv.c
trunk/getdata/test/alias_target.c
trunk/getdata/test/alias_target_alias.c
trunk/getdata/test/alias_target_missing.c
trunk/getdata/test/fragment_affix_alter2.c
trunk/getdata/test/madd_alias.c
trunk/getdata/test/madd_spec_resolv.c
Added Paths:
-----------
trunk/getdata/bindings/cxx/getdata/windowentry.h
trunk/getdata/bindings/cxx/internal.h
trunk/getdata/bindings/cxx/windowentry.cpp
trunk/getdata/test/vlist_alias.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/ChangeLog 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,3 +1,45 @@
+2011-12-27 D. V. Wiebe <ge...@ke...> svn:639
+ * src/add.c (gd_madd_lincom gd_madd_clincom gd_madd_linterp gd_madd_bit
+ gd_madd_sbit gd_madd_multiply gd_madd_phase gd_madd_polynom gd_madd_cpolynom
+ gd_madd_string gd_madd_const gd_madd_carray): Zero entry before
+ initialisation.
+
+ * src/fragment.c (gd_alter_affixes): Allow {pre,suf}fix == NULL to indicate
+ no change.
+
+ * src/entry.c (_GD_FreeE): Handle aliases.
+
+ * src/close.c (_GD_FreeD): Free fragment affixes.
+
+ * src/debug.c (gd_colnil gd_coladd gd_colsub): Export debugging symbols.
+
+ * src/field_list.c (_GD_ListEntry): Added.
+ * src/field_list.c (gd_constants gd_carrays gd_strings gd_field_list_by_type
+ gd_vector_list gd_field_list) src/meta_list.c (gd_mconstants gd_mcarrays
+ gd_mstrings gd_mfield_list_by_type gd_mvector_list gd_mfield_list): Call
+ _GD_ListEntry.
+
+ * bindings/python/pyentry.c bindings/python/pyfragment.c
+ bindings/python/pydirfile.c: Update for DSV9.
+ * bindings/cxx/fragment.cpp bindings/cxx/entry.cpp bindings/cxx/dirfile.cpp
+ bindings/cxx/getdata/entry.h bindings/cxx/getdata/dirfile.h: Update for
+ DSV9.
+ * bindings/cxx/windowentry.cpp bindings/cxx/getdata/windowentry.h: Added.
+ * bindings/perl/GetData.xs bindings/perl/simple_funcs.xsin: Update for DSV9.
+ * bindings/f77/fgetdata.c bindings/f77/getdata.f90.in: Update for DSV9.
+ * bindings/idl/getdata.c: Update for DSV9. Removed most of the function
+ aliases.
+
+ * bindings/make_parameters.c: Update for DSV9. Add missing
+ GD_E_UNKNWON_ENCODING.
+
+ * bindings/python/pygetdata.c (initpygetdata): Handle gaps in
+ gdpy_exception_list. Fix exception list.
+
+ * bindings/python/pyentry.c (gdpy_entry_settable): Set correct parameter.
+
+ * test/vlist_alias.c: Added.
+
2011-12-20 D. V. Wiebe <ge...@ke...> svn:638
* src/entry.c (_GD_GetScalar _GD_CalculateEntry) src/common.c (_GD_GetRepr
_GD_BadInput _GD_FindFieldAndRepr: Optionally prohibit setting errors (for
Modified: trunk/getdata/TODO
===================================================================
--- trunk/getdata/TODO 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/TODO 2011-12-27 06:37:42 UTC (rev 639)
@@ -2,5 +2,3 @@
* Hashed compressed files
* linterp table path munging [MH]
* Make webpage suck less
-
-* aliasing [MT]
Modified: trunk/getdata/bindings/cxx/Makefile.am
===================================================================
--- trunk/getdata/bindings/cxx/Makefile.am 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/Makefile.am 2011-12-27 06:37:42 UTC (rev 639)
@@ -41,7 +41,8 @@
getdata/stringentry.h getdata/indexentry.h \
getdata/sbitentry.h getdata/polynomentry.h \
getdata/fragment.h getdata/divideentry.h \
- getdata/recipentry.h getdata/carrayentry.h
+ getdata/recipentry.h getdata/carrayentry.h \
+ getdata/windowentry.h
lib_LTLIBRARIES=libgetdata++.la
libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \
@@ -49,10 +50,10 @@
fragment.cpp indexentry.cpp lincomentry.cpp \
linterpentry.cpp multiplyentry.cpp phaseentry.cpp \
polynomentry.cpp rawentry.cpp recipentry.cpp \
- sbitentry.cpp stringentry.cpp \
- ${getdata_include_HEADERS}
+ sbitentry.cpp stringentry.cpp windowentry.cpp \
+ ${getdata_include_HEADERS} internal.h
libgetdata___la_LIBADD=../../src/libgetdata.la
libgetdata___la_LDFLAGS = -version-info @GETDATAXX_VERSION@
clean-local:
- rm -rvf *~ getdata/*~
+ rm -rf *~ getdata/*~
Modified: trunk/getdata/bindings/cxx/bitentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/bitentry.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/bitentry.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,17 +18,8 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <cstring>
-#include <stdlib.h>
-
-using namespace GetData;
-
BitEntry::BitEntry(const char* field_code, const char* in_field,
gd_bit_t bitnum, gd_bit_t numbits, int fragment_index) : Entry()
{
Modified: trunk/getdata/bindings/cxx/carrayentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/carrayentry.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/carrayentry.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 D. V. Wiebe
+// Copyright (C) 2010-2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,16 +18,8 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <cstring>
-
-using namespace GetData;
-
CarrayEntry::CarrayEntry(const char* field_code, DataType data_type,
size_t array_len, int fragment_index)
{
Modified: trunk/getdata/bindings/cxx/constentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/constentry.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/constentry.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,14 +18,8 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <cstring>
-
using namespace GetData;
ConstEntry::ConstEntry(const char* field_code, DataType data_type,
Modified: trunk/getdata/bindings/cxx/dirfile.cpp
===================================================================
--- trunk/getdata/bindings/cxx/dirfile.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/dirfile.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -18,25 +18,13 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <stdlib.h>
-
-#ifdef _MSC_VER
-#define __gd_unused
-#else
-#define __gd_unused __attribute__ (( unused ))
-#endif
-using namespace GetData;
-
Dirfile::Dirfile()
{
D = gd_invalid_dirfile();
error_string = NULL;
+ reference_name = NULL;
}
Dirfile::Dirfile(const char* filedir, unsigned long flags,
@@ -44,18 +32,20 @@
{
D = gd_cbopen(filedir, flags, sehandler, extra);
error_string = NULL;
+ reference_name = NULL;
}
Dirfile::Dirfile(DIRFILE* dirfile)
{
D = dirfile;
error_string = NULL;
+ reference_name = NULL;
}
Dirfile::~Dirfile()
{
- if (error_string != NULL)
- free(error_string);
+ free(error_string);
+ free(reference_name);
gd_close(D);
}
@@ -117,6 +107,8 @@
return new GetData::StringEntry(this, field_code);
case IndexEntryType:
return new GetData::IndexEntry(this, field_code);
+ case WindowEntryType:
+ return new GetData::WindowEntry(this, field_code);
case NoEntryType:
break;
}
@@ -350,14 +342,16 @@
return gd_nfragments(D);
}
-const char* Dirfile::ReferenceFilename() const
+const char* Dirfile::ReferenceFilename()
{
const char* ref = gd_reference(D, NULL);
if (ref == NULL)
return NULL;
- return gd_raw_filename(D, ref);
+ free(reference_name);
+ reference_name = gd_raw_filename(D, ref);
+ return reference_name;
}
int Dirfile::Discard()
@@ -456,3 +450,66 @@
{
return gd_tell(D, field_code);
}
+
+int Dirfile::AddAlias(const char* field_code, const char* target,
+ int fragment_index) const
+{
+ return gd_add_alias(D, field_code, target, fragment_index);
+}
+
+const char** Dirfile::Aliases(const char* field_code) const
+{
+ return gd_aliases(D, field_code);
+}
+
+const char* Dirfile::AliasTarget(const char* field_code) const
+{
+ return gd_alias_target(D, field_code);
+}
+
+int Dirfile::DeleteAlias(const char* field_code, int flags) const
+{
+ return gd_delete_alias(D, field_code, flags);
+}
+
+int Dirfile::Hide(const char* field_code) const
+{
+ return gd_hide(D, field_code);
+}
+
+int Dirfile::Hidden(const char* field_code) const
+{
+ return gd_hidden(D, field_code);
+}
+
+int Dirfile::IncludeAffix(const char *file, int fragment_index,
+ const char* prefix, const char* suffix, unsigned long flags) const
+{
+ return gd_include_affix(D, file, fragment_index, prefix, suffix, flags);
+}
+
+int Dirfile::MAddAlias(const char* parent, const char* name, const char* target)
+ const
+{
+ return gd_madd_alias(D, parent, name, target);
+}
+
+int Dirfile::MoveAlias(const char* field_code, int new_fragment) const
+{
+ return gd_move_alias(D, field_code, new_fragment);
+}
+
+int Dirfile::NAliases(const char* field_code) const
+{
+ return gd_naliases(D, field_code);
+}
+
+int Dirfile::Sync(const char* field_code) const
+{
+ return gd_sync(D, field_code);
+}
+
+int Dirfile::UnHide(const char* field_code) const
+{
+ return gd_unhide(D, field_code);
+}
Modified: trunk/getdata/bindings/cxx/divideentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/divideentry.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/divideentry.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010 D. V. Wiebe
+// Copyright (C) 2010-2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,15 +18,8 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <stdlib.h>
-#include <cstring>
-
using namespace GetData;
DivideEntry::DivideEntry(const char* field_code, const char* in_field1,
Modified: trunk/getdata/bindings/cxx/entry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/entry.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/entry.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,15 +18,8 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <stdlib.h>
-#include <cstring>
-
using namespace GetData;
Entry::Entry()
@@ -154,6 +147,7 @@
case GD_RAW_ENTRY:
case GD_PHASE_ENTRY:
case GD_RECIP_ENTRY:
+ case GD_WINDOW_ENTRY:
if (index >= 1)
return 0;
break;
Modified: trunk/getdata/bindings/cxx/fragment.cpp
===================================================================
--- trunk/getdata/bindings/cxx/fragment.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/fragment.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2008, 2010, 2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,19 +18,14 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
+#include "internal.h"
-#include <stdlib.h>
-#include <cstring>
-
using namespace GetData;
Fragment::Fragment(const GetData::Dirfile *dirfile, int index)
{
+ dtrace("%p, %i", dirfile, index);
+
D = dirfile;
ind = index;
@@ -40,11 +35,15 @@
prot = gd_protection(D->D, index);
name = gd_fragmentname(D->D, index);
parent = (index == 0) ? -1 : gd_parent_fragment(D->D, index);
+ gd_fragment_affixes(D->D, index, &prefix, &suffix);
+
+ dreturnvoid();
}
Fragment::~Fragment()
{
- ;
+ free(prefix);
+ free(suffix);
}
int Fragment::ReWrite() const
@@ -91,3 +90,25 @@
return ret;
}
+
+int Fragment::SetPrefix(const char* new_prefix)
+{
+ int ret = gd_alter_affixes(D->D, ind, new_prefix, suffix);
+
+ free(prefix);
+ free(suffix);
+ if (!ret)
+ ret = gd_fragment_affixes(D->D, ind, &prefix, &suffix);
+ return ret;
+}
+
+int Fragment::SetSuffix(const char* new_suffix)
+{
+ int ret = gd_alter_affixes(D->D, ind, prefix, new_suffix);
+
+ free(prefix);
+ free(suffix);
+ if (!ret)
+ ret = gd_fragment_affixes(D->D, ind, &prefix, &suffix);
+ return ret;
+}
Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/dirfile.h 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2011-12-27 06:37:42 UTC (rev 639)
@@ -51,6 +51,7 @@
#include <getdata/multiplyentry.h>
#include <getdata/divideentry.h>
#include <getdata/recipentry.h>
+#include <getdata/windowentry.h>
namespace GetData {
@@ -69,6 +70,7 @@
friend class RecipEntry;
friend class PhaseEntry;
friend class PolynomEntry;
+ friend class WindowEntry;
friend class ConstEntry;
friend class CarrayEntry;
friend class StringEntry;
@@ -87,8 +89,15 @@
int Add(GetData::Entry &entry) const;
+ int AddAlias(const char *field_code, const char *target,
+ int fragment_index = 0) const;
+
int AddSpec(const char *spec, int fragment_index = 0) const;
+ const char** Aliases(const char* field_code) const;
+
+ const char* AliasTarget(const char* field_code) const;
+
int AlterSpec(const char* spec, int recode = 0) const;
off_t BoF(const char *field_code) const;
@@ -103,6 +112,8 @@
int Delete(const char* field_code, int flags = 0) const;
+ int DeleteAlias(const char* field_code, int flags = 0) const;
+
int Discard();
GetData::Entry* Entry(const char *field_code) const;
@@ -142,11 +153,22 @@
size_t GetString(const char *field_code, size_t len, char *data_out)
const;
+ int Hide(const char* field_code) const;
+
+ int Hidden(const char* field_code) const;
+
int Include(const char *file, int fragment_index = 0,
unsigned long flags = 0) const;
+ int IncludeAffix(const char *file, int fragment_index = 0,
+ const char* prefix = NULL, const char* suffix = NULL,
+ unsigned long flags = 0) const;
+
int MAdd(GetData::Entry &entry, const char *parent) const;
+ int MAddAlias(const char* parent, const char* name, const char* target)
+ const;
+
int MAddSpec(const char *spec, const char *parent) const;
int MAlterSpec(const char *line, const char *parent, int recode = 0)
@@ -165,8 +187,12 @@
const char **MStrings(const char *parent) const;
+ int MoveAlias(const char* field_code, int new_fragment) const;
+
const char **MVectorList(const char *parent) const;
+ int NAliases(const char* field_code) const;
+
unsigned int NFields() const;
unsigned int NFieldsByType(EntryType type) const;
@@ -201,7 +227,7 @@
GetData::RawEntry *Reference(const char* field_code = NULL) const;
- const char *ReferenceFilename() const;
+ const char *ReferenceFilename();
unsigned int SamplesPerFrame(const char *field_code) const;
@@ -215,8 +241,12 @@
const char **Strings() const;
+ int Sync(const char *field_code = NULL) const;
+
off_t Tell(const char* field_code) const;
+ int UnHide(const char* field_code) const;
+
int UnInclude(int fragment_index, int del = 0) const;
int Validate(const char* field_code) const;
@@ -227,6 +257,7 @@
DIRFILE* D;
char *error_string;
+ char *reference_name;
};
}
Modified: trunk/getdata/bindings/cxx/getdata/entry.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/entry.h 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/getdata/entry.h 2011-12-27 06:37:42 UTC (rev 639)
@@ -68,9 +68,21 @@
StringEntryType = GD_STRING_ENTRY,
IndexEntryType = GD_INDEX_ENTRY,
DivideEntryType = GD_DIVIDE_ENTRY,
- RecipEntryType = GD_RECIP_ENTRY
+ RecipEntryType = GD_RECIP_ENTRY,
+ WindowEntryType = GD_WINDOW_ENTRY
};
+ enum WindOpType {
+ WindOpEq = GD_WINDOP_EQ,
+ WindOpNe = GD_WINDOP_NE,
+ WindOpGe = GD_WINDOP_GE,
+ WindOpGt = GD_WINDOP_GT,
+ WindOpLe = GD_WINDOP_LE,
+ WindOpLt = GD_WINDOP_LT,
+ WindOpSet = GD_WINDOP_SET,
+ WindOpClr = GD_WINDOP_CLR
+ };
+
class Entry {
friend class Dirfile;
@@ -208,6 +220,22 @@
0;
};
+ /* WINDOW methods */
+ virtual const char *Check() const {
+ return (E.field_type == GD_WINDOW_ENTRY) ? E.in_fields[1] : 0;
+ };
+
+ virtual WindOpType WindOp() const {
+ return (E.field_type == GD_WINDOW_ENTRY) ? (WindOpType)E.u.window.windop
+ : (WindOpType)0;
+ }
+
+ virtual gd_triplet_t Threshold() const {
+ gd_triplet_t zero;
+ zero.r = 0;
+ return (E.field_type == GD_WINDOW_ENTRY) ? E.u.window.threshold : zero;
+ }
+
void SetName(const char* name);
void SetFragmentIndex(int fragment_index);
Modified: trunk/getdata/bindings/cxx/getdata/fragment.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/fragment.h 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/getdata/fragment.h 2011-12-27 06:37:42 UTC (rev 639)
@@ -68,18 +68,26 @@
int Parent() const { return parent; }
+ const char *Prefix() { return prefix; };
+
int Protection() const { return prot; }
int ReWrite() const;
+ const char *Suffix() { return suffix; };
+
int SetEncoding(EncodingScheme encoding, int recode = 0);
int SetEndianness(unsigned long byte_sex, int recode = 0);
int SetFrameOffset(off_t offset, int recode = 0);
+ int SetPrefix(const char *preix);
+
int SetProtection(int protection_level);
+ int SetSuffix(const char *suffix);
+
protected:
Fragment(const Dirfile *dirfile, int index);
@@ -90,6 +98,8 @@
int prot;
off_t off;
const char* name;
+ char* prefix;
+ char* suffix;
int parent;
};
}
Modified: trunk/getdata/bindings/cxx/getdata/rawentry.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/rawentry.h 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/getdata/rawentry.h 2011-12-27 06:37:42 UTC (rev 639)
@@ -32,11 +32,16 @@
friend class Dirfile;
public:
- RawEntry() : Entry() { E.field_type = GD_RAW_ENTRY; };
+ RawEntry() : Entry() {
+ E.field_type = GD_RAW_ENTRY;
+ filename = NULL;
+ };
RawEntry(const char* field_code, DataType data_type, gd_spf_t spf,
int fragment_index = 0);
+ virtual ~RawEntry();
+
virtual gd_spf_t SamplesPerFrame() const { return E.u.raw.spf; };
virtual DataType RawType() const { return (DataType)E.u.raw.data_type; };
@@ -52,7 +57,9 @@
private:
RawEntry(const GetData::Dirfile *dirfile, const char* field_code) :
- Entry(dirfile, field_code) { };
+ Entry(dirfile, field_code) { filename = NULL; };
+
+ char *filename;
};
}
Added: trunk/getdata/bindings/cxx/getdata/windowentry.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/windowentry.h (rev 0)
+++ trunk/getdata/bindings/cxx/getdata/windowentry.h 2011-12-27 06:37:42 UTC (rev 639)
@@ -0,0 +1,67 @@
+// 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
+//
+
+#ifndef GETDATA_WINDOWENTRY_H
+#define GETDATA_WINDOWENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+ class Dirfile;
+
+ class WindowEntry : public Entry {
+ friend class Dirfile;
+
+ public:
+ WindowEntry() : Entry() { E.field_type = GD_WINDOW_ENTRY; };
+
+ WindowEntry(const char* field_code, const char* in_field,
+ const char *check_Field, WindOpType windop, gd_triplet_t threshold,
+ int fragment_index = 0);
+
+ virtual const char *Check() const { return E.in_fields[1]; };
+
+ virtual const char *Input() const { return E.in_fields[0]; };
+
+ virtual const char *Scalar() const { return E.scalar[0]; }
+
+ virtual int ScalarIndex() const { return E.scalar_ind[0]; };
+
+ virtual WindOpType WindOp() const {
+ return (WindOpType)E.u.window.windop;
+ };
+
+ virtual gd_triplet_t Threshold() const { return E.u.window.threshold; };
+
+ virtual int SetInput(const char* field);
+ virtual int SetCheck(const char* field);
+ virtual int SetWindOp(WindOpType windop);
+ virtual int SetThreshold(gd_triplet_t threshold);
+ virtual int SetThreshold(const char* threshold);
+
+ private:
+ WindowEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+ Entry(dirfile, field_code) { };
+ };
+}
+
+#endif
Modified: trunk/getdata/bindings/cxx/indexentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/indexentry.cpp 2011-12-20 20:49:05 UTC (rev 638)
+++ trunk/getdata/bindings/cxx/indexentry.cpp 2011-12-27 06:37:42 UTC (rev 639)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2010 D. V. Wiebe
+// Copyright (C) 2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -18,10 +18,4 @@
// along with GetData; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-#ifdef HAVE_CONFIG_H
-#include "../../src/config.h"
-#endif
-#undef GETDATA_LEGACY_API
-#include "getdata/dirfile.h"
-
-using namespace GetData;
+#include "internal.h"
Added: trunk/getdata/bindings/cxx/internal.h
===================================================================
--- trunk/getdata/bindings/cxx/internal.h (rev 0)
+++ trunk/getdata/bindings/cxx/internal.h 2011-12-27 06:37:42 UTC (rev 639)
@@ -0,0 +1,61 @@
+// 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
+//
+#ifdef HAVE_CONFIG_H
+#include "../../src/config.h"
+#endif
+#undef GETDATA_LEGACY_API
+#include "getdata/dirfile.h"
+
+#include <cstring>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+/* debugging macros */
+#ifdef GETDATA_DEBUG
+extern "C" const char* gd_colnil(void);
+extern "C" const char* gd_coladd(void);
+extern "C" const char* gd_colsub(void);
+#define dtracevoid() printf("%s %s()\n", gd_coladd(), __FUNCTION__)
+#define dtrace(fmt, ...) printf("%s %s(" fmt ")\n", gd_coladd(), \
+ __FUNCTION__, ##__VA_ARGS__)
+#define dprintf(fmt, ...) printf("%s %s:%i " fmt "\n", gd_colnil(), \
+ __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define dreturnvoid() printf("%s %s = (nil)\n", gd_colsub(), __FUNCTION__)
+#define dreturn(fmt, ...) printf("%s %s = " fmt "\n", gd_colsub(), \
+ __FUNCTION__, ##__VA_ARGS__)
+#define dwatch(fmt, v) printf("%s %s = " fmt "\n", gd_colnil(), #v, v)
+#else
+#define dtracevoid()
+#define dtrace(...)
+#define dprintf(...)
+#define dreturnvoid()
+#define dreturn(...)
+#define dwatch(...)
+#endif
+
+#ifdef _MSC_VER
+#define __gd_unused
+#else
+#define __gd_unused __attribute__ (( unused ))
+#endif
+
+using namespace GetData;
Modified: trunk/getdata/bindings/cxx/lincomentry.cpp
===...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-28 17:35:41
|
Revision: 640
http://getdata.svn.sourceforge.net/getdata/?rev=640&view=rev
Author: ketiltrout
Date: 2011-12-28 17:35:32 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
Provisional ZZIP support. _GD_SetEncodedName has been pushed down into the encoding layer.
Modified Paths:
--------------
trunk/getdata/AUTHORS
trunk/getdata/ChangeLog
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/make_parameters.c
trunk/getdata/configure.ac
trunk/getdata/src/Makefile.am
trunk/getdata/src/del.c
trunk/getdata/src/encoding.c
trunk/getdata/src/entry.c
trunk/getdata/src/flimits.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/gzip.c
trunk/getdata/src/internal.h
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/nframes.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/add_alias.c
trunk/getdata/test/fragment_affix_alter.c
Added Paths:
-----------
trunk/getdata/src/zzip.c
trunk/getdata/test/zzip_get.c
trunk/getdata/test/zzip_get_get.c
trunk/getdata/test/zzip_nframes.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/AUTHORS
===================================================================
--- trunk/getdata/AUTHORS 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/AUTHORS 2011-12-28 17:35:32 UTC (rev 640)
@@ -8,15 +8,16 @@
Ted Kisner <tsk...@gm...> wrote the PutData library
(libdirfile).
-Matthew Truch <ma...@tr...> wrote the dirfile2ascii conversion utility.
-He also provides alpha-testing, bug fixes, and maintains the Fedora packages.
-
Eli Fidler <el...@st...> ported PutData to this version of the GetData
library.
Joseph Fowler <jf...@pr...> provided code which was adapted to
create the slimlib encoding support.
+Adam D Hincks <ada...@ut...> provided code whic was adapted to
+create the zzip encoding support. The original zzip encoding (ZIRFILE) was
+developed by Mike Nolta <no...@ci...>.
+
Peter Kümmel <syn...@gm...> ported GetData to MSVC.
George Staikos <st...@kd...> maintained the GetData library as part of
@@ -24,6 +25,8 @@
Adam Treat <tr...@kd...> wrote the code for the PHASE field type.
+Matthew Truch <ma...@tr...> wrote the dirfile2ascii conversion utility.
+
Andrew Walker <arw...@su...> maintained the GetData library as
part of kst.
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/ChangeLog 2011-12-28 17:35:32 UTC (rev 640)
@@ -1,3 +1,18 @@
+2011-12-29 D. V. Wiebe <ge...@ke...> svn:640
+ * configure.ac: zzip encoding check.
+ * src/getdata.h.in src/internal.h: GD_ZZIP_ENCODED / GD_ENC_ZZIP; Added name
+ to encoding_t.
+ * src/zzip.c: Added.
+ * src/encoding.c: Add Zzip encoding; gd_ef_name_t.
+ * src/encoding.c (_GD_GenericName): Renamed from _GD_SetEncodedName and
+ pushed down into the encoding framework.
+ * src/encoding.c (_GD_MissingFramework): Handle GD_EF_NAME.
+ * src/encoding.c (_GD_ResolveEncoding): Handle external name functions.
+ * src/entry.c (gd_raw_filename) src/encoding.c (_GD_InitRawIO
+ _GD_RecodeFragment) src/move.c (_GD_MogrifyFile) src/name.c (_GD_Rename)
+ src/del.c (_GD_Delete) src/flimits.c (_GD_GetEOF): Call _gd_ef->name.
+ * test/zzip_get.c test/zzip_get_get.c test/zzip_nframes.c: Added.
+
2011-12-27 D. V. Wiebe <ge...@ke...> svn:639
* src/add.c (gd_madd_lincom gd_madd_clincom gd_madd_linterp gd_madd_bit
gd_madd_sbit gd_madd_multiply gd_madd_phase gd_madd_polynom gd_madd_cpolynom
Modified: trunk/getdata/bindings/idl/getdata.c
===================================================================
--- trunk/getdata/bindings/idl/getdata.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/bindings/idl/getdata.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -1009,6 +1009,10 @@
encoding = GD_LZMA_ENCODED;
else if (strcasecmp(enc, "SLIM"))
encoding = GD_SLIM_ENCODED;
+ else if (strcasecmp(enc, "SIE"))
+ encoding = GD_SIE_ENCODED;
+ else if (strcasecmp(enc, "ZZIP"))
+ encoding = GD_ZZIP_ENCODED;
else if (strcasecmp(enc, "TEXT"))
encoding = GD_TEXT_ENCODED;
else if (strcasecmp(enc, "NONE"))
Modified: trunk/getdata/bindings/make_parameters.c
===================================================================
--- trunk/getdata/bindings/make_parameters.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/bindings/make_parameters.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -112,12 +112,13 @@
CONSTANT(PERMISSIVE, "GD_PM", 1),
CONSTANT(AUTO_ENCODED, "GD_EA", 1),
+ CONSTANT(BZIP2_ENCODED, "GD_EB", 2),
+ CONSTANT(LZMA_ENCODED, "GD_EL", 2),
CONSTANT(UNENCODED, "GD_EN", 2),
+ CONSTANT(GZIP_ENCODED, "GD_EG", 2),
CONSTANT(TEXT_ENCODED, "GD_ET", 2),
CONSTANT(SLIM_ENCODED, "GD_ES", 2),
- CONSTANT(GZIP_ENCODED, "GD_EG", 2),
- CONSTANT(BZIP2_ENCODED, "GD_EB", 2),
- CONSTANT(LZMA_ENCODED, "GD_EL", 2),
+ CONSTANT(ZZIP_ENCODED, "GD_EZ", 2),
CONSTANT(NO_ENTRY, "GD_NOE", 3),
CONSTANT(RAW_ENTRY, "GD_RWE", 3),
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/configure.ac 2011-12-28 17:35:32 UTC (rev 640)
@@ -823,6 +823,7 @@
[unslim],[slimdopen])
GD_CHECK_ENCODING([gzip],[z],[gzopen],[zlib.h],[gzip],[gunzip],[])
GD_CHECK_ENCODING([lzma],[lzma],[lzma_auto_decoder],[lzma.h],[xz],[],[])
+GD_CHECK_ENCODING([zzip],[zzip],[zzip_open],[zzip/lib.h],[zip],[unzip],[])
if test ! -z "${LIBS}"; then
PRIVATE_LIBS="${LIBS} ${PRIVATE_LIBS}"
Modified: trunk/getdata/src/Makefile.am
===================================================================
--- trunk/getdata/src/Makefile.am 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/Makefile.am 2011-12-28 17:35:32 UTC (rev 640)
@@ -64,14 +64,23 @@
endif
endif
+if USE_ZZIP
if USE_MODULES
+LIBGETDATAZZIP_LA=libgetdatazzip.la
+DLOPEN_LIBGETDATAZZIP_LA=-dlopen libgetdatazzip.la
+else
+ZZIP_C=zzip.c
+endif
+endif
+
+if USE_MODULES
EXPORT_DYNAMIC=-export-dynamic
DGETDATA_MODULEDIR=-DGETDATA_MODULEDIR="\"$(moduledir)\""
else
EXTERNAL_CPPFLAGS=$(SLIM_CPPFLAGS) $(GZIP_CPPFLAGS) $(BZIP2_CPPFLAGS) \
- $(LZMA_CPPFLAGS)
+ $(LZMA_CPPFLAGS) $(ZZIP_CPPFLAGS)
EXTERNAL_LDFLAGS=$(SLIM_LDFLAGS) $(GZIP_LDFLAGS) $(BZIP2_LDFLAGS) \
- $(LZMA_LDFLAGS)
+ $(LZMA_LDFLAGS) $(ZZIP_LDFLAGS)
endif
if INCLUDE_LEGACY_API
@@ -102,7 +111,8 @@
lib_LTLIBRARIES = libgetdata.la
module_LTLIBRARIES = ${LIBGETDATASLIM_LA} ${LIBGETDATAGZIP_LA} \
- ${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA}
+ ${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA} \
+ ${LIBGETDATAZZIP_LA}
libgetdata_la_SOURCES = add.c ascii.c ${BZIP2_C} close.c common.c compat.c \
constant.c ${DEBUG_C} del.c encoding.c endian.c \
entry.c errors.c field_list.c flimits.c flush.c fpos.c \
@@ -110,34 +120,41 @@
include.c ${LEGACY_C} ${LZMA_C} meta_list.c mod.c \
move.c name.c native.c nfields.c nframes.c nmeta.c \
open.c parse.c protect.c putdata.c raw.c sie.c \
- ${SLIM_C} spf.c string.c types.c ${GETDATA_LEGACY_H} \
- internal.h nan.h
+ ${SLIM_C} spf.c string.c types.c ${ZZIP_C} \
+ ${GETDATA_LEGACY_H} internal.h nan.h
libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
-version-info \
${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
$(EXTERNAL_LDFLAGS)
libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
$(DLOPEN_LIBGETDATAGZIP_LA) \
- $(DLOPEN_LIBGETDATABZIP2_LA) $(DLOPEN_LIBGETDATALZMA_LA)
+ $(DLOPEN_LIBGETDATABZIP2_LA) \
+ $(DLOPEN_LIBGETDATALZMA_LA) \
+ $(DLOPEN_LIBGETDATAZZIP_LA)
-libgetdataslim_la_SOURCES = slim.c ${DEBUG_C}
+libgetdataslim_la_SOURCES = slim.c
libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(PACKAGE_VERSION) \
-module
libgetdataslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS)
-libgetdatagzip_la_SOURCES = gzip.c ${DEBUG_C}
+libgetdatagzip_la_SOURCES = gzip.c
libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) -module
libgetdatagzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(GZIP_CPPFLAGS)
-libgetdatabzip2_la_SOURCES = bzip.c ${DEBUG_C}
+libgetdatabzip2_la_SOURCES = bzip.c
libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(PACKAGE_VERSION) \
-module
libgetdatabzip2_la_CPPFLAGS = $(AM_CPPFLAGS) $(BZIP2_CPPFLAGS)
-libgetdatalzma_la_SOURCES = lzma.c ${DEBUG_C}
+libgetdatalzma_la_SOURCES = lzma.c
libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(PACKAGE_VERSION) \
-module
libgetdatalzma_la_CPPFLAGS = $(AM_CPPFLAGS) $(LZMA_CPPFLAGS)
+libgetdatazzip_la_SOURCES = zzip.c
+libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+ -module
+libgetdatazzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+
clean-local:
rm -rf *~ getdata.pc
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/del.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -319,13 +319,15 @@
return -1;
}
- if (!_GD_Supports(D, E, GD_EF_UNLINK)) {
+ if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_UNLINK)) {
free(del_list);
dreturn("%i", -1);
return -1;
}
- if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) {
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ E->e->u.raw.filebase, 0, 0))
+ {
free(del_list);
dreturn("%i", -1);
return -1;
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/encoding.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -32,8 +32,8 @@
#endif
/* encoding schemas */
-#define GD_EF_NULL_SET NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
- &_GD_GenericMove, &_GD_GenericUnlink
+#define GD_EF_NULL_SET &_GD_GenericName, NULL, NULL, NULL, NULL, NULL, \
+ NULL, NULL, &_GD_GenericMove, &_GD_GenericUnlink
#ifdef USE_MODULES
#define GD_EXT_ENCODING(sc,ex,ec,af,ff) \
{ sc,ex,ec,af,ff,GD_EF_PROVIDES,GD_EF_NULL_SET }
@@ -42,8 +42,9 @@
#endif
struct encoding_t _gd_ef[GD_N_SUBENCODINGS] = {
{ GD_UNENCODED, "", GD_EF_ECOR, NULL, "none", 0,
- &_GD_RawOpen, &_GD_RawClose, &_GD_RawSeek, &_GD_RawRead, &_GD_RawSize,
- &_GD_RawWrite, &_GD_RawSync, &_GD_GenericMove, &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_RawOpen, &_GD_RawClose, &_GD_RawSeek, &_GD_RawRead,
+ &_GD_RawSize, &_GD_RawWrite, &_GD_RawSync, &_GD_GenericMove,
+ &_GD_GenericUnlink
},
#ifdef USE_GZIP
@@ -51,8 +52,9 @@
GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE | \
GD_EF_WRITE | GD_EF_SYNC
#define GD_INT_FUNCS \
- &_GD_GzipOpen, &_GD_GzipClose, &_GD_GzipSeek, &_GD_GzipRead, &_GD_GzipSize, \
- &_GD_GzipWrite, &_GD_GzipSync, &_GD_GenericMove, &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_GzipOpen, &_GD_GzipClose, &_GD_GzipSeek, \
+ &_GD_GzipRead, &_GD_GzipSize, &_GD_GzipWrite, &_GD_GzipSync, \
+ &_GD_GenericMove, &_GD_GenericUnlink
#else
#define GD_EF_PROVIDES 0
#define GD_INT_FUNCS GD_EF_NULL_SET
@@ -67,9 +69,9 @@
#define GD_EF_PROVIDES \
GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
#define GD_INT_FUNCS \
- &_GD_Bzip2Open, &_GD_Bzip2Close, &_GD_Bzip2Seek, &_GD_Bzip2Read, \
- &_GD_Bzip2Size, NULL /* WRITE */, NULL /* SYNC */, &_GD_GenericMove, \
- &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_Bzip2Open, &_GD_Bzip2Close, &_GD_Bzip2Seek, \
+ &_GD_Bzip2Read, &_GD_Bzip2Size, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink
#else
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
@@ -83,8 +85,9 @@
#define GD_EF_PROVIDES \
GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
#define GD_INT_FUNCS \
- &_GD_SlimOpen, &_GD_SlimClose, &_GD_SlimSeek, &_GD_SlimRead, &_GD_SlimSize, \
- NULL /* WRITE */, NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_SlimOpen, &_GD_SlimClose, &_GD_SlimSeek, \
+ &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink
#else
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
@@ -98,8 +101,9 @@
#define GD_EF_PROVIDES \
GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
#define GD_INT_FUNCS \
- &_GD_LzmaOpen, &_GD_LzmaClose, &_GD_LzmaSeek, &_GD_LzmaRead, &_GD_LzmaSize, \
- NULL /* WRITE */, NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_LzmaOpen, &_GD_LzmaClose, &_GD_LzmaSeek, \
+ &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink
#else
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
@@ -111,19 +115,36 @@
{ GD_TEXT_ENCODED, ".txt", 0, NULL, "text", 0,
- &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_AsciiSeek, &_GD_AsciiRead,
- &_GD_AsciiSize, &_GD_AsciiWrite, &_GD_AsciiSync, &_GD_GenericMove,
- &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_AsciiSeek,
+ &_GD_AsciiRead, &_GD_AsciiSize, &_GD_AsciiWrite, &_GD_AsciiSync,
+ &_GD_GenericMove, &_GD_GenericUnlink
},
{ GD_SIE_ENCODED, ".sie", GD_EF_ECOR | GD_EF_SWAP, NULL, "sie", 0,
- &_GD_SampIndOpen, &_GD_SampIndClose, &_GD_SampIndSeek, &_GD_SampIndRead,
- &_GD_SampIndSize, &_GD_SampIndWrite, &_GD_SampIndSync, &_GD_GenericMove,
- &_GD_GenericUnlink
+ &_GD_GenericName, &_GD_SampIndOpen, &_GD_SampIndClose, &_GD_SampIndSeek,
+ &_GD_SampIndRead, &_GD_SampIndSize, &_GD_SampIndWrite, &_GD_SampIndSync,
+ &_GD_GenericMove, &_GD_GenericUnlink
},
+
+#ifdef USE_ZZIP
+#define GD_EF_PROVIDES \
+ GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+ &_GD_ZzipName, &_GD_ZzipOpen, &_GD_ZzipClose, &_GD_ZzipSeek, &_GD_ZzipRead, \
+ &_GD_ZzipSize, NULL /* WRITE */, NULL /* SYNC */, &_GD_GenericMove, \
+ &_GD_GenericUnlink
+#else
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
+#endif
+ GD_EXT_ENCODING(GD_ZZIP_ENCODED, NULL, GD_EF_ECOR, "Zzip", "zzip"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
{ GD_ENC_UNSUPPORTED, "", 0, "", "", 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
},
};
@@ -218,6 +239,9 @@
free(library);
/* Try to resolve the symbols */
+ if (_gd_ef[encoding].provides & GD_EF_NAME)
+ _gd_ef[encoding].name = (gd_ef_name_t)_GD_ResolveSymbol(lib,
+ _gd_ef + encoding, "Name");
if (_gd_ef[encoding].provides & GD_EF_OPEN)
_gd_ef[encoding].open = (gd_ef_open_t)_GD_ResolveSymbol(lib,
_gd_ef + encoding, "Open");
@@ -252,6 +276,7 @@
#endif
ret =
+ (funcs & GD_EF_NAME && _gd_ef[encoding].name == NULL) ||
(funcs & GD_EF_OPEN && _gd_ef[encoding].open == NULL) ||
(funcs & GD_EF_CLOSE && _gd_ef[encoding].close == NULL) ||
(funcs & GD_EF_SEEK && _gd_ef[encoding].seek == NULL) ||
@@ -435,7 +460,7 @@
mode &= ~GD_FILE_TOUCH;
if (!(mode & GD_FILE_TEMP)) {
- if (!_GD_Supports(D, E, GD_EF_OPEN | funcs)) {
+ if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_OPEN | funcs)) {
dreturn("%i", 1);
return 1;
}
@@ -476,8 +501,7 @@
if (mode & GD_FILE_TEMP) {
/* create temporary file in file[1] */
- if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, filebase, 1))
- {
+ if ((*enc->name)(D, E->e->u.raw.file + 1, filebase, 1, 0)) {
; /* error already set */
} else if ((temp_fd = _GD_MakeTempFile(D, D->fragment[fragment].dirfd,
E->e->u.raw.file[1].name)) < 0)
@@ -500,7 +524,7 @@
if (oop_write) {
/* an out-of-place write requires us to open a temporary file and pass
* in its fd */
- if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, filebase, 1)) {
+ if ((*enc->name)(D, E->e->u.raw.file + 1, filebase, 1, 0)) {
dreturn("%i", 1);
return 1;
} else if ((temp_fd = _GD_MakeTempFile(D,
@@ -521,7 +545,7 @@
/* open a regular file, if necessary */
if (E->e->u.raw.file[0].idata < 0) {
- if (_GD_SetEncodedName(D, E->e->u.raw.file, filebase, 0)) {
+ if ((*enc->name)(D, E->e->u.raw.file, filebase, 0, 0)) {
dreturn("%i", 1);
return 1;
} else if ((*enc->open)(D->fragment[E->fragment_index].dirfd,
@@ -545,9 +569,8 @@
}
/* Figure out the encoding scheme */
-static unsigned long _GD_ResolveEncoding(const DIRFILE *D gd_unused_d,
- const char* name, unsigned long scheme, int dirfd,
- struct _gd_raw_file *file)
+static unsigned long _GD_ResolveEncoding(DIRFILE *D, const char* name,
+ unsigned long scheme, int dirfd, struct _gd_raw_file *file)
{
char *candidate;
int i;
@@ -558,20 +581,32 @@
for (i = 0; _gd_ef[i].scheme != GD_ENC_UNSUPPORTED; i++) {
if (scheme == GD_AUTO_ENCODED || scheme == _gd_ef[i].scheme) {
- candidate = (char *)malloc(len + strlen(_gd_ef[i].ext) + 1);
- if (candidate) {
+ if (_gd_ef[i].ext) {
+ candidate = (char *)malloc(len + strlen(_gd_ef[i].ext) + 1);
+ if (!candidate)
+ continue;
+
strcat(strcpy(candidate, name), _gd_ef[i].ext);
+ } else {
+ if (_GD_MissingFramework(i, GD_EF_NAME))
+ continue;
- if (gd_StatAt(D, dirfd, candidate, &statbuf, 0) == 0)
- if (S_ISREG(statbuf.st_mode)) {
- if (file != NULL)
- file->subenc = i;
- free(candidate);
- dreturn("%08lx", _gd_ef[i].scheme);
- return _gd_ef[i].scheme;
- }
- free(candidate);
+ if ((*_gd_ef[i].name)(D, file, name, 0, 1))
+ continue;
+
+ candidate = file->name;
+ file->name = NULL;
}
+
+ if (gd_StatAt(D, dirfd, candidate, &statbuf, 0) == 0)
+ if (S_ISREG(statbuf.st_mode)) {
+ if (file != NULL)
+ file->subenc = i;
+ free(candidate);
+ dreturn("%08lx", _gd_ef[i].scheme);
+ return _gd_ef[i].scheme;
+ }
+ free(candidate);
}
}
@@ -623,10 +658,10 @@
return 1;
}
-int _GD_SetEncodedName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
- int temp)
+int _GD_GenericName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
+ int temp, int resolv __gd_unused)
{
- dtrace("%p, %p, \"%s\", %i", D, file, base, temp);
+ dtrace("%p, %p, \"%s\", %i, <unused>", D, file, base, temp);
if (file->name == NULL) {
file->D = D;
@@ -706,8 +741,8 @@
/* discard the old file */
_GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_DISCARD);
- if (_GD_SetEncodedName(D, raw_entry[i]->e->u.raw.file,
- raw_entry[i]->e->u.raw.filebase, 0))
+ if ((*_gd_ef[temp.subenc].name)(D, raw_entry[i]->e->u.raw.file,
+ raw_entry[i]->e->u.raw.filebase, 0, 0))
{
raw_entry[i]->e->u.raw.file[0].name = temp.name;
raw_entry[i]->e->u.raw.file[0].subenc = temp.subenc;
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/entry.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -322,7 +322,7 @@
if (E->e->u.raw.file[0].name == NULL) {
/* ensure encoding sybtype is known */
- if (!_GD_Supports(D, E, 0)) {
+ if (!_GD_Supports(D, E, GD_EF_NAME)) {
dreturn("%p", NULL);
return NULL;
}
@@ -331,7 +331,8 @@
_GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET, NULL, 0, NULL);
dreturn("%p", NULL);
return NULL;
- } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
+ } else if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ E->e->u.raw.filebase, 0, 0))
{
dreturn("%p", NULL);
return NULL;
Modified: trunk/getdata/src/flimits.c
===================================================================
--- trunk/getdata/src/flimits.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/flimits.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -188,11 +188,14 @@
*is_index = 0;
switch (E->field_type) {
case GD_RAW_ENTRY:
- if (!_GD_Supports(D, E, GD_EF_SIZE))
+ if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_SIZE))
break;
- if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ E->e->u.raw.filebase, 0, 0))
+ {
break;
+ }
ns = (*_gd_ef[E->e->u.raw.file[0].subenc].size)(
D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/getdata.h.in 2011-12-28 17:35:32 UTC (rev 640)
@@ -440,6 +440,7 @@
#define GD_BZIP2_ENCODED 0x05000000 /* Data are bzip2 encoded */
#define GD_LZMA_ENCODED 0x06000000 /* Data are xz encoded */
#define GD_SIE_ENCODED 0x07000000 /* Data are sample index encoded */
+#define GD_ZZIP_ENCODED 0x08000000 /* Data are zzip encoded */
#define GD_ENC_UNSUPPORTED GD_ENCODING /* Encoding unsupported */
/* delete flags */
Modified: trunk/getdata/src/gzip.c
===================================================================
--- trunk/getdata/src/gzip.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/gzip.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -41,7 +41,7 @@
unsigned int mode)
{
const char *gzmode = "w";
- dtrace("%i, %p, <unused>, %u", fd, file, mode);
+ dtrace("%i, %p, <unused>, 0x%X", fd, file, mode);
if (mode & GD_FILE_READ) {
file->idata = gd_OpenAt(file->D, fd, file->name, O_RDONLY | O_BINARY, 0666);
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/internal.h 2011-12-28 17:35:32 UTC (rev 640)
@@ -728,12 +728,14 @@
#define GD_ENC_LZMA_RAW 5
#define GD_ENC_XZ_RAW 6
#define GD_ENC_SIE 7
-#define GD_ENC_UNKNOWN 8
+#define GD_ENC_ZZIP 8
+#define GD_ENC_UNKNOWN 9
#define GD_N_SUBENCODINGS (GD_ENC_UNKNOWN + 1)
-#define GD_EF_OPEN 0x0001
-#define GD_EF_CLOSE 0x0002
+#define GD_EF_NAME 0x0001
+#define GD_EF_OPEN 0x0002
+#define GD_EF_CLOSE 0x0004
#define GD_EF_SEEK 0x0008
#define GD_EF_READ 0x0010
#define GD_EF_SIZE 0x0020
@@ -755,6 +757,8 @@
# define SCREWY_FLOATS
#endif
+typedef int (*gd_ef_name_t)(DIRFILE *D, struct _gd_raw_file*, const char*, int,
+ int);
typedef int (*gd_ef_open_t)(int, struct _gd_raw_file*, int, unsigned int);
typedef off64_t (*gd_ef_seek_t)(struct _gd_raw_file*, off64_t, gd_type_t,
unsigned int);
@@ -779,6 +783,7 @@
const char* affix;
const char* ffname;
unsigned int provides;
+ gd_ef_name_t name;
gd_ef_open_t open;
gd_ef_close_t close;
gd_ef_seek_t seek;
@@ -959,6 +964,7 @@
void _GD_Flush(DIRFILE* D, gd_entry_t *E, int);
void _GD_FlushMeta(DIRFILE* D, int fragment, int force);
void _GD_FreeE(DIRFILE *D, gd_entry_t* E, int priv);
+int _GD_GenericName(DIRFILE*, struct _gd_raw_file*, const char*, int, int);
off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
int *is_index);
off64_t _GD_GetFilePos(DIRFILE *D, gd_entry_t *E, off64_t index_pos);
@@ -1004,8 +1010,6 @@
char *_GD_ParseFragment(FILE*, DIRFILE*, int, int*, unsigned long int*, int);
void _GD_ReadLinterpFile(DIRFILE* D, gd_entry_t *E);
void _GD_ReleaseDir(DIRFILE *D, int dirfd);
-int _GD_SetEncodedName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
- int temp);
void _GD_SetError(DIRFILE* D, int error, int suberror, const char* format_file,
int line, const char* token);
int _GD_SetTablePath(DIRFILE *D, gd_entry_t *E, struct _gd_private_entry *e);
@@ -1109,6 +1113,16 @@
off64_t _GD_SampIndSize(int, struct _gd_raw_file* file, gd_type_t data_type,
int swap);
+/* zzip I/O methods */
+int _GD_ZzipOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
+off64_t _GD_ZzipSeek(struct _gd_raw_file* file, off64_t count,
+ gd_type_t data_type, unsigned int);
+ssize_t _GD_ZzipRead(struct _gd_raw_file* file, void *ptr, gd_type_t data_type,
+ size_t nmemb);
+int _GD_ZzipClose(struct _gd_raw_file* file);
+off64_t _GD_ZzipSize(int, struct _gd_raw_file* file, gd_type_t data_type,
+ int swap);
+
/* allocation boilerplates */
_gd_static_inline void *_GD_Malloc(DIRFILE *D, size_t size)
{
Modified: trunk/getdata/src/move.c
===================================================================
--- trunk/getdata/src/move.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/move.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -82,8 +82,8 @@
}
/* input encoding check */
- if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ
- | GD_EF_UNLINK))
+ if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK |
+ GD_EF_READ | GD_EF_UNLINK))
{
free(new_filebase);
dreturn("%i", -1);
@@ -243,7 +243,9 @@
E->e->u.raw.file[0].name = NULL;
E->e->u.raw.file[0].subenc = subencoding;
- if (_GD_SetEncodedName(D, E->e->u.raw.file, new_filebase, 0)) {
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ new_filebase, 0, 0))
+ {
E->e->u.raw.file[0].name = temp.name;
E->e->u.raw.file[0].subenc = temp.subenc;
} else if (_GD_FiniRawIO(D, E, new_fragment, GD_FINIRAW_KEEP |
Modified: trunk/getdata/src/name.c
===================================================================
--- trunk/getdata/src/name.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/name.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -497,7 +497,7 @@
return -1;
}
- if (!_GD_Supports(D, E, GD_EF_MOVE)) {
+ if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_MOVE)) {
free(name);
free(filebase);
dreturn("%i", -1);
@@ -506,14 +506,16 @@
memcpy(&temp, E->e->u.raw.file, sizeof(struct _gd_raw_file));
temp.name = NULL;
- if (_GD_SetEncodedName(D, &temp, filebase, 0)) {
+ if ((*_gd_ef[temp.subenc].name)(D, &temp, filebase, 0, 0)) {
free(name);
free(filebase);
dreturn("%i", -1);
return -1;
}
- if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) {
+ if ((*_gd_ef[temp.subenc].name)(D, E->e->u.raw.file, E->e->u.raw.filebase,
+ 0, 0))
+ {
free(name);
free(filebase);
dreturn("%i", -1);
Modified: trunk/getdata/src/nframes.c
===================================================================
--- trunk/getdata/src/nframes.c 2011-12-27 06:37:42 UTC (rev 639)
+++ trunk/getdata/src/nframes.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -41,13 +41,14 @@
return 0;
}
- if (!_GD_Supports(D, D->reference_field, GD_EF_SIZE)) {
+ if (!_GD_Supports(D, D->reference_field, GD_EF_NAME | GD_EF_SIZE)) {
dreturn("%i", 0);
return 0;
}
- if (_GD_SetEncodedName(D, D->reference_field->e->u.raw.file,
- D->reference_field->e->u.raw.filebase, 0))
+ if ((*_gd_ef[D->reference_field->e->u.raw.file[0].subenc].name)(D,
+ D->reference_field->e->u.raw.file,
+ D->reference_field->e->u.raw.filebase, 0, 0))
{
dreturn("%i", 0);
return 0;
Added: trunk/getdata/src/zzip.c
===================================================================
--- trunk/getdata/src/zzip.c (rev 0)
+++ trunk/getdata/src/zzip.c 2011-12-28 17:35:32 UTC (rev 640)
@@ -0,0 +1,204 @@
+/* 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
+ */
+#include "internal.h"
+
+#ifdef HAVE_ZZIP_LIB_H
+#include <zzip/lib.h>
+#endif
+
+#ifdef USE_MODULES
+#define _GD_ZzipName libgetdatazzip_LTX_GD_ZzipName
+#define _GD_ZzipOpen libgetdatazzip_LTX_GD_ZzipOpen
+#define _GD_ZzipSeek libgetdatazzip_LTX_GD_ZzipSeek
+#define _GD_ZzipRead libgetdatazzip_LTX_GD_ZzipRead
+#define _GD_ZzipClose libgetdatazzip_LTX_GD_ZzipClose
+#define _GD_ZzipSize libgetdatazzip_LTX_GD_ZzipSize
+#endif
+
+/* The zzip encoding scheme looks just like the regular ol' C IO. */
+
+int _GD_ZzipName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
+ int temp __gd_unused, int resolv)
+{
+ dtrace("%p, %p, \"%s\", <unused>, %i", D, file, base, resolv);
+
+ if (resolv) {
+ free(file->name);
+ file->name = strdup("raw.zip");
+ dreturn("%i", (file->name == NULL) ? -1 : 0);
+ return (file->name == NULL) ? -1 : 0;
+ }
+
+ if (file->name == NULL) {
+ file->D = D;
+ file->name = (char *)malloc(strlen(base) + 5);
+ if (file->name == NULL) {
+ _GD_SetError(D, GD...
[truncated message content] |
|
From: <ket...@us...> - 2011-12-28 20:10:12
|
Revision: 641
http://getdata.svn.sourceforge.net/getdata/?rev=641&view=rev
Author: ketiltrout
Date: 2011-12-28 20:10:05 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
Add an optional second parameter to /ECODING to specify the name of the archive for the zzip encoding.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/close.c
trunk/getdata/src/del.c
trunk/getdata/src/encoding.c
trunk/getdata/src/entry.c
trunk/getdata/src/flimits.c
trunk/getdata/src/include.c
trunk/getdata/src/internal.h
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/nframes.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/src/zzip.c
trunk/getdata/test/Makefile.am
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/ChangeLog 2011-12-28 20:10:05 UTC (rev 641)
@@ -1,4 +1,13 @@
2011-12-29 D. V. Wiebe <ge...@ke...> svn:640
+ * src/internal.h src/encoding.c (_GD_GenericName): Added fragment->enc_data.
+ Pass enc_data to gd_ef->name. Flag encodings that use enc_data with
+ GD_EF_EDAT.
+ * src/parse.c (_GD_ParseDirective): Allow an optional second parameter to
+ /ENCODING of encoding-specific data.
+ * src/entry.c (_GD_ResolveEncoding): Pass in enc_data.
+ * src/zzip.c (_GD_ZzipName): Use enc_data to specify archive name.
+
+2011-12-29 D. V. Wiebe <ge...@ke...> svn:640
* configure.ac: zzip encoding check.
* src/getdata.h.in src/internal.h: GD_ZZIP_ENCODED / GD_ENC_ZZIP; Added name
to encoding_t.
Modified: trunk/getdata/src/close.c
===================================================================
--- trunk/getdata/src/close.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/close.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -33,6 +33,7 @@
_GD_FreeE(D, D->entry[i], 1);
for (j = 0; j < D->n_fragment; ++j) {
+ free(D->fragment[j].enc_data);
free(D->fragment[j].prefix);
free(D->fragment[j].suffix);
free(D->fragment[j].bname);
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/del.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -325,7 +325,8 @@
return -1;
}
- if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D,
+ D->fragment[E->fragment_index].enc_data, E->e->u.raw.file,
E->e->u.raw.filebase, 0, 0))
{
free(del_list);
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/encoding.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -138,7 +138,8 @@
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
#endif
- GD_EXT_ENCODING(GD_ZZIP_ENCODED, NULL, GD_EF_ECOR, "Zzip", "zzip"),
+ GD_EXT_ENCODING(GD_ZZIP_ENCODED, NULL, GD_EF_ECOR | GD_EF_EDAT, "Zzip",
+ "zzip"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -501,7 +502,9 @@
if (mode & GD_FILE_TEMP) {
/* create temporary file in file[1] */
- if ((*enc->name)(D, E->e->u.raw.file + 1, filebase, 1, 0)) {
+ if ((*enc->name)(D, D->fragment[E->fragment_index].enc_data,
+ E->e->u.raw.file + 1, filebase, 1, 0))
+ {
; /* error already set */
} else if ((temp_fd = _GD_MakeTempFile(D, D->fragment[fragment].dirfd,
E->e->u.raw.file[1].name)) < 0)
@@ -524,7 +527,9 @@
if (oop_write) {
/* an out-of-place write requires us to open a temporary file and pass
* in its fd */
- if ((*enc->name)(D, E->e->u.raw.file + 1, filebase, 1, 0)) {
+ if ((*enc->name)(D, D->fragment[E->fragment_index].enc_data,
+ E->e->u.raw.file + 1, filebase, 1, 0))
+ {
dreturn("%i", 1);
return 1;
} else if ((temp_fd = _GD_MakeTempFile(D,
@@ -545,7 +550,9 @@
/* open a regular file, if necessary */
if (E->e->u.raw.file[0].idata < 0) {
- if ((*enc->name)(D, E->e->u.raw.file, filebase, 0, 0)) {
+ if ((*enc->name)(D, D->fragment[E->fragment_index].enc_data,
+ E->e->u.raw.file, filebase, 0, 0))
+ {
dreturn("%i", 1);
return 1;
} else if ((*enc->open)(D->fragment[E->fragment_index].dirfd,
@@ -570,14 +577,16 @@
/* Figure out the encoding scheme */
static unsigned long _GD_ResolveEncoding(DIRFILE *D, const char* name,
- unsigned long scheme, int dirfd, struct _gd_raw_file *file)
+ const char *enc_data, unsigned long scheme, int dirfd,
+ struct _gd_raw_file *file)
{
char *candidate;
int i;
const size_t len = strlen(name);
struct stat statbuf;
- dtrace("%p, \"%s\", 0x%08lx, %i, %p", D, name, scheme, dirfd, file);
+ dtrace("%p, \"%s\", \"%s\", 0x%08lx, %i, %p", D, name, enc_data, scheme,
+ dirfd, file);
for (i = 0; _gd_ef[i].scheme != GD_ENC_UNSUPPORTED; i++) {
if (scheme == GD_AUTO_ENCODED || scheme == _gd_ef[i].scheme) {
@@ -591,7 +600,7 @@
if (_GD_MissingFramework(i, GD_EF_NAME))
continue;
- if ((*_gd_ef[i].name)(D, file, name, 0, 1))
+ if ((*_gd_ef[i].name)(D, enc_data, file, name, 0, 1))
continue;
candidate = file->name;
@@ -630,7 +639,8 @@
/* Figure out the dirfile encoding type, if required */
if (D->fragment[E->fragment_index].encoding == GD_AUTO_ENCODED) {
D->fragment[E->fragment_index].encoding =
- _GD_ResolveEncoding(D, E->e->u.raw.filebase, GD_AUTO_ENCODED,
+ _GD_ResolveEncoding(D, E->e->u.raw.filebase,
+ D->fragment[E->fragment_index].enc_data, GD_AUTO_ENCODED,
D->fragment[E->fragment_index].dirfd, E->e->u.raw.file);
}
@@ -644,6 +654,7 @@
/* Figure out the encoding subtype, if required */
if (E->e->u.raw.file[0].subenc == GD_ENC_UNKNOWN)
_GD_ResolveEncoding(D, E->e->u.raw.filebase,
+ D->fragment[E->fragment_index].enc_data,
D->fragment[E->fragment_index].encoding,
D->fragment[E->fragment_index].dirfd, E->e->u.raw.file);
@@ -658,10 +669,11 @@
return 1;
}
-int _GD_GenericName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
- int temp, int resolv __gd_unused)
+int _GD_GenericName(DIRFILE* D, const char *enc_data __gd_unused,
+ struct _gd_raw_file* file, const char* base, int temp,
+ int resolv __gd_unused)
{
- dtrace("%p, %p, \"%s\", %i, <unused>", D, file, base, temp);
+ dtrace("%p, <unused>, %p, \"%s\", %i, <unused>", D, file, base, temp);
if (file->name == NULL) {
file->D = D;
@@ -680,6 +692,7 @@
return 0;
}
+/* This function assumes that the new encoding has no fragment->enc_data. */
static void _GD_RecodeFragment(DIRFILE* D, unsigned long encoding, int fragment,
int move)
{
@@ -741,8 +754,10 @@
/* discard the old file */
_GD_FiniRawIO(D, raw_entry[i], fragment, GD_FINIRAW_DISCARD);
- if ((*_gd_ef[temp.subenc].name)(D, raw_entry[i]->e->u.raw.file,
- raw_entry[i]->e->u.raw.filebase, 0, 0))
+ if ((*_gd_ef[temp.subenc].name)(D,
+ D->fragment[raw_entry[i]->fragment_index].enc_data,
+ raw_entry[i]->e->u.raw.file, raw_entry[i]->e->u.raw.filebase, 0,
+ 0))
{
raw_entry[i]->e->u.raw.file[0].name = temp.name;
raw_entry[i]->e->u.raw.file[0].subenc = temp.subenc;
@@ -788,6 +803,8 @@
}
}
+ free(D->fragment[fragment].enc_data);
+ D->fragment[fragment].enc_data = NULL;
D->fragment[fragment].encoding = encoding;
D->fragment[fragment].modified = 1;
D->flags &= ~GD_HAVE_VERSION;
@@ -872,8 +889,8 @@
{
D->fragment[fragment].encoding =
_GD_ResolveEncoding(D, D->entry[i]->e->u.raw.filebase,
- GD_AUTO_ENCODED, D->fragment[fragment].dirfd,
- D->entry[i]->e->u.raw.file);
+ D->fragment[fragment].enc_data, GD_AUTO_ENCODED,
+ D->fragment[fragment].dirfd, D->entry[i]->e->u.raw.file);
if (D->fragment[fragment].encoding != GD_AUTO_ENCODED)
break;
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/entry.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -331,7 +331,8 @@
_GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET, NULL, 0, NULL);
dreturn("%p", NULL);
return NULL;
- } else if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ } else if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D,
+ D->fragment[E->fragment_index].enc_data, E->e->u.raw.file,
E->e->u.raw.filebase, 0, 0))
{
dreturn("%p", NULL);
Modified: trunk/getdata/src/flimits.c
===================================================================
--- trunk/getdata/src/flimits.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/flimits.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -191,7 +191,8 @@
if (!_GD_Supports(D, E, GD_EF_NAME | GD_EF_SIZE))
break;
- if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D,
+ D->fragment[E->fragment_index].enc_data, E->e->u.raw.file,
E->e->u.raw.filebase, 0, 0))
{
break;
Modified: trunk/getdata/src/include.c
===================================================================
--- trunk/getdata/src/include.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/include.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -208,6 +208,7 @@
D->fragment[D->n_fragment - 1].bname = base;
D->fragment[D->n_fragment - 1].cname = temp_buf1;
D->fragment[D->n_fragment - 1].ename = _GD_Strdup(D, ename);
+ D->fragment[D->n_fragment - 1].enc_data = NULL;
D->fragment[D->n_fragment - 1].modified = 0;
D->fragment[D->n_fragment - 1].parent = me;
D->fragment[D->n_fragment - 1].dirfd = dirfd;
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/internal.h 2011-12-28 20:10:05 UTC (rev 641)
@@ -757,8 +757,8 @@
# define SCREWY_FLOATS
#endif
-typedef int (*gd_ef_name_t)(DIRFILE *D, struct _gd_raw_file*, const char*, int,
- int);
+typedef int (*gd_ef_name_t)(DIRFILE *D, const char *, struct _gd_raw_file*,
+ const char*, int, int);
typedef int (*gd_ef_open_t)(int, struct _gd_raw_file*, int, unsigned int);
typedef off64_t (*gd_ef_seek_t)(struct _gd_raw_file*, off64_t, gd_type_t,
unsigned int);
@@ -775,6 +775,7 @@
#define GD_EF_ECOR 0x1 /* post-framework byte-sex correction required */
#define GD_EF_SWAP 0x2 /* in-framework byte-sex metadata correction required */
#define GD_EF_OOP 0x4 /* writes occur out-of-place */
+#define GD_EF_EDAT 0x8 /* The /ENCODING datum is used */
/* Encoding schemes */
extern struct encoding_t {
unsigned long int scheme;
@@ -805,6 +806,7 @@
char *bname;
/* External name (the one that appears in the format file) */
char* ename;
+ void *enc_data;
int modified;
int parent;
int dirfd;
@@ -964,7 +966,6 @@
void _GD_Flush(DIRFILE* D, gd_entry_t *E, int);
void _GD_FlushMeta(DIRFILE* D, int fragment, int force);
void _GD_FreeE(DIRFILE *D, gd_entry_t* E, int priv);
-int _GD_GenericName(DIRFILE*, struct _gd_raw_file*, const char*, int, int);
off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
int *is_index);
off64_t _GD_GetFilePos(DIRFILE *D, gd_entry_t *E, off64_t index_pos);
@@ -1027,6 +1028,8 @@
/* generic I/O methods */
int _GD_GenericMove(int, struct _gd_raw_file* file, int, char* new_path);
+int _GD_GenericName(DIRFILE*, const char *, struct _gd_raw_file*, const char*,
+ int, int);
int _GD_GenericUnlink(int, struct _gd_raw_file* file);
/* unencoded I/O methods */
Modified: trunk/getdata/src/move.c
===================================================================
--- trunk/getdata/src/move.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/move.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -243,7 +243,8 @@
E->e->u.raw.file[0].name = NULL;
E->e->u.raw.file[0].subenc = subencoding;
- if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D, E->e->u.raw.file,
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].name)(D,
+ D->fragment[E->fragment_index].enc_data, E->e->u.raw.file,
new_filebase, 0, 0))
{
E->e->u.raw.file[0].name = temp.name;
Modified: trunk/getdata/src/name.c
===================================================================
--- trunk/getdata/src/name.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/name.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -506,15 +506,18 @@
memcpy(&temp, E->e->u.raw.file, sizeof(struct _gd_raw_file));
temp.name = NULL;
- if ((*_gd_ef[temp.subenc].name)(D, &temp, filebase, 0, 0)) {
+ if ((*_gd_ef[temp.subenc].name)(D,
+ D->fragment[E->fragment_index].enc_data, &temp, filebase, 0, 0))
+ {
free(name);
free(filebase);
dreturn("%i", -1);
return -1;
}
- if ((*_gd_ef[temp.subenc].name)(D, E->e->u.raw.file, E->e->u.raw.filebase,
- 0, 0))
+ if ((*_gd_ef[temp.subenc].name)(D,
+ D->fragment[E->fragment_index].enc_data, E->e->u.raw.file,
+ E->e->u.raw.filebase, 0, 0))
{
free(name);
free(filebase);
Modified: trunk/getdata/src/nframes.c
===================================================================
--- trunk/getdata/src/nframes.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/nframes.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -47,6 +47,7 @@
}
if ((*_gd_ef[D->reference_field->e->u.raw.file[0].subenc].name)(D,
+ D->fragment[D->reference_field->fragment_index].enc_data,
D->reference_field->e->u.raw.file,
D->reference_field->e->u.raw.filebase, 0, 0))
{
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/open.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -418,6 +418,7 @@
D->fragment[0].sname = NULL;
/* The root format file needs no external name */
D->fragment[0].ename = NULL;
+ D->fragment[0].enc_data = NULL;
D->fragment[0].modified = 0;
D->fragment[0].parent = -1;
D->fragment[0].dirfd = D->dir[0].fd;
Modified: trunk/getdata/src/parse.c
===================================================================
--- trunk/getdata/src/parse.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/parse.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -1929,6 +1929,11 @@
for (i = 0; i < GD_N_SUBENCODINGS - 1; ++i)
if (strcmp(in_cols[1], _gd_ef[i].ffname) == 0) {
D->fragment[me].encoding = _gd_ef[i].scheme;
+ free(D->fragment[me].enc_data);
+ if (n_cols > 2 && _gd_ef[i].flags & GD_EF_EDAT)
+ D->fragment[me].enc_data = _GD_Strdup(D, in_cols[2]);
+ else
+ D->fragment[me].enc_data = NULL;
break;
}
}
Modified: trunk/getdata/src/zzip.c
===================================================================
--- trunk/getdata/src/zzip.c 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/src/zzip.c 2011-12-28 20:10:05 UTC (rev 641)
@@ -35,29 +35,46 @@
/* The zzip encoding scheme looks just like the regular ol' C IO. */
-int _GD_ZzipName(DIRFILE* D, struct _gd_raw_file* file, const char* base,
- int temp __gd_unused, int resolv)
+int _GD_ZzipName(DIRFILE* D, const char *enc_data, struct _gd_raw_file* file,
+ const char* base, int temp __gd_unused, int resolv)
{
- dtrace("%p, %p, \"%s\", <unused>, %i", D, file, base, resolv);
+ size_t enc_len;
+
+ dtrace("%p, \"%s\", %p, \"%s\", <unused>, %i", D, enc_data, file, base,
+ resolv);
+
+ if (enc_data == NULL)
+ enc_data = "raw";
+
+ enc_len = strlen(enc_data);
if (resolv) {
free(file->name);
- file->name = strdup("raw.zip");
- dreturn("%i", (file->name == NULL) ? -1 : 0);
- return (file->name == NULL) ? -1 : 0;
+ file->name = (char*)malloc(enc_len + 5);
+ if (file->name == NULL) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ strcpy(file->name, enc_data);
+ strcpy(file->name + enc_len, ".zip");
+
+ dreturn("%i (%s)", 0, file->name);
+ return 0;
}
if (file->name == NULL) {
file->D = D;
- file->name = (char *)malloc(strlen(base) + 5);
+ file->name = (char *)malloc(strlen(base) + strlen(enc_data) + 2);
if (file->name == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
- strcpy(file->name, "raw/");
- strcpy(file->name + 4, base);
+ strcpy(file->name, enc_data);
+ file->name[enc_len] = '/';
+ strcpy(file->name + enc_len + 1, base);
}
dreturn("%i (%s)", 0, file->name);
Modified: trunk/getdata/test/Makefile.am
===================================================================
--- trunk/getdata/test/Makefile.am 2011-12-28 17:35:32 UTC (rev 640)
+++ trunk/getdata/test/Makefile.am 2011-12-28 20:10:05 UTC (rev 641)
@@ -343,7 +343,7 @@
XZ_TESTS=xz_get xz_nframes
-ZZIP_TESTS=zzip_get zzip_get_get zzip_nframes
+ZZIP_TESTS=zzip_data zzip_get zzip_get_get zzip_nframes
TESTS=$(ADD_TESTS) $(ALIAS_TESTS) $(ALTER_TESTS) $(ASCII_TESTS) \
$(BOF_TESTS) $(BZIP_TESTS) $(CLOSE_TESTS) $(CONVERT_TESTS) \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-12-28 20:12:01
|
Revision: 642
http://getdata.svn.sourceforge.net/getdata/?rev=642&view=rev
Author: ketiltrout
Date: 2011-12-28 20:11:54 +0000 (Wed, 28 Dec 2011)
Log Message:
-----------
Add test.
Modified Paths:
--------------
trunk/getdata/ChangeLog
Added Paths:
-----------
trunk/getdata/test/zzip_data.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-28 20:10:05 UTC (rev 641)
+++ trunk/getdata/ChangeLog 2011-12-28 20:11:54 UTC (rev 642)
@@ -1,4 +1,4 @@
-2011-12-29 D. V. Wiebe <ge...@ke...> svn:640
+2011-12-29 D. V. Wiebe <ge...@ke...> svn:641
* src/internal.h src/encoding.c (_GD_GenericName): Added fragment->enc_data.
Pass enc_data to gd_ef->name. Flag encodings that use enc_data with
GD_EF_EDAT.
Property changes on: trunk/getdata/test
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
add_type
add_window
add_window_op
alias_list
alias_list_alias
alias_list_missing
alias_num
alias_num_alias
alias_num_missing
alias_target
alias_target_alias
alias_target_missing
alter_bit_bitnum
alter_bit_numbits
alter_carray_len
alter_carray_type
alter_const
alter_cpolynom
alter_crecip
alter_crecip89
alter_crecip_zero
alter_divide
alter_entry
alter_entry_affix
alter_entry_hidden
alter_entry_recode
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
alter_lincom_23
alter_lincom_32
alter_lincom_input
alter_lincom_offset
alter_lincom_slope
alter_linterp
alter_linterp_move
alter_mspec
alter_mspec_affix
alter_multiply
alter_phase
alter_polynom_coeff
alter_polynom_input
alter_polynom_ord
alter_raw_spf
alter_raw_type
alter_recip
alter_recip_zero
alter_spec
alter_spec_affix
alter_spec_meta
alter_window
ascii_add
ascii_get
ascii_get_get
ascii_nframes
ascii_put
bof
bof_lincom
bof_phase
bzip_get
bzip_get_get
bzip_move_from
bzip_nframes
bzip_put
close
close_bad
close_discard
close_null
convert_complex128_complex64
convert_complex128_float64
convert_complex128_int64
convert_complex128_uint64
convert_complex64_complex128
convert_complex64_float64
convert_complex64_int64
convert_complex64_uint64
convert_float32_complex128
convert_float32_complex64
convert_float32_float64
convert_float32_int16
convert_float32_int32
convert_float32_int64
convert_float32_int8
convert_float32_uint16
convert_float32_uint32
convert_float32_uint64
convert_float32_uint8
convert_float64_complex128
convert_float64_complex64
convert_float64_float32
convert_float64_int16
convert_float64_int32
convert_float64_int64
convert_float64_int8
convert_float64_uint16
convert_float64_uint32
convert_float64_uint64
convert_float64_uint8
convert_int16_complex128
convert_int16_complex64
convert_int16_float32
convert_int16_float64
convert_int16_int32
convert_int16_int64
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_uint64
convert_int16_uint8
convert_int32_complex128
convert_int32_complex64
convert_int32_float32
convert_int32_float64
convert_int32_int16
convert_int32_int64
convert_int32_int8
convert_int32_uint16
convert_int32_uint32
convert_int32_uint64
convert_int32_uint8
convert_int64_complex128
convert_int64_complex64
convert_int64_float32
convert_int64_float64
convert_int64_int16
convert_int64_int32
convert_int64_int8
convert_int64_uint16
convert_int64_uint32
convert_int64_uint64
convert_int64_uint8
convert_int8_complex128
convert_int8_complex64
convert_int8_float32
convert_int8_float64
convert_int8_int16
convert_int8_int32
convert_int8_int64
convert_int8_uint16
convert_int8_uint32
convert_int8_uint64
convert_int8_uint8
convert_uint16_complex128
convert_uint16_complex64
convert_uint16_float32
convert_uint16_float64
convert_uint16_int16
convert_uint16_int32
convert_uint16_int64
convert_uint16_int8
convert_uint16_uint32
convert_uint16_uint64
convert_uint16_uint8
convert_uint32_complex128
convert_uint32_complex64
convert_uint32_float32
convert_uint32_float64
convert_uint32_int16
convert_uint32_int32
convert_uint32_int64
convert_uint32_int8
convert_uint32_uint16
convert_uint32_uint64
convert_uint32_uint8
convert_uint64_complex128
convert_uint64_complex64
convert_uint64_float32
convert_uint64_float64
convert_uint64_int16
convert_uint64_int32
convert_uint64_int64
convert_uint64_int8
convert_uint64_uint16
convert_uint64_uint32
convert_uint64_uint8
convert_uint8_complex128
convert_uint8_complex64
convert_uint8_float32
convert_uint8_float64
convert_uint8_int16
convert_uint8_int32
convert_uint8_int64
convert_uint8_int8
convert_uint8_uint16
convert_uint8_uint32
convert_uint8_uint64
creat
creat_excl
creat_rdonly
cvlist
cvlist_array
cvlist_array_hidden
cvlist_array_meta
cvlist_array_meta_hidden
cvlist_hidden
cvlist_invalid
cvlist_meta
cvlist_meta_hidden
cvlist_meta_invalid
del
del_carray
del_carray_deref
del_const
del_const_deref
del_const_force
del_data
del_derived
del_derived_after
del_derived_force
del_meta
del_meta_force
dfes_bit
dfes_divide
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_recip
dfes_zero
encode_alter
encode_get
encode_move
endian_alter
endian_alter_sie
endian_get
endian_move
entry_bad_code
entry_bit
entry_bit_scalar
entry_divide
entry_invalid
entry_lincom
entry_lincom_scalar
entry_linterp
entry_multiply
entry_phase
entry_phase_scalar
entry_polynom
entry_polynom_scalar
entry_raw
entry_raw_scalar
entry_raw_scalar_code
entry_raw_scalar_type
entry_recip
entry_scalar_repr
entry_type
entry_type_alias
entry_window
entry_window_scalar
eof
eof_index
eof_lincom
eof_phase
error
error_error
error_num
error_short
file
file_code
file_type
flist
flist_hidden
flist_invalid
flist_meta
flist_meta_hidden
flist_meta_invalid
flist_type
flist_type_hidden
flist_type_invalid
flist_type_meta
flist_type_meta_hidden
flist_type_meta_invalid
flush
flush_all
flush_bad_code
flush_invalid
flush_meta
flush_spec
foffs_alter
foffs_get
foffs_move
fragment_affix
fragment_affix_alter
fragment_affix_alter2
fragment_affix_dup
fragment_index
fragment_index_alias
fragment_name
fragment_name_oor
fragment_num
fragment_parent
get64
get_bad_code
get_bit
get_carray
get_carray_len
get_carray_slice
get_char
get_clincom
get_complex128
get_complex64
get_const
get_const_complex
get_const_repr
get_cpolynom
get_divide
get_endian16
get_endian32
get_endian64
get_endian8
get_endian_complex128_arm
get_endian_complex128_big
get_endian_complex128_little
get_endian_complex64_arm
get_endian_complex64_big
get_endian_complex64_little
get_endian_float32_arm
get_endian_float32_big
get_endian_float32_little
get_endian_float64_arm
get_endian_float64_big
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_here
get_here_foffs
get_heres
get_int16
get_int32
get_int64
get_int8
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_lincom_non
get_linterp
get_linterp_noin
get_linterp_notab
get_linterp_sort
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_phase_affix
get_polynom
get_polynom_noin
get_recip
get_recip_const
get_recurse
get_rofs
get_sbit
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
get_window
get_window_clr
get_window_ge
get_window_gt
get_window_le
get_window_lt
get_window_ne
get_window_set
get_zero
global_name
global_ref
global_ref_empty
global_ref_set
gzip_add
gzip_get
gzip_get_get
gzip_get_put
gzip_move_from
gzip_move_to
gzip_nframes
gzip_put
gzip_put_get
header_complex
hide
hide_hidden
hide_unhide
include
include_accmode
include_affix
include_auto
include_cb
include_creat
include_ignore
include_index
include_invalid
include_nonexistent
include_pc
include_ref
include_syntax
index
index_domain
index_range
legacy_get
legacy_get_put
legacy_get_rofs
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
lzma_get
lzma_nframes
madd
madd_affix
madd_alias
madd_bit
madd_bit_invalid
madd_carray
madd_clincom
madd_const
madd_cpolynom
madd_crecip
madd_crecip89
madd_divide
madd_index
madd_lincom
madd_lincom_invalid
madd_linterp
madd_linterp_invalid
madd_multiply
madd_multiply_invalid
madd_phase
madd_phase_invalid
madd_polynom
madd_recip
madd_sbit
madd_spec
madd_spec_directive
madd_spec_invalid
madd_spec_resolv
madd_string
madd_window
move
move_affix
move_affix_dup
move_alias
move_data_enc_ar
move_data_enc_ra
move_data_endian
move_data_foffs
move_data_nop
move_index
move_meta
move_protect
move_subdir
name
name_affix
name_affix_bad
name_after
name_after_const
name_dup
name_move
name_update
name_update_const
nfields
nfields_hidden
nfields_invalid
nfields_type
nfields_type_hidden
nfields_type_invalid
nfields_vector
nfields_vector_hidden
nfields_vector_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
nmeta
nmeta_hidden
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_hidden
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_del
nmeta_vectors_hidden
nmeta_vectors_invalid
nmeta_vectors_parent
open
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_invalid
open_cb_rescan
open_eaccess
open_nonexistent
open_notdirfile
parse_alias
parse_alias_code
parse_alias_dup
parse_alias_meta
parse_alias_missing
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_bit_scalar
parse_carray
parse_carray_long
parse_const
parse_const_ncols
parse_divide
parse_duplicate
parse_duplicate_ignore
parse_endian_bad
parse_endian_big
parse_endian_force
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_loop
parse_include_nonexistent
parse_include_prefix
parse_include_prefix_dup
parse_include_preprefix
parse_include_relabs
parse_include_relrel
parse_include_slash
parse_include_suffix
parse_include_sufsuffix
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_lincom_non
parse_lincom_non_ncols
parse_lincom_scalar
parse_linterp
parse_linterp_ncols
parse_malias
parse_malias_dup
parse_meta
parse_meta_affix
parse_meta_alias
parse_meta_implicit
parse_meta_implicit2
parse_meta_implicit_affix
parse_meta_index
parse_meta_index2
parse_meta_jump
parse_meta_malias
parse_meta_meta
parse_meta_parent
parse_meta_raw
parse_multiply
parse_multiply_ncols
parse_name
parse_name_dot
parse_name_ext
parse_name_pedantic
parse_ncols
parse_phase
parse_phase_ncols
parse_phase_scalar
parse_polynom
parse_polynom_ncols1
parse_polynom_ncols2
parse_polynom_scalar
parse_protect_all
parse_protect_bad
parse_protect_data
parse_protect_format
parse_protect_none
parse_quote
parse_quote_mismatch
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_scalar
parse_raw_spf
parse_raw_type
parse_recip
parse_ref
parse_ref_nonexistent
parse_sbit
parse_sort
parse_string
parse_string_ncols
parse_string_null
parse_version
parse_version_89
parse_version_98
parse_version_include
parse_version_p8
parse_version_p9
parse_version_permissive
parse_version_slash
parse_whitespace
parse_window
parse_window_ncols
parse_window_op
parse_window_scalar
protect_alter
protect_get
put64
put_bad_code
put_bit
put_bof
put_carray
put_carray_slice
put_char
put_complex128
put_complex64
put_const
put_const_protect
put_divide
put_endian16
put_endian32
put_endian64
put_endian8
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
put_endian_float32_arm
put_endian_float32_big
put_endian_float32_little
put_endian_float64_arm
put_endian_float64_big
put_endian_float64_little
put_ff
put_float32
put_float64
put_foffs
put_fs
put_here
put_heres
put_int16
put_int32
put_int64
put_int8
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_noin
put_linterp_nomono
put_linterp_notab
put_linterp_reverse
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_polynom1
put_polynom2
put_polynom_noin
put_protect
put_rdonly
put_recip
put_recurse
put_repr
put_rofs
put_sbit
put_sf
put_ss
put_string
put_string_protect
put_type
put_uint16
put_uint32
put_uint64
put_window
ref
ref_none
ref_two
repr_a
repr_float32
repr_float64
repr_i
repr_int16
repr_int32
repr_int64
repr_int8
repr_m
repr_r
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_uint16
repr_uint32
repr_uint64
repr_uint8
seek64
seek_cur
seek_end
seek_foffs
seek_set
sie_get_big
sie_get_little
sie_move_from
sie_move_to
sie_nframes_big
sie_nframes_little
sie_put_big
sie_put_little
slim_get
slim_nframes
slim_put
spf
spf_alias
spf_alias_meta
spf_alias_missing
spf_divide
spf_lincom
spf_multiply
spf_polynom
spf_recip
spf_recurse
svlist
svlist_hidden
svlist_invalid
svlist_meta
svlist_meta_hidden
svlist_meta_invalid
tell
tell64
trunc
trunc_rdonly
trunc_rofs
unclude
unclude_del
unclude_move
version_0
version_0_write
version_1
version_1_write
version_2
version_2_write
version_3
version_3_write
version_4
version_4_write
version_5
version_5_strict
version_5_write
version_6
version_6_strict
version_6_write
version_7
version_7_strict
version_7_write
version_8
version_8_strict
version_8_write
version_9
version_9_strict
version_9_write
vlist
vlist_alias
vlist_hidden
vlist_invalid
vlist_meta
vlist_meta_hidden
vlist_meta_invalid
xz_get
xz_nframes
zzip_get
zzip_get_get
zzip_nframes
+ Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
add_type
add_window
add_window_op
alias_list
alias_list_alias
alias_list_missing
alias_num
alias_num_alias
alias_num_missing
alias_target
alias_target_alias
alias_target_missing
alter_bit_bitnum
alter_bit_numbits
alter_carray_len
alter_carray_type
alter_const
alter_cpolynom
alter_crecip
alter_crecip89
alter_crecip_zero
alter_divide
alter_entry
alter_entry_affix
alter_entry_hidden
alter_entry_recode
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
alter_lincom_23
alter_lincom_32
alter_lincom_input
alter_lincom_offset
alter_lincom_slope
alter_linterp
alter_linterp_move
alter_mspec
alter_mspec_affix
alter_multiply
alter_phase
alter_polynom_coeff
alter_polynom_input
alter_polynom_ord
alter_raw_spf
alter_raw_type
alter_recip
alter_recip_zero
alter_spec
alter_spec_affix
alter_spec_meta
alter_window
ascii_add
ascii_get
ascii_get_get
ascii_nframes
ascii_put
bof
bof_lincom
bof_phase
bzip_get
bzip_get_get
bzip_move_from
bzip_nframes
bzip_put
close
close_bad
close_discard
close_null
convert_complex128_complex64
convert_complex128_float64
convert_complex128_int64
convert_complex128_uint64
convert_complex64_complex128
convert_complex64_float64
convert_complex64_int64
convert_complex64_uint64
convert_float32_complex128
convert_float32_complex64
convert_float32_float64
convert_float32_int16
convert_float32_int32
convert_float32_int64
convert_float32_int8
convert_float32_uint16
convert_float32_uint32
convert_float32_uint64
convert_float32_uint8
convert_float64_complex128
convert_float64_complex64
convert_float64_float32
convert_float64_int16
convert_float64_int32
convert_float64_int64
convert_float64_int8
convert_float64_uint16
convert_float64_uint32
convert_float64_uint64
convert_float64_uint8
convert_int16_complex128
convert_int16_complex64
convert_int16_float32
convert_int16_float64
convert_int16_int32
convert_int16_int64
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_uint64
convert_int16_uint8
convert_int32_complex128
convert_int32_complex64
convert_int32_float32
convert_int32_float64
convert_int32_int16
convert_int32_int64
convert_int32_int8
convert_int32_uint16
convert_int32_uint32
convert_int32_uint64
convert_int32_uint8
convert_int64_complex128
convert_int64_complex64
convert_int64_float32
convert_int64_float64
convert_int64_int16
convert_int64_int32
convert_int64_int8
convert_int64_uint16
convert_int64_uint32
convert_int64_uint64
convert_int64_uint8
convert_int8_complex128
convert_int8_complex64
convert_int8_float32
convert_int8_float64
convert_int8_int16
convert_int8_int32
convert_int8_int64
convert_int8_uint16
convert_int8_uint32
convert_int8_uint64
convert_int8_uint8
convert_uint16_complex128
convert_uint16_complex64
convert_uint16_float32
convert_uint16_float64
convert_uint16_int16
convert_uint16_int32
convert_uint16_int64
convert_uint16_int8
convert_uint16_uint32
convert_uint16_uint64
convert_uint16_uint8
convert_uint32_complex128
convert_uint32_complex64
convert_uint32_float32
convert_uint32_float64
convert_uint32_int16
convert_uint32_int32
convert_uint32_int64
convert_uint32_int8
convert_uint32_uint16
convert_uint32_uint64
convert_uint32_uint8
convert_uint64_complex128
convert_uint64_complex64
convert_uint64_float32
convert_uint64_float64
convert_uint64_int16
convert_uint64_int32
convert_uint64_int64
convert_uint64_int8
convert_uint64_uint16
convert_uint64_uint32
convert_uint64_uint8
convert_uint8_complex128
convert_uint8_complex64
convert_uint8_float32
convert_uint8_float64
convert_uint8_int16
convert_uint8_int32
convert_uint8_int64
convert_uint8_int8
convert_uint8_uint16
convert_uint8_uint32
convert_uint8_uint64
creat
creat_excl
creat_rdonly
cvlist
cvlist_array
cvlist_array_hidden
cvlist_array_meta
cvlist_array_meta_hidden
cvlist_hidden
cvlist_invalid
cvlist_meta
cvlist_meta_hidden
cvlist_meta_invalid
del
del_carray
del_carray_deref
del_const
del_const_deref
del_const_force
del_data
del_derived
del_derived_after
del_derived_force
del_meta
del_meta_force
dfes_bit
dfes_divide
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_recip
dfes_zero
encode_alter
encode_get
encode_move
endian_alter
endian_alter_sie
endian_get
endian_move
entry_bad_code
entry_bit
entry_bit_scalar
entry_divide
entry_invalid
entry_lincom
entry_lincom_scalar
entry_linterp
entry_multiply
entry_phase
entry_phase_scalar
entry_polynom
entry_polynom_scalar
entry_raw
entry_raw_scalar
entry_raw_scalar_code
entry_raw_scalar_type
entry_recip
entry_scalar_repr
entry_type
entry_type_alias
entry_window
entry_window_scalar
eof
eof_index
eof_lincom
eof_phase
error
error_error
error_num
error_short
file
file_code
file_type
flist
flist_hidden
flist_invalid
flist_meta
flist_meta_hidden
flist_meta_invalid
flist_type
flist_type_hidden
flist_type_invalid
flist_type_meta
flist_type_meta_hidden
flist_type_meta_invalid
flush
flush_all
flush_bad_code
flush_invalid
flush_meta
flush_spec
foffs_alter
foffs_get
foffs_move
fragment_affix
fragment_affix_alter
fragment_affix_alter2
fragment_affix_dup
fragment_index
fragment_index_alias
fragment_name
fragment_name_oor
fragment_num
fragment_parent
get64
get_bad_code
get_bit
get_carray
get_carray_len
get_carray_slice
get_char
get_clincom
get_complex128
get_complex64
get_const
get_const_complex
get_const_repr
get_cpolynom
get_divide
get_endian16
get_endian32
get_endian64
get_endian8
get_endian_complex128_arm
get_endian_complex128_big
get_endian_complex128_little
get_endian_complex64_arm
get_endian_complex64_big
get_endian_complex64_little
get_endian_float32_arm
get_endian_float32_big
get_endian_float32_little
get_endian_float64_arm
get_endian_float64_big
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_here
get_here_foffs
get_heres
get_int16
get_int32
get_int64
get_int8
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_lincom_non
get_linterp
get_linterp_noin
get_linterp_notab
get_linterp_sort
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_phase_affix
get_polynom
get_polynom_noin
get_recip
get_recip_const
get_recurse
get_rofs
get_sbit
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
get_window
get_window_clr
get_window_ge
get_window_gt
get_window_le
get_window_lt
get_window_ne
get_window_set
get_zero
global_name
global_ref
global_ref_empty
global_ref_set
gzip_add
gzip_get
gzip_get_get
gzip_get_put
gzip_move_from
gzip_move_to
gzip_nframes
gzip_put
gzip_put_get
header_complex
hide
hide_hidden
hide_unhide
include
include_accmode
include_affix
include_auto
include_cb
include_creat
include_ignore
include_index
include_invalid
include_nonexistent
include_pc
include_ref
include_syntax
index
index_domain
index_range
legacy_get
legacy_get_put
legacy_get_rofs
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
lzma_get
lzma_nframes
madd
madd_affix
madd_alias
madd_bit
madd_bit_invalid
madd_carray
madd_clincom
madd_const
madd_cpolynom
madd_crecip
madd_crecip89
madd_divide
madd_index
madd_lincom
madd_lincom_invalid
madd_linterp
madd_linterp_invalid
madd_multiply
madd_multiply_invalid
madd_phase
madd_phase_invalid
madd_polynom
madd_recip
madd_sbit
madd_spec
madd_spec_directive
madd_spec_invalid
madd_spec_resolv
madd_string
madd_window
move
move_affix
move_affix_dup
move_alias
move_data_enc_ar
move_data_enc_ra
move_data_endian
move_data_foffs
move_data_nop
move_index
move_meta
move_protect
move_subdir
name
name_affix
name_affix_bad
name_after
name_after_const
name_dup
name_move
name_update
name_update_const
nfields
nfields_hidden
nfields_invalid
nfields_type
nfields_type_hidden
nfields_type_invalid
nfields_vector
nfields_vector_hidden
nfields_vector_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
nmeta
nmeta_hidden
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_hidden
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_del
nmeta_vectors_hidden
nmeta_vectors_invalid
nmeta_vectors_parent
open
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_invalid
open_cb_rescan
open_eaccess
open_nonexistent
open_notdirfile
parse_alias
parse_alias_code
parse_alias_dup
parse_alias_meta
parse_alias_missing
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_bit_scalar
parse_carray
parse_carray_long
parse_const
parse_const_ncols
parse_divide
parse_duplicate
parse_duplicate_ignore
parse_endian_bad
parse_endian_big
parse_endian_force
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_loop
parse_include_nonexistent
parse_include_prefix
parse_include_prefix_dup
parse_include_preprefix
parse_include_relabs
parse_include_relrel
parse_include_slash
parse_include_suffix
parse_include_sufsuffix
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_lincom_non
parse_lincom_non_ncols
parse_lincom_scalar
parse_linterp
parse_linterp_ncols
parse_malias
parse_malias_dup
parse_meta
parse_meta_affix
parse_meta_alias
parse_meta_implicit
parse_meta_implicit2
parse_meta_implicit_affix
parse_meta_index
parse_meta_index2
parse_meta_jump
parse_meta_malias
parse_meta_meta
parse_meta_parent
parse_meta_raw
parse_multiply
parse_multiply_ncols
parse_name
parse_name_dot
parse_name_ext
parse_name_pedantic
parse_ncols
parse_phase
parse_phase_ncols
parse_phase_scalar
parse_polynom
parse_polynom_ncols1
parse_polynom_ncols2
parse_polynom_scalar
parse_protect_all
parse_protect_bad
parse_protect_data
parse_protect_format
parse_protect_none
parse_quote
parse_quote_mismatch
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_scalar
parse_raw_spf
parse_raw_type
parse_recip
parse_ref
parse_ref_nonexistent
parse_sbit
parse_sort
parse_string
parse_string_ncols
parse_string_null
parse_version
parse_version_89
parse_version_98
parse_version_include
parse_version_p8
parse_version_p9
parse_version_permissive
parse_version_slash
parse_whitespace
parse_window
parse_window_ncols
parse_window_op
parse_window_scalar
protect_alter
protect_get
put64
put_bad_code
put_bit
put_bof
put_carray
put_carray_slice
put_char
put_complex128
put_complex64
put_const
put_const_protect
put_divide
put_endian16
put_endian32
put_endian64
put_endian8
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
put_endian_float32_arm
put_endian_float32_big
put_endian_float32_little
put_endian_float64_arm
put_endian_float64_big
put_endian_float64_little
put_ff
put_float32
put_float64
put_foffs
put_fs
put_here
put_heres
put_int16
put_int32
put_int64
put_int8
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_noin
put_linterp_nomono
put_linterp_notab
put_linterp_reverse
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_polynom1
put_polynom2
put_polynom_noin
put_protect
put_rdonly
put_recip
put_recurse
put_repr
put_rofs
put_sbit
put_sf
put_ss
put_string
put_string_protect
put_type
put_uint16
put_uint32
put_uint64
put_window
ref
ref_none
ref_two
repr_a
repr_float32
repr_float64
repr_i
repr_int16
repr_int32
repr_int64
repr_int8
repr_m
repr_r
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_uint16
repr_uint32
repr_uint64
repr_uint8
seek64
seek_cur
seek_end
seek_foffs
seek_set
sie_get_big
sie_get_little
sie_move_from
sie_move_to
sie_nframes_big
sie_nframes_little
sie_put_big
sie_put_little
slim_get
slim_nframes
slim_put
spf
spf_alias
spf_alias_meta
spf_alias_missing
spf_divide
spf_lincom
spf_multiply
spf_polynom
spf_recip
spf_recurse
svlist
svlist_hidden
svlist_invalid
svlist_meta
svlist_meta_hidden
svlist_meta_invalid
tell
tell64
trunc
trunc_rdonly
trunc_rofs
unclude
unclude_del
unclude_move
version_0
version_0_write
version_1
version_1_write
version_2
version_2_write
version_3
version_3_write
version_4
version_4_write
version_5
version_5_strict
version_5_write
version_6
version_6_strict
version_6_write
version_7
version_7_strict
version_7_write
version_8
version_8_strict
version_8_write
version_9
version_9_strict
version_9_write
vlist
vlist_alias
vlist_hidden
vlist_invalid
vlist_meta
vlist_meta_hidden
vlist_meta_invalid
xz_get
xz_nframes
zzip_data
zzip_get
zzip_get_get
zzip_nframes
Added: trunk/getdata/test/zzip_data.c
===================================================================
--- trunk/getdata/test/zzip_data.c (rev 0)
+++ trunk/getdata/test/zzip_data.c 2011-12-28 20:11:54 UTC (rev 642)
@@ -0,0 +1,90 @@
+/* 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
+ */
+#include "test.h"
+
+int main(void)
+{
+#ifndef TEST_ZZIP
+ return 77;
+#else
+ const char *filedir = "dirfile";
+ const char *format = "dirfile/format";
+ const char *data = "dirfile/data";
+ const char *testzip = "dirfile/test.zip";
+ const char *format_data =
+ "data RAW UINT16 8\n"
+ "/ENCODING zzip test\n";
+ uint16_t c[8];
+ char command[4096];
+ uint16_t data_data[256];
+ int fd, n, error, i, r = 0;
+ DIRFILE *D;
+
+ memset(c, 0, 8);
+ 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 */
+ chdir(filedir);
+ snprintf(command, 4096, "%s test data > /dev/null", ZIP);
+ if (gd_system(command))
+ return 1;
+ chdir("..");
+ unlink(data);
+
+#ifdef USE_ZZIP
+ D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
+#else
+ D = gd_open(filedir, GD_RDONLY);
+#endif
+ n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT16, c);
+ error = gd_error(D);
+
+ gd_close(D);
+
+ unlink(testzip);
+ unlink(format);
+ rmdir(filedir);
+
+#ifdef USE_ZZIP
+ CHECKI(error, 0);
+ CHECKI(n, 8);
+ for (i = 0; i < 8; ++i)
+ CHECKIi(i,c[i], 40 + i);
+#else
+ CHECKI(error, GD_E_UNSUPPORTED);
+ CHECKI(n,0);
+#endif
+
+ return r;
+#endif
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-12-31 03:33:44
|
Revision: 643
http://getdata.svn.sourceforge.net/getdata/?rev=643&view=rev
Author: ketiltrout
Date: 2011-12-31 03:33:37 +0000 (Sat, 31 Dec 2011)
Log Message:
-----------
Fix bugs.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/python/pyentry.c
trunk/getdata/bindings/python/test/big_test.py
trunk/getdata/src/internal.h
trunk/getdata/test/zzip_get.c
trunk/getdata/test/zzip_nframes.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-12-28 20:11:54 UTC (rev 642)
+++ trunk/getdata/ChangeLog 2011-12-31 03:33:37 UTC (rev 643)
@@ -1,3 +1,6 @@
+2011-12-31 D. V. Wiebe <ge...@ke...> svn:643
+ * bindings/python/pyentry.c (gdpy_set_entry_from_dict): Add missing INCREF.
+
2011-12-29 D. V. Wiebe <ge...@ke...> svn:641
* src/internal.h src/encoding.c (_GD_GenericName): Added fragment->enc_data.
Pass enc_data to gd_ef->name. Flag encodings that use enc_data with
Modified: trunk/getdata/bindings/python/pyentry.c
===================================================================
--- trunk/getdata/bindings/python/pyentry.c 2011-12-28 20:11:54 UTC (rev 642)
+++ trunk/getdata/bindings/python/pyentry.c 2011-12-31 03:33:37 UTC (rev 643)
@@ -557,6 +557,7 @@
return;
}
+ Py_INCREF(o);
PyTuple_SET_ITEM(tuple, i, o);
}
}
@@ -805,7 +806,6 @@
case GD_POLYNOM_ENTRY:
case GD_SBIT_ENTRY:
case GD_RECIP_ENTRY:
- case GD_WINDOW_ENTRY:
if (!PyTuple_Check(value))
s[0] = gdpy_dup_pystring(value);
else {
@@ -828,6 +828,7 @@
break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
+ case GD_WINDOW_ENTRY:
if (!PyTuple_Check(value)) {
PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' "
"attribute 'in_fields' must be a tuple");
Modified: trunk/getdata/bindings/python/test/big_test.py
===================================================================
--- trunk/getdata/bindings/python/test/big_test.py 2011-12-28 20:11:54 UTC (rev 642)
+++ trunk/getdata/bindings/python/test/big_test.py 2011-12-31 03:33:37 UTC (rev 643)
@@ -1791,7 +1791,7 @@
except:
CheckOK(223)
-# 224: GDMOVA check
+# 224: gd_move_alias check
try:
d.move_alias('new20', 1)
except:
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-12-28 20:11:54 UTC (rev 642)
+++ trunk/getdata/src/internal.h 2011-12-31 03:33:37 UTC (rev 643)
@@ -1117,6 +1117,8 @@
int swap);
/* zzip I/O methods */
+int _GD_ZzipName(DIRFILE*, const char*, struct _gd_raw_file*, const char*, int,
+ int);
int _GD_ZzipOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
off64_t _GD_ZzipSeek(struct _gd_raw_file* file, off64_t count,
gd_type_t data_type, unsigned int);
Modified: trunk/getdata/test/zzip_get.c
===================================================================
--- trunk/getdata/test/zzip_get.c 2011-12-28 20:11:54 UTC (rev 642)
+++ trunk/getdata/test/zzip_get.c 2011-12-31 03:33:37 UTC (rev 643)
@@ -79,7 +79,7 @@
for (i = 0; i < 8; ++i)
CHECKIi(i,c[i], 40 + i);
#else
- CHECKI(error, GD_E_UNSUPPORTED);
+ CHECKI(error, GD_E_UNKNOWN_ENCODING);
CHECKI(n,0);
#endif
Modified: trunk/getdata/test/zzip_nframes.c
===================================================================
--- trunk/getdata/test/zzip_nframes.c 2011-12-28 20:11:54 UTC (rev 642)
+++ trunk/getdata/test/zzip_nframes.c 2011-12-31 03:33:37 UTC (rev 643)
@@ -85,7 +85,7 @@
CHECKI(error, 0);
CHECKI(n, 256);
#else
- CHECKI(error, GD_E_UNSUPPORTED);
+ CHECKI(error, GD_E_UNKNOWN_ENCODING);
CHECKI(n, 0);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2012-01-11 08:06:05
|
Revision: 645
http://getdata.svn.sourceforge.net/getdata/?rev=645&view=rev
Author: ketiltrout
Date: 2012-01-11 08:05:50 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
MPLEX.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/cxx/Makefile.am
trunk/getdata/bindings/cxx/dirfile.cpp
trunk/getdata/bindings/cxx/entry.cpp
trunk/getdata/bindings/cxx/getdata/dirfile.h
trunk/getdata/bindings/cxx/getdata/entry.h
trunk/getdata/bindings/cxx/getdata/windowentry.h
trunk/getdata/bindings/cxx/test/big_test.cpp
trunk/getdata/bindings/cxx/windowentry.cpp
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/f77/fgetdata.h
trunk/getdata/bindings/f77/getdata.f.in
trunk/getdata/bindings/f77/getdata.f90.in
trunk/getdata/bindings/f77/test/big_test.f
trunk/getdata/bindings/f77/test/big_test95.f90
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/idl/test/big_test.pro
trunk/getdata/bindings/make_parameters.c
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/bindings/perl/simple_funcs.pl
trunk/getdata/bindings/perl/simple_funcs.xsin
trunk/getdata/bindings/perl/t/big_test.t
trunk/getdata/bindings/perl/typemap
trunk/getdata/bindings/python/pydirfile.c
trunk/getdata/bindings/python/pyentry.c
trunk/getdata/bindings/python/test/Makefile.am
trunk/getdata/bindings/python/test/big_test.py
trunk/getdata/doc/list.tests
trunk/getdata/src/add.c
trunk/getdata/src/common.c
trunk/getdata/src/del.c
trunk/getdata/src/entry.c
trunk/getdata/src/errors.c
trunk/getdata/src/field_list.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/fpos.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/getdata_legacy.h
trunk/getdata/src/internal.h
trunk/getdata/src/legacy.c
trunk/getdata/src/mod.c
trunk/getdata/src/name.c
trunk/getdata/src/native.c
trunk/getdata/src/nfields.c
trunk/getdata/src/nmeta.c
trunk/getdata/src/parse.c
trunk/getdata/src/putdata.c
trunk/getdata/src/spf.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/add_window.c
Added Paths:
-----------
trunk/getdata/bindings/cxx/getdata/mplexentry.h
trunk/getdata/bindings/cxx/mplexentry.cpp
trunk/getdata/test/add_mplex.c
trunk/getdata/test/add_mplex_val.c
trunk/getdata/test/alter_mplex.c
trunk/getdata/test/entry_mplex.c
trunk/getdata/test/entry_mplex_scalar.c
trunk/getdata/test/get_mplex.c
trunk/getdata/test/get_mplex_lb.c
trunk/getdata/test/madd_mplex.c
trunk/getdata/test/parse_mplex.c
trunk/getdata/test/parse_mplex_ncols.c
trunk/getdata/test/parse_mplex_scalar.c
trunk/getdata/test/put_mplex.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/ChangeLog 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,3 +1,70 @@
+2012-01-11 D. V. Wiebe <ge...@ke...> svn:644
+ * src/getdata.h.in: Added GD_MPLEX_ENTRY. Updated gd_entry_t. Defined
+ GD_COUNT_MAX.
+
+ * src/legacy.c (CopyMplexEntry) src/getdata.c (_GD_MplexData _GD_DoMplex)
+ src/putdata.c (_GD_MplexOutData _GD_DoMplexOut) src/parse.c (_GD_ParseMplex)
+ src/add.c (gd_add_mplex gd_madd_mplex) src/mod.c (gd_alter_mplex): Added.
+ * src/internal.h: Define GD_MPLEX_LOOKBACK
+
+ * src/entry.c (_GD_FreeE _GD_CalculateEntry gd_entry gd_validate)
+ src/flush.c (_GD_Flush _GD_FieldSpec _GD_FindVersion) src/fpos.c
+ (_GD_GetFilePos _GD_WriteSeek) src/legacy.c (GetFormat) src/getdata.c
+ (_GD_DoField) src/name.c (_GD_InvalidateConst _GD_InvalidateVect)
+ src/native.c (_GD_NativeType) src/putdata.c (_GD_DoFieldOut) src/del.c
+ (_GD_ClearDerived _GD_DeReference) src/flimits.c (_GD_GetEOF _GD_GetBOF)
+ src/parse.c (_GD_ParseFieldSpec) src/add.c (_GD_Add) src/spf.c (_GD_GetSPF)
+ src/mod.c (_GD_Change): Handle MPLEX.
+
+ * src/fpos.c (_GD_Seek): De-statickify.
+ * src/legacy.c (CopyWindowEntry): Report as MPLEX.
+ * src/getdata_legacy.h: Fix mplex list in FormatType.
+
+ * src/errors.c: Rename GD_E_BAD_ENTRY_* suberrors to GD_E_ENTRY_* for
+ brevity. Added GD_E_FORMAT_MPLEXVAL, GD_E_ENTRY_CNTVAL, GD_E_ENTRY_CNTMAX.
+
+ * src/field_list.c (_GD_ListEntry): Move the alias check down so that hidden
+ and meta alias are handled properly.
+
+ * internal.h src/common.c (_GD_Malloc _GD_Realloc _GD_Strdup): Moved from
+ internal.h.
+
+ * bindings/make_parameters.c: Define MPLEX_ENTRY, E_FORMAT_MPLEXVAL,
+ COUNT_MAX.
+ * bindings/cxx/mplexentry.cpp bindings/cxx/getdata/mplexentry.h: Added.
+ * bindings/python/pyentry.c (gdpy_entry_getcountval gdpy_entry_setcountval
+ gdpy_entry_getcountmax gdpy_entry_setcountmax) bindings/cxx/getdata/entry.h
+ (Entry::CountVal Entry::CountMax) bindings/f77/getdata.f90.in (fgd_add_mplex
+ fgd_madd_mplex fgd_alter_mplex) bindings/f77/fgetdata.c (GDGEMX GDADMX
+ GDMDMX GDALMX) bindings/idl/getdata.c (gdidl_add_mplex gdidl_alter_mplex):
+ Added.
+
+ * bindings/python/pyentry.c (gdpy_set_entry_from_tuple
+ gdpy_set_entry_from_dict gdpy_entry_getinfields gdpy_entry_setinfields
+ gdpy_entry_getparms) bindings/cxx/entry.cpp (CheckIndex scalar_ok)
+ bindings/cxx/dirfile.cpp (Dirfile::Entry) bindings/cxx/getdata/dirfile.h
+ bindings/perl/GetData.xs (gdp_to_entry entry) bindings/f77/getdata.f90.in
+ (fgd_entry fgd_add fgd_madd) bindings/f77/fgetdata.c (GDASCA GDMDWD)
+ bindings/idl/getdata.c (gdidl_make_idl_entry gdidl_read_idl_entry): MPLEX
+ bindings.
+
+ * bindings/perl/simple_funcs.xsin: Add add_mplex, alter_mplex, madd_mplex.
+ * bindings/perl/simple_funcs.pl: Handle gd_count_t.
+
+ * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+ bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+ bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Add tests
+ 228-231.
+
+ * bindings/cxx/windowentry.cpp bindings/cxx/getdata/windowentry.h
+ bindings/idl/getdata.c (gdidl_alter_window): Get rid of
+ Check stuff: just use Input, for consistency.
+
+ * test/add_mplex.c test/add_mplex_val.c test/alter_mplex.c
+ test/entry_mplex.c test/entry_mplex_scalar.c test/get_mplex.c
+ test/get_mplex_lb.c test/madd_mplex.c test/parse_mplex.c
+ test/parse_mplex_ncols.c test/parse_mplex_scalar.c test/put_mplex.c: Added.
+
2011-12-31 D. V. Wiebe <ge...@ke...> svn:643
* bindings/python/pyentry.c (gdpy_set_entry_from_dict): Add missing INCREF.
Modified: trunk/getdata/bindings/cxx/Makefile.am
===================================================================
--- trunk/getdata/bindings/cxx/Makefile.am 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/Makefile.am 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2010 D. V. Wiebe
+# Copyright (C) 2008-2012 D. V. Wiebe
#
##########################################################################
#
@@ -42,16 +42,16 @@
getdata/sbitentry.h getdata/polynomentry.h \
getdata/fragment.h getdata/divideentry.h \
getdata/recipentry.h getdata/carrayentry.h \
- getdata/windowentry.h
+ getdata/windowentry.h getdata/mplexentry.h
lib_LTLIBRARIES=libgetdata++.la
libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \
constentry.cpp divideentry.cpp entry.cpp \
fragment.cpp indexentry.cpp lincomentry.cpp \
- linterpentry.cpp multiplyentry.cpp phaseentry.cpp \
- polynomentry.cpp rawentry.cpp recipentry.cpp \
- sbitentry.cpp stringentry.cpp windowentry.cpp \
- ${getdata_include_HEADERS} internal.h
+ linterpentry.cpp mplexentry.cpp multiplyentry.cpp \
+ phaseentry.cpp polynomentry.cpp rawentry.cpp \
+ recipentry.cpp sbitentry.cpp stringentry.cpp \
+ windowentry.cpp ${getdata_include_HEADERS} internal.h
libgetdata___la_LIBADD=../../src/libgetdata.la
libgetdata___la_LDFLAGS = -version-info @GETDATAXX_VERSION@
Modified: trunk/getdata/bindings/cxx/dirfile.cpp
===================================================================
--- trunk/getdata/bindings/cxx/dirfile.cpp 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/dirfile.cpp 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2011 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -109,6 +109,8 @@
return new GetData::IndexEntry(this, field_code);
case WindowEntryType:
return new GetData::WindowEntry(this, field_code);
+ case MplexEntryType:
+ return new GetData::MplexEntry(this, field_code);
case NoEntryType:
break;
}
Modified: trunk/getdata/bindings/cxx/entry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/entry.cpp 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/entry.cpp 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2011 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -46,6 +46,11 @@
switch (field_type) {
case GD_RAW_ENTRY:
+ case GD_INDEX_ENTRY:
+ case GD_CONST_ENTRY:
+ case GD_CARRAY_ENTRY:
+ case GD_STRING_ENTRY:
+ case GD_NO_ENTRY:
return 0;
case GD_LINCOM_ENTRY:
if (index > n_fields)
@@ -53,9 +58,16 @@
break;
case GD_MULTIPLY_ENTRY:
case GD_DIVIDE_ENTRY:
+ case GD_WINDOW_ENTRY:
+ case GD_MPLEX_ENTRY:
if (index > 2)
return 0;
- default:
+ case GD_LINTERP_ENTRY:
+ case GD_BIT_ENTRY:
+ case GD_PHASE_ENTRY:
+ case GD_POLYNOM_ENTRY:
+ case GD_SBIT_ENTRY:
+ case GD_RECIP_ENTRY:
if (index > 1)
return 0;
}
@@ -141,6 +153,7 @@
break;
case GD_BIT_ENTRY:
case GD_SBIT_ENTRY:
+ case GD_MPLEX_ENTRY:
if (index >= 2)
return 0;
break;
Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/dirfile.h 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -48,6 +48,7 @@
#include <getdata/constentry.h>
#include <getdata/carrayentry.h>
#include <getdata/stringentry.h>
+#include <getdata/mplexentry.h>
#include <getdata/multiplyentry.h>
#include <getdata/divideentry.h>
#include <getdata/recipentry.h>
@@ -71,6 +72,7 @@
friend class PhaseEntry;
friend class PolynomEntry;
friend class WindowEntry;
+ friend class MplexEntry;
friend class ConstEntry;
friend class CarrayEntry;
friend class StringEntry;
Modified: trunk/getdata/bindings/cxx/getdata/entry.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/entry.h 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/getdata/entry.h 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -69,7 +69,8 @@
IndexEntryType = GD_INDEX_ENTRY,
DivideEntryType = GD_DIVIDE_ENTRY,
RecipEntryType = GD_RECIP_ENTRY,
- WindowEntryType = GD_WINDOW_ENTRY
+ WindowEntryType = GD_WINDOW_ENTRY,
+ MplexEntryType = GD_MPLEX_ENTRY
};
enum WindOpType {
@@ -221,10 +222,6 @@
};
/* WINDOW methods */
- virtual const char *Check() const {
- return (E.field_type == GD_WINDOW_ENTRY) ? E.in_fields[1] : 0;
- };
-
virtual WindOpType WindOp() const {
return (E.field_type == GD_WINDOW_ENTRY) ? (WindOpType)E.u.window.windop
: (WindOpType)0;
@@ -236,6 +233,16 @@
return (E.field_type == GD_WINDOW_ENTRY) ? E.u.window.threshold : zero;
}
+ /* MPLEX methods */
+ virtual gd_count_t CountVal() const {
+ return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.count_val : 0;
+ }
+
+ virtual gd_count_t CountMax() const {
+ return (E.field_type == GD_MPLEX_ENTRY) ? E.u.mplex.count_max : 0;
+ }
+
+ /* Set methods */
void SetName(const char* name);
void SetFragmentIndex(int fragment_index);
Added: trunk/getdata/bindings/cxx/getdata/mplexentry.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/mplexentry.h (rev 0)
+++ trunk/getdata/bindings/cxx/getdata/mplexentry.h 2012-01-11 08:05:50 UTC (rev 645)
@@ -0,0 +1,65 @@
+// Copyright (C) 2012 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
+//
+
+#ifndef GETDATA_MPLEXENTRY_H
+#define GETDATA_MPLEXENTRY_H
+
+#include <getdata/entry.h>
+
+namespace GetData {
+
+ class Dirfile;
+
+ class MplexEntry : public Entry {
+ friend class Dirfile;
+
+ public:
+ MplexEntry() : Entry() { E.field_type = GD_MPLEX_ENTRY; };
+
+ MplexEntry(const char* field_code, const char* in_field,
+ const char *check_Field, gd_count_t count_val, gd_count_t count_max,
+ int fragment_index = 0);
+
+ virtual const char *Input(int index = 0) const {
+ return E.in_fields[(index == 0) ? 0 : 1];
+ };
+
+ virtual const char *Scalar() const { return E.scalar[0]; }
+
+ virtual int ScalarIndex() const { return E.scalar_ind[0]; };
+
+ virtual gd_count_t CountVal() const { return E.u.mplex.count_val; };
+
+ virtual gd_count_t CountMax() const { return E.u.mplex.count_max; };
+
+ int SetInput(const char* field, int index);
+ virtual int SetCountVal(gd_count_t count_val);
+ virtual int SetCountVal(const char* threshold);
+ virtual int SetCountMax(gd_count_t count_max);
+ virtual int SetCountMax(const char* threshold);
+
+ private:
+ MplexEntry(const GetData::Dirfile *dirfile, const char* field_code) :
+ Entry(dirfile, field_code) { };
+ };
+}
+
+#endif
Modified: trunk/getdata/bindings/cxx/getdata/windowentry.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/windowentry.h 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/getdata/windowentry.h 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011 D. V. Wiebe
+// Copyright (C) 2011-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -38,10 +38,10 @@
const char *check_Field, WindOpType windop, gd_triplet_t threshold,
int fragment_index = 0);
- virtual const char *Check() const { return E.in_fields[1]; };
+ virtual const char *Input(int index = 0) const {
+ return E.in_fields[(index == 0) ? 0 : 1];
+ };
- virtual const char *Input() const { return E.in_fields[0]; };
-
virtual const char *Scalar() const { return E.scalar[0]; }
virtual int ScalarIndex() const { return E.scalar_ind[0]; };
@@ -52,8 +52,7 @@
virtual gd_triplet_t Threshold() const { return E.u.window.threshold; };
- virtual int SetInput(const char* field);
- virtual int SetCheck(const char* field);
+ int SetInput(const char* field, int index);
virtual int SetWindOp(WindOpType windop);
virtual int SetThreshold(gd_triplet_t threshold);
virtual int SetThreshold(const char* threshold);
Added: trunk/getdata/bindings/cxx/mplexentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/mplexentry.cpp (rev 0)
+++ trunk/getdata/bindings/cxx/mplexentry.cpp 2012-01-11 08:05:50 UTC (rev 645)
@@ -0,0 +1,127 @@
+// Copyright (C) 2012 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
+//
+#include "internal.h"
+
+MplexEntry::MplexEntry(const char* field_code, const char* in_field,
+ const char* count, gd_count_t count_val, gd_count_t count_max,
+ int fragment_index) : Entry()
+{
+ dtrace("\"%s\", \"%s\", \"%s\", %i, %i, %i", field_code,
+ in_field, count, count_val, count_max, fragment_index);
+
+ E.field = strdup(field_code);
+ E.field_type = GD_MPLEX_ENTRY;
+ E.in_fields[0] = strdup(in_field);
+ E.in_fields[1] = strdup(count);
+ E.scalar[0] = E.scalar[1] = 0;
+ E.u.mplex.count_val = count_val;
+ E.u.mplex.count_max = count_max;
+ E.fragment_index = fragment_index;
+
+ dreturnvoid();
+}
+
+int MplexEntry::SetInput(const char* field, int index)
+{
+ if (index < 0 || index > 1)
+ return -1;
+
+ char* ptr = strdup(field);
+
+ if (ptr == NULL)
+ return -1;
+
+ free(E.in_fields[index]);
+ E.in_fields[index] = ptr;
+
+ if (D != NULL)
+ return gd_alter_entry(D->D, E.field, &E, 0);
+
+ return 0;
+}
+
+int MplexEntry::SetCountVal(gd_count_t count_val)
+{
+ int ret = 0;
+
+ dtrace("%u", count_val);
+
+ E.u.mplex.count_val = count_val;
+
+ if (D != NULL)
+ ret = gd_alter_entry(D->D, E.field, &E, 0);
+
+ dreturn("%i", ret);
+ return ret;
+}
+
+int MplexEntry::SetCountMax(gd_count_t count_max)
+{
+ int ret = 0;
+
+ dtrace("%u", count_max);
+
+ E.u.mplex.count_max = count_max;
+
+ if (D != NULL)
+ ret = gd_alter_entry(D->D, E.field, &E, 0);
+
+ dreturn("%i", ret);
+ return ret;
+}
+
+int MplexEntry::SetCountVal(const char *count_val)
+{
+ int r = 0;
+
+ dtrace("\"%s\"", count_val);
+
+ SetScalar(0, count_val);
+
+ if (D != NULL) {
+ r = gd_alter_entry(D->D, E.field, &E, 0);
+
+ if (!r)
+ r = gd_get_constant(D->D, count_val, GD_UINT16, &E.u.mplex.count_val);
+ }
+
+ dreturn("%i", r);
+ return r;
+}
+
+int MplexEntry::SetCountMax(const char *count_max)
+{
+ int r = 0;
+
+ dtrace("\"%s\"", count_max);
+
+ SetScalar(1, count_max);
+
+ if (D != NULL) {
+ r = gd_alter_entry(D->D, E.field, &E, 0);
+
+ if (!r)
+ r = gd_get_constant(D->D, count_max, GD_UINT16, &E.u.mplex.count_max);
+ }
+
+ dreturn("%i", r);
+ return r;
+}
Modified: trunk/getdata/bindings/cxx/test/big_test.cpp
===================================================================
--- trunk/getdata/bindings/cxx/test/big_test.cpp 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/test/big_test.cpp 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2009-2010 D. V. Wiebe
+// Copyright (C) 2009-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -130,6 +130,7 @@
"polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const\n"
"bit BIT data 3 4\n"
"sbit SBIT data 5 6\n"
+ "mplex MPLEX sbit data 1 10\n"
"mult MULTIPLY data sbit\n"
"div DIVIDE mult bit\n"
"recip RECIP div 6.5;4.3\n"
@@ -138,7 +139,7 @@
"/ALIAS alias data\n"
"string STRING \"Zaphod Beeblebrox\"\n";
const char* form2_data = "const2 CONST INT8 -19\n";
- const int nfields = 16;
+ const int nfields = 17;
unsigned char c[8];
unsigned char data_data[80];
signed char sc;
@@ -166,14 +167,15 @@
CarrayEntry aent, *aep;
StringEntry gent;
WindowEntry went, *wep;
+ MplexEntry xent, *xep;
Fragment *frag;
gd_triplet_t thresh;
char* fields[nfields + 7] = {(char*)"INDEX", (char*)"alias", (char*)"bit",
(char*)"carray", (char*)"const", (char*)"data", (char*)"div",
- (char*)"lincom", (char*)"linterp", (char*)"mult", (char*)"phase",
- (char*)"polynom", (char*)"recip", (char*)"sbit", (char*)"string",
- (char*)"window", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+ (char*)"lincom", (char*)"linterp", (char*)"mplex", (char*)"mult",
+ (char*)"phase", (char*)"polynom", (char*)"recip", (char*)"sbit",
+ (char*)"string", (char*)"window", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
char *strings[3];
// Write the test dirfile
@@ -635,7 +637,7 @@
// 44: Dirfile::NVectors check
n = d->NVectors();
CHECK_OK(44);
- CHECK_INT(44,n,23);
+ CHECK_INT(44,n,24);
// 45: Dirfile::VectorList check
fields[0] = (char*)"INDEX";
@@ -645,22 +647,23 @@
fields[4] = (char*)"div";
fields[5] = (char*)"lincom";
fields[6] = (char*)"linterp";
- fields[7] = (char*)"mult";
- fields[8] = (char*)"new1";
- fields[9] = (char*)"new10";
- fields[10] = (char*)"new2";
- fields[11] = (char*)"new3";
- fields[12] = (char*)"new4";
- fields[13] = (char*)"new5";
- fields[14] = (char*)"new6";
- fields[15] = (char*)"new7";
- fields[16] = (char*)"new8";
- fields[17] = (char*)"new9";
- fields[18] = (char*)"phase";
- fields[19] = (char*)"polynom";
- fields[20] = (char*)"recip";
- fields[21] = (char*)"sbit";
- fields[22] = (char*)"window";
+ fields[7] = (char*)"mplex";
+ fields[8] = (char*)"mult";
+ fields[9] = (char*)"new1";
+ fields[10] = (char*)"new10";
+ fields[11] = (char*)"new2";
+ fields[12] = (char*)"new3";
+ fields[13] = (char*)"new4";
+ fields[14] = (char*)"new5";
+ fields[15] = (char*)"new6";
+ fields[16] = (char*)"new7";
+ fields[17] = (char*)"new8";
+ fields[18] = (char*)"new9";
+ fields[19] = (char*)"phase";
+ fields[20] = (char*)"polynom";
+ fields[21] = (char*)"recip";
+ fields[22] = (char*)"sbit";
+ fields[23] = (char*)"window";
list = d->VectorList();
CHECK_OK(45);
CHECK_STRING_ARRAY(45,n,list[i],fields[i]);
@@ -1416,16 +1419,16 @@
CHECK_INT2(211, 1, ent->Type(), WindowEntryType);
CHECK_INT2(211, 2, ent->FragmentIndex(), 0);
CHECK_INT2(211, 3, ent->WindOp(), WindOpLt);
- CHECK_STRING2(211, 4, ent->Input(), "linterp");
- CHECK_STRING2(211, 5, ent->Check(), "mult");
+ CHECK_STRING2(211, 4, ent->Input(0), "linterp");
+ CHECK_STRING2(211, 5, ent->Input(1), "mult");
CHECK_DOUBLE2(211, 6, ent->Threshold().r, 4.1);
delete ent;
// 212: Dirfile::Add / WindowEntry check
went.SetName("new18");
went.SetFragmentIndex(0);
- went.SetInput("in1");
- went.SetCheck("in2");
+ went.SetInput("in1", 0);
+ went.SetInput("in2", 1);
went.SetWindOp(WindOpNe);
thresh.i = 32;
went.SetThreshold(thresh);
@@ -1437,16 +1440,16 @@
CHECK_INT2(212, 1, ent->Type(), WindowEntryType);
CHECK_INT2(212, 2, ent->FragmentIndex(), 0);
CHECK_INT2(212, 3, ent->WindOp(), WindOpNe);
- CHECK_STRING2(212, 4, ent->Input(), "in1");
- CHECK_STRING2(212, 5, ent->Check(), "in2");
+ CHECK_STRING2(212, 4, ent->Input(0), "in1");
+ CHECK_STRING2(212, 5, ent->Input(1), "in2");
CHECK_INT2(212, 6, ent->Threshold().i, 32);
delete ent;
// 214: gd_madd_window_i check
went.Dissociate();
went.SetName("mnew18");
- went.SetInput("in2");
- went.SetCheck("in3");
+ went.SetInput("in2", 0);
+ went.SetInput("in3", 1);
went.SetWindOp(WindOpSet);
thresh.u = 128;
went.SetThreshold(thresh);
@@ -1458,15 +1461,15 @@
CHECK_INT2(214, 1, ent->Type(), WindowEntryType);
CHECK_INT2(214, 2, ent->FragmentIndex(), 0);
CHECK_INT2(214, 3, ent->WindOp(), WindOpSet);
- CHECK_STRING2(214, 4, ent->Input(), "in2");
- CHECK_STRING2(214, 5, ent->Check(), "in3");
+ CHECK_STRING2(214, 4, ent->Input(0), "in2");
+ CHECK_STRING2(214, 5, ent->Input(1), "in3");
CHECK_INT2(214, 6, ent->Threshold().u, 128);
delete ent;
// 217: gd_alter_window_r check
wep = reinterpret_cast<WindowEntry*>(d->Entry("new18"));
- wep->SetInput("in3");
- wep->SetCheck("in4");
+ wep->SetInput("in3", 0);
+ wep->SetInput("in4", 1);
wep->SetWindOp(WindOpGe);
thresh.r = 32e3;
wep->SetThreshold(thresh);
@@ -1478,8 +1481,8 @@
CHECK_INT2(217, 1, ent->Type(), WindowEntryType);
CHECK_INT2(217, 2, ent->FragmentIndex(), 0);
CHECK_INT2(217, 3, ent->WindOp(), WindOpGe);
- CHECK_STRING2(217, 4, ent->Input(), "in3");
- CHECK_STRING2(217, 5, ent->Check(), "in4");
+ CHECK_STRING2(217, 4, ent->Input(0), "in3");
+ CHECK_STRING2(217, 5, ent->Input(1), "in4");
CHECK_DOUBLE2(217, 6, ent->Threshold().r, 32e3);
delete ent;
@@ -1554,12 +1557,82 @@
CHECK_STRING2(227, 3, frag->Suffix(), "C");
delete frag;
+ // 228: gd_entry (MPLEX) check
+ ent = d->Entry("mplex");
+ CHECK_OK(228);
+ CHECK_INT2(228, 1, ent->Type(), MplexEntryType);
+ CHECK_INT2(228, 2, ent->FragmentIndex(), 0);
+ CHECK_INT2(228, 3, ent->CountVal(), 1);
+ CHECK_STRING2(228, 4, ent->Input(0), "data");
+ CHECK_STRING2(228, 5, ent->Input(1), "sbit");
+ CHECK_INT2(228, 6, ent->CountMax(), 10);
+ delete ent;
+ // 229: Dirfile::Add / MplexEntry check
+ xent.SetName("new21");
+ xent.SetFragmentIndex(0);
+ xent.SetInput("in1", 0);
+ xent.SetInput("in2", 1);
+ xent.SetCountVal(5);
+ xent.SetCountMax(6);
+ d->Add(xent);
+ CHECK_OK2(229, 1);
+ ent = d->Entry("new21");
+ CHECK_OK2(229, 2);
+ CHECK_INT2(229, 1, ent->Type(), MplexEntryType);
+ CHECK_INT2(229, 2, ent->FragmentIndex(), 0);
+ CHECK_INT2(229, 3, ent->CountVal(), 5);
+ CHECK_STRING2(229, 4, ent->Input(0), "in1");
+ CHECK_STRING2(229, 5, ent->Input(1), "in2");
+ CHECK_INT2(229, 6, ent->CountMax(), 6);
+ delete ent;
+ // 230: gd_madd_mplex check
+ xent.Dissociate();
+ xent.SetName("mnew21");
+ xent.SetInput("in2", 0);
+ xent.SetInput("in3", 1);
+ xent.SetCountVal((gd_count_t)0);
+ xent.SetCountMax(12);
+ d->MAdd(xent, "data");
+ CHECK_OK2(230, 1);
+ ent = d->Entry("data/mnew21");
+ CHECK_OK2(230, 2);
+ CHECK_INT2(230, 1, ent->Type(), MplexEntryType);
+ CHECK_INT2(230, 2, ent->FragmentIndex(), 0);
+ CHECK_INT2(230, 3, ent->CountVal(), 0);
+ CHECK_STRING2(230, 4, ent->Input(0), "in2");
+ CHECK_STRING2(230, 5, ent->Input(1), "in3");
+ CHECK_INT2(230, 6, ent->CountMax(), 12);
+ delete ent;
+ // 231: gd_alter_mplex check
+ xep = reinterpret_cast<MplexEntry*>(d->Entry("new21"));
+ xep->SetInput("in3", 0);
+ xep->SetInput("in4", 1);
+ xep->SetCountVal(3);
+ xep->SetCountMax(7);
+ CHECK_OK2(231, 1);
+ delete xep;
+ ent = d->Entry("new21");
+ CHECK_OK2(231, 2);
+ CHECK_INT2(231, 1, ent->Type(), MplexEntryType);
+ CHECK_INT2(231, 2, ent->FragmentIndex(), 0);
+ CHECK_INT2(231, 3, ent->CountVal(), 3);
+ CHECK_STRING2(231, 4, ent->Input(0), "in3");
+ CHECK_STRING2(231, 5, ent->Input(1), "in4");
+ CHECK_INT2(231, 6, ent->CountMax(), 7);
+ delete ent;
+
+
+
+
+
+
+
// ===================================================================
d->Discard();
delete d;
Modified: trunk/getdata/bindings/cxx/windowentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/windowentry.cpp 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/cxx/windowentry.cpp 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-// Copyright (C) 2011 D. V. Wiebe
+// Copyright (C) 2011-2012 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -40,50 +40,23 @@
dreturnvoid();
}
-int WindowEntry::SetInput(const char* field)
+int WindowEntry::SetInput(const char* field, int index)
{
- int ret = 0;
-
- dtrace("\"%s\"", field);
-
- char* ptr = strdup(field);
-
- if (ptr == NULL) {
- dreturn("%i", -1);
+ if (index < 0 || index > 1)
return -1;
- }
- free(E.in_fields[0]);
- E.in_fields[0] = ptr;
-
- if (D != NULL)
- ret = gd_alter_entry(D->D, E.field, &E, 0);
-
- dreturn("%i", ret);
- return ret;
-}
-
-int WindowEntry::SetCheck(const char* field)
-{
- int ret = 0;
-
- dtrace("\"%s\"", field);
-
char* ptr = strdup(field);
- if (ptr == NULL) {
- dreturn("%i", -1);
+ if (ptr == NULL)
return -1;
- }
- free(E.in_fields[1]);
- E.in_fields[1] = ptr;
+ free(E.in_fields[index]);
+ E.in_fields[index] = ptr;
if (D != NULL)
- ret = gd_alter_entry(D->D, E.field, &E, 0);
+ return gd_alter_entry(D->D, E.field, &E, 0);
- dreturn("%i", ret);
- return ret;
+ return 0;
}
int WindowEntry::SetWindOp(WindOpType windop)
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2012-01-07 04:19:42 UTC (rev 644)
+++ trunk/getdata/bindings/f77/fgetdata.c 2012-01-11 08:05:50 UTC (rev 645)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2011 D. V. Wiebe
+/* Copyright (C) 2008-2012 D. V. Wiebe
*
*************************************************************************
*
@@ -853,6 +853,7 @@
else {
_GDF_FString(in_field, in_field_l, E.in_fields[0]);
_GDF_FString(check_field, check_field_l, E.in_fields[1])...
[truncated message content] |
|
From: <ket...@us...> - 2012-01-18 03:54:24
|
Revision: 650
http://getdata.svn.sourceforge.net/getdata/?rev=650&view=rev
Author: ketiltrout
Date: 2012-01-18 03:54:15 +0000 (Wed, 18 Jan 2012)
Log Message:
-----------
zzslim encoding support.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/f77/test/big_test.f
trunk/getdata/bindings/make_parameters.c
trunk/getdata/configure.ac
trunk/getdata/m4/encoding.m4
trunk/getdata/src/Makefile.am
trunk/getdata/src/common.c
trunk/getdata/src/encoding.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/internal.h
trunk/getdata/src/slim.c
trunk/getdata/test/Makefile.am
Added Paths:
-----------
trunk/getdata/src/zzslim.c
trunk/getdata/test/zzslim_get.c
trunk/getdata/test/zzslim_nframes.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/ChangeLog 2012-01-18 03:54:15 UTC (rev 650)
@@ -1,3 +1,21 @@
+2012-01-18 D. V. Wiebe <ge...@ke...> svn:650
+ * src/getdata.h.in src/internal.h: Define GD_ENC_ZZSLIM GD_ZZSLIM_ENCODED.
+ * src/zzslim.c: Added.
+ * src/encoding.c: In the initialisation of _gd_ef, differentiate things
+ that are willing to use the Generic functions from those that aren't. Added
+ zzslim.
+
+ * src/common.c (_GD_CanonicalPath): Don't truncate on ENOENT.
+
+ * src/slim.c (_GD_SlimOpen): The slimdopen in slimlib-2.6.5 doesn't interact
+ well with slim's own zzip support, so let's ignore it for now.
+
+ * bindings/make_parameters.c: Convert F77 encoding parameters to the form
+ GDE_xx.
+
+ * configure.ac: zzslim tests. Always look for a C++ compiler.
+ * m4/encoding.m4: Separate LIBS from LDFLAGS; fix some underquoting.
+
2012-01-11 D. V. Wiebe <ge...@ke...> svn:644
* src/getdata.h.in: Added GD_MPLEX_ENTRY. Updated gd_entry_t. Defined
GD_COUNT_MAX.
Modified: trunk/getdata/bindings/f77/test/big_test.f
===================================================================
--- trunk/getdata/bindings/f77/test/big_test.f 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/bindings/f77/test/big_test.f 2012-01-18 03:54:15 UTC (rev 650)
@@ -1254,7 +1254,7 @@
C 78: GDGENC check
CALL GDGENC(n, d, 0)
CALL CHKEOK(ne, 78, d)
- CALL CHKINT(ne, 78, n, GD_EN)
+ CALL CHKINT(ne, 78, n, GDE_UN)
C 79: GDGEND check
CALL GDGEND(n, d, 0)
@@ -1297,12 +1297,12 @@
CALL CHKSTR(ne, 85, str, 'new1')
C 87: GDAENC check
- CALL GDAENC(d, GD_ES, 1, 0)
+ CALL GDAENC(d, GDE_TX, 1, 0)
CALL CHKOK2(ne, 87, 1, d)
CALL GDGENC(n, d, 1)
CALL CHKOK2(ne, 87, 2, d)
- CALL CHKINT(ne, 87, n, GD_ES)
+ CALL CHKINT(ne, 87, n, GDE_TX)
C 88: GDAEND check
CALL GDAEND(d, GD_BE, 1, 0)
Modified: trunk/getdata/bindings/make_parameters.c
===================================================================
--- trunk/getdata/bindings/make_parameters.c 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/bindings/make_parameters.c 2012-01-18 03:54:15 UTC (rev 650)
@@ -111,14 +111,15 @@
CONSTANT(NOT_ARM_ENDIAN, "GD_NA", 2),
CONSTANT(PERMISSIVE, "GD_PM", 1),
- CONSTANT(AUTO_ENCODED, "GD_EA", 1),
- CONSTANT(BZIP2_ENCODED, "GD_EB", 2),
- CONSTANT(LZMA_ENCODED, "GD_EL", 2),
- CONSTANT(UNENCODED, "GD_EN", 2),
- CONSTANT(GZIP_ENCODED, "GD_EG", 2),
- CONSTANT(TEXT_ENCODED, "GD_ET", 2),
- CONSTANT(SLIM_ENCODED, "GD_ES", 2),
- CONSTANT(ZZIP_ENCODED, "GD_EZ", 2),
+ CONSTANT(AUTO_ENCODED, "GDE_AU", 1),
+ CONSTANT(BZIP2_ENCODED, "GDE_BZ", 2),
+ CONSTANT(LZMA_ENCODED, "GDE_LZ", 2),
+ CONSTANT(UNENCODED, "GDE_UN", 2),
+ CONSTANT(GZIP_ENCODED, "GDE_GZ", 2),
+ CONSTANT(TEXT_ENCODED, "GDE_TX", 2),
+ CONSTANT(SLIM_ENCODED, "GDE_SL", 2),
+ CONSTANT(ZZIP_ENCODED, "GDE_ZZ", 2),
+ CONSTANT(ZZSLIM_ENCODED, "GDE_ZS", 2),
CONSTANT(NO_ENTRY, "GD_NOE", 3),
CONSTANT(RAW_ENTRY, "GD_RWE", 3),
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/configure.ac 2012-01-18 03:54:15 UTC (rev 650)
@@ -345,16 +345,13 @@
AC_HEADER_STDC
AM_PROG_AS
-if test "x$make_cxxbindings" != "xno"; then
- echo
- echo "*** Checking C++ compiler characteristics"
- echo
- AC_PROG_CXX
- AC_PROG_CXX_C_O
-else
- am__fastdepCXX_TRUE=
- am__fastdepCXX_FALSE='#'
-fi
+
+echo
+echo "*** Checking C++ compiler characteristics"
+echo
+AC_PROG_CXX
+AC_PROG_CXX_C_O
+
if test "x$make_f77bindings" != "xno"; then
echo
echo "*** Checking Fortran 77 compiler characteristics"
@@ -466,7 +463,7 @@
GD_PROG_CC_WALL
GD_PROG_CC_WEXTRA
-if test "x$make_c++bindings" != "xno"; then
+if test "x$make_cxxbindings" != "xno"; then
GD_PROG_CXX_WALL
GD_PROG_CXX_WEXTRA
fi
@@ -820,12 +817,95 @@
dnl external encodings
GD_CHECK_ENCODING([bzip2],[bz2],[BZ2_bzReadOpen],[bzlib.h],[bzip2],[bunzip2],[])
+GD_CHECK_ENCODING([gzip],[z],[gzopen],[zlib.h],[gzip],[gunzip],[])
+GD_CHECK_ENCODING([lzma],[lzma],[lzma_auto_decoder],[lzma.h],[xz],[],[])
GD_CHECK_ENCODING([slim],[slim],[slimopen],[slimlib.h], [slim slimdata],
[unslim],[slimdopen])
-GD_CHECK_ENCODING([gzip],[z],[gzopen],[zlib.h],[gzip],[gunzip],[])
-GD_CHECK_ENCODING([lzma],[lzma],[lzma_auto_decoder],[lzma.h],[xz],[],[])
GD_CHECK_ENCODING([zzip],[zzip],[zzip_open],[zzip/lib.h],[zip],[unzip],[])
+dnl zzslim hackery -- there's no easy way to check whether slim supports zzip
+AC_ARG_ENABLE(zzslim, AS_HELP_STRING([--enable-zzslim],
+ [skip probing for zzslim required features and enable the zzslim
+ encoding. The default is to autodetect support. Note: zzslim
+ encoding support requires both slim and zzip encoding support.]),
+ [
+ case "${enableval}" in
+ no) zzslim_override="no" ;;
+ *) zzslim_override="yes" ;;
+ esac
+ ], [ zzslim_override="auto" ])
+m4_divert_once([HELP_ENABLE], AS_HELP_STRING([--disable-zzslim],
+ [disable zzslim encodings support]))
+
+echo
+echo "*** Configuring zzslim support "
+echo
+if test $zzslim_override = "no"; then
+ AC_MSG_CHECKING([for zzslim support])
+ AC_MSG_RESULT([no (forced)])
+ use_zzslim=no
+else
+ AC_MSG_CHECKING([for slim support])
+ AC_MSG_RESULT([$use_slim])
+ AC_MSG_CHECKING([for zzip support])
+ AC_MSG_RESULT([$use_zzip])
+ if test "$use_slim$use_zzip" == "yesyes"; then
+ if test $zzslim_override = "yes"; then
+ AC_MSG_CHECKING([for zzslim support])
+ AC_MSG_RESULT([yes (forced)])
+ use_zzslim=yes
+ elif test "x$CXX" = "x"; then
+ AC_MSG_CHECKING([for zzslim support])
+ AC_MSG_RESULT([no (no C++ compiler available for configure test)])
+ use_zzslim=no
+ else
+ dnl try linking to the slim library to see if it contains the unprototyped
+ dnl ibitstream::ibitstream(ZZIP_FILE *file, int buffersize)
+ dnl given that this function isn't public, this is probably easily broken
+ AC_MSG_CHECKING([whether -lslim contains zzip capability])
+ AC_LANG_PUSH([C++])
+ saved_ldflags=$LDFLAGS
+ saved_libs=$LIBS
+ LDFLAGS="$SLIM_LDFLAGS $LDFLAGS"
+ LIBS="$SLIM_LIBS $LIBS"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(
+ [[
+ struct zzip_file;
+ typedef struct zzip_file ZZIP_FILE;
+ class ibitstream {
+ public:
+ ibitstream(ZZIP_FILE *file, int buffersize);
+ };
+ ]],
+ [[
+ ZZIP_FILE *file;
+ ibitstream foo(file, 0);
+ ]]
+ )], [slim_zzip="yes"], [slim_zzip="no"])
+ AC_MSG_RESULT([$slim_zzip])
+ LDFLAGS=$saved_ldflags
+ LIBS=$saved_libs
+ AC_LANG_POP
+
+ use_zzslim=$slim_zzip
+ fi
+ else
+ use_zzslim="no"
+ fi
+fi
+
+dnl add to summary and private lib list
+if test "x$use_zzslim" != "xno"; then
+ AC_DEFINE([USE_ZZSLIM], [], [ Define to enable zzslim support ])
+ if test "x$use_modules" != "xno"; then
+ ENCODINGS_MODS="${ENCODINGS_MODS} zzslim";
+ else
+ ENCODINGS_BUILT="${ENCODINGS_BUILT} zzslim";
+ fi
+else
+ ENCODINGS_LEFT="${ENCODINGS_LEFT} zzslim";
+fi
+
if test ! -z "${LIBS}"; then
PRIVATE_LIBS="${LIBS} ${PRIVATE_LIBS}"
fi
@@ -901,8 +981,10 @@
AM_CONDITIONAL(TEST_IDL, [test "x$NO_DLOPEN_TESTS" = "x0"])
AM_CONDITIONAL(TEST_PERL, [test "x$HAVE_Test__Harness" = "xyes"])
AM_CONDITIONAL(HAVE_DIFF, [test "x$DIFF" != "x"])
+AM_CONDITIONAL(USE_ZZSLIM, [test "x$use_zzslim" = "xyes"])
AM_CONDITIONAL(GDIDL_EXTERNAL, [false])
+
dnl we do this here to avoid screwing up other tests
LDFLAGS="${LDFLAGS}${NO_UNDEFINED}"
Modified: trunk/getdata/m4/encoding.m4
===================================================================
--- trunk/getdata/m4/encoding.m4 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/m4/encoding.m4 2012-01-18 03:54:15 UTC (rev 650)
@@ -77,13 +77,15 @@
dnl cleanup
AS_TR_CPP(gd_encoding[_CPPFLAGS])=
AS_TR_CPP(gd_encoding[_LDFLAGS])=
+AS_TR_CPP(gd_encoding[_LIBS])=
if test "x$have_this_header" = "xyes" -a "x$have_this_lib" = "xyes"; then
if test "x$gd_encoding[]_prefix" = "x"; then
- AS_TR_CPP(gd_encoding[_LDFLAGS])="-l$2"
+ AS_TR_CPP(gd_encoding[_LIBS])="-l$2"
AS_TR_CPP(gd_encoding[_SEARCHPATH])="$PATH"
else
AS_TR_CPP(gd_encoding[_CPPFLAGS])="-I$gd_encoding[]_prefix/include"
- AS_TR_CPP(gd_encoding[_LDFLAGS])="-L$gd_encoding[]_prefix/lib -l$2"
+ AS_TR_CPP(gd_encoding[_LDFLAGS])="-L$gd_encoding[]_prefix/lib"
+ AS_TR_CPP(gd_encoding[_LIBS])="-l$2"
AS_TR_CPP(gd_encoding[_SEARCHPATH])="$gd_encoding[]_prefix/bin:$PATH"
fi
AC_DEFINE(AS_TR_CPP([USE_]gd_encoding), [], [ Define to enable ]gd_encoding[ support ])
@@ -93,9 +95,10 @@
fi
AC_SUBST(AS_TR_CPP(gd_encoding[_CPPFLAGS]))
AC_SUBST(AS_TR_CPP(gd_encoding[_LDFLAGS]))
+AC_SUBST(AS_TR_CPP(gd_encoding[_LIBS]))
dnl executables needed for tests
-m4_define(gd_progname, regexp([$5 ], [^\([^ ]*\) ], [\1]))
+m4_define([gd_progname], regexp([$5 ], [^\([^ ]*\) ], [\1]))
AC_PATH_PROGS([path_]gd_progname, [$5], [not found], [$AS_TR_CPP(gd_encoding[_SEARCHPATH])])
if test "x$path_[]gd_progname" != "xnot found"; then
@@ -104,7 +107,7 @@
fi
ifelse(`x$6', `x',,[
-m4_define(gd_unprogname, regexp([$6 ], [^\([^ ]*\) ], [\1]))
+m4_define([gd_unprogname], regexp([$6 ], [^\([^ ]*\) ], [\1]))
AC_PATH_PROGS([path_]gd_unprogname, [$6], [not found], [$AS_TR_CPP(gd_encoding[_SEARCHPATH])])
if test "x$path_[]gd_unprogname" != "xnot found"; then
@@ -126,9 +129,9 @@
else
ENCODINGS_BUILT="${ENCODINGS_BUILT} gd_encoding";
if test -z "$PRIVATE_LIBS"; then
- PRIVATE_LIBS="[$]AS_TR_CPP(gd_encoding[_LDFLAGS])"
+ PRIVATE_LIBS="[$]AS_TR_CPP(gd_encoding[_LDFLAGS]) [$]AS_TR_CPP(gd_encoding[_LIBS])"
else
- PRIVATE_LIBS="$PRIVATE_LIBS [$]AS_TR_CPP(gd_encoding[_LDFLAGS])"
+ PRIVATE_LIBS="[$]AS_TR_CPP(gd_encoding[_LDFLAGS]) $PRIVATE_LIBS [$]AS_TR_CPP(gd_encoding[_LIBS])"
fi
fi
else
Modified: trunk/getdata/src/Makefile.am
===================================================================
--- trunk/getdata/src/Makefile.am 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/src/Makefile.am 2012-01-18 03:54:15 UTC (rev 650)
@@ -73,7 +73,16 @@
endif
endif
+if USE_ZZSLIM
if USE_MODULES
+LIBGETDATAZZSLIM_LA=libgetdatazzslim.la
+DLOPEN_LIBGETDATAZZSLIM_LA=-dlopen libgetdatazzslim.la
+else
+ZZSLIM_C=zzslim.c
+endif
+endif
+
+if USE_MODULES
EXPORT_DYNAMIC=-export-dynamic
DGETDATA_MODULEDIR=-DGETDATA_MODULEDIR="\"$(moduledir)\""
else
@@ -81,6 +90,7 @@
$(LZMA_CPPFLAGS) $(ZZIP_CPPFLAGS)
EXTERNAL_LDFLAGS=$(SLIM_LDFLAGS) $(GZIP_LDFLAGS) $(BZIP2_LDFLAGS) \
$(LZMA_LDFLAGS) $(ZZIP_LDFLAGS)
+EXTERNAL_LIBS=$(SLIM_LIBS) $(GZIP_LIBS) $(BZIP2_LIBS) $(LZMA_LIBS) $(ZZIP_LIBS)
endif
if INCLUDE_LEGACY_API
@@ -112,7 +122,7 @@
lib_LTLIBRARIES = libgetdata.la
module_LTLIBRARIES = ${LIBGETDATASLIM_LA} ${LIBGETDATAGZIP_LA} \
${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_LA} \
- ${LIBGETDATAZZIP_LA}
+ ${LIBGETDATAZZIP_LA} ${LIBGETDATAZZSLIM_LA}
libgetdata_la_SOURCES = add.c ascii.c ${BZIP2_C} close.c common.c compat.c \
constant.c ${DEBUG_C} del.c encoding.c endian.c \
entry.c errors.c field_list.c flimits.c flush.c fpos.c \
@@ -120,41 +130,48 @@
include.c ${LEGACY_C} ${LZMA_C} meta_list.c mod.c \
move.c name.c native.c nfields.c nframes.c nmeta.c \
open.c parse.c protect.c putdata.c raw.c sie.c \
- ${SLIM_C} spf.c string.c types.c ${ZZIP_C} \
+ ${SLIM_C} spf.c string.c types.c ${ZZIP_C} ${ZZSLIM_C} \
${GETDATA_LEGACY_H} internal.h nan.h
libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
-version-info \
${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
- $(EXTERNAL_LDFLAGS)
+ $(EXTERNAL_LDFLAGS) $(EXTERNAL_LIBS)
libgetdata_la_LIBADD = $(LIBLTDL) $(DLOPEN_LIBGETDATASLIM_LA) \
- $(DLOPEN_LIBGETDATAGZIP_LA) \
+ $(DLOPEN_LIBGETDATAGZIP_LA)
$(DLOPEN_LIBGETDATABZIP2_LA) \
- $(DLOPEN_LIBGETDATALZMA_LA) \
- $(DLOPEN_LIBGETDATAZZIP_LA)
+ $(DLOPEN_LIBGETDATALZMA_LA) $(DLOPEN_LIBGETDATAZZIP_LA) \
+ $(DLOPEN_LIBGETDATAZZSLIM_LA)
libgetdataslim_la_SOURCES = slim.c
libgetdataslim_la_LDFLAGS = $(SLIM_LDFLAGS) -release $(PACKAGE_VERSION) \
- -module
+ -module $(SLIM_LIBS)
libgetdataslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS)
libgetdatagzip_la_SOURCES = gzip.c
-libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) -module
+libgetdatagzip_la_LDFLAGS = $(GZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
+ -module $(GZIP_LIBS)
libgetdatagzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(GZIP_CPPFLAGS)
libgetdatabzip2_la_SOURCES = bzip.c
libgetdatabzip2_la_LDFLAGS = $(BZIP2_LDFLAGS) -release $(PACKAGE_VERSION) \
- -module
+ -module $(BZIP2_LIBS)
libgetdatabzip2_la_CPPFLAGS = $(AM_CPPFLAGS) $(BZIP2_CPPFLAGS)
libgetdatalzma_la_SOURCES = lzma.c
libgetdatalzma_la_LDFLAGS = $(LZMA_LDFLAGS) -release $(PACKAGE_VERSION) \
- -module
+ -module $(LZMA_LIBS)
libgetdatalzma_la_CPPFLAGS = $(AM_CPPFLAGS) $(LZMA_CPPFLAGS)
libgetdatazzip_la_SOURCES = zzip.c
libgetdatazzip_la_LDFLAGS = $(ZZIP_LDFLAGS) -release $(PACKAGE_VERSION) \
- -module
+ -module $(ZZIP_LIBS)
libgetdatazzip_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+libgetdatazzslim_la_SOURCES = zzslim.c
+libgetdatazzslim_la_LDFLAGS = $(SLIM_LDFLAGS) $(ZZIP_LDFLAGS) \
+ -release $(PACKAGE_VERSION) -module \
+ $(SLIM_LIBS) $(ZZIP_LIBS)
+libgetdatazzslim_la_CPPFLAGS = $(AM_CPPFLAGS) $(SLIM_CPPFLAGS) $(ZZIP_CPPFLAGS)
+
clean-local:
rm -rf *~ getdata.pc
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/src/common.c 2012-01-18 03:54:15 UTC (rev 650)
@@ -955,7 +955,7 @@
return D->name;
}
-/* This is effectively the POSIX.1 realpath(3) function, but with some
+/* This is mostly the POSIX.1 realpath(3) function, but with some
* optimisation due to the fact that we know that the front part of the
* path (car) has already been canonicalised */
char *_GD_CanonicalPath(const char *car, const char *cdr)
@@ -1122,11 +1122,30 @@
/* check if it's a symlink */
if (lstat64(res, &statbuf)) {
- if (errno == ENOENT && *end == '\0') {
- /* the leaf doesn't exist. I guess that means we're done. */
+ if (errno == ENOENT) {
+ /* the thing doesn't exist. I guess that means we're done;
+ * copy the rest of the work buffer onto the resul and call it a
+ * day. */
+ dwatch("%s", res);
+ if (*end) {
+ len = strlen(end) + 1;
+ if (res_len + len >= res_size) {
+ ptr = (char*)realloc(res, res_size += len);
+ if (ptr == NULL) {
+ free(res);
+ free(work);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+ res = ptr;
+ }
+ res[res_len++] = '/';
+ strcpy(res + res_len, end);
+ res_len += len - 1;
+ }
goto _GD_CanonicalPath_DONE;
}
- /* doesn't exist */
+ /* lstat error */
free(res);
free(work);
dreturn("%p", NULL);
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/src/encoding.c 2012-01-18 03:54:15 UTC (rev 650)
@@ -32,13 +32,19 @@
#endif
/* encoding schemas */
-#define GD_EF_NULL_SET &_GD_GenericName, NULL, NULL, NULL, NULL, NULL, \
+#define GD_EF_NULL_SET NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
+ NULL
+#define GD_EF_GENERIC_SET &_GD_GenericName, NULL, NULL, NULL, NULL, NULL, \
NULL, NULL, &_GD_GenericMove, &_GD_GenericUnlink
#ifdef USE_MODULES
-#define GD_EXT_ENCODING(sc,ex,ec,af,ff) \
+#define GD_EXT_ENCODING_NULL(sc,ex,ec,af,ff) \
{ sc,ex,ec,af,ff,GD_EF_PROVIDES,GD_EF_NULL_SET }
+#define GD_EXT_ENCODING_GEN(sc,ex,ec,af,ff) \
+{ sc,ex,ec,af,ff,GD_EF_PROVIDES,GD_EF_GENERIC_SET }
#else
#define GD_EXT_ENCODING(sc,ex,ec,af,ff) { sc,ex,ec,af,ff,0,GD_INT_FUNCS }
+#define GD_EXT_ENCODING_NULL GD_EXT_ENCODING
+#define GD_EXT_ENCODING_GEN GD_EXT_ENCODING
#endif
struct encoding_t _gd_ef[GD_N_SUBENCODINGS] = {
{ GD_UNENCODED, "", GD_EF_ECOR, NULL, "none", 0,
@@ -59,7 +65,7 @@
#define GD_EF_PROVIDES 0
#define GD_INT_FUNCS GD_EF_NULL_SET
#endif
- GD_EXT_ENCODING(GD_GZIP_ENCODED, ".gz", GD_EF_ECOR | GD_EF_OOP, "Gzip",
+ GD_EXT_ENCODING_GEN(GD_GZIP_ENCODED, ".gz", GD_EF_ECOR | GD_EF_OOP, "Gzip",
"gzip"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -76,7 +82,7 @@
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
#endif
- GD_EXT_ENCODING(GD_BZIP2_ENCODED, ".bz2", GD_EF_ECOR, "Bzip2", "bzip2"),
+ GD_EXT_ENCODING_GEN(GD_BZIP2_ENCODED, ".bz2", GD_EF_ECOR, "Bzip2", "bzip2"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -92,7 +98,7 @@
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
#endif
- GD_EXT_ENCODING(GD_SLIM_ENCODED, ".slm", GD_EF_ECOR, "Slim", "slim"),
+ GD_EXT_ENCODING_GEN(GD_SLIM_ENCODED, ".slm", GD_EF_ECOR, "Slim", "slim"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -108,8 +114,8 @@
#define GD_INT_FUNCS GD_EF_NULL_SET
#define GD_EF_PROVIDES 0
#endif
- GD_EXT_ENCODING(GD_LZMA_ENCODED, ".xz", GD_EF_ECOR, "Lzma", "lzma"),
- GD_EXT_ENCODING(GD_LZMA_ENCODED, ".lzma", GD_EF_ECOR, "Lzma", "lzma"),
+ GD_EXT_ENCODING_GEN(GD_LZMA_ENCODED, ".xz", GD_EF_ECOR, "Lzma", "lzma"),
+ GD_EXT_ENCODING_GEN(GD_LZMA_ENCODED, ".lzma", GD_EF_ECOR, "Lzma", "lzma"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -132,21 +138,38 @@
GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
#define GD_INT_FUNCS \
&_GD_ZzipName, &_GD_ZzipOpen, &_GD_ZzipClose, &_GD_ZzipSeek, &_GD_ZzipRead, \
- &_GD_ZzipSize, NULL /* WRITE */, NULL /* SYNC */, &_GD_GenericMove, \
- &_GD_GenericUnlink
+ &_GD_ZzipSize, NULL /* WRITE */, NULL /* SYNC */, NULL /* MOVE */, \
+ NULL /* UNLINK */
#else
-#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_INT_FUNCS NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
#define GD_EF_PROVIDES 0
#endif
- GD_EXT_ENCODING(GD_ZZIP_ENCODED, NULL, GD_EF_ECOR | GD_EF_EDAT, "Zzip",
+ GD_EXT_ENCODING_NULL(GD_ZZIP_ENCODED, NULL, GD_EF_ECOR | GD_EF_EDAT, "Zzip",
"zzip"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
- { GD_ENC_UNSUPPORTED, "", 0, "", "", 0,
+#ifdef USE_ZZSLIM
+#define GD_EF_PROVIDES \
+ GD_EF_NAME | GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+ &_GD_ZzslimName, &_GD_ZzslimOpen, &_GD_ZzslimClose, &_GD_ZzslimSeek, \
+ &_GD_ZzslimRead, &_GD_ZzslimSize, NULL /* WRITE */, NULL /* SYNC */, \
+ NULL /* MOVE */, NULL /* UNLINK */
+#else
+#define GD_INT_FUNCS NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+#define GD_EF_PROVIDES 0
+#endif
+ GD_EXT_ENCODING_NULL(GD_ZZSLIM_ENCODED, NULL, GD_EF_ECOR | GD_EF_EDAT,
+ "Zzslim", "zzslim"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+ { GD_ENC_UNSUPPORTED, NULL, 0, "", "", 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
- },
+ }
};
void _GD_InitialiseFramework(void)
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/src/getdata.h.in 2012-01-18 03:54:15 UTC (rev 650)
@@ -451,6 +451,7 @@
#define GD_LZMA_ENCODED 0x06000000 /* Data are xz encoded */
#define GD_SIE_ENCODED 0x07000000 /* Data are sample index encoded */
#define GD_ZZIP_ENCODED 0x08000000 /* Data are zzip encoded */
+#define GD_ZZSLIM_ENCODED 0x09000000 /* Data are zzslim encoded */
#define GD_ENC_UNSUPPORTED GD_ENCODING /* Encoding unsupported */
/* delete flags */
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/src/internal.h 2012-01-18 03:54:15 UTC (rev 650)
@@ -740,7 +740,8 @@
#define GD_ENC_XZ_RAW 6
#define GD_ENC_SIE 7
#define GD_ENC_ZZIP 8
-#define GD_ENC_UNKNOWN 9
+#define GD_ENC_ZZSLIM 9
+#define GD_ENC_UNKNOWN 10
#define GD_N_SUBENCODINGS (GD_ENC_UNKNOWN + 1)
@@ -1147,6 +1148,18 @@
off64_t _GD_ZzipSize(int, struct _gd_raw_file* file, gd_type_t data_type,
int swap);
+/* zzslim I/O methods */
+int _GD_ZzslimName(DIRFILE *restrict, const char *restrict,
+ struct _gd_raw_file *restrict, const char *restrict, int, int);
+int _GD_ZzslimOpen(int, struct _gd_raw_file* file, int swap, unsigned int);
+off64_t _GD_ZzslimSeek(struct _gd_raw_file* file, off64_t count,
+ gd_type_t data_type, unsigned int);
+ssize_t _GD_ZzslimRead(struct _gd_raw_file *restrict, void *restrict, gd_type_t,
+ size_t);
+int _GD_ZzslimClose(struct _gd_raw_file* file);
+off64_t _GD_ZzslimSize(int, struct _gd_raw_file* file, gd_type_t data_type,
+ int swap);
+
#ifndef __cplusplus
# undef gd_nothrow
# define gd_nothrow
Modified: trunk/getdata/src/slim.c
===================================================================
--- trunk/getdata/src/slim.c 2012-01-17 01:46:27 UTC (rev 649)
+++ trunk/getdata/src/slim.c 2012-01-18 03:54:15 UTC (rev 650)
@@ -38,33 +38,20 @@
int _GD_SlimOpen(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
unsigned int mode __gd_unused)
{
+ char *filepath;
+
dtrace("%i, %p, <unused>, <unused>", dirfd, file);
- {
-#ifdef HAVE_SLIMDOPEN
- int fd;
- fd = gd_OpenAt(file->D, dirfd, file->name, ((mode & GD_FILE_WRITE) ?
- (O_RDWR | O_CREAT) : O_RDONLY) | O_BINARY, 0666);
-
- if (fd < 0) {
- dreturn("%i", 1);
- return 1;
- }
- file->edata = slimdopen(fd, "r");
-#else
- char *filepath;
- /* this is easily broken, but the best we can do for now... */
- filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
- if (filepath == NULL) {
- dreturn("%i", 1);
- return 1;
- }
-
- file->edata = slimopen(filepath, "r");
- free(filepath);
-#endif
+ /* this is easily broken, but the best we can do for now... */
+ filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+ if (filepath == NULL) {
+ dreturn("%i", 1);
+ return 1;
}
+ file->edata = slimopen(filepath, "r");
+ free(filepath);
+
if (file->edata == NULL) {
dreturn("%i", 1);
return 1;
Added: trunk/getdata/src/zzslim.c
===================================================================
--- trunk/getdata/src/zzslim.c (rev 0)
+++ trunk/getdata/src/zzslim.c 2012-01-18 03:54:15 UTC (rev 650)
@@ -0,0 +1,180 @@
+/* Copyright (C) 2008, 2010, 2011, 2012 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
+ */
+#include "internal.h"
+
+#ifdef HAVE_SLIMLIB_H
+#include <slimlib.h>
+#endif
+
+#ifdef USE_MODULES
+#define _GD_ZzslimName libgetdatazzslim_LTX_GD_ZzslimName
+#define _GD_ZzslimOpen libgetdatazzslim_LTX_GD_ZzslimOpen
+#define _GD_ZzslimSeek libgetdatazzslim_LTX_GD_ZzslimSeek
+#define _GD_ZzslimRead libgetdatazzslim_LTX_GD_ZzslimRead
+#define _GD_ZzslimClose libgetdatazzslim_LTX_GD_ZzslimClose
+#define _GD_ZzslimSize libgetdatazzslim_LTX_GD_ZzslimSize
+#endif
+
+/* The zzslim encoding scheme uses edata as a slimfile pointer. If a file is
+ * open, idata = 0 otherwise idata = -1. */
+
+int _GD_ZzslimName(DIRFILE *restrict D, const char *restrict enc_data,
+ struct _gd_raw_file *restrict file, const char *restrict base,
+ int temp __gd_unused, int resolv)
+{
+ size_t enc_len;
+
+ dtrace("%p, \"%s\", %p, \"%s\", <unused>, %i", D, enc_data, file, base,
+ resolv);
+
+ if (enc_data == NULL)
+ enc_data = "raw";
+
+ enc_len = strlen(enc_data);
+
+ /* Resolution is degenerate with the zzip encoding; so skip it for now */
+ if (resolv) {
+ dreturn("%i", 1);
+ return 1;
+ }
+
+ if (file->name == NULL) {
+ file->D = D;
+ file->name = (char *)malloc(strlen(base) + strlen(enc_data) + 6);
+ if (file->name == NULL) {
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ strcpy(file->name, enc_data);
+ file->name[enc_len] = '/';
+ strcat(strcpy(file->name + enc_len + 1, base), ".slm");
+ }
+
+ dreturn("%i (%s)", 0, file->name);
+ return 0;
+}
+int _GD_ZzslimOpen(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
+ unsigned int mode __gd_unused)
+{
+ char *filepath;
+
+ dtrace("%i, %p, <unused>, <unused>", dirfd, file);
+
+ /* this is easily broken, but the best we can do for now... */
+ filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+ if (filepath == NULL) {
+ dreturn("%i", 1);
+ return 1;
+ }
+
+ file->edata = slimopen(filepath, "r");
+ free(filepath);
+
+ if (file->edata == NULL) {
+ dreturn("%i", 1);
+ return 1;
+ }
+
+ file->mode = GD_RDONLY;
+ file->idata = 0;
+ dreturn("%i", 0);
+ return 0;
+}
+
+off64_t _GD_ZzslimSeek(struct _gd_raw_file* file, off64_t count,
+ gd_type_t data_type, unsigned int mode __gd_unused)
+{
+ off64_t n;
+
+ dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
+
+ n = (off64_t)slimseek((SLIMFILE *)file->edata, (off_t)count *
+ GD_SIZE(data_type), SEEK_SET);
+
+ if (n == -1) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ dreturn("%lli", (long long)(n / GD_SIZE(data_type)));
+ return n;
+}
+
+ssize_t _GD_ZzslimRead(struct _gd_raw_file *restrict file, void *restrict ptr,
+ gd_type_t data_type, size_t nmemb)
+{
+ ssize_t n;
+
+ dtrace("%p, %p, 0x%X, %zu", file, ptr, data_type, nmemb);
+
+ n = slimread(ptr, GD_SIZE(data_type), nmemb, (SLIMFILE *)file->edata);
+
+ dreturn("%zu", n);
+ return n;
+}
+
+int _GD_ZzslimClose(struct _gd_raw_file *file)
+{
+ int ret;
+
+ dtrace("%p", file);
+
+ ret = slimclose((SLIMFILE *)file->edata);
+ if (!ret) {
+ file->idata = -1;
+ file->edata = NULL;
+ file->mode = 0;
+ }
+
+ dreturn("%i", ret);
+ return ret;
+}
+
+off64_t _GD_ZzslimSize(int dirfd, struct _gd_raw_file *file,
+ gd_type_t data_type, int swap __gd_unused)
+{
+ char *filepath;
+ off64_t size;
+
+ dtrace("%i, %p, 0x%X", dirfd, file, data_type);
+
+ /* this is easily broken, but the best we can do for now... */
+ filepath = gd_MakeFullPathOnly(file->D, dirfd, file->name);
+ if (filepath == NULL) {
+ dreturn("%i", 1);
+ return 1;
+ }
+
+ size = slimrawsize(filepath);
+ free(filepath);
+
+ if (size < 0) {
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ size /= GD_SIZE(data_type);
+
+ dreturn("%lli", (long long)size);
+ return size;
+}
Property changes on: trunk/getdata/test
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_mplex
add_mplex_val
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
...
[truncated message content] |
|
From: <ket...@us...> - 2012-02-01 19:05:58
|
Revision: 652
http://getdata.svn.sourceforge.net/getdata/?rev=652&view=rev
Author: ketiltrout
Date: 2012-02-01 19:05:51 +0000 (Wed, 01 Feb 2012)
Log Message:
-----------
Windows path malarkey.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/cxx/test/big_test.cpp
trunk/getdata/bindings/f77/test/Makefile.am
trunk/getdata/bindings/f77/test/big_test.f
trunk/getdata/bindings/f77/test/big_test95.f90
trunk/getdata/configure.ac
trunk/getdata/src/common.c
trunk/getdata/src/internal.h
trunk/getdata/src/open.c
trunk/getdata/src/spf.c
trunk/getdata/test/file.c
trunk/getdata/test/fragment_name.c
Added Paths:
-----------
trunk/getdata/bindings/f77/test/test_getdata.f.in
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/ChangeLog 2012-02-01 19:05:51 UTC (rev 652)
@@ -1,3 +1,21 @@
+2012-02-01 D. V. Wiebe <ge...@ke...> svn:652
+ * configure.ac: Figure out the directory separator (ie. '/' on POSIX).
+
+ * src/open.c (_GD_CreateDirfile): Handle DIRSEP.
+ * src/internal.h (_GD_Root): Added.
+ * src/common.c (_GD_CanonicalPath): Handle WIN32/DOS paths.
+
+ * src/open.c (gd_cbopen): Temporarily store the full path in D->name so that
+ _GD_CreateDirfile can use it when needed.
+
+ * src/spf.c (_GD_GetSPF): De const-ify E.
+
+ * src/common.c (_GD_FindField): Fix buffer length calculation.
+
+ * test/file.c test/fragment_name.c bindings/cxx/test/big_test.cpp
+ bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90: Handle DIRSEP.
+ * bindings/f77/test/test_getdata.f.in: Added.
+
2012-01-18 D. V. Wiebe <ge...@ke...> svn:650
* src/getdata.h.in src/internal.h: Define GD_ENC_ZZSLIM GD_ZZSLIM_ENCODED.
* src/zzslim.c: Added.
Modified: trunk/getdata/bindings/cxx/test/big_test.cpp
===================================================================
--- trunk/getdata/bindings/cxx/test/big_test.cpp 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/bindings/cxx/test/big_test.cpp 2012-02-01 19:05:51 UTC (rev 652)
@@ -32,6 +32,7 @@
#include <unistd.h>
#include <iostream>
#include <math.h>
+#include <stdio.h>
#if MKDIR_NO_MODE
#ifdef HAVE__MKDIR
@@ -97,8 +98,8 @@
ne++; cerr << "s(" << i << ")[" << t << "] = \"" << (v) << "\"" << endl; }
#define CHECK_EOSTRING(t,v,g) \
- if (strcmp((v) + strlen(v) - sizeof(g) + 1, (g))) { ne++; cerr << "s[" << t << "] = \"" << (v) << "\"" \
- << endl; }
+ if (strcmp((v) + strlen(v) - strlen(g), (g))) { ne++; cerr << "s[" << t << "] = \"" << (v) << \
+ "\", expected ...\"" << g << "\"" << endl; }
#define CHECK_COMPLEX2(t,m,v,g) \
if (abs((v) - (g)) > 1e-10) { \
@@ -605,7 +606,8 @@
// 39: Fragment check
frag = d->Fragment(0);
CHECK_OK(39);
- CHECK_EOSTRING(39,frag->Name(), "dirfile/format");
+ sprintf(buf, "dirfile%cformat", GD_DIRSEP);
+ CHECK_EOSTRING(39,frag->Name(), buf);
delete frag;
// 40: Dirfile::NFragments check
@@ -993,7 +995,8 @@
// 84: RawEntry::FileName check
str = rep->FileName();
CHECK_OK(84);
- CHECK_EOSTRING(84,str, "dirfile/new1");
+ sprintf(buf, "dirfile%cnew1", GD_DIRSEP);
+ CHECK_EOSTRING(84,str, buf);
delete rep;
// 85: Dirfile::Reference check
@@ -1005,7 +1008,7 @@
// 135: Dirfile::ReferenceFilename check
str = d->ReferenceFilename();
CHECK_OK(135);
- CHECK_EOSTRING(135,str, "dirfile/new1");
+ CHECK_EOSTRING(135,str, buf);
// 87: Fragment::SetEncoding check
frag->SetEncoding(SlimEncoding,0);
Modified: trunk/getdata/bindings/f77/test/Makefile.am
===================================================================
--- trunk/getdata/bindings/f77/test/Makefile.am 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/bindings/f77/test/Makefile.am 2012-02-01 19:05:51 UTC (rev 652)
@@ -40,6 +40,8 @@
F95TESTS=big_test95
endif
+BUILT_SOUCES = test_getdata.f
+
FFLAGS += -I.. $(F77_WALL) $(F77_WEXTRA) $(F77_ASSUME)
FCFLAGS += -I.. $(F77_WALL) $(FC_WEXTRA) $(FC_ASSUME)
F95LDADD=../libf95getdata.la $(F77LDADD)
Modified: trunk/getdata/bindings/f77/test/big_test.f
===================================================================
--- trunk/getdata/bindings/f77/test/big_test.f 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/bindings/f77/test/big_test.f 2012-02-01 19:05:51 UTC (rev 652)
@@ -169,6 +169,7 @@
PROGRAM BIGTST
INCLUDE "getdata.f"
+ INCLUDE "test_getdata.f"
CHARACTER*12 fildir
PARAMETER (fildir = 'test_dirfile')
@@ -725,7 +726,7 @@
CALL CHKEOK(ne, 39, d)
CALL CHKINT(ne, 39, l, plen)
- CALL CHKEOS(ne, 39, path, 'test_dirfile/format')
+ CALL CHKEOS(ne, 39, path, 'test_dirfile'//DIRSEP//'format')
C 40: GDNFRG check
CALL GDNFRG(n, d)
@@ -1287,7 +1288,7 @@
CALL GDRWFN(path, l, d, "data", 4)
CALL CHKEOK(ne, 84, d)
CALL CHKINT(ne, 84, l, plen)
- CALL CHKEOS(ne, 84, path, 'test_dirfile/data')
+ CALL CHKEOS(ne, 84, path, 'test_dirfile'//DIRSEP//'data')
C 85: GDREFE check
l = slen
Modified: trunk/getdata/bindings/f77/test/big_test95.f90
===================================================================
--- trunk/getdata/bindings/f77/test/big_test95.f90 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/bindings/f77/test/big_test95.f90 2012-02-01 19:05:51 UTC (rev 652)
@@ -188,6 +188,7 @@
program big_test
use getdata
+ include "test_getdata.f"
character (len=*), parameter :: fildir = 'test95_dirfile'
character (len=*), parameter :: frmat = 'test95_dirfile/format'
character (len=*), parameter :: frm2 = 'test95_dirfile/form2'
@@ -892,7 +893,7 @@
! 39: fgd_fragmentname check
str = fgd_fragmentname(d, 0)
call check_ok(ne, 39, d)
- call check_eos(ne, 39, str, 'test95_dirfile/format')
+ call check_eos(ne, 39, str, 'test95_dirfile'//DIRSEP//'format')
! 40: fgd_nfragments check
n = fgd_nfragments(d)
@@ -1482,7 +1483,7 @@
! 84: fgd_raw_filename check
str = fgd_raw_filename(d, "data")
call check_ok(ne, 84, d)
- call check_eos(ne, 84, str, 'test95_dirfile/data')
+ call check_eos(ne, 84, str, 'test95_dirfile'//DIRSEP//'data')
! 85: fgd_reference check
str = fgd_reference(d, "new1")
Added: trunk/getdata/bindings/f77/test/test_getdata.f.in
===================================================================
--- trunk/getdata/bindings/f77/test/test_getdata.f.in (rev 0)
+++ trunk/getdata/bindings/f77/test/test_getdata.f.in 2012-02-01 19:05:51 UTC (rev 652)
@@ -0,0 +1,2 @@
+ CHARACTER*1 DIRSEP
+ PARAMETER (DIRSEP="@GD_FDIRSEP@")
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/configure.ac 2012-02-01 19:05:51 UTC (rev 652)
@@ -322,6 +322,17 @@
esac
AC_MSG_RESULT([$gd_unaligned_ok])
+AC_MSG_CHECKING([the directory separator])
+case "${host}" in
+ *-*-djgpp|*-*-mingw32) GD_FDIRSEP=\\; GD_DIRSEP=\\\\ ;;
+ *) GD_FDIRSEP=/; GD_DIRSEP=/ ;;
+esac
+AC_SUBST([GD_FDIRSEP])
+AC_SUBST([GD_DIRSEP])
+AC_DEFINE_UNQUOTED([GD_DIRSEP], ['$GD_DIRSEP'],
+ [ The separator between directory elements ])
+AC_MSG_RESULT([$GD_FDIRSEP])
+
echo
echo "*** Checking C compiler characteristics"
echo
@@ -934,6 +945,7 @@
AC_CONFIG_FILES([bindings/cxx/test/Makefile])
AC_CONFIG_FILES([bindings/f77/Makefile])
AC_CONFIG_FILES([bindings/f77/test/Makefile])
+AC_CONFIG_FILES([bindings/f77/test/test_getdata.f])
AC_CONFIG_FILES([bindings/idl/Makefile])
AC_CONFIG_FILES([bindings/idl/makedlm.sh])
AC_CONFIG_FILES([bindings/idl/test/Makefile])
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/src/common.c 2012-02-01 19:05:51 UTC (rev 652)
@@ -146,7 +146,7 @@
if (E && E->field_type == GD_ALIAS_ENTRY && E->e->entry[0]) {
size_t plen = strlen(E->e->entry[0]->field);
- new_code = malloc(plen + strlen(ptr));
+ new_code = malloc(plen + strlen(ptr) + 2);
if (new_code) {
strcpy(new_code, E->e->entry[0]->field);
new_code[plen] = '/';
@@ -951,7 +951,7 @@
#endif
/* we only get here in the early stages of opening a dirfile */
- dreturn("%p", D->name);
+ dreturn("\"%s\"", D->name);
return D->name;
}
@@ -960,20 +960,23 @@
* path (car) has already been canonicalised */
char *_GD_CanonicalPath(const char *car, const char *cdr)
{
- int last_element = 0, loop_count = 0;
- size_t res_len, res_size, len;
+ int last_element = 0;
+#if defined HAVE_READLINK && defined HAVE_LSTAT64
+ int loop_count = 0;
+#endif
+ size_t res_len, res_root, res_size, len;
char *res = NULL, *ptr, *work, *cur, *end;
dtrace("\"%s\", \"%s\"", car, cdr);
if (car && !_GD_AbsPath(cdr)) {
- if (car[0] != '/') {
+ if (!_GD_AbsPath(car)) {
/* car is not abosulte -- don't bother trying to do anything fancy */
res = malloc(strlen(car) + strlen(cdr) + 2);
if (res == NULL) {
dreturn("%p", NULL);
return NULL;
}
- sprintf(res, "%s/%s", car, cdr);
+ sprintf(res, "%s%c%s", car, GD_DIRSEP, cdr);
dreturn("%s", res);
return res;
}
@@ -985,6 +988,7 @@
return NULL;
}
res_size = (res_len = strlen(car)) + 1;
+ res_root = _GD_RootLen(res);
cur = work = strdup(cdr);
if (work == NULL) {
@@ -992,24 +996,23 @@
dreturn("%p", NULL);
return NULL;
}
- } else if (cdr[0] == '/') {
+ } else if (_GD_AbsPath(cdr)) {
/* cdr is absolute: make res "/" and copy cdr relative to / into work;
* ignore car */
- res_len = 1;
res = (char*)malloc(res_size = PATH_MAX);
if (res == NULL) {
dreturn("%p", NULL);
return NULL;
}
- res[0] = '/';
- res[1] = '\0';
+ _GD_Root(res, cdr, res_root);
+ res_len = res_root;
- if (cdr[0] == '/' && cdr[1] == '\0') {
+ if (cdr[res_len] == '\0') {
dreturn("\"%s\"", res);
return res;
}
- cur = work = strdup(cdr + 1);
+ cur = work = strdup(cdr + res_len);
if (work == NULL) {
free(res);
dreturn("%p", NULL);
@@ -1039,7 +1042,7 @@
return NULL;
}
res[0] = '\0';
- res_len = 0;
+ res_root = res_len = 0;
} else {
if ((len = strlen(work) + 2 + strlen(cdr)) < PATH_MAX) {
ptr = (char*)realloc(work, len);
@@ -1052,17 +1055,16 @@
work = ptr;
}
ptr = work + strlen(work);
- *(ptr++) = '/';
+ *(ptr++) = GD_DIRSEP;
strcpy(ptr, cdr);
- if (work[0] == '/') {
- res[0] = '/';
- res[1] = '\0';
- res_len = 1;
- cur = work + 1;
+ if (_GD_AbsPath(work)) {
+ _GD_Root(res, work, res_root);
+ res_len = res_root;
+ cur = work + res_len;
} else {
res[0] = '\0';
- res_len = 0;
+ res_root = res_len = 0;
cur = work;
}
}
@@ -1070,8 +1072,8 @@
/* now step through work, building up res as appropriate */
for (end = cur ; !last_element; cur = end) {
- /* look for the next '/' or NUL */
- for (; *end != '\0' && *end != '/'; ++end)
+ /* look for the next GD_DIRSEP or NUL */
+ for (; *end != '\0' && *end != GD_DIRSEP; ++end)
;
/* end of string */
@@ -1089,10 +1091,11 @@
/* discard . */
continue;
} else if (cur[0] == '.' && cur[1] == '.' && cur[2] == '\0') {
- /* don't strip the leading '/' */
- if (res_len > 1) {
- /* find the last '/', but don't strip the leading '/' */
- for(ptr = res + res_len - 1; *ptr != '/' && ptr > res + 1; --ptr)
+ /* don't strip the leading GD_DIRSEP */
+ if (res_len > res_root) {
+ /* find the last GD_DIRSEP, but don't strip the leading GD_DIRSEP */
+ for(ptr = res + res_len - 1; *ptr != GD_DIRSEP && ptr > res + res_root;
+ --ptr)
;
/* strip the .. if possible, otherwise append it */
@@ -1112,8 +1115,8 @@
}
res = ptr;
}
- if (res_len > 1 && res[res_len - 1] != '/')
- res[res_len++] = '/';
+ if (res_len > 1 && res[res_len - 1] != GD_DIRSEP)
+ res[res_len++] = GD_DIRSEP;
strcpy(res + res_len, cur);
res_len += len - 1;
#if defined HAVE_READLINK && defined HAVE_LSTAT64
@@ -1139,7 +1142,7 @@
}
res = ptr;
}
- res[res_len++] = '/';
+ res[res_len++] = GD_DIRSEP;
strcpy(res + res_len, end);
res_len += len - 1;
}
@@ -1176,14 +1179,14 @@
/* now we have to start all over again */
ptr = target;
- if (target[0] == '/') {
- res[1] = '\0';
- res_len = 1;
- ptr++;
- slen--;
+ if (_GD_AbsPath(target)) {
+ _GD_Root(res, target[0]);
+ res_len = GD_ABSPATH_LEN;
+ ptr += GD_ABSPATH_LEN;
+ slen -= GD_ABSPATH_LEN;
} else if (res_len > 1) {
/* strip the symlink name from res */
- for (ptr = res + res_len - 1; *ptr != '/'; --ptr)
+ for (ptr = res + res_len - 1; *ptr != GD_DIRSEP; --ptr)
;
*(ptr + 1) = '\0';
res_len = res - ptr + 1;
@@ -1200,10 +1203,10 @@
return NULL;
}
} else {
- char slash[2] = "/";
+ char slash[2] = { GD_DIRSEP, 0 };
len = strlen(end) + slen + 2;
- if (*(ptr + slen - 1) == '/') {
+ if (*(ptr + slen - 1) == GD_DIRSEP) {
slash[0] = '\0';
len--;
}
@@ -1225,7 +1228,9 @@
}
}
+#if defined HAVE_READLINK && defined HAVE_LSTAT64
_GD_CanonicalPath_DONE:
+#endif
free(work);
/* trim */
@@ -1262,7 +1267,7 @@
if (dir) {
filepath = (char*)_GD_Malloc(D, strlen(dir) + strlen(name) + 2);
if (filepath)
- sprintf(filepath, "%s/%s", dir, name);
+ sprintf(filepath, "%s%c%s", dir, GD_DIRSEP, name);
} else
filepath = _GD_Strdup(D, name);
}
@@ -1292,7 +1297,6 @@
unsigned int i;
char *path, *dir = NULL;
void *ptr;
- int abs = _GD_AbsPath(name);
dtrace("%p, %i, \"%s\"", D, dirfd, name);
@@ -1336,7 +1340,7 @@
D->dir[D->ndir].fd = D->ndir;
free(path);
#else
- if (abs) {
+ if (_GD_AbsPath(name)) {
D->dir[D->ndir].fd = open(dir, O_RDONLY);
} else {
free(path);
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/src/internal.h 2012-02-01 19:05:51 UTC (rev 652)
@@ -558,11 +558,40 @@
((uint64_t)(x) >> 56)))
#endif
-/* returns true if s is an absolute path */
+/* path malarkey */
#if defined _WIN32 || defined _WIN64
-# define _GD_AbsPath(s) ((s)[0] != '\0' && (s)[1] == ':')
+# define _GD_AbsPath(s) ((s)[0] == '/' || (s)[0] == GD_DIRSEP || \
+ ((s)[0] != '\0' && (s)[1] == ':'))
+# define _GD_Root(s,d,l) \
+ do { \
+ if ((d)[0] == '/' || (d)[0] == GD_DIRSEP) { \
+ (s)[0] = (d)[0]; \
+ l = 1; \
+ if ((d)[1] == '/' || (d)[1] == GD_DIRSEP) { \
+ (s)[1] = (d)[1]; \
+ l = 2; \
+ } \
+ } else { \
+ (s)[0] = (d)[0]; \
+ (s)[1] = ':'; \
+ (s)[2] = '\\'; \
+ (s)[3] = '\0'; \
+ l = 3; \
+ } \
+ } while (0)
+# define _GD_RootLen(d) ( \
+ ((d)[0] == '/' || (d)[0] == GD_DIRSEP) ? \
+ ((d)[1] == '/' || (d)[1] == GD_DIRSEP) ? 2 : 1 : 3 \
+ )
#else
# define _GD_AbsPath(s) ((s)[0] == '/')
+# define _GD_Root(s,d,l) \
+ do { \
+ (s)[0] = '/'; \
+ (s)[1] = '\0'; \
+ l = 1; \
+ } while (0)
+# define _GD_RootLen(d) 1
#endif
/* maximum number of recursions */
@@ -984,7 +1013,7 @@
char *_GD_GetLine(FILE *restrict, size_t *restrict, int *restrict);
int _GD_GetRepr(DIRFILE *restrict, const char *restrict,
char **restrict, int);
-gd_spf_t _GD_GetSPF(DIRFILE*, const gd_entry_t*);
+gd_spf_t _GD_GetSPF(DIRFILE*, gd_entry_t*);
int _GD_GrabDir(DIRFILE*, int, const char *restrict);
int _GD_Include(DIRFILE*, const char *restrict, const char *restrict, int,
char **restrict, int, const char *restrict, const char *restrict,
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/src/open.c 2012-02-01 19:05:51 UTC (rev 652)
@@ -57,7 +57,7 @@
/* unable to read the format file */
if (format_error == EACCES || dir_error == EACCES) {
char *format_file = (char *)malloc(strlen(dirfile) + 8);
- strcat(strcpy(format_file, dirfile), "/format");
+ sprintf(format_file, "%s%cformat", dirfile, GD_DIRSEP);
_GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NO_ACCESS, format_file, 0, NULL);
free(dirfile);
free(format_file);
@@ -289,7 +289,7 @@
gd_stat64_t statbuf;
#endif
- dtrace("\"%s\", 0x%lx, %p, %p", filedir, (unsigned long)flags, sehandler,
+ dtrace("\"%s\", 0x%lX, %p, %p", filedir, (unsigned long)flags, sehandler,
extra);
#ifdef GD_NO_DIR_OPEN
@@ -337,18 +337,12 @@
if (flags & GD_PERMISSIVE && flags & GD_PEDANTIC)
flags &= ~GD_PERMISSIVE;
- D->name = strdup(filedir);
+ D->name = dirfile; /* temporarily store canonicalised path here */
D->flags = (flags | GD_INVALID) & ~GD_IGNORE_REFS;
D->sehandler = sehandler;
D->sehandler_extra = extra;
D->standards = GD_DIRFILE_STANDARDS_VERSION;
- if (D->name == NULL || dirfile == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- dreturn("%p", D);
- return D;
- }
-
/* Add the INDEX entry */
D->n_entries = 1;
D->n[_GD_EntryIndex(GD_INDEX_ENTRY)] = 1;
@@ -391,6 +385,16 @@
return D; /* errors have already been set */
}
+ /* remember back when we temporarily stored the canonicalised path here?
+ * We're over that. Remember the dirfile's name. */
+ D->name = strdup(filedir);
+
+ if (D->name == NULL) {
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ dreturn("%p", D);
+ return D;
+ }
+
/* Parse the file. This will take care of any necessary inclusions */
D->n_fragment = 1;
@@ -484,7 +488,7 @@
{
DIRFILE *D;
- dtrace("\"%s\", 0x%lx", filedir, (unsigned long)flags);
+ dtrace("\"%s\", 0x%lX", filedir, (unsigned long)flags);
D = gd_cbopen(filedir, flags, NULL, NULL);
Modified: trunk/getdata/src/spf.c
===================================================================
--- trunk/getdata/src/spf.c 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/src/spf.c 2012-02-01 19:05:51 UTC (rev 652)
@@ -23,7 +23,7 @@
/* _GD_GetSPF: Get samples per frame for field
*/
-gd_spf_t _GD_GetSPF(DIRFILE *D, const gd_entry_t *E)
+gd_spf_t _GD_GetSPF(DIRFILE *D, gd_entry_t *E)
{
gd_spf_t spf = 0;
Modified: trunk/getdata/test/file.c
===================================================================
--- trunk/getdata/test/file.c 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/test/file.c 2012-02-01 19:05:51 UTC (rev 652)
@@ -67,7 +67,11 @@
/* This only checks whether the end of the returned path is what we expect.
* This should work, since we can guarantee that both "dirfile" and "data"
* aren't symlinks. */
+#if GD_DIRSEP == '/'
CHECKEOS(path,"dirfile/data");
+#else
+ CHECKEOS(path,"dirfile\\data");
+#endif
free(path);
return r;
Modified: trunk/getdata/test/fragment_name.c
===================================================================
--- trunk/getdata/test/fragment_name.c 2012-01-30 00:27:51 UTC (rev 651)
+++ trunk/getdata/test/fragment_name.c 2012-02-01 19:05:51 UTC (rev 652)
@@ -65,8 +65,13 @@
/* This only checks whether the end of the returned path is what we expect.
* This should work, since we can guarantee that both "dirfile" and "format*"
* aren't symlinks. */
+#if GD_DIRSEP == '/'
CHECKEOS(form0,"dirfile/format");
CHECKEOS(form1,"dirfile/format1");
+#else
+ CHECKEOS(form0,"dirfile\\format");
+ CHECKEOS(form1,"dirfile\\format1");
+#endif
free(form0);
free(form1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2012-02-01 23:40:44
|
Revision: 653
http://getdata.svn.sourceforge.net/getdata/?rev=653&view=rev
Author: ketiltrout
Date: 2012-02-01 23:40:38 +0000 (Wed, 01 Feb 2012)
Log Message:
-----------
More path fixing.
Modified Paths:
--------------
trunk/getdata/src/common.c
trunk/getdata/src/open.c
trunk/getdata/test/test.h
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2012-02-01 19:05:51 UTC (rev 652)
+++ trunk/getdata/src/common.c 2012-02-01 23:40:38 UTC (rev 653)
@@ -1,5 +1,5 @@
/* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2011 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
*
***************************************************************************
*
@@ -1180,11 +1180,11 @@
/* now we have to start all over again */
ptr = target;
if (_GD_AbsPath(target)) {
- _GD_Root(res, target[0]);
- res_len = GD_ABSPATH_LEN;
- ptr += GD_ABSPATH_LEN;
- slen -= GD_ABSPATH_LEN;
- } else if (res_len > 1) {
+ _GD_Root(res, target, res_root);
+ res_len = res_root;
+ ptr += res_root;
+ slen -= res_root;
+ } else if (res_len > res_root) {
/* strip the symlink name from res */
for (ptr = res + res_len - 1; *ptr != GD_DIRSEP; --ptr)
;
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2012-02-01 19:05:51 UTC (rev 652)
+++ trunk/getdata/src/open.c 2012-02-01 23:40:38 UTC (rev 653)
@@ -1,5 +1,5 @@
/* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2011 D. V. Wiebe
+ * Copyright (C) 2005-2012 D. V. Wiebe
*
***************************************************************************
*
@@ -381,6 +381,7 @@
#ifndef GD_NO_DIR_OPEN
close(dirfd);
#endif
+ D->name = NULL; /* so a subsequent gd_discard() doesn't go awry. */
dreturn("%p", D);
return D; /* errors have already been set */
}
Modified: trunk/getdata/test/test.h
===================================================================
--- trunk/getdata/test/test.h 2012-02-01 19:05:51 UTC (rev 652)
+++ trunk/getdata/test/test.h 2012-02-01 23:40:38 UTC (rev 653)
@@ -34,7 +34,7 @@
#ifdef _MSC_VER
#define rmdirfile() system("rmdir /q/s dirfile");
#else
-#define rmdirfile() system("rm -rf dirfile");
+#define rmdirfile() chmod("dirfile", 0755); system("rm -rf dirfile");
#endif
/* path munging for WIN32/64 */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2012-02-14 05:55:32
|
Revision: 656
http://getdata.svn.sourceforge.net/getdata/?rev=656&view=rev
Author: ketiltrout
Date: 2012-02-14 05:55:25 +0000 (Tue, 14 Feb 2012)
Log Message:
-----------
Return success instead of GD_INTERNAL_ERROR from putdata if num_frames == 0 and num_samples == 0.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/putdata.c
trunk/getdata/test/Makefile.am
Added Paths:
-----------
trunk/getdata/test/put_zero
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-02-08 01:09:18 UTC (rev 655)
+++ trunk/getdata/ChangeLog 2012-02-14 05:55:25 UTC (rev 656)
@@ -1,3 +1,6 @@
+2012-02-14 D. V. Wiebe <ge...@ke...> svn:654
+ * src/putdata.c (gd_putdata): Return early if num_samp == 0.
+
2012-02-01 D. V. Wiebe <ge...@ke...> svn:652
* configure.ac: Figure out the directory separator (ie. '/' on POSIX).
Modified: trunk/getdata/src/putdata.c
===================================================================
--- trunk/getdata/src/putdata.c 2012-02-08 01:09:18 UTC (rev 655)
+++ trunk/getdata/src/putdata.c 2012-02-14 05:55:25 UTC (rev 656)
@@ -843,6 +843,12 @@
return 0;
}
+ /* the easy case */
+ if (num_samp == 0) {
+ dreturn("%u", 0);
+ return 0;
+ }
+
n_wrote = _GD_DoFieldOut(D, entry, repr, first_samp, num_samp, data_type,
data_in);
Modified: trunk/getdata/test/Makefile.am
===================================================================
--- trunk/getdata/test/Makefile.am 2012-02-08 01:09:18 UTC (rev 655)
+++ trunk/getdata/test/Makefile.am 2012-02-14 05:55:25 UTC (rev 656)
@@ -304,7 +304,7 @@
put_polynom2 put_polynom_noin put_protect put_rdonly put_recip \
put_recurse put_repr put_rofs put_sbit put_sf put_ss put_string \
put_string_protect put_type put_uint16 put_uint32 put_uint64 \
- put_window
+ put_window put_zero
REF_TESTS=ref ref_none ref_two
Added: trunk/getdata/test/put_zero
===================================================================
--- trunk/getdata/test/put_zero (rev 0)
+++ trunk/getdata/test/put_zero 2012-02-14 05:55:25 UTC (rev 656)
@@ -0,0 +1,225 @@
+#! /bin/sh
+
+# put_zero - temporary wrapper script for .libs/put_zero
+# Generated by libtool (GNU libtool) 2.4
+#
+# The put_zero program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command="(cd /home/dvw/getdata/trunk/getdata/test; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/home/dvw/usr/lib; export LD_LIBRARY_PATH; PATH=/home/dvw/bin:/home/dvw/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/rsi/idl/bin:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:/usr/share/texmf/bin:.:/usr/local/rsi/idl/bin:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/local/rsi/idl/bin:/usr/lib/java/bin:/usr/lib/kde4/libexec; export PATH; gcc -std=gnu99 -g -O2 -o \$progdir/\$file put_zero.o ../src/.libs/libgetdata.so -lbz2 /usr/lib/liblzma.so /usr/lib/libzzip.so -lz -lm -pthread -Wl,-rpath -Wl,/home/dvw/getdata/trunk/getdata/src/.libs)"
+
+# This environment variable determines our operation mode.
+if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='2.4'
+ notinst_deplibs=' ../src/libgetdata.la'
+else
+ # When we are sourced in execute mode, $file and $ECHO are already set.
+ if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+ file="$0"
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+ ECHO="printf %s\\n"
+ fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string --lt-
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's ../libtool value, followed by no.
+lt_option_debug=
+func_parse_lt_options ()
+{
+ lt_script_arg0=$0
+ shift
+ for lt_opt
+ do
+ case "$lt_opt" in
+ --lt-debug) lt_option_debug=1 ;;
+ --lt-dump-script)
+ lt_dump_D=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%/[^/]*$%%'`
+ test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=.
+ lt_dump_F=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%^.*/%%'`
+ cat "$lt_dump_D/$lt_dump_F"
+ exit 0
+ ;;
+ --lt-*)
+ $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ # Print the debug banner immediately:
+ if test -n "$lt_option_debug"; then
+ echo "put_zero:put_zero:${LINENO}: libtool wrapper (GNU libtool) 2.4" 1>&2
+ fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+ lt_dump_args_N=1;
+ for lt_arg
+ do
+ $ECHO "put_zero:put_zero:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg"
+ lt_dump_args_N=`expr $lt_dump_args_N + 1`
+ done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+
+ if test -n "$lt_option_debug"; then
+ $ECHO "put_zero:put_zero:${LINENO}: newargv[0]: $progdir/$program" 1>&2
+ func_lt_dump_args ${1+"$@"} 1>&2
+ fi
+ exec "$progdir/$program" ${1+"$@"}
+
+ $ECHO "$0: cannot exec $program $*" 1>&2
+ exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from $@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+ for lt_wr_arg
+ do
+ case $lt_wr_arg in
+ --lt-*) ;;
+ *) set x "$@" "$lt_wr_arg"; shift;;
+ esac
+ shift
+ done
+ func_exec_program_core ${1+"$@"}
+}
+
+ # Parse options
+ func_parse_lt_options "$0" ${1+"$@"}
+
+ # Find the directory that this script lives in.
+ thisdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'`
+ test "x$thisdir" = "x$file" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=`ls -ld "$file" | /usr/bin/sed -n 's/.*-> //p'`
+ while test -n "$file"; do
+ destdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'`
+
+ # If there was a directory component, then change thisdir.
+ if test "x$destdir" != "x$file"; then
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
+ *) thisdir="$thisdir/$destdir" ;;
+ esac
+ fi
+
+ file=`$ECHO "$file" | /usr/bin/sed 's%^.*/%%'`
+ file=`ls -ld "$thisdir/$file" | /usr/bin/sed -n 's/.*-> //p'`
+ done
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
+ if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
+ # special case for '.'
+ if test "$thisdir" = "."; then
+ thisdir=`pwd`
+ fi
+ # remove .libs from thisdir
+ case "$thisdir" in
+ *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /usr/bin/sed 's%[\\/][^\\/]*$%%'` ;;
+ .libs ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=`cd "$thisdir" && pwd`
+ test -n "$absdir" && thisdir="$absdir"
+
+ program=lt-'put_zero'
+ progdir="$thisdir/.libs"
+
+ if test ! -f "$progdir/$program" ||
+ { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /usr/bin/sed 1q`; \
+ test "X$file" != "X$progdir/$program"; }; then
+
+ file="$$-$program"
+
+ if test ! -d "$progdir"; then
+ mkdir "$progdir"
+ else
+ rm -f "$progdir/$file"
+ fi
+
+ # relink executable if necessary
+ if test -n "$relink_command"; then
+ if relink_command_output=`eval $relink_command 2>&1`; then :
+ else
+ printf %s\n "$relink_command_output" >&2
+ rm -f "$progdir/$file"
+ exit 1
+ fi
+ fi
+
+ mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
+ { rm -f "$progdir/$program";
+ mv -f "$progdir/$file" "$progdir/$program"; }
+ rm -f "$progdir/$file"
+ fi
+
+ if test -f "$progdir/$program"; then
+ if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+ # Run the actual program with our arguments.
+ func_exec_program ${1+"$@"}
+ fi
+ else
+ # The program doesn't exist.
+ $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
+ $ECHO "This script is just a wrapper for $program." 1>&2
+ $ECHO "See the libtool documentation for more information." 1>&2
+ exit 1
+ fi
+fi
Property changes on: trunk/getdata/test/put_zero
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2012-02-16 03:16:30
|
Revision: 658
http://getdata.svn.sourceforge.net/getdata/?rev=658&view=rev
Author: ketiltrout
Date: 2012-02-16 03:16:18 +0000 (Thu, 16 Feb 2012)
Log Message:
-----------
* When truncating don't delete and recreate the format file; just truncate it
* use the correct SPF when calculating lincoms.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/getdata.c
trunk/getdata/src/open.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/trunc_rofs.c
Added Paths:
-----------
trunk/getdata/test/get_lincom_spf.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-02-15 00:09:19 UTC (rev 657)
+++ trunk/getdata/ChangeLog 2012-02-16 03:16:18 UTC (rev 658)
@@ -1,5 +1,14 @@
-2012-02-14 D. V. Wiebe <ge...@ke...> svn:654
+2012-02-16 D. V. Wiebe <ge...@ke...> svn:658
+ * src/getdata.c (_GD_DoLincom): Get the correct SPFs.
+ * test/get_lincom_spf.c: Added.
+
+ * src/open.c (_GD_CreateDirfile): When truncating, don't delete and then
+ recreate the format file; just truncate it. (This helps kst not get
+ confused when monitoring a dirfile which gets truncated.)
+
+2012-02-14 D. V. Wiebe <ge...@ke...> svn:656,657
* src/putdata.c (gd_putdata): Return early if num_samp == 0.
+ * test/put_zero.c: Added.
2012-02-01 D. V. Wiebe <ge...@ke...> svn:652
* configure.ac: Figure out the directory separator (ie. '/' on POSIX).
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2012-02-15 00:09:19 UTC (rev 657)
+++ trunk/getdata/src/getdata.c 2012-02-16 03:16:18 UTC (rev 658)
@@ -972,7 +972,7 @@
return 0;
}
- spf[i] = _GD_GetSPF(D, E->e->entry[0]);
+ spf[i] = _GD_GetSPF(D, E->e->entry[i]);
if (D->error != GD_E_OK) {
dreturn("%i", 0);
return 0;
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2012-02-15 00:09:19 UTC (rev 657)
+++ trunk/getdata/src/open.c 2012-02-16 03:16:18 UTC (rev 658)
@@ -29,7 +29,7 @@
DIR* dir;
struct dirent* lamb;
int fd = -1;
- int format_error = 0;
+ int format_error = 0, format_trunc = 0;
FILE* fp = NULL;
dtrace("%p, %i, %i, \"%s\"", D, dirfd, dir_error, dirfile);
@@ -154,7 +154,10 @@
#endif
)
{
- if (gd_UnlinkAt(D, dirfd, lamb->d_name, 0)) {
+ /* don't delete the format file; we'll truncate it later */
+ if (strcmp(lamb->d_name, "format") == 0) {
+ format_trunc = 1;
+ } else if (gd_UnlinkAt(D, dirfd, lamb->d_name, 0)) {
char *name = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name)
+ 2);
strcat(strcat(strcpy(name, dirfile), "/"), lamb->d_name);
@@ -205,9 +208,9 @@
#endif
}
- /* create a new, empty format file */
- if ((fd = gd_OpenAt(D, dirfd, "format", O_CREAT | O_EXCL | O_BINARY, 0666))
- < 0)
+ /* create a new, empty format file, or else truncate it */
+ if ((fd = gd_OpenAt(D, dirfd, "format", O_RDWR | O_CREAT | O_BINARY |
+ (format_trunc ? O_TRUNC : O_EXCL), 0666)) < 0)
{
char *format_file = (char *)malloc(strlen(dirfile) + 8);
strcat(strcpy(format_file, dirfile), "/format");
Property changes on: trunk/getdata/test
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_mplex
add_mplex_val
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
add_type
add_window
add_window_op
alias_list
alias_list_alias
alias_list_missing
alias_num
alias_num_alias
alias_num_missing
alias_target
alias_target_alias
alias_target_missing
alter_bit_bitnum
alter_bit_numbits
alter_carray_len
alter_carray_type
alter_const
alter_cpolynom
alter_crecip
alter_crecip89
alter_crecip_zero
alter_divide
alter_entry
alter_entry_affix
alter_entry_hidden
alter_entry_recode
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
alter_lincom_23
alter_lincom_32
alter_lincom_input
alter_lincom_offset
alter_lincom_slope
alter_linterp
alter_linterp_move
alter_mplex
alter_mspec
alter_mspec_affix
alter_multiply
alter_phase
alter_polynom_coeff
alter_polynom_input
alter_polynom_ord
alter_raw_spf
alter_raw_type
alter_recip
alter_recip_zero
alter_spec
alter_spec_affix
alter_spec_meta
alter_window
ascii_add
ascii_get
ascii_get_get
ascii_nframes
ascii_put
bof
bof_lincom
bof_phase
bzip_get
bzip_get_get
bzip_move_from
bzip_nframes
bzip_put
close
close_bad
close_discard
close_null
convert_complex128_complex64
convert_complex128_float64
convert_complex128_int64
convert_complex128_uint64
convert_complex64_complex128
convert_complex64_float64
convert_complex64_int64
convert_complex64_uint64
convert_float32_complex128
convert_float32_complex64
convert_float32_float64
convert_float32_int16
convert_float32_int32
convert_float32_int64
convert_float32_int8
convert_float32_uint16
convert_float32_uint32
convert_float32_uint64
convert_float32_uint8
convert_float64_complex128
convert_float64_complex64
convert_float64_float32
convert_float64_int16
convert_float64_int32
convert_float64_int64
convert_float64_int8
convert_float64_uint16
convert_float64_uint32
convert_float64_uint64
convert_float64_uint8
convert_int16_complex128
convert_int16_complex64
convert_int16_float32
convert_int16_float64
convert_int16_int32
convert_int16_int64
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_uint64
convert_int16_uint8
convert_int32_complex128
convert_int32_complex64
convert_int32_float32
convert_int32_float64
convert_int32_int16
convert_int32_int64
convert_int32_int8
convert_int32_uint16
convert_int32_uint32
convert_int32_uint64
convert_int32_uint8
convert_int64_complex128
convert_int64_complex64
convert_int64_float32
convert_int64_float64
convert_int64_int16
convert_int64_int32
convert_int64_int8
convert_int64_uint16
convert_int64_uint32
convert_int64_uint64
convert_int64_uint8
convert_int8_complex128
convert_int8_complex64
convert_int8_float32
convert_int8_float64
convert_int8_int16
convert_int8_int32
convert_int8_int64
convert_int8_uint16
convert_int8_uint32
convert_int8_uint64
convert_int8_uint8
convert_uint16_complex128
convert_uint16_complex64
convert_uint16_float32
convert_uint16_float64
convert_uint16_int16
convert_uint16_int32
convert_uint16_int64
convert_uint16_int8
convert_uint16_uint32
convert_uint16_uint64
convert_uint16_uint8
convert_uint32_complex128
convert_uint32_complex64
convert_uint32_float32
convert_uint32_float64
convert_uint32_int16
convert_uint32_int32
convert_uint32_int64
convert_uint32_int8
convert_uint32_uint16
convert_uint32_uint64
convert_uint32_uint8
convert_uint64_complex128
convert_uint64_complex64
convert_uint64_float32
convert_uint64_float64
convert_uint64_int16
convert_uint64_int32
convert_uint64_int64
convert_uint64_int8
convert_uint64_uint16
convert_uint64_uint32
convert_uint64_uint8
convert_uint8_complex128
convert_uint8_complex64
convert_uint8_float32
convert_uint8_float64
convert_uint8_int16
convert_uint8_int32
convert_uint8_int64
convert_uint8_int8
convert_uint8_uint16
convert_uint8_uint32
convert_uint8_uint64
creat
creat_excl
creat_rdonly
cvlist
cvlist_array
cvlist_array_hidden
cvlist_array_meta
cvlist_array_meta_hidden
cvlist_hidden
cvlist_invalid
cvlist_meta
cvlist_meta_hidden
cvlist_meta_invalid
del
del_carray
del_carray_deref
del_const
del_const_deref
del_const_force
del_data
del_derived
del_derived_after
del_derived_force
del_meta
del_meta_force
dfes_bit
dfes_divide
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_recip
dfes_zero
encode_alter
encode_get
encode_move
endian_alter
endian_alter_sie
endian_get
endian_move
entry_bad_code
entry_bit
entry_bit_scalar
entry_divide
entry_invalid
entry_lincom
entry_lincom_scalar
entry_linterp
entry_mplex
entry_mplex_scalar
entry_multiply
entry_phase
entry_phase_scalar
entry_polynom
entry_polynom_scalar
entry_raw
entry_raw_scalar
entry_raw_scalar_code
entry_raw_scalar_type
entry_recip
entry_scalar_repr
entry_type
entry_type_alias
entry_window
entry_window_scalar
eof
eof_index
eof_lincom
eof_phase
error
error_error
error_num
error_short
file
file_code
file_type
flist
flist_hidden
flist_invalid
flist_meta
flist_meta_hidden
flist_meta_invalid
flist_type
flist_type_hidden
flist_type_invalid
flist_type_meta
flist_type_meta_hidden
flist_type_meta_invalid
flush
flush_all
flush_bad_code
flush_invalid
flush_meta
flush_spec
foffs_alter
foffs_get
foffs_move
fragment_affix
fragment_affix_alter
fragment_affix_alter2
fragment_affix_dup
fragment_index
fragment_index_alias
fragment_name
fragment_name_oor
fragment_num
fragment_parent
get64
get_bad_code
get_bit
get_carray
get_carray_len
get_carray_slice
get_char
get_clincom
get_complex128
get_complex64
get_const
get_const_complex
get_const_repr
get_cpolynom
get_divide
get_endian16
get_endian32
get_endian64
get_endian8
get_endian_complex128_arm
get_endian_complex128_big
get_endian_complex128_little
get_endian_complex64_arm
get_endian_complex64_big
get_endian_complex64_little
get_endian_float32_arm
get_endian_float32_big
get_endian_float32_little
get_endian_float64_arm
get_endian_float64_big
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_here
get_here_foffs
get_heres
get_int16
get_int32
get_int64
get_int8
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_lincom_non
get_linterp
get_linterp_noin
get_linterp_notab
get_linterp_sort
get_mplex
get_mplex_lb
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_phase_affix
get_polynom
get_polynom_noin
get_recip
get_recip_const
get_recurse
get_rofs
get_sbit
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
get_window
get_window_clr
get_window_ge
get_window_gt
get_window_le
get_window_lt
get_window_ne
get_window_set
get_zero
global_name
global_ref
global_ref_empty
global_ref_set
gzip_add
gzip_get
gzip_get_get
gzip_get_put
gzip_move_from
gzip_move_to
gzip_nframes
gzip_put
gzip_put_get
header_complex
hide
hide_hidden
hide_unhide
include
include_accmode
include_affix
include_auto
include_cb
include_creat
include_ignore
include_index
include_invalid
include_nonexistent
include_pc
include_ref
include_syntax
index
index_domain
index_range
legacy_get
legacy_get_put
legacy_get_rofs
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
lzma_get
lzma_nframes
madd
madd_affix
madd_alias
madd_bit
madd_bit_invalid
madd_carray
madd_clincom
madd_const
madd_cpolynom
madd_crecip
madd_crecip89
madd_divide
madd_index
madd_lincom
madd_lincom_invalid
madd_linterp
madd_linterp_invalid
madd_mplex
madd_multiply
madd_multiply_invalid
madd_phase
madd_phase_invalid
madd_polynom
madd_recip
madd_sbit
madd_spec
madd_spec_directive
madd_spec_invalid
madd_spec_resolv
madd_string
madd_window
move
move_affix
move_affix_dup
move_alias
move_data_enc_ar
move_data_enc_ra
move_data_endian
move_data_foffs
move_data_nop
move_index
move_meta
move_protect
move_subdir
name
name_affix
name_affix_bad
name_after
name_after_const
name_dup
name_move
name_update
name_update_const
nfields
nfields_hidden
nfields_invalid
nfields_type
nfields_type_hidden
nfields_type_invalid
nfields_vector
nfields_vector_hidden
nfields_vector_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
nmeta
nmeta_hidden
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_hidden
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_del
nmeta_vectors_hidden
nmeta_vectors_invalid
nmeta_vectors_parent
open
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_invalid
open_cb_rescan
open_eaccess
open_nonexistent
open_notdirfile
parse_alias
parse_alias_code
parse_alias_dup
parse_alias_meta
parse_alias_missing
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_bit_scalar
parse_carray
parse_carray_long
parse_const
parse_const_ncols
parse_divide
parse_duplicate
parse_duplicate_ignore
parse_endian_bad
parse_endian_big
parse_endian_force
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_loop
parse_include_nonexistent
parse_include_prefix
parse_include_prefix_dup
parse_include_preprefix
parse_include_relabs
parse_include_relrel
parse_include_slash
parse_include_suffix
parse_include_sufsuffix
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_lincom_non
parse_lincom_non_ncols
parse_lincom_scalar
parse_linterp
parse_linterp_ncols
parse_malias
parse_malias_dup
parse_meta
parse_meta_affix
parse_meta_alias
parse_meta_implicit
parse_meta_implicit2
parse_meta_implicit_affix
parse_meta_index
parse_meta_index2
parse_meta_jump
parse_meta_malias
parse_meta_meta
parse_meta_parent
parse_meta_raw
parse_mplex
parse_mplex_ncols
parse_mplex_scalar
parse_multiply
parse_multiply_ncols
parse_name
parse_name_dot
parse_name_ext
parse_name_pedantic
parse_ncols
parse_phase
parse_phase_ncols
parse_phase_scalar
parse_polynom
parse_polynom_ncols1
parse_polynom_ncols2
parse_polynom_scalar
parse_protect_all
parse_protect_bad
parse_protect_data
parse_protect_format
parse_protect_none
parse_quote
parse_quote_mismatch
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_scalar
parse_raw_spf
parse_raw_type
parse_recip
parse_ref
parse_ref_nonexistent
parse_sbit
parse_sort
parse_string
parse_string_ncols
parse_string_null
parse_version
parse_version_89
parse_version_98
parse_version_include
parse_version_p8
parse_version_p9
parse_version_permissive
parse_version_slash
parse_whitespace
parse_window
parse_window_ncols
parse_window_op
parse_window_scalar
protect_alter
protect_get
put64
put_bad_code
put_bit
put_bof
put_carray
put_carray_slice
put_char
put_complex128
put_complex64
put_const
put_const_protect
put_divide
put_endian16
put_endian32
put_endian64
put_endian8
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
put_endian_float32_arm
put_endian_float32_big
put_endian_float32_little
put_endian_float64_arm
put_endian_float64_big
put_endian_float64_little
put_ff
put_float32
put_float64
put_foffs
put_fs
put_here
put_heres
put_int16
put_int32
put_int64
put_int8
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_noin
put_linterp_nomono
put_linterp_notab
put_linterp_reverse
put_mplex
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_polynom1
put_polynom2
put_polynom_noin
put_protect
put_rdonly
put_recip
put_recurse
put_repr
put_rofs
put_sbit
put_sf
put_ss
put_string
put_string_protect
put_type
put_uint16
put_uint32
put_uint64
put_window
ref
ref_none
ref_two
repr_a
repr_float32
repr_float64
repr_i
repr_int16
repr_int32
repr_int64
repr_int8
repr_m
repr_r
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_uint16
repr_uint32
repr_uint64
repr_uint8
seek64
seek_cur
seek_end
seek_foffs
seek_set
sie_get_big
sie_get_little
sie_move_from
sie_move_to
sie_nframes_big
sie_nframes_little
sie_put_big
sie_put_little
slim_get
slim_nframes
slim_put
spf
spf_alias
spf_alias_meta
spf_alias_missing
spf_divide
spf_lincom
spf_multiply
spf_polynom
spf_recip
spf_recurse
svlist
svlist_hidden
svlist_invalid
svlist_meta
svlist_meta_hidden
svlist_meta_invalid
tell
tell64
trunc
trunc_rdonly
trunc_rofs
unclude
unclude_del
unclude_move
version_0
version_0_write
version_1
version_1_write
version_2
version_2_write
version_3
version_3_write
version_4
version_4_write
version_5
version_5_strict
version_5_write
version_6
version_6_strict
version_6_write
version_7
version_7_strict
version_7_write
version_8
version_8_strict
version_8_write
version_9
version_9_strict
version_9_write
vlist
vlist_alias
vlist_hidden
vlist_invalid
vlist_meta
vlist_meta_hidden
vlist_meta_invalid
xz_get
xz_nframes
zzip_data
zzip_get
zzip_get_get
zzip_nframes
zzslim_get
zzslim_nframes
+ Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_mplex
add_mplex_val
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
add_type
add_window
add_window_op
alias_list
alias_list_alias
alias_list_missing
alias_num
alias_num_alias
alias_num_missing
alias_target
alias_target_alias
alias_target_missing
alter_bit_bitnum
alter_bit_numbits
alter_carray_len
alter_carray_type
alter_const
alter_cpolynom
alter_crecip
alter_crecip89
alter_crecip_zero
alter_divide
alter_entry
alter_entry_affix
alter_entry_hidden
alter_entry_recode
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
alter_lincom_23
alter_lincom_32
alter_lincom_input
alter_lincom_offset
alter_lincom_slope
alter_linterp
alter_linterp_move
alter_mplex
alter_mspec
alter_mspec_affix
alter_multiply
alter_phase
alter_polynom_coeff
alter_polynom_input
alter_polynom_ord
alter_raw_spf
alter_raw_type
alter_recip
alter_recip_zero
alter_spec
alter_spec_affix
alter_spec_meta
alter_window
ascii_add
ascii_get
ascii_get_get
ascii_nframes
ascii_put
bof
bof_lincom
bof_phase
bzip_get
bzip_get_get
bzip_move_from
bzip_nframes
bzip_put
close
close_bad
close_discard
close_null
convert_complex128_complex64
convert_complex128_float64
convert_complex128_int64
convert_complex128_uint64
convert_complex64_complex128
convert_complex64_float64
convert_complex64_int64
convert_complex64_uint64
convert_float32_complex128
convert_float32_complex64
convert_float32_float64
convert_float32_int16
convert_float32_int32
convert_float32_int64
convert_float32_int8
convert_float32_uint16
convert_float32_uint32
convert_float32_uint64
convert_float32_uint8
convert_float64_complex128
convert_float64_complex64
convert_float64_float32
convert_float64_int16
convert_float64_int32
convert_float64_int64
convert_float64_int8
convert_float64_uint16
convert_float64_uint32
convert_float64_uint64
convert_float64_uint8
convert_int16_complex128
convert_int16_complex64
convert_int16_float32
convert_int16_float64
convert_int16_int32
convert_int16_int64
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_uint64
convert_int16_uint8
convert_int32_complex128
convert_int32_complex64
convert_int32_float32
convert_int32_float64
convert_int32_int16
convert_int32_int64
convert_int32_int8
convert_int32_uint16
convert_int32_uint32
convert_int32_uint64
convert_int32_uint8
convert_int64_complex128
convert_int64_complex64
convert_int64_float32
convert_int64_float64
convert_int64_int16
convert_int64_int32
convert_int64_int8
convert_int64_uint16
convert_int64_uint32
convert_int64_uint64
convert_int64_uint8
convert_int8_complex128
convert_int8_complex64
convert_int8_float32
convert_int8_float64
convert_int8_int16
convert_int8_int32
convert_int8_int64
convert_int8_uint16
convert_int8_uint32
convert_int8_uint64
convert_int8_uint8
convert_uint16_complex128
convert_uint16_complex64
convert_uint16_float32
convert_uint16_float64
convert_uint16_int16
convert_uint16_int32
convert_uint16_int64
convert_uint16_int8
convert_uint16_uint32
convert_uint16_uint64
convert_uint16_uint8
convert_uint32_complex128
convert_uint32_complex64
convert_uint32_float32
convert_uint32_float64
convert_uint32_int16
convert_uint32_int32
convert_uint32_int64
convert_uint32_int8
convert_uint32_uint16
convert_uint32_uint64
convert_uint32_uint8
convert_uint64_complex128
convert_uint64_complex64
convert_uint64_float32
convert_uint64_float64
convert_uint64_int16
convert_uint64_int32
convert_uint64_int64
convert_uint64_int8
convert_uint64_uint16
convert_uint64_uint32
convert_uint64_uint8
convert_uint8_complex128
convert_uint8_complex64
convert_uint8_float32
convert_uint8_float64
convert_uint8_int16
convert_uint8_int32
convert_uint8_int64
convert_uint8_int8
convert_uint8_uint16
convert_uint8_uint32
convert_uint8_uint64
creat
creat_excl
creat_rdonly
cvlist
cvlist_array
cvlist_array_hidden
cvlist_array_meta
cvlist_array_meta_hidden
cvlist_hidden
cvlist_invalid
cvlist_meta
cvlist_meta_hidden
cvlist_meta_invalid
del
del_carray
del_carray_deref
del_const
del_const_deref
del_const_force
del_data
del_derived
del_derived_after
del_derived_force
del_meta
del_meta_force
dfes_bit
dfes_divide
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_recip
dfes_zero
encode_alter
encode_get
encode_move
endian_alter
endian_alter_sie
endian_get
endian_move
entry_bad_code
entry_bit
entry_bit_scalar
entry_divide
entry_invalid
entry_lincom
entry_lincom_scalar
entry_linterp
entry_mplex
entry_mplex_scalar
entry_multiply
entry_phase
entry_phase_scalar
entry_polynom
entry_polynom_scalar
entry_raw
entry_raw_scalar
entry_raw_scalar_code
entry_raw_scalar_type
entry_recip
entry_scalar_repr
entry_type
entry_type_alias
entry_window
entry_window_scalar
eof
eof_index
eof_lincom
eof_phase
error
error_error
error_num
error_short
file
file_code
file_type
flist
flist_hidden
flist_invalid
flist_meta
flist_meta_hidden
flist_meta_invalid
flist_type
flist_type_hidden
flist_type_invalid
flist_type_meta
flist_type_meta_hidden
flist_type_meta_invalid
flush
flush_all
flush_bad_code
flush_invalid
flush_meta
flush_spec
foffs_alter
foffs_get
foffs_move
fragment_affix
fragment_affix_alter
fragment_affix_alter2
fragment_affix_dup
fragment_index
fragment_index_alias
fragment_name
fragment_name_oor
fragment_num
fragment_parent
get64
get_bad_code
get_bit
get_carray
get_carray_len
get_carray_slice
get_char
get_clincom
get_complex128
get_complex64
get_const
get_const_complex
get_const_repr
get_cpolynom
get_divide
get_endian16
get_endian32
get_endian64
get_endian8
get_endian_complex128_arm
get_endian_complex128_big
get_endian_complex128_little
get_endian_complex64_arm
get_endian_complex64_big
get_endian_complex64_little
get_endian_float32_arm
get_endian_float32_big
get_endian_float32_little
get_endian_float64_arm
get_endian_float64_big
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_here
get_here_foffs
get_heres
get_int16
get_int32
get_int64
get_int8
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_lincom_non
get_linterp
get_linterp_noin
get_linterp_notab
get_lincom_spf
get_linterp_sort
get_mplex
get_mplex_lb
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_phase_affix
get_polynom
get_polynom_noin
get_recip
get_recip_const
get_recurse
get_rofs
get_sbit
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
get_window
get_window_clr
get_window_ge
get_window_gt
get_window_le
get_window_lt
get_window_ne
get_window_set
get_zero
global_name
global_ref
global_ref_empty
global_ref_set
gzip_add
gzip_get
gzip_get_get
gzip_get_put
gzip_move_from
gzip_move_to
gzip_nframes
gzip_put
gzip_put_get
header_complex
hide
hide_hidden
hide_unhide
include
include_accmode
include_affix
include_auto
include_cb
include_creat
include_ignore
include_index
include_invalid
include_nonexistent
include_pc
include_ref
include_syntax
index
index_domain
index_range
legacy_get
legacy_get_put
legacy_get_rofs
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
lzma_get
lzma_nframes
madd
madd_affix
madd_alias
madd_bit
madd_bit_invalid
madd_carray
madd_clincom
madd_const
madd_cpolynom
madd_crecip
madd_crecip89
madd_divide
madd_index
madd_lincom
madd_lincom_invalid
madd_linterp
madd_linterp_invalid
madd_mplex
madd_multiply
madd_multiply_invalid
madd_phase
madd_phase_invalid
madd_polynom
madd_recip
madd_sbit
madd_spec
madd_spec_directive
madd_spec_invalid
madd_spec_resolv
madd_string
madd_window
move
move_affix
move_affix_dup
move_alias
move_data_enc_ar
move_data_enc_ra
move_data_endian
move_data_foffs
move_data_nop
move_index
move_meta
move_protect
move_subdir
name
name_affix
name_affix_bad
name_after
name_after_const
name_dup
name_move
name_update
name_update_const
nfields
nfields_hidden
nfields_invalid
nfields_type
nfields_type_hidden
nfields_type_invalid
nfields_vector
nfields_vector_hidden
nfields_vector_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
nmeta
nmeta_hidden
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_hidden
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_del
nmeta_vectors_hidden
nmeta_vectors_invalid
nmeta_vectors_parent
open
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_invalid
open_cb_rescan
open_eaccess
open_nonexistent
open_notdirfile
parse_alias
parse_alias_code
parse_alias_dup
parse_alias_meta
parse_alias_missing
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_bit_scalar
parse_carray
parse_carray_long
parse_const
parse_const_ncols
parse_divide
parse_duplicate
parse_duplicate_ignore
parse_endian_bad
parse_endian_big
parse_endian_force
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_loop
parse_include_nonexistent
parse_include_prefix
parse_include_prefix_dup
parse_include_preprefix
parse_include_relabs
parse_include_relrel
parse_include_slash
parse_include_suffix
parse_include_sufsuffix
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_lincom_non
parse_lincom_non_ncols
parse_lincom_scalar
parse_linterp
parse_linterp_ncols
parse_malias
parse_malias_dup
parse_meta
parse_meta_affix
parse_meta_alias
parse_meta_implicit
parse_meta_implicit2
parse_meta_implicit_affix
parse_meta_index
parse_meta_index2
parse_meta_jump
parse_meta_malias
parse_meta_meta
parse_meta_parent
parse_meta_raw
parse_mplex
parse_mplex_ncols
parse_mplex_scalar
parse_multiply
parse_multiply_ncols
parse_name
parse_name_dot
parse_name_ext
parse_name_pedantic
parse_ncols
parse_phase
parse_phase_ncols
parse_phase_scalar
parse_polynom
parse_polynom_ncols1
parse_polynom_ncols2
parse_polynom_scalar
parse_protect_all
parse_protect_bad
parse_protect_data
parse_protect_format
parse_protect_none
parse_quote
parse_quote_mismatch
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_scalar
parse_raw_spf
parse_raw_type
parse_recip
parse_ref
parse_ref_nonexistent
parse_sbit
parse_sort
parse_string
parse_string_ncols
parse_string_null
parse_version
parse_version_89
parse_version_98
parse_version_include
parse_version_p8
parse_version_p9
parse_version_permissive
parse_version_slash
parse_whitespace
parse_window
parse_window_ncols
parse_window_op
parse_window_scalar
protect_alter
protect_get
put64
put_bad_code
put_bit
put_bof
put_carray
put_carray_slice
put_char
put_complex128
put_complex64
put_const
put_const_protect
put_divide
put_endian16
put_endian32
put_endian64
put_endian8
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
put_endian_float32_arm
put_endian_float32_big
put_endian_float32_little
put_endian_float64_arm
put_endian_float64_big
put_endian_float64_little
put_ff
put_float32
put_float64
put_foffs
put_fs
put_here
put_heres
put_int16
put_int32
put_int64
put_int8
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_noin
put_linterp_nomono
put_linterp_notab
put_linterp_reverse
put_mplex
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_polynom1
put_polynom2
put_polynom_noin
put_protect
put_rdonly
put_recip
put_recurse
put_repr
put_rofs
put_sbit
put_sf
put_ss
put_string
put_string_protect
put_type
put_uint16
put_uint32
put_uint64
put_window
put_zero
ref
ref_none
ref_two
repr_a
repr_float32
repr_float64
repr_i
repr_int16
repr_int32
repr_int64
repr_int8
repr_m
repr_r
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_uint16
repr_uint32
repr_uint64
repr_uint8
seek64
seek_cur
seek_end
seek_foffs
seek_set
sie_get_big
sie_get_little
sie_move_from
sie_move_to
sie_nframes_big
sie_nframes_little
sie_put_big
sie_put_little
slim_get
slim_nframes
slim_put
spf
spf_alias
spf_alias_meta
spf_alias_missing
spf_divide
spf_lincom
spf_multiply
spf_polynom
spf_recip
spf_recurse
svlist
svlist_hidden
svlist_invalid
svlist_meta
svlist_meta_hidden
svlist_meta_invalid
tell
tell64
trunc
trunc_rdonly
trunc_rofs
unclude
unclude_del
unclude_move
version_0
version_0_write
version_1
version_1_write
version_2
version_2_write
version_3
version_3_write
version_4
version_4_write
version_5
version_5_strict
version_5_write
version_6
version_6_strict
version_6_write
version_7
version_7_strict
version_7_write
version_8
version_8_strict
version_8_write
version_9
version_9_strict
version_9_write
vlist
vlist_alias
vlist_hidden
vlist_invalid
vlist_meta
vlist_meta_hidden
vlist_meta_invalid
xz_get
xz_nframes
zzip_data
zzip_get
zzip_get_get
zzip_nframes
zzslim_get
zzslim_nframes
Modified: trunk/getdata/test/Makefile.am
===================================================================
--- trunk/getdata/test/Makefile.am 2012-02-15 00:09:19 UTC (rev 657)
+++ trunk/getdata/test/Makefile.am 2012-02-16 03:16:18 UTC (rev 658)
@@ -186,14 +186,15 ...
[truncated message content] |
|
From: <ket...@us...> - 2012-03-02 02:57:29
|
Revision: 664
http://getdata.svn.sourceforge.net/getdata/?rev=664&view=rev
Author: ketiltrout
Date: 2012-03-02 02:57:19 +0000 (Fri, 02 Mar 2012)
Log Message:
-----------
* gd_tokenise() (with bindings)
* Allow adding meta fields using "parent/meta" vi gd_add[_<type>]
* Don't indiscriminantly cast between data and code pointers in the F77 bindings.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/cxx/dirfile.cpp
trunk/getdata/bindings/cxx/getdata/dirfile.h
trunk/getdata/bindings/cxx/test/big_test.cpp
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/f77/fgetdata.h
trunk/getdata/bindings/f77/getdata.f.in
trunk/getdata/bindings/f77/getdata.f90.in
trunk/getdata/bindings/f77/test/big_test.f
trunk/getdata/bindings/f77/test/big_test95.f90
trunk/getdata/bindings/f77/test/gdcopn.f
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/idl/test/big_test.pro
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/bindings/perl/t/big_test.t
trunk/getdata/bindings/python/pydirfile.c
trunk/getdata/bindings/python/test/big_test.py
trunk/getdata/doc/list.tests
trunk/getdata/man/checkdirfile.1
trunk/getdata/man/dirfile2ascii.1
trunk/getdata/man/gd_add.3
trunk/getdata/man/gd_add_bit.3
trunk/getdata/man/gd_madd_bit.3
trunk/getdata/src/add.c
trunk/getdata/src/errors.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/internal.h
trunk/getdata/src/mod.c
trunk/getdata/src/parse.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/ascii_get.c
trunk/getdata/test/ascii_get_get.c
trunk/getdata/test/ascii_nframes.c
trunk/getdata/test/ascii_put.c
Added Paths:
-----------
trunk/getdata/test/add_meta.c
trunk/getdata/test/add_meta_alias.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/ChangeLog 2012-03-02 02:57:19 UTC (rev 664)
@@ -1,3 +1,38 @@
+2012-03-02 D. V. Wiebe <ge...@ke...> svn:664
+ * src/errors.c: Added GD_E_ARGUMENT:GD_E_ARG_NODATA.
+ * src/parse.c (_GD_Tokenise): Take number of columns to return.
+ * src/parse.c (gd_tokenise): Added.
+ * src/internal.h: Added _GD_DIRFILE->tok_pos.
+
+ * src/parse.c (_GD_CheckParent): Destatickify, and modify for use by
+ _GD_Add.
+ * src/add.c (_GD_Add): Call _GD_CheckParent to automatically allow
+ parent/meta style metafield addition via gd_add[_<whatever>]().
+
+ * bindings/python/pydirfile.c (gdpy_dirfile_tokenise)
+ bindings/cxx/dirfile.cpp (Dirfile::Tokenise) bindings/perl/GetData.xs
+ (tokenise) bindings/f77/getdata.f90.in (fgd_tokenise)
+ bindings/f77/fgetdata.c (GDTOKE) bindings/idl/getdata.c (gdidl_tokenise):
+ Added.
+
+ * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp
+ bindings/perl/t/big_test.t bindings/f77/test/big_test.f
+ bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Add test
+ #232.
+
+ * bindings/f77/getdata.f90.in (fgd_fragment_affixes): Fix GDFRAF call.
+
+ * bindings/f77/fgetdata.c (_GDF_SetDirfile _GDF_Callback GDCOPN GDCLBK):
+ Don't cast between data and code pointers. Encapsulate the F77 callback
+ function in a container.
+ * bindings/f77/fgetdata.c (GDNOCB): Added.
+ * bindings/f77/test/gdcopn.f: Add GDCLBK and GDNOCB tests.
+
+ * test/ascii_get.c test/ascii_put.c test/ascii_get_get.c
+ test/ascii_nframes.c: Delete FOPEN_TEXT.
+
+ * test/add_meta.c test/add_meta_alias.c: Added.
+
2012-02-16 D. V. Wiebe <ge...@ke...> svn:658
* src/getdata.c (_GD_DoLincom): Get the correct SPFs.
* test/get_lincom_spf.c: Added.
Modified: trunk/getdata/bindings/cxx/dirfile.cpp
===================================================================
--- trunk/getdata/bindings/cxx/dirfile.cpp 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/cxx/dirfile.cpp 2012-03-02 02:57:19 UTC (rev 664)
@@ -515,3 +515,8 @@
{
return gd_unhide(D, field_code);
}
+
+char *Dirfile::Tokenise(const char *string)
+{
+ return gd_tokenise(D, string);
+}
Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/dirfile.h 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2012-03-02 02:57:19 UTC (rev 664)
@@ -247,6 +247,8 @@
off_t Tell(const char* field_code) const;
+ char *Tokenise(const char *string = NULL);
+
int UnHide(const char* field_code) const;
int UnInclude(int fragment_index, int del = 0) const;
Modified: trunk/getdata/bindings/cxx/test/big_test.cpp
===================================================================
--- trunk/getdata/bindings/cxx/test/big_test.cpp 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/cxx/test/big_test.cpp 2012-03-02 02:57:19 UTC (rev 664)
@@ -1630,12 +1630,22 @@
CHECK_INT2(231, 6, ent->CountMax(), 7);
delete ent;
+ // 232: gd_tokenise
+ str = d->Tokenise("\"test1 test2\" test3\\ test4");
+ CHECK_OK2(232, 1);
+ CHECK_STRING2(232, 2, str, "test1 test2");
+ str = d->Tokenise();
+ CHECK_OK2(232, 3);
+ CHECK_STRING2(232, 4, str, "test3 test4");
+
+
+
// ===================================================================
d->Discard();
delete d;
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/fgetdata.c 2012-03-02 02:57:19 UTC (rev 664)
@@ -39,6 +39,12 @@
static DIRFILE* f77dirfiles[GDF_N_DIRFILES];
static int f77dirfiles_initialised = 0;
+/* casting data pointers to function pointers is prohibited in C. This
+ * container is used to get around that */
+static struct _GDF_callback_container {
+ _GDF_callback_t func;
+} f77callbacks[GDF_N_DIRFILES];
+
/* initialise the f77dirfiles array */
static void _GDF_InitDirfiles(void)
{
@@ -102,6 +108,7 @@
for (i = 1; i < GDF_N_DIRFILES; ++i)
if (f77dirfiles[i] == NULL) {
f77dirfiles[i] = D;
+ f77callbacks[i].func = NULL;
dreturn("%i", i);
return i;
}
@@ -182,17 +189,19 @@
/* callback wrapper */
static int _GDF_Callback(gd_parser_data_t* pdata, void* f77_callback)
{
+ struct _GDF_callback_container *c =
+ (struct _GDF_callback_container*)f77_callback;
+
int unit;
int r = GD_SYNTAX_ABORT;
dtrace("%p, %p", pdata, f77_callback);
- if (f77_callback != NULL) {
+ if (c != NULL && c->func != NULL) {
unit = _GDF_SetDirfile((DIRFILE*)pdata->dirfile);
- (*(void(*)(int*, const int*, const int*, char*, const int*,
- const char*))f77_callback)(&r, &unit, &pdata->suberror,
- pdata->line, &pdata->linenum, pdata->filename);
+ (c->func)(&r, &unit, &pdata->suberror, pdata->line, &pdata->linenum,
+ pdata->filename);
pdata->line[GD_MAX_LINE_LENGTH - 1] = '\0';
@@ -2262,34 +2271,69 @@
/* gd_cbopen wrapper */
void F77_FUNC(gdcopn, GDCOPN) (int* dirfile, const char* dirfilename,
- const int* dirfilename_l, const int* flags, const void* callback)
+ const int* dirfilename_l, const int* flags, const _GDF_callback_t callback)
{
+ const struct _GDF_callback_container temp = { callback };
+ DIRFILE *D;
char *out;
dtrace("%p, %p, %i, %x, %p", dirfile, dirfilename, *dirfilename_l, *flags,
callback);
out = (char *)malloc(*dirfilename_l + 1);
+ _GDF_CString(out, dirfilename, *dirfilename_l);
- *dirfile = _GDF_SetDirfile(gd_cbopen(_GDF_CString(out, dirfilename,
- *dirfilename_l), *flags, (callback == 0) ? NULL : _GDF_Callback,
- (callback == 0) ? NULL : (void*)callback));
+ D = gd_cbopen(out, *flags, _GDF_Callback, (void*)&temp);
+ *dirfile = _GDF_SetDirfile(D);
+ /* save the callback */
+ f77callbacks[*dirfile].func = callback;
+ /* and tell getdata its new location */
+ gd_parser_callback(D, _GDF_Callback, f77callbacks + *dirfile);
+
free(out);
dreturn("%i", *dirfile);
}
/* gd_parser_callback wrapper */
-void F77_FUNC(gdclbk, GDCLBK) (const int* dirfile, const void* callback)
+void F77_FUNC(gdclbk, GDCLBK) (const int* dirfile,
+ const _GDF_callback_t callback)
{
dtrace("%i, %p", *dirfile, callback);
- gd_parser_callback(_GDF_GetDirfile(*dirfile), (callback == 0) ? NULL
- : _GDF_Callback, (callback == 0) ? NULL : (void*)callback);
+ /* ensure *dirfile is sane */
+ if (*dirfile < 0 || *dirfile >= GDF_N_DIRFILES) {
+ dreturnvoid();
+ return;
+ }
+ /* we only have to modify GetData's callback pointer if f77callbacks is
+ * NULL for this dirfile (inidicating no previous callback); otherwise, just
+ * update the saved callback pointer */
+ if (f77callbacks[*dirfile].func == NULL) {
+ f77callbacks[*dirfile].func = callback;
+ gd_parser_callback(_GDF_GetDirfile(*dirfile), _GDF_Callback,
+ f77callbacks + *dirfile);
+ } else
+ f77callbacks[*dirfile].func = callback;
+
dreturnvoid();
}
+/* deregister a callback function (ie. gd_parser_callback(..., NULL) */
+void F77_FUNC(gdnocb, GDNOCB) (const int* dirfile)
+{
+ dtrace("%i", *dirfile);
+
+ /* ensure *dirfile is sane */
+ if (*dirfile >= 0 && *dirfile < GDF_N_DIRFILES) {
+ f77callbacks[*dirfile].func = NULL;
+ gd_parser_callback(_GDF_GetDirfile(*dirfile), NULL, NULL);
+ }
+
+ dreturnvoid();
+}
+
/* gd_alter_bit wrapper */
void F77_FUNC(gdalbt, GDALBT) (const int* dirfile, const char* field_code,
const int* field_code_l, const char* in_field, const int* in_field_l,
@@ -3410,10 +3454,7 @@
targ = gd_alias_target(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
*field_code_l));
- if (targ)
- _GDF_FString(target, target_l, targ);
- else
- *target_l = 0;
+ _GDF_FString(target, target_l, targ);
free(fc);
@@ -3689,13 +3730,13 @@
const int* prefix_l, const char* suffix, const int* suffix_l,
const int* flags)
{
- dtrace("%i, %p, %i, %i, %p, %i, %p, %i, %i", *dirfile, file, *file_l,
- *fragment_index, prefix, *prefix_l, suffix, *suffix_l, *flags);
-
char* fi = (char *)malloc(*file_l + 1);
char* px = (char *)malloc(*prefix_l + 1);
char* sx = (char *)malloc(*suffix_l + 1);
+ dtrace("%i, %p, %i, %i, %p, %i, %p, %i, %i", *dirfile, file, *file_l,
+ *fragment_index, prefix, *prefix_l, suffix, *suffix_l, *flags);
+
gd_include_affix(_GDF_GetDirfile(*dirfile), _GDF_CString(fi, file, *file_l),
*fragment_index, _GDF_CString(px, prefix, *prefix_l), _GDF_CString(sx,
suffix, *suffix_l), *flags);
@@ -3723,3 +3764,29 @@
dreturnvoid();
}
+
+void F77_FUNC(gdtoke, GDTOKE) (char *toke, int *toke_l, const int *dirfile,
+ const char *string, const int *string_l, const int *n)
+{
+ char *token, *st;
+ DIRFILE *D;
+ int i;
+
+ dtrace("%p, %p, %i, %p, %i, %i", toke, toke_l, *dirfile, string, *string_l,
+ *n);
+
+ D = _GDF_GetDirfile(*dirfile);
+ st = (char *)malloc(*string_l + 1);
+ _GDF_CString(st, string, *string_l);
+
+ token = gd_tokenise(D, st);
+ for (i = 1; i < *n; ++i) {
+ free(token);
+ token = gd_tokenise(D, NULL);
+ }
+
+ _GDF_FString(toke, toke_l, token);
+ free(token);
+
+ dreturn("%i", *toke_l);
+}
Modified: trunk/getdata/bindings/f77/fgetdata.h
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.h 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/fgetdata.h 2012-03-02 02:57:19 UTC (rev 664)
@@ -44,6 +44,9 @@
#ifdef __cplusplus
extern "C" {
#endif
+typedef void(*_GDF_callback_t)(int*, const int*, const int*, char*, const int*,
+ const char*);
+
/* Forward declarations to keep icc happy */
void F77_FUNC(gdopen, GDOPEN) (int* dirfile, const char* dirfilename,
const int* dirfilename_l, const int* flags);
@@ -304,9 +307,10 @@
void F77_FUNC(gddscd, GDDSCD) (const int* dirfile);
void F77_FUNC(gdcopn, GDCOPN) (int* dirfile, const char* dirfilename,
- const int* dirfilename_l, const int* flags, const void* callback);
+ const int* dirfilename_l, const int* flags, const _GDF_callback_t callback);
-void F77_FUNC(gdclbk, GDCLBK) (const int* dirfile, const void* callback);
+void F77_FUNC(gdclbk, GDCLBK) (const int* dirfile,
+ const _GDF_callback_t callback);
void F77_FUNC(gdalbt, GDALBT) (const int* dirfile, const char* field_code,
const int* field_code_l, const char* in_field, const int* in_field_l,
@@ -662,6 +666,8 @@
void F77_FUNC(gdadal, GDADAL) (const int *dirfile, const char *field_code,
const int *field_code_l, const char *target, const int *target_l,
const int *fragment_index);
+
+void F77_FUNC(gdnocb, GDNOCB) (const int* dirfile);
#ifdef __cplusplus
}
#endif
Modified: trunk/getdata/bindings/f77/getdata.f.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f.in 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/getdata.f.in 2012-03-02 02:57:19 UTC (rev 664)
@@ -308,6 +308,8 @@
EXTERNAL GDNMFT
C Corresponding to gd_nmvectors(3)
EXTERNAL GDNMVE
+C Deregister a callback function (ie. gd_parser_callback(..., NULL))
+ EXTERNAL GDNOCB
C Corresponding to gd_native_type(3)
EXTERNAL GDNTYP
C Corresponding to gd_nvectors(3)
Modified: trunk/getdata/bindings/f77/getdata.f90.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f90.in 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/getdata.f90.in 2012-03-02 02:57:19 UTC (rev 664)
@@ -2734,13 +2734,13 @@
call gdsync(dirfile, TRIM(field_code), LEN_TRIM(field_code))
end subroutine
-subroutine fgd_fragment_affixes (prefix, suffix, dirfile, fragment_index)
+subroutine fgd_fragment_affixes (prefix, pl, suffix, sl, dirfile, &
+fragment_index)
character(len=*), intent(out) :: prefix, suffix
integer, intent(in) :: dirfile, fragment_index
- integer :: len1 = GD_FIELD_LEN
- integer :: len2 = GD_FIELD_LEN
+ integer, intent(inout) :: pl, sl
- call gdfraf(prefix, len1, suffix, len2, dirfile, fragment_index)
+ call gdfraf(prefix, pl, suffix, sl, dirfile, fragment_index)
end subroutine
subroutine fgd_add_mplex (dirfile, field_code, in_field, count_field, &
@@ -2773,4 +2773,13 @@
count_max)
end subroutine
+subroutine fgd_tokenise (token, l, dirfile, string, n)
+ character (len=*), intent(out) :: token
+ integer, intent(inout) :: l
+ integer, intent(in) :: dirfile, n
+ character (len=*), intent(in) :: string
+
+ call gdtoke(token, l, dirfile, TRIM(string), LEN_TRIM(string), n)
+end subroutine
+
end module
Modified: trunk/getdata/bindings/f77/test/big_test.f
===================================================================
--- trunk/getdata/bindings/f77/test/big_test.f 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/test/big_test.f 2012-03-02 02:57:19 UTC (rev 664)
@@ -721,7 +721,7 @@
CALL CHKDBL(ne, 38, 1d0 * fl, -8.1d0)
C 39: GDFRGN check
- l = plen;
+ l = plen
CALL GDFRGN(path, l, d, 0)
CALL CHKEOK(ne, 39, d)
@@ -2057,7 +2057,18 @@
CALL CHKST2(ne, 231, 6, fields(2), 'in4')
CALL CHKIN2(ne, 231, 7, j, 7)
+C 232: GDTOKE check
+ l = slen
+ CALL GDTOKE(str, l, d, '"test1 test2" test3\ test4 test5', 32, 1)
+ CALL CHKOK2(ne, 232, 1, d)
+ CALL CHKIN2(ne, 232, 2, l, slen)
+ CALL CHKST2(ne, 232, 3, str, 'test1 test2')
+ l = slen
+ CALL GDTOKE(str, l, d, '"test1 test2" test3\ test4 test5', 32, 2)
+ CALL CHKOK2(ne, 232, 4, d)
+ CALL CHKIN2(ne, 232, 5, l, slen)
+ CALL CHKST2(ne, 232, 6, str, 'test3 test4')
@@ -2066,6 +2077,7 @@
+
C ===============================================================
C Cleanup
CALL GDDSCD(d)
Modified: trunk/getdata/bindings/f77/test/big_test95.f90
===================================================================
--- trunk/getdata/bindings/f77/test/big_test95.f90 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/test/big_test95.f90 2012-03-02 02:57:19 UTC (rev 664)
@@ -188,6 +188,7 @@
program big_test
use getdata
+ implicit none
include "test_getdata.f"
character (len=*), parameter :: fildir = 'test95_dirfile'
character (len=*), parameter :: frmat = 'test95_dirfile/format'
@@ -627,8 +628,8 @@
cq(5) = dcmplx(5.5, 0.0)
cq(6) = dcmplx(5.5, 0.0)
DO i=1,3
- call check_dbl2(ne, 18, i * 2 - 1, ent%cm(i), cq(i * 2 - 1))
- call check_dbl2(ne, 18, i * 2, ent%cb(i), cq(i * 2))
+ call check_cpx2(ne, 18, i * 2 - 1, ent%cm(i), cq(i * 2 - 1))
+ call check_cpx2(ne, 18, i * 2, ent%cb(i), cq(i * 2))
end do
! 20: fgd_entry (polynom) check
@@ -1736,13 +1737,13 @@
call check_ok(ne, 155, d)
! 156: fgd_invalid_dirfile check
- m = fgd_invalid_dirfile()
- call check_ok2(ne, 98, 1, m)
+ l = fgd_invalid_dirfile()
+ call check_ok2(ne, 98, 1, l)
- n = fgd_nfragments(m)
- call check_err2(ne, 98, 2, m, GD_E_BAD_DIRFILE)
+ n = fgd_nfragments(l)
+ call check_err2(ne, 98, 2, l, GD_E_BAD_DIRFILE)
- call fgd_close(m)
+ call fgd_close(l)
! 157: fgd_dirfile_standards
n = fgd_dirfile_standards(d, GD_VERSION_CURRENT)
@@ -1789,7 +1790,7 @@
call check_ok(ne, 162, d)
do i=1,2
- call check_int2(ne, 162, i, ci8(i), i + 2)
+ call check_int2(ne, 162, i, int(ci8(i)), i + 2)
end do
! 163: gd_get_carray_slice (FLOAT32)
@@ -2000,7 +2001,7 @@
call check_ok2(ne, 179, 3, d)
do i=1,4
- call check_dbl2(ne, 179, i, 1d0 * cr4(i), 0.)
+ call check_dbl2(ne, 179, i, 1d0 * cr4(i), 0d0)
end do
! 180: gd_madd_carray
@@ -2018,7 +2019,7 @@
call check_ok2(ne, 180, 3, d)
do i=1,4
- call check_dbl2(ne, 180, i, 1d0 * cr4(i), 0.)
+ call check_dbl2(ne, 180, i, 1d0 * cr4(i), 0d0)
end do
! 181: gd_alter_carray
@@ -2036,7 +2037,7 @@
call check_ok2(ne, 181, 3, d)
do i=1,4
- call check_dbl2(ne, 181, i, 1d0 * cr4(i), 0.)
+ call check_dbl2(ne, 181, i, 1d0 * cr4(i), 0d0)
end do
! 183: fgd_constants_i1 check
@@ -2047,7 +2048,7 @@
call check_ok(ne, 183, d)
do i = 1, n
- call check_int2(ne, 183, i, int(ci1(i)), iq(i))
+ call check_int2(ne, 183, i, int(ci1(i)), int(iq(i)))
end do
! 184: fgd_constants_i2 check
@@ -2056,7 +2057,7 @@
call check_ok(ne, 184, d)
do i = 1, n
- call check_int2(ne, 184, i, int(ci2(i)), iq(i))
+ call check_int2(ne, 184, i, int(ci2(i)), int(iq(i)))
end do
! 185: fgd_constants_i4 check
@@ -2064,7 +2065,7 @@
call check_ok(ne, 185, d)
do i = 1, n
- call check_int2(ne, 185, i, ci4(i), iq(i))
+ call check_int2(ne, 185, i, ci4(i), int(iq(i)))
end do
! 186: fgd_constants_i8 check
@@ -2072,7 +2073,7 @@
call check_ok(ne, 186, d)
do i = 1, n
- call check_int2(ne, 186, i, ci8(i), iq(i))
+ call check_int2(ne, 186, i, int(ci8(i)), int(iq(i)))
end do
! 187: fgd_constants_r4 check
@@ -2120,7 +2121,7 @@
call check_ok(ne, 191, d)
do i = 1, n
- call check_int2(ne, 191, i, int(ci1(i)), iq(i))
+ call check_int2(ne, 191, i, int(ci1(i)), int(iq(i)))
end do
! 192: fgd_mconstants_i2 check
@@ -2128,7 +2129,7 @@
call check_ok(ne, 192, d)
do i = 1, n
- call check_int2(ne, 192, i, int(ci2(i)), iq(i))
+ call check_int2(ne, 192, i, int(ci2(i)), int(iq(i)))
end do
! 193: fgd_mconstants_i4 check
@@ -2136,7 +2137,7 @@
call check_ok(ne, 193, d)
do i = 1, n
- call check_int2(ne, 193, i, ci4(i), iq(i))
+ call check_int2(ne, 193, i, ci4(i), int(iq(i)))
end do
! 194: fgd_mconstants_i8 check
@@ -2144,7 +2145,7 @@
call check_ok(ne, 194, d)
do i = 1, n
- call check_int2(ne, 194, i, ci8(i), iq(i))
+ call check_int2(ne, 194, i, int(ci8(i)), int(iq(i)))
end do
! 195: fgd_mconstants_r4 check
@@ -2224,8 +2225,8 @@
call check_ok(ne, 203, d)
call check_int2(ne, 203, 1, n, 280)
- m = fgd_getdata_r8(d, 'data', GD_HERE, 0, 1, 0, cr8)
- call check_int2(ne, 203, 2, m, 8)
+ n = fgd_getdata_r8(d, 'data', GD_HERE, 0, 1, 0, cr8)
+ call check_int2(ne, 203, 2, n, 8)
do i=1,8
call check_dbl2(ne, 203, i, cr8(i), 16d0 + i)
@@ -2419,19 +2420,27 @@
call check_int(ne, 225, n, -1)
! 226: fgd_fragment_affixes check
- call fgd_fragment_affixes(fields(1), fields(2), d, 1)
+ l = flen
+ n = flen
+ call fgd_fragment_affixes(fields(1), l, fields(2), n, d, 1)
call check_ok(ne, 226, d)
- call check_str2(ne, 226, 1, fields(1), 'A')
- call check_str2(ne, 226, 2, fields(2), 'Z')
+ call check_int2(ne, 226, 1, l, flen)
+ call check_str2(ne, 226, 2, fields(1), 'A')
+ call check_int2(ne, 226, 3, n, flen)
+ call check_str2(ne, 226, 4, fields(2), 'Z')
! 227: fgd_alter_affixes check
call fgd_alter_affixes(d, 1, 'B', '')
call check_ok2(ne, 227, 1, d)
- call fgd_fragment_affixes(fields(1), fields(2), d, 1)
+ l = flen
+ n = flen
+ call fgd_fragment_affixes(fields(1), l, fields(2), n, d, 1)
call check_ok2(ne, 227, 2, d)
- call check_str2(ne, 227, 3, fields(1), 'B')
- call check_str2(ne, 227, 3, fields(2), '')
+ call check_int2(ne, 226, 3, l, flen)
+ call check_str2(ne, 227, 4, fields(1), 'B')
+ call check_int2(ne, 226, 5, n, flen)
+ call check_str2(ne, 227, 6, fields(2), '')
! 228: fgd_entry (MPLEX) check
n = fgd_entry(d, 'mplex', ent)
@@ -2480,8 +2489,21 @@
call check_int2(ne, 231, 3, ent%count_val, 5)
call check_str2(ne, 231, 4, ent%field(1), 'in3')
call check_str2(ne, 231, 5, ent%field(2), 'in4')
- call check_dbl2(ne, 231, 6, ent%count_max, 7)
+ call check_int2(ne, 231, 6, ent%count_max, 7)
+! 232: fgd_tokenise check
+ l = slen
+ call fgd_tokenise(str, l, d, '"test1 test2" test3\ test4 test5', 1)
+ call check_ok2(ne, 232, 1, d)
+ call check_int2(ne, 232, 2, l, slen)
+ call check_str2(ne, 232, 3, str, 'test1 test2')
+
+ l = slen
+ call fgd_tokenise(str, l, d, '"test1 test2" test3\ test4 test5', 2)
+ call check_ok2(ne, 232, 4, d)
+ call check_int2(ne, 232, 5, l, slen)
+ call check_str2(ne, 232, 6, str, 'test3 test4')
+
Modified: trunk/getdata/bindings/f77/test/gdcopn.f
===================================================================
--- trunk/getdata/bindings/f77/test/gdcopn.f 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/f77/test/gdcopn.f 2012-03-02 02:57:19 UTC (rev 664)
@@ -11,25 +11,38 @@
END SUBROUTINE
+ SUBROUTINE CALBK2(R, DUNIT, SUBERROR, LINE)
+ INTEGER R
+
+C An invalid response
+ R = 3333
+
+ END SUBROUTINE
+
PROGRAM GETTST
+ IMPLICIT NONE
EXTERNAL CALBCK
+ EXTERNAL CALBK2
INCLUDE "getdata.f"
CHARACTER*12 fildir
PARAMETER (fildir = 'test_dirfile')
CHARACTER*19 frmat
PARAMETER (frmat = 'test_dirfile/format')
+ CHARACTER*20 frmat2
+ PARAMETER (frmat2 = 'test_dirfile/format2')
+ CHARACTER*20 frmat3
+ PARAMETER (frmat3 = 'test_dirfile/format3')
CHARACTER*17 dat
PARAMETER (dat = 'test_dirfile/data')
- CHARACTER*15 frmdat1
- PARAMETER (frmdat1 = 'data RAW INT8 8')
- CHARACTER*9 frmdat2
- PARAMETER (frmdat2 = 'bad line')
INTEGER*1 datdat(80)
- INTEGER*1 i;
- INTEGER d;
- INTEGER e;
+ INTEGER*1 i
+ INTEGER d
+ INTEGER e1, e2, e3, e4
+ INTEGER r
+ r = 0
+
CALL SYSTEM ( 'rm -rf ' // fildir )
CALL SYSTEM ( 'mkdir ' // fildir )
@@ -38,22 +51,61 @@
20 CONTINUE
OPEN(1, FILE=frmat, STATUS='NEW')
- WRITE(1, *) frmdat1
- WRITE(1, *) frmdat2
+ WRITE(1, *) "data RAW INT 8"
+ WRITE(1, *) "bad line"
CLOSE(1, STATUS='KEEP')
+ OPEN(1, FILE=frmat2, STATUS='NEW')
+ WRITE(1, *) "bad line2"
+ CLOSE(1, STATUS='KEEP')
+
+ OPEN(1, FILE=frmat3, STATUS='NEW')
+ WRITE(1, *) "bad line3"
+ CLOSE(1, STATUS='KEEP')
+
OPEN(1, FILE=dat, FORM='UNFORMATTED', ACCESS='DIRECT', RECL=80,
+STATUS='NEW')
WRITE (1,REC=1) datdat
CLOSE(1, STATUS='KEEP')
- CALL GDCOPN(d, fildir, 12, GD_RO, CALBCK)
- CALL GDEROR(e, d)
- CALL GDCLOS(d)
+ CALL GDCOPN(d, fildir, 12, GD_RW, CALBCK)
+ CALL GDEROR(e1, d)
+ CALL GDINCL(d, "format2", 7, 0, 0)
+ CALL GDEROR(e2, d)
+C Change callback
+ CALL GDCLBK(d, CALBK2)
+ CALL GDINCL(d, "format3", 7, 0, 0)
+ CALL GDEROR(e3, d)
+
+C Delete callback
+ CALL GDNOCB(d)
+ CALL GDINCL(d, "format3", 7, 0, 0)
+ CALL GDEROR(e4, d)
+ CALL GDDSCD(d)
+
CALL SYSTEM ( 'rm -rf ' // fildir )
- IF (e .NE. GD_EOK) CALL EXIT(1)
+ IF (e1 .NE. GD_EOK) THEN
+ r = 1
+ WRITE(*, 9001) 1, e1, GD_EOK
+ ENDIF
+ IF (e2 .NE. GD_EOK) THEN
+ r = 1
+ WRITE(*, 9001) 2, e2, GD_EOK
+ ENDIF
+ IF (e3 .NE. GD_ECB) THEN
+ r = 1
+ WRITE(*, 9001) 3, e3, GD_ECB
+ ENDIF
+ IF (e4 .NE. GD_EFO) THEN
+ r = 1
+ WRITE(*, 9001) 3, e4, GD_EFO
+ ENDIF
+ IF (r .GT. 0) CALL ExIT(1)
+
+ 9001 FORMAT('e[', i3, '] = ', i4, ', expected ', i4)
+
STOP
END
Modified: trunk/getdata/bindings/idl/getdata.c
===================================================================
--- trunk/getdata/bindings/idl/getdata.c 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/idl/getdata.c 2012-03-02 02:57:19 UTC (rev 664)
@@ -5539,9 +5539,54 @@
return r;
}
+/* @@DLM: F gdidl_tokenise GD_TOKENISE 1 1 KEYWORDS */
+IDL_VPTR gdidl_tokenise(int argc, IDL_VPTR argv[], char *argk)
+{
+ dtraceidl();
+ const char *string = NULL;
+ char *token;
+ typedef struct {
+ IDL_KW_RESULT_FIRST_FIELD;
+ GDIDL_KW_RESULT_ERROR;
+ IDL_STRING string;
+ int string_x;
+ } KW_RESULT;
+ KW_RESULT kw;
+ GDIDL_KW_INIT_ERROR;
+ kw.string_x = 0;
+ static IDL_KW_PAR kw_pars[] = {
+ GDIDL_KW_PAR_ERROR,
+ GDIDL_KW_PAR_ESTRING,
+ { "STRING", IDL_TYP_STRING, 1, 0, IDL_KW_OFFSETOF(string_x),
+ IDL_KW_OFFSETOF(string) },
+ { NULL }
+ };
+
+ IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+ DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+
+ if (kw.string_x)
+ string = IDL_STRING_STR(&kw.string);
+
+ token = gd_tokenise(D, string);
+
+ GDIDL_SET_ERROR(D);
+
+ IDL_KW_FREE;
+
+ IDL_VPTR r = IDL_StrToSTRING(token);
+ free(token);
+ dreturn("%p", r);
+ return r;
+}
+
+
+
+
/**** Module initialisation ****/
/* These are defined in the automatically generated sublist.c */
Modified: trunk/getdata/bindings/idl/test/big_test.pro
===================================================================
--- trunk/getdata/bindings/idl/test/big_test.pro 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/idl/test/big_test.pro 2012-03-02 02:57:19 UTC (rev 664)
@@ -1332,6 +1332,15 @@
nume += check_simple2(231, 4, n.in_fields, [ 'in3', 'in4' ])
nume += check_simple2(231, 5, n.count_max, 7)
+; 232: gd_tokenise check
+str = gd_tokenise(d, STRING='"test1 test2" test3\ test4')
+nume += check_ok2(232, 1 ,d)
+nume += check_simple2(232, 2, str, "test1 test2")
+
+str = gd_tokenise(d)
+nume += check_ok2(232, 3 ,d)
+nume += check_simple2(232, 4, str, "test3 test4")
+
Modified: trunk/getdata/bindings/perl/GetData.xs
===================================================================
--- trunk/getdata/bindings/perl/GetData.xs 2012-02-21 01:23:45 UTC (rev 663)
+++ trunk/getdata/bindings/perl/GetData.xs 2012-03-02 02:57:19 UTC (rev 664)
@@ -279,7 +279,7 @@
while (SvROK(sv))
sv = SvRV(sv);
- if (SvTYPE(sv) != SVt_PVHV)
+ if (SvTYPE(sv) != SVt_PVHV)
croak("%s::%s() - Entry must be hash", pkg, func);
GDP_EHASH_FETCH_UV("field_type", field_type, gd_entype_t);
@@ -435,7 +435,7 @@
case GD_UNKNOWN:
;
}
-
+
dreturnvoid();
}
@@ -460,7 +460,7 @@
func);
/* argument grokking goes thus (in order!):
- * if d == undef, the remaining arguments are taken to be data
+ * if d == undef, the remaining arguments are taken to be data
* if d == reference to an array, the array is taken to be data, and
* remaining arguments ignored
* if there is exactly one argument after d, d is taken as a type code
@@ -487,7 +487,7 @@
if (din.arg_type == GDP_DATA_IN_LIST) {
din.nsamp = items - idx;
din.type = gdp_get_type(&ST(idx), pkg, func);
- } else if (din.arg_type == GDP_DATA_IN_REF) {
+ } else if (din.arg_type == GDP_DATA_IN_REF) {
if (SvTYPE((SV*)av) != SVt_PVAV)
croak("%s::%s() - Expected array reference, but found some other "
"type of object", pkg, func);
@@ -812,7 +812,7 @@
AV *av = NULL;
if (!sp) {
- av = newAV();
+ av = newAV();
av_extend(av, n - 1);
}
@@ -1699,7 +1699,7 @@
GetData::Dirfile::put_carray = 1
CODE:
dtrace("%p, \"%s\", %p, ...[%li]", dirfile, field_code, d, (long)items - 3);
-
+
din = gdp_convert_data(d, items, ax, 2, gdp_package, "put_carray");
RETVAL = gd_put_carray(dirfile, field_code, din.type, din.data_in);
@@ -1727,7 +1727,7 @@
CODE:
dtrace("%p, \"%s\", %lli, %p, ...[%li]", dirfile, field_code,
(long long)start, d, (long)items - 4);
-
+
din = gdp_convert_data(d, items, ax, 3, gdp_package, "put_carray");
RETVAL = gd_put_carray_slice(dirfile, field_code, start, din.nsamp,
@@ -1757,7 +1757,7 @@
CODE:
dtrace("%p, \"%s\", %03x, %i, %p, ...[%li]", dirfile, field_code,
const_type, fragment_index, d, (long)items - 5);
-
+
din = gdp_convert_data(d, items, ax, 4, gdp_package, "put_carray");
RETVAL = gd_add_carray(dirfile, field_code, const_type, din.nsamp,
@@ -1787,7 +1787,7 @@
CODE:
dtrace("%p, \"%s\", \"%s\", %03x, %p, ...[%li]", dirfile, parent,
field_code, const_type, d, (long)items - 5);
-
+
din = gdp_convert_data(d, items, ax, 4, gdp_package, "put_carray");
RETVAL = gd_madd_carray(dirfile, parent, field_code, const_type, din.nsamp,
@@ -1989,5 +1989,29 @@
dreturnvoid();
+void
+tokenise(dirfile, string)
+ DIRFILE * dirfile
+ const char * string
+ PREINIT:
+ int i;
+ char *token;
+ GDP_DIRFILE_ALIAS;
+ ALIAS:
+ GetData::Dirfile::to...
[truncated message content] |
|
From: <ket...@us...> - 2012-03-03 03:55:07
|
Revision: 665
http://getdata.svn.sourceforge.net/getdata/?rev=665&view=rev
Author: ketiltrout
Date: 2012-03-03 03:54:58 +0000 (Sat, 03 Mar 2012)
Log Message:
-----------
GD_TRUNCSUB
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/cxx/windowentry.cpp
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/make_parameters.c
trunk/getdata/man/Makefile.am
trunk/getdata/man/gd_add.3
trunk/getdata/man/gd_add_bit.3
trunk/getdata/man/gd_alter_bit.3
trunk/getdata/man/gd_alter_endianness.3.in
trunk/getdata/man/gd_alter_protection.3
trunk/getdata/man/gd_cbopen.3
trunk/getdata/man/gd_delete.3
trunk/getdata/man/gd_fragment_index.3
trunk/getdata/man/gd_move.3
trunk/getdata/man/gd_rename.3
trunk/getdata/src/fragment.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/open.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/fragment_affix_alter.c
trunk/getdata/test/fragment_affix_alter2.c
trunk/getdata/test/fragment_affix_dup.c
Added Paths:
-----------
trunk/getdata/man/gd_add_alias.3
trunk/getdata/man/gd_alias_target.3
trunk/getdata/man/gd_aliases.3
trunk/getdata/man/gd_alter_affixes.3
trunk/getdata/man/gd_fragment_affixes.3
trunk/getdata/man/gd_hidden.3
trunk/getdata/man/gd_hide.3
trunk/getdata/man/gd_naliases.3
trunk/getdata/test/trunc_dir.c
trunk/getdata/test/trunc_truncsub.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/ChangeLog 2012-03-03 03:54:58 UTC (rev 665)
@@ -1,3 +1,14 @@
+2012-03-03 D. V. Wiebe <ge...@ke...> svn:???
+ * src/getdata.h.in bindings/make_parameters.c: Added GD_TRUNCSUB open flag.
+ * src/open.c (_GD_TruncDir): Added.
+ * src/open.c (_GD_CreateDirfile): Call _GD_TruncDir.
+ * test/trunc_dir.c test/trunc_truncsub.c: Added.
+
+ * src/fragment.c (gd_alter_affixes): Handle GD_E_ACCMODE and GD_E_PROTECTED
+ errors.
+
+ * bindings/f77/fgetdata.c (GDDELA): Correct call to gd_delete_alias.
+
2012-03-02 D. V. Wiebe <ge...@ke...> svn:664
* src/errors.c: Added GD_E_ARGUMENT:GD_E_ARG_NODATA.
* src/parse.c (_GD_Tokenise): Take number of columns to return.
Modified: trunk/getdata/bindings/cxx/windowentry.cpp
===================================================================
--- trunk/getdata/bindings/cxx/windowentry.cpp 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/bindings/cxx/windowentry.cpp 2012-03-03 03:54:58 UTC (rev 665)
@@ -78,7 +78,8 @@
{
int ret = 0;
- dtrace("{%g,%llX,%lli}", threshold.r, threshold.u, threshold.i);
+ dtrace("{%g,%llX,%lli}", threshold.r, (unsigned long long)threshold.u,
+ (long long)threshold.i);
E.u.window.threshold = threshold;
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/bindings/f77/fgetdata.c 2012-03-03 03:54:58 UTC (rev 665)
@@ -3615,7 +3615,7 @@
char *fc = (char *)malloc(*field_code_l + 1);
gd_delete_alias(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
- *field_code_l), (unsigned)flags);
+ *field_code_l), (unsigned int)*flags);
free(fc);
dreturnvoid();
Modified: trunk/getdata/bindings/make_parameters.c
===================================================================
--- trunk/getdata/bindings/make_parameters.c 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/bindings/make_parameters.c 2012-03-03 03:54:58 UTC (rev 665)
@@ -110,6 +110,7 @@
CONSTANT(ARM_ENDIAN, "GD_AE", 2),
CONSTANT(NOT_ARM_ENDIAN, "GD_NA", 2),
CONSTANT(PERMISSIVE, "GD_PM", 1),
+ CONSTANT(TRUNCSUB, "GD_TS", 1),
CONSTANT(AUTO_ENCODED, "GDE_AU", 1),
CONSTANT(BZIP2_ENCODED, "GDE_BZ", 2),
Modified: trunk/getdata/man/Makefile.am
===================================================================
--- trunk/getdata/man/Makefile.am 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/Makefile.am 2012-03-03 03:54:58 UTC (rev 665)
@@ -28,30 +28,33 @@
nodist_man_MANS = gd_alter_encoding.3 gd_alter_endianness.3 \
gd_alter_frameoffset.3
-dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_bit.3 \
- gd_add_spec.3 gd_alter_bit.3 gd_alter_entry.3 \
+dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_alias.3 \
+ gd_add_bit.3 gd_add_spec.3 gd_alias_target.3 gd_aliases.3 \
+ gd_alter_affixes.3 gd_alter_bit.3 gd_alter_entry.3 \
gd_alter_protection.3 gd_alter_spec.3 gd_bof.3 gd_carray_len.3 \
- gd_carrays.3 gd_cbopen.3 gd_close.3 gd_get_carray_slice.3 \
- gd_put_carray_slice.3 gd_get_constant.3 gd_put_constant.3 \
- gd_constants.3 gd_dirfile_standards.3 gd_getdata.3 \
- gd_putdata.3 gd_delete.3 gd_encoding.3 gd_endianness.3 \
- gd_entry.3 gd_entry_type.3 gd_eof.3 gd_error.3 \
- gd_error_count.3 gd_error_string.3 gd_field_list.3 \
- gd_field_list_by_type.3 gd_flush.3 gd_fragment_index.3 \
- gd_fragmentname.3 gd_framenum_subset.3 gd_frameoffset.3 \
- gd_free_entry_strings.3 gd_include.3 gd_invalid_dirfile.3 \
+ gd_carrays.3 gd_cbopen.3 gd_close.3 gd_constants.3 \
+ gd_dirfile_standards.3 gd_delete.3 gd_dirfilename.3 \
+ gd_encoding.3 gd_endianness.3 gd_entry.3 gd_entry_type.3 \
+ gd_eof.3 gd_error.3 gd_error_count.3 gd_error_string.3 \
+ gd_field_list.3 gd_field_list_by_type.3 gd_flush.3 \
+ gd_fragment_affixes.3 gd_fragment_index.3 gd_fragmentname.3 \
+ gd_framenum_subset.3 gd_frameoffset.3 gd_free_entry_strings.3 \
+ gd_get_carray_slice.3 gd_get_constant.3 gd_getdata.3 \
+ gd_get_string.3 gd_hidden.3 gd_hide.3 gd_include.3 \
+ gd_invalid_dirfile.3 \
gd_madd_bit.3 gd_mcarrays.3 gd_mconstants.3 gd_metaflush.3 \
gd_mfield_list.3 gd_mfield_list_by_type.3 gd_move.3 \
- gd_mstrings.3 gd_mvector_list.3 gd_dirfilename.3 \
+ gd_mstrings.3 gd_mvector_list.3 gd_dirfilename.3 gd_naliases.3 \
gd_native_type.3 gd_nfields.3 gd_nfields_by_type.3 \
gd_nfragments.3 gd_nframes.3 gd_nmfields.3 \
gd_nmfields_by_type.3 gd_nmvectors.3 gd_nvectors.3 \
gd_parent_fragment.3 gd_parser_callback.3 gd_protection.3 \
- gd_raw_filename.3 gd_reference.3 gd_rename.3 \
- gd_rewrite_fragment.3 gd_seek.3 gd_spf.3 gd_get_string.3 \
- gd_put_string.3 gd_strings.3 gd_tell.3 gd_uninclude.3 \
- gd_validate.3 gd_vector_list.3 dirfile.5 dirfile-encoding.5 \
- dirfile-format.5 $(LFS_transitional_mans)
+ gd_put_carray_slice.3 gd_put_constant.3 gd_putdata.3 \
+ gd_put_string.3 gd_raw_filename.3 gd_reference.3 gd_rename.3 \
+ gd_rewrite_fragment.3 gd_seek.3 gd_spf.3 gd_strings.3 \
+ gd_tell.3 gd_uninclude.3 gd_validate.3 gd_vector_list.3 \
+ dirfile.5 dirfile-encoding.5 dirfile-format.5 \
+ $(LFS_transitional_mans)
MAN3ALIASES=gd_add_bit.3:gd_add_carray.3 gd_add_bit.3:gd_add_clincom.3 \
gd_add_bit.3:gd_add_const.3 gd_add_bit.3:gd_add_cpolynom.3 \
@@ -60,15 +63,15 @@
gd_add_bit.3:gd_add_multiply.3 gd_add_bit.3:gd_add_polynom.3 \
gd_add_bit.3:gd_add_phase.3 gd_add_bit.3:gd_add_raw.3 \
gd_add_bit.3:gd_add_recip.3 gd_add_bit.3:gd_add_sbit.3 \
- gd_add_bit.3:gd_add_string.3 gd_madd_bit.3:gd_madd_carray.3 \
- gd_madd_bit.3:gd_madd_clincom.3 gd_madd_bit.3:gd_madd_const.3 \
- gd_madd_bit.3:gd_madd_cpolynom.3 gd_madd_bit.3:gd_madd_crecip.3 \
- gd_madd_bit.3:gd_madd_divide.3 gd_madd_bit.3:gd_madd_lincom.3 \
- gd_madd_bit.3:gd_madd_linterp.3 gd_madd_bit.3:gd_madd_multiply.3 \
- gd_madd_bit.3:gd_madd_phase.3 gd_madd_bit.3:gd_madd_polynom.3 \
- gd_madd_bit.3:gd_madd_recip.3 gd_madd_bit.3:gd_madd_sbit.3 \
- gd_madd_bit.3:gd_madd_string.3 gd_add.3:gd_madd.3 \
- gd_add_spec.3:gd_madd_spec.3 gd_cbopen.3:gd_open.3 \
+ gd_add_bit.3:gd_add_string.3 gd_add_bit.3:gd_add_window.3 \
+ gd_madd_bit.3:gd_madd_carray.3 gd_madd_bit.3:gd_madd_clincom.3 \
+ gd_madd_bit.3:gd_madd_const.3 gd_madd_bit.3:gd_madd_cpolynom.3 \
+ gd_madd_bit.3:gd_madd_crecip.3 gd_madd_bit.3:gd_madd_divide.3 \
+ gd_madd_bit.3:gd_madd_lincom.3 gd_madd_bit.3:gd_madd_linterp.3 \
+ gd_madd_bit.3:gd_madd_multiply.3 gd_madd_bit.3:gd_madd_phase.3 \
+ gd_madd_bit.3:gd_madd_polynom.3 gd_madd_bit.3:gd_madd_recip.3 \
+ gd_madd_bit.3:gd_madd_sbit.3 gd_madd_bit.3:gd_madd_string.3 \
+ gd_add.3:gd_madd.3 gd_add_spec.3:gd_madd_spec.3 gd_cbopen.3:gd_open.3 \
gd_close.3:gd_discard.3 gd_alter_bit.3:gd_alter_carray.3 \
gd_alter_bit.3:gd_alter_clincom.3 gd_alter_bit.3:gd_alter_const.3 \
gd_alter_bit.3:gd_alter_cpolynom.3 gd_alter_bit.3:gd_alter_crecip.3 \
@@ -76,9 +79,11 @@
gd_alter_bit.3:gd_alter_linterp.3 gd_alter_bit.3:gd_alter_multiply.3 \
gd_alter_bit.3:gd_alter_phase.3 gd_alter_bit.3:gd_alter_polynom.3 \
gd_alter_bit.3:gd_alter_recip.3 gd_alter_bit.3:gd_alter_raw.3 \
- gd_alter_bit.3:gd_alter_sbit.3 gd_alter_spec.3:gd_malter_spec.3 \
- gd_framenum_subset.3:gd_framenum.3 gd_get_carray_slice.3:gd_get_carray.3 \
- gd_put_carray_slice.3:gd_put_carray.3 $(MAN3ALIASES64)
+ gd_alter_bit.3:gd_alter_sbit.3 gd_alter_bit.3:gd_alter_window.3 \
+ gd_alter_spec.3:gd_malter_spec.3 gd_framenum_subset.3:gd_framenum.3 \
+ gd_get_carray_slice.3:gd_get_carray.3 gd_put_carray_slice.3:gd_put_carray.3 \
+ gd_delete.3:gd_delete_alias.3 gd_hide.3:gd_unhide.3 \
+ gd_add_alias.3:gd_madd_alias.3 $(MAN3ALIASES64)
#man conversion
HTMLMANS=$(addsuffix .html,$(nodist_man_MANS)) \
Modified: trunk/getdata/man/gd_add.3
===================================================================
--- trunk/getdata/man/gd_add.3 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/gd_add.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_add 3 "1 March 2012" "Version 0.8.0" "GETDATA"
+.TH gd_add 3 "2 March 2012" "Version 0.8.0" "GETDATA"
.SH NAME
gd_add, gd_madd \(em add a field to a dirfile
.SH SYNOPSIS
@@ -106,7 +106,8 @@
.B GD_E_BAD_CODE
The field name provided in
.IR entry -> field
-contained invalid characters. Alternately, the
+contained invalid characters or did not contain the affected fragment's prefix
+or suffix. Alternately, the
.I parent
field code was not found, or was already a metafield.
.TP
Added: trunk/getdata/man/gd_add_alias.3
===================================================================
--- trunk/getdata/man/gd_add_alias.3 (rev 0)
+++ trunk/getdata/man/gd_add_alias.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -0,0 +1,101 @@
+.\" gd_add_alias.3. The gd_add_alias man page.
+.\"
+.\" Copyright (C) 2012 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_add_alias 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_add_alias, gd_madd_alias \(em add a field to a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_add_alias(DIRFILE *" dirfile ", const char *" alias_name ,
+.BI "const char *" target_code ", int " fragment_index );
+.HP
+.BI "int gd_madd_alias(DIRFILE *" dirfile ", const char *" parent ,
+.BI "const char *" alias_name ", const char *" target_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_add_alias ()
+function adds the alias named
+.I alias_name
+pointing to
+.I target_code
+to the fragment indexed by
+.I fragment_index
+in the dirfile specified by
+.IR dirfile .
+The
+.BR gd_madd_alias ()
+function behaves similarly, but adds the field as a meta-entry under the field
+indicated by the field code
+.IR parent .
+
+.SH RETURN VALUE
+On success,
+.BR gd_add_alias ()
+and
+.BR gd_madd_alias ()
+return zero. On error, -1 is returned and the dirfile error is set to a
+non-zero error value. Possible error values are:
+.TP 8
+.B GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The
+.IR alias_name
+parameter contained invalid characters or was missing the indicated fragment's
+field prefix or suffix. Alternately, the
+.I parent
+field code was not found, or was already a metafield.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_INDEX
+The
+.I fragment_index
+specified was out of range.
+.TP
+.B GD_E_DUPLICATE
+The
+.I alias_name
+parameter duplicated that of an already existing entry.
+.TP
+.B GD_E_PROTECTED
+The metadata of the fragment was protected from change. Or, the creation of a
+.B RAW
+field was attempted and the data of the fragment was protected.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_add (3),
+.BR gd_alias_target (3),
+.BR gd_entry (3),
+.BR gd_madd (3),
+.BR gd_metaflush (3),
+.BR gd_open (3),
+.BR dirfile-format (5)
Modified: trunk/getdata/man/gd_add_bit.3
===================================================================
--- trunk/getdata/man/gd_add_bit.3 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/gd_add_bit.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -83,6 +83,10 @@
.HP
.BI "int gd_add_string(DIRFILE *" dirfile ", const char *" field_name ,
.BI "const char *" value ", int " fragment_index );
+.HP
+.BI "int gd_add_window(DIRFILE *" dirfile ", const char *" field_name ,
+.BI "const char *" in_field ", const char *" check_field ", gd_windop_t"
+.IB windop ", gd_triplet_t " threshold );
.hy
.ad n
.SH DESCRIPTION
@@ -206,7 +210,8 @@
.B GD_E_BAD_CODE
The
.IR field_name
-argument contained invalid characters.
+argument contained invalid characters or did not contain the affected fragment's
+prefix or suffix.
.TP
.B GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
Added: trunk/getdata/man/gd_alias_target.3
===================================================================
--- trunk/getdata/man/gd_alias_target.3 (rev 0)
+++ trunk/getdata/man/gd_alias_target.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -0,0 +1,80 @@
+.\" gd_alias_target.3. The gd_alias_target man page.
+.\"
+.\" Copyright (C) 2012 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_alias_target 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_alias_target \(em return the target of an alias defined in a dirfile database
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "const char *gd_alias(DIRFILE *" dirfile ", const char *" alias_name );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_alias_target ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns the target field code of the alias specified by
+.IR alias_name .
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+Note: the target may itself be the an alias, which will have its own target. To
+obtain the canonical name of the field ultimately referenced by
+.IR alias_name ,
+pass it to
+.BR gd_entry (3)
+and inspect the
+.I field
+member of the gd_entry_t structure returned.
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_alias_target ()
+returns a pointer to a read-only character string containing the name of the
+target of the specified alias. On error,
+.BR gd_alias_target ()
+returns NULL and sets the dirfile error a non-zero error value. Possible error
+values are:
+.TP 8
+.B GD_E_BAD_CODE
+The name
+.I alias_name
+was not found in the dirfile.
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_FIELD_TYPE
+The entry specified by
+.I alias_name
+was not an alias.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+
+.SH SEE ALSO
+.BR gd_aliases (3),
+.BR gd_entry (3),
+.BR gd_open (3),
+.BR dirfile (5)
Added: trunk/getdata/man/gd_aliases.3
===================================================================
--- trunk/getdata/man/gd_aliases.3 (rev 0)
+++ trunk/getdata/man/gd_aliases.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -0,0 +1,84 @@
+.\" gd_aliases.3. The gd_aliases man page.
+.\"
+.\" Copyright (C) 2012 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_aliases 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_aliases \(em retrieve a list of aliases for a field in a dirfile database
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "const char **gd_aliases(DIRFILE *" dirfile ", const char *" field_code );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_aliases ()
+function queries a dirfile(5) database specified by
+.I dirfile
+and returns a read-only list of aliases of the field specified by
+.IR field_code .
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+The array returned will be de-allocated by a call to
+.BR gd_close (3)
+and should not be de-allocated by the caller. The list returned should not be
+assumed to be in any particular order. The array is terminated by a NULL
+pointer. The number of strings in the array can be obtained from a call to
+.BR gd_naliases (3).
+
+The caller may not modify any strings in the array, or the array itself. Doing
+so may cause database corruption. The pointer returned is guaranteed to be
+valid until
+.BR gd_aliases ()
+is called again with the same arguments, or until the array is de-allocated by
+a call to
+.BR gd_close (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_aliases ()
+returns a pointer to an array of strings containing the values of all the
+aliases for the specified field. The array is terminated by a NULL pointer.
+If successful, this list will always contain at least one entry, to wit:
+.IR field_code .
+
+On error it returns NULL and sets the dirfile error to a non-zero error value.
+Possible error values are:
+.TP 8
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The specified field code was not found in the database.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH SEE ALSO
+.BR dirfile (5),
+.BR gd_open (3),
+.BR gd_alias_target (3),
+.BR gd_naliases (3)
Added: trunk/getdata/man/gd_alter_affixes.3
===================================================================
--- trunk/getdata/man/gd_alter_affixes.3 (rev 0)
+++ trunk/getdata/man/gd_alter_affixes.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -0,0 +1,112 @@
+.\" gd_alter_affixes.3. The gd_alter_affixes man page.
+.\"
+.\" Copyright (C) 2012 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_alter_affixes 3 "1 January 2012" "Version 0.8.0" "GETDATA"
+.SH NAME
+gd_alter_affixes \(em modify the field affixes of a fragments in a dirfile
+.SH SYNOPSIS
+.B #include <getdata.h>
+.HP
+.nh
+.ad l
+.BI "int gd_alter_affixes(DIRFILE *" dirfile ", int " fragment_index ,
+.BI "const char *" prefix ", const char *" suffix );
+.hy
+.ad n
+.SH DESCRIPTION
+The
+.BR gd_alter_affixes ()
+function sets the field prefix and suffix of fields defined in the format
+specification fragment given by
+.I fragment_index
+to
+.I prefix
+and
+.I suffix
+in the dirfile(5) database specified by
+.IR dirfile .
+
+The field prefix and suffix are appended to all field codes found in the
+specified fragment. If the parent fragment to the modified fragment contains
+field affixes themselves, they should be included in the affixes passed to
+.BR gd_alter_affixes ().
+See EXAMPLES below for further details. If
+.I prefix
+or
+.I suffix
+is NULL, the corresponding affix will be unchanged. To remove an affix, set it
+to the parent fragment's corresponding affix, which may be the empty string
+("").
+
+It is not possible to set affixes on the root format file (i.e.
+.I fragment_index
+may not be zero).
+
+The
+.I dirfile
+argument must point to a valid DIRFILE object previously created by a call to
+.BR gd_open (3).
+
+.SH RETURN VALUE
+Upon successful completion,
+.BR gd_alter_affixes ()
+returns zero. On error, it returns -1 and sets the dirfile error to a non-zero
+error value. Possible error values are:
+.TP 8
+.B GD_E_ACCMODE
+The specified dirfile was opened read-only.
+.TP
+.B GD_E_ALLOC
+The library was unable to allocate memory.
+.TP
+.B GD_E_BAD_CODE
+The supplied
+.I prefix
+or
+.I suffix
+contained invalid characters.
+.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_INDEX
+The supplied index was out of range.
+.TP
+.B GD_E_DUPLICATE
+The supplied affixes would result in one or more field codes duplicating an
+existing field code.
+.TP
+.B GD_E_PROTECTED
+The metadata of the given fragment's parent fragment was protected from
+change.
+.PP
+The dirfile error may be retrieved by calling
+.BR gd_error (3).
+A descriptive error string for the last error encountered can be obtained from
+a call to
+.BR gd_error_string (3).
+.SH EXAMPLES
+Dealing with affixes of parent fragments is relatively straightforward. Say,
+for instance, fragment #1 has a prefix "A" and a suffix "B" and fragment #2 is
+included from fragment #1. In this case any prefix for fragment #2 must end
+with "A" and any suffix for fragment #2 must begin with "B".
+.SH SEE ALSO
+.BR gd_open (3),
+.BR gd_error (3),
+.BR gd_error_string (3),
+.BR gd_fragment_affixes (3),
+.BR gd_include_affix (3),
+.BR dirfile (5),
+.BR dirfile-format (5)
Modified: trunk/getdata/man/gd_alter_bit.3
===================================================================
--- trunk/getdata/man/gd_alter_bit.3 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/gd_alter_bit.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -1,6 +1,6 @@
.\" gd_alter_bit.3. The gd_alter_bit man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2012 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_alter_bit 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_bit 3 "1 January 2012" "Version 0.8.0" "GETDATA"
.SH NAME
gd_alter_bit, gd_alter_carray, gd_alter_clincom, gd_alter_const,
gd_alter_cpolynom, gd_alter_crecip, gd_alter_divide, gd_alter_lincom,
@@ -71,6 +71,10 @@
.HP
.BI "int gd_alter_sbit(DIRFILE *" dirfile ", const char *" field_code ,
.BI "const char *" in_field ", gd_bit_t " bitnum ", gd_bit_t " numbits );
+.HP
+.BI "int gd_alter_window(DIRFILE *" dirfile ", const char *" field_code ,
+.BI "const char *" in_field ", const char *" check_field ,
+.BI "gd_windop_t " windop ", gd_triplet_t " threshold );
.hy
.ad n
.SH DESCRIPTION
@@ -130,8 +134,7 @@
.BR gd_alter_cpolynom ()
take an array of length
.I poly_ord
-+ 1
-containing the polynomial co-efficients
++ 1 containing the polynomial co-efficients
.RI ( a " or " ca ).
Some field parameters have special values which indicate no change should be
@@ -148,6 +151,10 @@
.IR data_type ", or " const_type
are equal to
.BR GD_NULL ,
+or if
+.I windop
+is
+.BR GD_WINDOP_UNK ,
these parameters will not be modified.
All field parameters introduced with this interface must contain literal
Modified: trunk/getdata/man/gd_alter_endianness.3.in
===================================================================
--- trunk/getdata/man/gd_alter_endianness.3.in 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/gd_alter_endianness.3.in 2012-03-03 03:54:58 UTC (rev 665)
@@ -2,7 +2,7 @@
.\"
.\" @configure_input@
.\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 D. V. Wiebe
.\"
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
@@ -15,7 +15,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_alter_endianness 3 "21 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_endianness 3 "1 January 2012" "Version 0.8.0" "GETDATA"
.SH NAME
gd_alter_endianness \(em modify the byte sex of fields in a dirfile
.SH SYNOPSIS
@@ -99,6 +99,11 @@
.B GD_E_ALLOC
The library was unable to allocate memory.
.TP
+.B GD_E_ARGUMENT
+The supplied
+.I byte_sex
+was invalid.
+.TP
.B GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
.TP
Modified: trunk/getdata/man/gd_alter_protection.3
===================================================================
--- trunk/getdata/man/gd_alter_protection.3 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/gd_alter_protection.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -1,6 +1,6 @@
.\" gd_alter_protection.3. The gd_alter_protection man page.
.\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2012 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_alter_protection 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_protection 3 "1 January 2012" "Version 0.8.0" "GETDATA"
.SH NAME
gd_alter_protection \(em modify the protection level of a dirfile fragment
.SH SYNOPSIS
@@ -72,6 +72,11 @@
.B GD_E_ACCMODE
The specified dirfile was opened read-only.
.TP
+.B GD_E_ARGUMENT
+The supplied
+.I protection_level
+was invalid.
+.TP
.B GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
.TP
Modified: trunk/getdata/man/gd_cbopen.3
===================================================================
--- trunk/getdata/man/gd_cbopen.3 2012-03-02 02:57:19 UTC (rev 664)
+++ trunk/getdata/man/gd_cbopen.3 2012-03-03 03:54:58 UTC (rev 665)
@@ -1,6 +1,6 @@
.\" gd_cbopen.3. The gd_cbopen man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010, 2011 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011, 2012 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_cbopen 3 "17 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_cbopen 3 "1 January 2012" "Version 0.8.0" "GETDATA"
.SH NAME
gd_cbopen, gd_open \(em open or create a dirfile
.SH SYNOPSIS
@@ -283,12 +283,21 @@
.B GD_SLIM_ENCODED
Specifies that raw data files are compressed using the slimlib library.
.TP
+.B GD_SIE_ENCODED
+Specified that raw data files are sample-index encoded, similar to run-length
+encoding, suitable for data that change rarely.
+.TP
.B GD_TEXT_ENCODED
Specifies that raw data files are encoded as text files containing one data
sample per line.
.TP
.B GD_UNENCODED
Specifies that raw data files are not encoded, but written verbatim to disk.
+.TP
+.B GD_ZZIP_ENCODED
+Specifies that raw data files are compressed using the DEFLATE algorithm. All
+raw data files for a given fragment are collected together and stored in a PKZIP
+archive called raw.zip.
.SS Standards Compliance
The latest Dirfile Standards Version which this release of GetData understands
@@ -428,6 +437,9 @@
parameter will be one of the following symbols indicating the type of syntax
error encountered:
.TP
+.B GD_E_FORMAT_ALIAS
+The parent specified for a meta field was an alias.
+.TP
.B GD_E_FORMAT_BAD_LINE
The line was indecipherable. Typically this means that the line contained
neither a reserved word, nor a field type.
@@ -465,6 +477,9 @@
.B GD_E_FORMAT_LOCATION
The parent of a metafield was defined in another fragment.
.TP
+.B GD_E_FORMAT_META_META
+An attempt was made to use a metafield as the parent to a new metafield.
+.TP
.B GD_E_FORMAT_METARAW
An attempt was made to add a RAW metafield.
.TP
@@ -474,7 +489,7 @@
.B GD_E_FORMAT_N_TOK
An insufficient number of tokens was found on the line.
.TP
-.B GD_E_...
[truncated message content] |
|
From: <ket...@us...> - 2012-03-06 01:45:25
|
Revision: 667
http://getdata.svn.sourceforge.net/getdata/?rev=667&view=rev
Author: ketiltrout
Date: 2012-03-06 01:45:18 +0000 (Tue, 06 Mar 2012)
Log Message:
-----------
GD_TRUNCSUB fixes. Allow "parent/meta" in gd_add_alias, too.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/add.c
trunk/getdata/src/compat.c
trunk/getdata/src/errors.c
trunk/getdata/src/internal.h
trunk/getdata/src/open.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/test.h
Added Paths:
-----------
trunk/getdata/test/add_alias_meta.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2012-03-03 04:48:18 UTC (rev 666)
+++ trunk/getdata/ChangeLog 2012-03-06 01:45:18 UTC (rev 667)
@@ -1,4 +1,16 @@
-2012-03-03 D. V. Wiebe <ge...@ke...> svn:???
+2012-03-06 D. V. Wiebe <ge...@ke...> svn:667
+ * src/errors.c: Change prefix on verbose output to "libgetdata".
+
+ * src/add.c (_GD_FixName): Added.
+ * src/add.c (_GD_Add _GD_AddAlias): Call _GD_FixName.
+ * test/add_alias_meta.c: Added.
+
+ * src/open.c (_GD_TruncDir): Fix subdirectory truncation.
+ * src/internal.h: Remove conditional defition of AT_SYMLINK_NOFOLLOW.
+ * src/compat.c (gd_StatAt): Check for definition of AT_SYMLINK_NOFOLLOW
+ before use.
+
+2012-03-03 D. V. Wiebe <ge...@ke...> svn:665
* src/getdata.h.in bindings/make_parameters.c: Added GD_TRUNCSUB open flag.
* src/open.c (_GD_TruncDir): Added.
* src/open.c (_GD_CreateDirfile): Call _GD_TruncDir.
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2012-03-03 04:48:18 UTC (rev 666)
+++ trunk/getdata/src/add.c 2012-03-06 01:45:18 UTC (rev 667)
@@ -20,6 +20,53 @@
*/
#include "internal.h"
+static gd_entry_t *_GD_FixName(DIRFILE *restrict D, char **restrict buffer,
+ const char *name, int frag, int *restrict offset)
+{
+ gd_entry_t *P;
+ char *ptr;
+
+ dtrace("%p, %p, \"%s\", %i, %p", D, buffer, name, frag, offset);
+
+ /* Apply prefix and suffix */
+ *buffer = ptr = _GD_MungeFromFrag(D, NULL, frag, name, offset);
+
+ if (ptr == NULL) {
+ free(ptr);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ P = _GD_CheckParent(D, &ptr, -1, 0);
+
+ if (D->error) {
+ free(*buffer);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ if (P) {
+ char *temp2;
+ /* make the new name -- this may be different because P may have been
+ * dealiased */
+
+ *offset = strlen(P->field) + 1;
+ temp2 = _GD_Malloc(D, *offset + strlen(ptr) + 1);
+ if (temp2 == NULL) {
+ free(*buffer);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ sprintf(temp2, "%s/%s", P->field, ptr);
+ free(*buffer);
+ *buffer = temp2;
+ }
+
+ dreturn("%p [\"%s\", %i]", P, *buffer, *offset);
+ return P;
+}
+
/* add an entry - returns the added entry on success. */
static gd_entry_t *_GD_Add(DIRFILE *restrict D,
const gd_entry_t *restrict entry, const char *restrict parent)
@@ -92,43 +139,15 @@
temp_buffer[offset - 1] = '/';
strcpy(temp_buffer + offset, entry->field);
} else {
- char *ptr;
- /* Apply prefix and suffix */
- temp_buffer = ptr = _GD_MungeFromFrag(D, NULL, entry->fragment_index,
- entry->field, &offset);
+ /* this will munge the name and take care of detecting Barth-style metafield
+ * definitions */
+ P = _GD_FixName(D, &temp_buffer, entry->field, entry->fragment_index,
+ &offset);
- if (temp_buffer == NULL) {
- dreturn("%p", NULL);
- return NULL;
- }
-
- /* look for a Barth-style meta field. We do this after mungification
- * to ensure that the parent field ends up with the right prefix and
- * suffix */
- P = _GD_CheckParent(D, &ptr, -1, 0);
-
if (D->error) {
- free(temp_buffer);
dreturn("%p", NULL);
return NULL;
}
-
- if (P) {
- /* make the new name -- this may be different because P may have been
- * dealiased */
- offset = strlen(P->field) + 1;
- char *temp2 = _GD_Malloc(D, offset + strlen(ptr) + 1);
- if (temp2 == NULL) {
- free(temp_buffer);
- dreturn("%p", NULL);
- return NULL;
- }
-
- dwatch("%s", ptr);
- sprintf(temp2, "%s/%s", P->field, ptr);
- free(temp_buffer);
- temp_buffer = temp2;
- }
}
/* check for duplicate field */
@@ -1943,9 +1962,9 @@
strcpy(munged_code + offset, field_code);
}
} else
- /* Apply prefix and suffix */
- munged_code = _GD_MungeFromFrag(D, NULL, fragment_index, field_code,
- &offset);
+ /* this will munge the name and take care of detecting Barth-style metafield
+ * definitions */
+ P = _GD_FixName(D, &munged_code, field_code, fragment_index, &offset);
if (D->error) {
free(munged_code);
Modified: trunk/getdata/src/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2012-03-03 04:48:18 UTC (rev 666)
+++ trunk/getdata/src/compat.c 2012-03-06 01:45:18 UTC (rev 667)
@@ -100,7 +100,7 @@
dtrace("%p, %i, \"%s\", %p, %x", D, dirfd, name, buf, flags);
path = _GD_MakeFullPathOnly(D, dirfd, name);
-#ifdef HAVE_LSTAT
+#if defined(HAVE_LSTAT) && defined(AT_SYMLINK_NOFOLLOW)
if (flags & AT_SYMLINK_NOFOLLOW)
ret = lstat(path, buf);
else
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2012-03-03 04:48:18 UTC (rev 666)
+++ trunk/getdata/src/errors.c 2012-03-06 01:45:18 UTC (rev 667)
@@ -234,7 +234,7 @@
if (D->flags & GD_VERBOSE) {
char *error_string = gd_error_string(D, NULL, 0);
- fprintf(stderr, PACKAGE_NAME ": %s\n", error_string);
+ fprintf(stderr, "libgetdata: %s\n", error_string);
free(error_string);
}
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2012-03-03 04:48:18 UTC (rev 666)
+++ trunk/getdata/src/internal.h 2012-03-06 01:45:18 UTC (rev 667)
@@ -442,10 +442,6 @@
# endif
#endif
-#ifndef AT_SYMLINK_NOFOLLOW
-#define AT_SYMLINK_NOFOLLOW 0x100
-#endif
-
#ifdef HAVE_OPENAT
# ifdef GETDATA_DEBUG
# define gd_unused_d /**/
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2012-03-03 04:48:18 UTC (rev 666)
+++ trunk/getdata/src/open.c 2012-03-06 01:45:18 UTC (rev 667)
@@ -28,6 +28,7 @@
DIR* dir;
struct dirent* lamb;
struct stat statbuf;
+ int fd = dirfd;
dtrace("%p, %i, \"%s\", %i", D, dirfd, dirfile, root);
@@ -51,15 +52,17 @@
}
while ((lamb = readdir(dir)) != NULL) {
+ char *name = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name) + 2);
+ sprintf(name, "%s%c%s", dirfile, GD_DIRSEP, lamb->d_name);
if (lamb->d_name[0] == '.' && lamb->d_name[1] == '\0') {
+ free(name);
continue; /* skip current dir */
} else if (lamb->d_name[0] == '.' && lamb->d_name[1] == '.' &&
lamb->d_name[2] == '\0')
{
+ free(name);
continue; /* skip parent dir */
} else {
- char *name = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name) + 2);
- sprintf(name, "%s%c%s", dirfile, GD_DIRSEP, lamb->d_name);
if (
#if defined(HAVE_FSTATAT) && !defined(GD_NO_DIR_OPEN)
fstatat(dirfd, lamb->d_name, &statbuf, AT_SYMLINK_NOFOLLOW)
@@ -76,7 +79,6 @@
dreturn("%i", -1);
return -1;
}
- free(name);
}
/* check file type */
@@ -89,10 +91,14 @@
if (root && strcmp(lamb->d_name, "format") == 0) {
/* don't delete the format file; we'll truncate it later */
format_trunc = 1;
- } else if (gd_UnlinkAt(D, dirfd, lamb->d_name, 0)) {
- char *name = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name)
- + 2);
- sprintf(name, "%s%c%s", dirfile, GD_DIRSEP, lamb->d_name);
+ } else if (
+#ifdef HAVE_UNLINKAT
+ unlinkat(dirfd, lamb->d_name, 0)
+#else
+ unlink(name)
+#endif
+ )
+ {
_GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, name, errno, NULL);
free(name);
closedir(dir);
@@ -104,9 +110,6 @@
/* descend into subdir if requested */
if (D->flags & GD_TRUNCSUB) {
int subdirfd;
- char *subdir = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name)
- + 2);
- sprintf(subdir, "%s%c%s", dirfile, GD_DIRSEP, lamb->d_name);
#ifdef GD_NO_DIR_OPEN
subdirfd = 0; /* unused */
#else
@@ -114,28 +117,37 @@
#ifdef HAVE_OPENAT
subdirfd = openat(dirfd, lamb->d_name, O_RDONLY)
#else
- subdirfd = open(subdir, O_RDONLY)
+ subdirfd = open(name, O_RDONLY)
#endif
) < 0)
{
- _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, subdir, errno, NULL);
- free(subdir);
+ _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, name, errno, NULL);
+ closedir(dir);
+ free(name);
dreturn("%i", -1);
return -1;
}
#endif
/* descend -- this will close subdirfd */
- _GD_TruncDir(D, subdirfd, subdir, 0);
- free(subdir);
+ _GD_TruncDir(D, subdirfd, name, 0);
/* delete */
-#ifdef HAVE_UNLINKAT___
- unlinkat(dirfd, lamb->d_name, /* AT_...? */);
+ if (
+#ifdef HAVE_UNLINKAT
+ unlinkat(dirfd, lamb->d_name, AT_REMOVEDIR)
#else
- rmdir(subdir);
+ rmdir(name)
#endif
+ ) {
+ _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, name, errno, NULL);
+ free(name);
+ closedir(dir);
+ dreturn("%i", -1);
+ return -1;
+ }
}
}
+ free(name);
}
closedir(dir);
Property changes on: trunk/getdata/test
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_meta
add_meta_alias
add_mplex
add_mplex_val
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
add_type
add_window
add_window_op
alias_list
alias_list_alias
alias_list_missing
alias_num
alias_num_alias
alias_num_missing
alias_target
alias_target_alias
alias_target_missing
alter_bit_bitnum
alter_bit_numbits
alter_carray_len
alter_carray_type
alter_const
alter_cpolynom
alter_crecip
alter_crecip89
alter_crecip_zero
alter_divide
alter_entry
alter_entry_affix
alter_entry_hidden
alter_entry_recode
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
alter_lincom_23
alter_lincom_32
alter_lincom_input
alter_lincom_offset
alter_lincom_slope
alter_linterp
alter_linterp_move
alter_mplex
alter_mspec
alter_mspec_affix
alter_multiply
alter_phase
alter_polynom_coeff
alter_polynom_input
alter_polynom_ord
alter_raw_spf
alter_raw_type
alter_recip
alter_recip_zero
alter_spec
alter_spec_affix
alter_spec_meta
alter_window
ascii_add
ascii_get
ascii_get_get
ascii_nframes
ascii_put
bof
bof_lincom
bof_phase
bzip_get
bzip_get_get
bzip_move_from
bzip_nframes
bzip_put
close
close_bad
close_discard
close_null
convert_complex128_complex64
convert_complex128_float64
convert_complex128_int64
convert_complex128_uint64
convert_complex64_complex128
convert_complex64_float64
convert_complex64_int64
convert_complex64_uint64
convert_float32_complex128
convert_float32_complex64
convert_float32_float64
convert_float32_int16
convert_float32_int32
convert_float32_int64
convert_float32_int8
convert_float32_uint16
convert_float32_uint32
convert_float32_uint64
convert_float32_uint8
convert_float64_complex128
convert_float64_complex64
convert_float64_float32
convert_float64_int16
convert_float64_int32
convert_float64_int64
convert_float64_int8
convert_float64_uint16
convert_float64_uint32
convert_float64_uint64
convert_float64_uint8
convert_int16_complex128
convert_int16_complex64
convert_int16_float32
convert_int16_float64
convert_int16_int32
convert_int16_int64
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_uint64
convert_int16_uint8
convert_int32_complex128
convert_int32_complex64
convert_int32_float32
convert_int32_float64
convert_int32_int16
convert_int32_int64
convert_int32_int8
convert_int32_uint16
convert_int32_uint32
convert_int32_uint64
convert_int32_uint8
convert_int64_complex128
convert_int64_complex64
convert_int64_float32
convert_int64_float64
convert_int64_int16
convert_int64_int32
convert_int64_int8
convert_int64_uint16
convert_int64_uint32
convert_int64_uint64
convert_int64_uint8
convert_int8_complex128
convert_int8_complex64
convert_int8_float32
convert_int8_float64
convert_int8_int16
convert_int8_int32
convert_int8_int64
convert_int8_uint16
convert_int8_uint32
convert_int8_uint64
convert_int8_uint8
convert_uint16_complex128
convert_uint16_complex64
convert_uint16_float32
convert_uint16_float64
convert_uint16_int16
convert_uint16_int32
convert_uint16_int64
convert_uint16_int8
convert_uint16_uint32
convert_uint16_uint64
convert_uint16_uint8
convert_uint32_complex128
convert_uint32_complex64
convert_uint32_float32
convert_uint32_float64
convert_uint32_int16
convert_uint32_int32
convert_uint32_int64
convert_uint32_int8
convert_uint32_uint16
convert_uint32_uint64
convert_uint32_uint8
convert_uint64_complex128
convert_uint64_complex64
convert_uint64_float32
convert_uint64_float64
convert_uint64_int16
convert_uint64_int32
convert_uint64_int64
convert_uint64_int8
convert_uint64_uint16
convert_uint64_uint32
convert_uint64_uint8
convert_uint8_complex128
convert_uint8_complex64
convert_uint8_float32
convert_uint8_float64
convert_uint8_int16
convert_uint8_int32
convert_uint8_int64
convert_uint8_int8
convert_uint8_uint16
convert_uint8_uint32
convert_uint8_uint64
creat
creat_excl
creat_rdonly
cvlist
cvlist_array
cvlist_array_hidden
cvlist_array_meta
cvlist_array_meta_hidden
cvlist_hidden
cvlist_invalid
cvlist_meta
cvlist_meta_hidden
cvlist_meta_invalid
del
del_carray
del_carray_deref
del_const
del_const_deref
del_const_force
del_data
del_derived
del_derived_after
del_derived_force
del_meta
del_meta_force
dfes_bit
dfes_divide
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_recip
dfes_zero
encode_alter
encode_get
encode_move
endian_alter
endian_alter_sie
endian_get
endian_move
entry_bad_code
entry_bit
entry_bit_scalar
entry_divide
entry_invalid
entry_lincom
entry_lincom_scalar
entry_linterp
entry_mplex
entry_mplex_scalar
entry_multiply
entry_phase
entry_phase_scalar
entry_polynom
entry_polynom_scalar
entry_raw
entry_raw_scalar
entry_raw_scalar_code
entry_raw_scalar_type
entry_recip
entry_scalar_repr
entry_type
entry_type_alias
entry_window
entry_window_scalar
eof
eof_index
eof_lincom
eof_phase
error
error_error
error_num
error_short
file
file_code
file_type
flist
flist_hidden
flist_invalid
flist_meta
flist_meta_hidden
flist_meta_invalid
flist_type
flist_type_hidden
flist_type_invalid
flist_type_meta
flist_type_meta_hidden
flist_type_meta_invalid
flush
flush_all
flush_bad_code
flush_invalid
flush_meta
flush_spec
foffs_alter
foffs_get
foffs_move
fragment_affix
fragment_affix_alter
fragment_affix_alter2
fragment_affix_dup
fragment_index
fragment_index_alias
fragment_name
fragment_name_oor
fragment_num
fragment_parent
get64
get_bad_code
get_bit
get_carray
get_carray_len
get_carray_slice
get_char
get_clincom
get_complex128
get_complex64
get_const
get_const_complex
get_const_repr
get_cpolynom
get_divide
get_endian16
get_endian32
get_endian64
get_endian8
get_endian_complex128_arm
get_endian_complex128_big
get_endian_complex128_little
get_endian_complex64_arm
get_endian_complex64_big
get_endian_complex64_little
get_endian_float32_arm
get_endian_float32_big
get_endian_float32_little
get_endian_float64_arm
get_endian_float64_big
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_here
get_here_foffs
get_heres
get_int16
get_int32
get_int64
get_int8
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_lincom_non
get_lincom_spf
get_linterp
get_linterp_noin
get_linterp_notab
get_linterp_sort
get_mplex
get_mplex_lb
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_phase_affix
get_polynom
get_polynom_noin
get_recip
get_recip_const
get_recurse
get_rofs
get_sbit
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
get_window
get_window_clr
get_window_ge
get_window_gt
get_window_le
get_window_lt
get_window_ne
get_window_set
get_zero
global_name
global_ref
global_ref_empty
global_ref_set
gzip_add
gzip_get
gzip_get_get
gzip_get_put
gzip_move_from
gzip_move_to
gzip_nframes
gzip_put
gzip_put_get
header_complex
hide
hide_hidden
hide_unhide
include
include_accmode
include_affix
include_auto
include_cb
include_creat
include_ignore
include_index
include_invalid
include_nonexistent
include_pc
include_ref
include_syntax
index
index_domain
index_range
legacy_get
legacy_get_put
legacy_get_rofs
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
lzma_get
lzma_nframes
madd
madd_affix
madd_alias
madd_bit
madd_bit_invalid
madd_carray
madd_clincom
madd_const
madd_cpolynom
madd_crecip
madd_crecip89
madd_divide
madd_index
madd_lincom
madd_lincom_invalid
madd_linterp
madd_linterp_invalid
madd_mplex
madd_multiply
madd_multiply_invalid
madd_phase
madd_phase_invalid
madd_polynom
madd_recip
madd_sbit
madd_spec
madd_spec_directive
madd_spec_invalid
madd_spec_resolv
madd_string
madd_window
move
move_affix
move_affix_dup
move_alias
move_data_enc_ar
move_data_enc_ra
move_data_endian
move_data_foffs
move_data_nop
move_index
move_meta
move_protect
move_subdir
name
name_affix
name_affix_bad
name_after
name_after_const
name_dup
name_move
name_update
name_update_const
nfields
nfields_hidden
nfields_invalid
nfields_type
nfields_type_hidden
nfields_type_invalid
nfields_vector
nfields_vector_hidden
nfields_vector_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
nmeta
nmeta_hidden
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_hidden
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_del
nmeta_vectors_hidden
nmeta_vectors_invalid
nmeta_vectors_parent
open
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_invalid
open_cb_rescan
open_eaccess
open_nonexistent
open_notdirfile
parse_alias
parse_alias_code
parse_alias_dup
parse_alias_meta
parse_alias_missing
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_bit_scalar
parse_carray
parse_carray_long
parse_const
parse_const_ncols
parse_divide
parse_duplicate
parse_duplicate_ignore
parse_endian_bad
parse_endian_big
parse_endian_force
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_loop
parse_include_nonexistent
parse_include_prefix
parse_include_prefix_dup
parse_include_preprefix
parse_include_relabs
parse_include_relrel
parse_include_slash
parse_include_suffix
parse_include_sufsuffix
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_lincom_non
parse_lincom_non_ncols
parse_lincom_scalar
parse_linterp
parse_linterp_ncols
parse_malias
parse_malias_dup
parse_meta
parse_meta_affix
parse_meta_alias
parse_meta_implicit
parse_meta_implicit2
parse_meta_implicit_affix
parse_meta_index
parse_meta_index2
parse_meta_jump
parse_meta_malias
parse_meta_meta
parse_meta_parent
parse_meta_raw
parse_mplex
parse_mplex_ncols
parse_mplex_scalar
parse_multiply
parse_multiply_ncols
parse_name
parse_name_dot
parse_name_ext
parse_name_pedantic
parse_ncols
parse_phase
parse_phase_ncols
parse_phase_scalar
parse_polynom
parse_polynom_ncols1
parse_polynom_ncols2
parse_polynom_scalar
parse_protect_all
parse_protect_bad
parse_protect_data
parse_protect_format
parse_protect_none
parse_quote
parse_quote_mismatch
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_scalar
parse_raw_spf
parse_raw_type
parse_recip
parse_ref
parse_ref_nonexistent
parse_sbit
parse_sort
parse_string
parse_string_ncols
parse_string_null
parse_version
parse_version_89
parse_version_98
parse_version_include
parse_version_p8
parse_version_p9
parse_version_permissive
parse_version_slash
parse_whitespace
parse_window
parse_window_ncols
parse_window_op
parse_window_scalar
protect_alter
protect_get
put64
put_bad_code
put_bit
put_bof
put_carray
put_carray_slice
put_char
put_complex128
put_complex64
put_const
put_const_protect
put_divide
put_endian16
put_endian32
put_endian64
put_endian8
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
put_endian_float32_arm
put_endian_float32_big
put_endian_float32_little
put_endian_float64_arm
put_endian_float64_big
put_endian_float64_little
put_ff
put_float32
put_float64
put_foffs
put_fs
put_here
put_heres
put_int16
put_int32
put_int64
put_int8
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_noin
put_linterp_nomono
put_linterp_notab
put_linterp_reverse
put_mplex
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_polynom1
put_polynom2
put_polynom_noin
put_protect
put_rdonly
put_recip
put_recurse
put_repr
put_rofs
put_sbit
put_sf
put_ss
put_string
put_string_protect
put_type
put_uint16
put_uint32
put_uint64
put_window
put_zero
ref
ref_none
ref_two
repr_a
repr_float32
repr_float64
repr_i
repr_int16
repr_int32
repr_int64
repr_int8
repr_m
repr_r
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_uint16
repr_uint32
repr_uint64
repr_uint8
seek64
seek_cur
seek_end
seek_foffs
seek_set
sie_get_big
sie_get_little
sie_move_from
sie_move_to
sie_nframes_big
sie_nframes_little
sie_put_big
sie_put_little
slim_get
slim_nframes
slim_put
spf
spf_alias
spf_alias_meta
spf_alias_missing
spf_divide
spf_lincom
spf_multiply
spf_polynom
spf_recip
spf_recurse
svlist
svlist_hidden
svlist_invalid
svlist_meta
svlist_meta_hidden
svlist_meta_invalid
tell
tell64
trunc
trunc_dir
trunc_rdonly
trunc_rofs
trunc_truncsub
unclude
unclude_del
unclude_move
version_0
version_0_write
version_1
version_1_write
version_2
version_2_write
version_3
version_3_write
version_4
version_4_write
version_5
version_5_strict
version_5_write
version_6
version_6_strict
version_6_write
version_7
version_7_strict
version_7_write
version_8
version_8_strict
version_8_write
version_9
version_9_strict
version_9_write
vlist
vlist_alias
vlist_hidden
vlist_invalid
vlist_meta
vlist_meta_hidden
vlist_meta_invalid
xz_get
xz_nframes
zzip_data
zzip_get
zzip_get_get
zzip_nframes
zzslim_get
zzslim_nframes
+ Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
add
add_affix
add_alias
add_alias_meta
add_bit
add_bit_bitnum
add_bit_bitsize
add_bit_invalid
add_bit_numbits
add_carray
add_clincom
add_code
add_const
add_cpolynom
add_crecip
add_crecip89
add_divide
add_divide_invalid
add_duplicate
add_format
add_invalid
add_lincom
add_lincom_invalid
add_lincom_nfields
add_linterp
add_linterp_invalid
add_meta
add_meta_alias
add_mplex
add_mplex_val
add_multiply
add_multiply_invalid
add_phase
add_phase_invalid
add_polynom
add_protect
add_raw
add_raw_include
add_raw_invalid
add_raw_spf
add_raw_type
add_rdonly
add_recip
add_resolv
add_sbit
add_scalar
add_scalar_carray
add_sort
add_spec
add_spec_directive
add_spec_invalid
add_spec_meta
add_spec_resolv
add_string
add_string_affix
add_type
add_window
add_window_op
alias_list
alias_list_alias
alias_list_missing
alias_num
alias_num_alias
alias_num_missing
alias_target
alias_target_alias
alias_target_missing
alter_bit_bitnum
alter_bit_numbits
alter_carray_len
alter_carray_type
alter_const
alter_cpolynom
alter_crecip
alter_crecip89
alter_crecip_zero
alter_divide
alter_entry
alter_entry_affix
alter_entry_hidden
alter_entry_recode
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
alter_lincom_23
alter_lincom_32
alter_lincom_input
alter_lincom_offset
alter_lincom_slope
alter_linterp
alter_linterp_move
alter_mplex
alter_mspec
alter_mspec_affix
alter_multiply
alter_phase
alter_polynom_coeff
alter_polynom_input
alter_polynom_ord
alter_raw_spf
alter_raw_type
alter_recip
alter_recip_zero
alter_spec
alter_spec_affix
alter_spec_meta
alter_window
ascii_add
ascii_get
ascii_get_get
ascii_nframes
ascii_put
bof
bof_lincom
bof_phase
bzip_get
bzip_get_get
bzip_move_from
bzip_nframes
bzip_put
close
close_bad
close_discard
close_null
convert_complex128_complex64
convert_complex128_float64
convert_complex128_int64
convert_complex128_uint64
convert_complex64_complex128
convert_complex64_float64
convert_complex64_int64
convert_complex64_uint64
convert_float32_complex128
convert_float32_complex64
convert_float32_float64
convert_float32_int16
convert_float32_int32
convert_float32_int64
convert_float32_int8
convert_float32_uint16
convert_float32_uint32
convert_float32_uint64
convert_float32_uint8
convert_float64_complex128
convert_float64_complex64
convert_float64_float32
convert_float64_int16
convert_float64_int32
convert_float64_int64
convert_float64_int8
convert_float64_uint16
convert_float64_uint32
convert_float64_uint64
convert_float64_uint8
convert_int16_complex128
convert_int16_complex64
convert_int16_float32
convert_int16_float64
convert_int16_int32
convert_int16_int64
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_uint64
convert_int16_uint8
convert_int32_complex128
convert_int32_complex64
convert_int32_float32
convert_int32_float64
convert_int32_int16
convert_int32_int64
convert_int32_int8
convert_int32_uint16
convert_int32_uint32
convert_int32_uint64
convert_int32_uint8
convert_int64_complex128
convert_int64_complex64
convert_int64_float32
convert_int64_float64
convert_int64_int16
convert_int64_int32
convert_int64_int8
convert_int64_uint16
convert_int64_uint32
convert_int64_uint64
convert_int64_uint8
convert_int8_complex128
convert_int8_complex64
convert_int8_float32
convert_int8_float64
convert_int8_int16
convert_int8_int32
convert_int8_int64
convert_int8_uint16
convert_int8_uint32
convert_int8_uint64
convert_int8_uint8
convert_uint16_complex128
convert_uint16_complex64
convert_uint16_float32
convert_uint16_float64
convert_uint16_int16
convert_uint16_int32
convert_uint16_int64
convert_uint16_int8
convert_uint16_uint32
convert_uint16_uint64
convert_uint16_uint8
convert_uint32_complex128
convert_uint32_complex64
convert_uint32_float32
convert_uint32_float64
convert_uint32_int16
convert_uint32_int32
convert_uint32_int64
convert_uint32_int8
convert_uint32_uint16
convert_uint32_uint64
convert_uint32_uint8
convert_uint64_complex128
convert_uint64_complex64
convert_uint64_float32
convert_uint64_float64
convert_uint64_int16
convert_uint64_int32
convert_uint64_int64
convert_uint64_int8
convert_uint64_uint16
convert_uint64_uint32
convert_uint64_uint8
convert_uint8_complex128
convert_uint8_complex64
convert_uint8_float32
convert_uint8_float64
convert_uint8_int16
convert_uint8_int32
convert_uint8_int64
convert_uint8_int8
convert_uint8_uint16
convert_uint8_uint32
convert_uint8_uint64
creat
creat_excl
creat_rdonly
cvlist
cvlist_array
cvlist_array_hidden
cvlist_array_meta
cvlist_array_meta_hidden
cvlist_hidden
cvlist_invalid
cvlist_meta
cvlist_meta_hidden
cvlist_meta_invalid
del
del_carray
del_carray_deref
del_const
del_const_deref
del_const_force
del_data
del_derived
del_derived_after
del_derived_force
del_meta
del_meta_force
dfes_bit
dfes_divide
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_recip
dfes_zero
encode_alter
encode_get
encode_move
endian_alter
endian_alter_sie
endian_get
endian_move
entry_bad_code
entry_bit
entry_bit_scalar
entry_divide
entry_invalid
entry_lincom
entry_lincom_scalar
entry_linterp
entry_mplex
entry_mplex_scalar
entry_multiply
entry_phase
entry_phase_scalar
entry_polynom
entry_polynom_scalar
entry_raw
entry_raw_scalar
entry_raw_scalar_code
entry_raw_scalar_type
entry_recip
entry_scalar_repr
entry_type
entry_type_alias
entry_window
entry_window_scalar
eof
eof_index
eof_lincom
eof_phase
error
error_error
error_num
error_short
file
file_code
file_type
flist
flist_hidden
flist_invalid
flist_meta
flist_meta_hidden
flist_meta_invalid
flist_type
flist_type_hidden
flist_type_invalid
flist_type_meta
flist_type_meta_hidden
flist_type_meta_invalid
flush
flush_all
flush_bad_code
flush_invalid
flush_meta
flush_spec
foffs_alter
foffs_get
foffs_move
fragment_affix
fragment_affix_alter
fragment_affix_alter2
fragment_affix_dup
fragment_index
fragment_index_alias
fragment_name
fragment_name_oor
fragment_num
fragment_parent
get64
get_bad_code
get_bit
get_carray
get_carray_len
get_carray_slice
get_char
get_clincom
get_complex128
get_complex64
get_const
get_const_complex
get_const_repr
get_cpolynom
get_divide
get_endian16
get_endian32
get_endian64
get_endian8
get_endian_complex128_arm
get_endian_complex128_big
get_endian_complex128_little
get_endian_complex64_arm
get_endian_complex64_big
get_endian_complex64_little
get_endian_float32_arm
get_endian_float32_big
get_endian_float32_little
get_endian_float64_arm
get_endian_float64_big
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_here
get_here_foffs
get_heres
get_int16
get_int32
get_int64
get_int8
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_lincom_non
get_lincom_spf
get_linterp
get_linterp_noin
get_linterp_notab
get_linterp_sort
get_mplex
get_mplex_lb
get_multiply
get_multip...
[truncated message content] |
|
From: <ket...@us...> - 2012-03-12 22:18:38
|
Revision: 669
http://getdata.svn.sourceforge.net/getdata/?rev=669&view=rev
Author: ketiltrout
Date: 2012-03-12 22:18:31 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
Clean compiler warnings.
Modified Paths:
--------------
trunk/getdata/bindings/perl/simple_funcs.pl
trunk/getdata/src/ascii.c
trunk/getdata/src/flush.c
trunk/getdata/src/fpos.c
trunk/getdata/src/getdata.c
trunk/getdata/src/index.c
trunk/getdata/src/putdata.c
trunk/getdata/src/sie.c
Modified: trunk/getdata/bindings/perl/simple_funcs.pl
===================================================================
--- trunk/getdata/bindings/perl/simple_funcs.pl 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/bindings/perl/simple_funcs.pl 2012-03-12 22:18:31 UTC (rev 669)
@@ -41,10 +41,13 @@
my ($t, $n) = @$_;
return "&$n" if ($t =~ /&$/);
- return "(long long)$n" if ($t eq "off64_t" or $t eq "gd_shift_t");
+ return "(long long)$n" if ($t eq "off64_t" or $t eq "gd_shift_t" or
+ $t eq "gdpu_shift_t" or $t eq "int64_t");
+ return "(unsigned long long)$n" if ($t eq "uint64_t");
return "creal($n), cimag($n)" if ($t eq "_Complex double" or
$t eq "gdpu_complex");
- return "$n.r, $n.u, $n.i" if ($t eq "gd_triplet_t");
+ return "$n.r, (unsigned long long)$n.u, (long long)$n.i"
+ if ($t eq "gd_triplet_t");
return $n;
}
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/ascii.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -64,7 +64,7 @@
{
char line[64];
- dtrace("%p, %lli, <unused>, 0x%X", file, count, mode);
+ dtrace("%p, %lli, <unused>, 0x%X", file, (long long)count, mode);
if (count < file->pos) {
rewind((FILE *)file->edata);
@@ -388,6 +388,6 @@
fclose(stream);
- dreturn("%lli", n);
+ dreturn("%lli", (long long)n);
return n;
}
Modified: trunk/getdata/src/flush.c
===================================================================
--- trunk/getdata/src/flush.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/flush.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -1065,7 +1065,7 @@
}
D->flags |= GD_HAVE_VERSION;
- dreturn("0x%04llx", D->av);
+ dreturn("0x%04" PRIx64, D->av);
return D->av;
}
Modified: trunk/getdata/src/fpos.c
===================================================================
--- trunk/getdata/src/fpos.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/fpos.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -316,8 +316,8 @@
int repr, is_index = 0;
unsigned int mode = (whence & GD_SEEK_WRITE) ? GD_FILE_WRITE : GD_FILE_READ;
- dtrace("%p, \"%s\", %lli, %lli, 0x%X", D, field_code_in, frame_num,
- sample_num, whence);
+ dtrace("%p, \"%s\", %lli, %lli, 0x%X", D, field_code_in, (long long)frame_num,
+ (long long)sample_num, whence);
if (D->flags & GD_INVALID) {/* don't crash */
_GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/getdata.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -159,7 +159,7 @@
{
size_t i;
- dtrace("%p, 0x%X, %lli, %zu", dataout, rtype, s0, n);
+ dtrace("%p, 0x%X, %lli, %zu", dataout, rtype, (long long)s0, n);
switch (rtype) {
case GD_INT8:
@@ -258,7 +258,8 @@
char *databuffer;
size_t zero_pad = 0;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p)", D, E, s0, ns, return_type, data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p)", D, E, (long long)s0, ns, return_type,
+ data_out);
if (s0 < E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset)
zero_pad = E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset -
@@ -962,8 +963,8 @@
const gd_type_t ntype = (return_type & GD_COMPLEX) ? GD_COMPLEX128
: GD_FLOAT64;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
/* input field checks */
for (i = 0; i < E->EN(lincom,n_fields); ++i) {
@@ -1096,8 +1097,8 @@
off64_t first_samp2;
gd_type_t type2;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
/* Check input fields */
if (_GD_BadInput(D, E, 0, 1)) {
@@ -1191,8 +1192,8 @@
{
size_t n_read;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
/* Check input fields */
if (_GD_BadInput(D, E, 0, 1)) {
@@ -1237,8 +1238,8 @@
off64_t first_samp2;
gd_type_t type2;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
/* Check input fields */
if (_GD_BadInput(D, E, 0, 1) || _GD_BadInput(D, E, 1, 1)) {
@@ -1333,8 +1334,8 @@
const uint64_t mask = (E->EN(bit,numbits) == 64) ? 0xffffffffffffffffULL :
((uint64_t)1 << E->EN(bit,numbits)) - 1;
- dtrace("%p, %p, %i, %lli, %zu, 0x%X, %p", D, E, is_signed, first_samp,
- num_samp, return_type, data_out);
+ dtrace("%p, %p, %i, %lli, %zu, 0x%X, %p", D, E, is_signed,
+ (long long)first_samp, num_samp, return_type, data_out);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -1386,8 +1387,8 @@
{
size_t n_read;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -1410,8 +1411,8 @@
size_t n_read = 0;
double* data_in;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
if (E->e->u.linterp.table_len < 0) {
_GD_ReadLinterpFile(D, E);
@@ -1460,8 +1461,8 @@
{
size_t n_read;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -1506,8 +1507,8 @@
off64_t first_samp2;
gd_type_t type2;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
/* Check input fields */
if (_GD_BadInput(D, E, 0, 1)) {
@@ -1612,8 +1613,8 @@
const size_t size = GD_SIZE(return_type);
off64_t first_samp2;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ return_type, data_out);
/* Check input fields */
if (_GD_BadInput(D, E, 0, 1)) {
@@ -1772,8 +1773,8 @@
{
gd_type_t type;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first, len, return_type,
- data_out);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first, len,
+ return_type, data_out);
type = _GD_ConstType(D, E->EN(scalar,const_type));
_GD_ConvertType(D, (char *)E->e->u.scalar.d + first * GD_SIZE(type), type,
@@ -1816,7 +1817,7 @@
int out_of_place = 0;
dtrace("%p, %p(%s), %i, %lli, %zu, 0x%X, %p", D, E, E->field, repr,
- first_samp, num_samp, return_type, data_out);
+ (long long)first_samp, num_samp, return_type, data_out);
if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
_GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
@@ -1951,7 +1952,8 @@
gd_spf_t spf;
dtrace("%p, \"%s\", %lli, %lli, %zu, %zu, 0x%X, %p", D, field_code_in,
- first_frame, first_samp, num_frames, num_samp, return_type, data_out);
+ (long long)first_frame, (long long)first_samp, num_frames, num_samp,
+ return_type, data_out);
if (D->flags & GD_INVALID) {/* don't crash */
_GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
Modified: trunk/getdata/src/index.c
===================================================================
--- trunk/getdata/src/index.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/index.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -29,7 +29,7 @@
double sample = NAN;
double data[2];
- dtrace("%p, %p, %i, %g, %lli, %i", D, E, repr, value, limit, eof);
+ dtrace("%p, %p, %i, %g, %lli, %i", D, E, repr, value, (long long)limit, eof);
/* load data */
n = _GD_DoField(D, E, repr, limit - eof, 2, GD_FLOAT64, data);
@@ -60,8 +60,8 @@
double low_v, high_v, field_start_v, c_v;
size_t n;
- dtrace("%p, %p, %i, %g, %lli, %lli", D, E, repr, value, field_start,
- field_end);
+ dtrace("%p, %p, %i, %g, %lli, %lli", D, E, repr, value,
+ (long long)field_start, (long long)field_end);
/* find the end-points */
n = _GD_DoField(D, E, repr, field_start, 1, GD_FLOAT64, &low_v);
@@ -214,8 +214,8 @@
int repr = GD_REPR_NONE;
gd_spf_t spf;
- dtrace("%p, \"%s\", %g, %lli, %lli", D, field_code_in, value, field_start,
- field_end);
+ dtrace("%p, \"%s\", %g, %lli, %lli", D, field_code_in, value,
+ (long long)field_start, (long long)field_end);
if (D->flags & GD_INVALID) {/* don't crash */
_GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
Modified: trunk/getdata/src/putdata.c
===================================================================
--- trunk/getdata/src/putdata.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/putdata.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -36,7 +36,8 @@
return 0;
}
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, s0, ns, data_type, data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)s0, ns, data_type,
+ data_in);
if (s0 < D->fragment[E->fragment_index].frame_offset * E->EN(raw,spf)) {
_GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
@@ -130,8 +131,8 @@
double *tmpbuf;
struct _gd_lut *tmp_lut;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -231,8 +232,8 @@
size_t n_wrote;
void* tmpbuf;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
/* we cannot write to LINCOM fields that are a linear combination */
/* of more than one raw field (no way to know how to split data). */
@@ -310,8 +311,8 @@
const uint64_t mask = (E->EN(bit,numbits) == 64) ? 0xffffffffffffffffULL :
((uint64_t)1 << E->EN(bit,numbits)) - 1;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -365,8 +366,8 @@
{
size_t n_wrote;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -388,8 +389,8 @@
size_t n_wrote;
void* tmpbuf;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -434,8 +435,8 @@
size_t n_wrote;
void* tmpbuf;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
/* we cannot write to POLYNOM fields that are quadradic or higher order */
@@ -562,8 +563,8 @@
off64_t first_samp2;
gd_spf_t spf1, spf2;
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first_samp, num_samp, data_type,
- data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first_samp, num_samp,
+ data_type, data_in);
if (_GD_BadInput(D, E, 0, 1)) {
dreturn("%i", 0);
@@ -631,7 +632,8 @@
off64_t first, size_t len, gd_type_t data_type,
const void *restrict data_in)
{
- dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, first, len, data_type, data_in);
+ dtrace("%p, %p, %lli, %zu, 0x%X, %p", D, E, (long long)first, len, data_type,
+ data_in);
/* check protection */
if (D->fragment[E->fragment_index].protection & GD_PROTECT_FORMAT)
@@ -688,8 +690,8 @@
{
size_t n_wrote = 0;
- dtrace("%p, %p, %i, %lli, %zu, 0x%X, %p", D, E, repr, first_samp, num_samp,
- data_type, data_in);
+ dtrace("%p, %p, %i, %lli, %zu, 0x%X, %p", D, E, repr, (long long)first_samp,
+ num_samp, data_type, data_in);
if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
_GD_SetError(D, GD_E_RECURSE_LEVEL, GD_E_RECURSE_CODE, NULL, 0, E->field);
@@ -784,7 +786,8 @@
gd_spf_t spf = 0;
dtrace("%p, \"%s\", %lli, %lli, %zu, %zu, 0x%X, %p", D, field_code_in,
- first_frame, first_samp, num_frames, num_samp, data_type, data_in);
+ (long long)first_frame, (long long)first_samp, num_frames, num_samp,
+ data_type, data_in);
if (D->flags & GD_INVALID) {/* don't crash */
_GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
Modified: trunk/getdata/src/sie.c
===================================================================
--- trunk/getdata/src/sie.c 2012-03-07 04:48:00 UTC (rev 668)
+++ trunk/getdata/src/sie.c 2012-03-12 22:18:31 UTC (rev 669)
@@ -141,7 +141,7 @@
dtrace("%p, %llx, 0x%X, 0x%X", file, (long long)sample, data_type, mode);
if (file->pos == sample) {
- dreturn("%lli", sample);
+ dreturn("%lli", (long long)sample);
return sample;
}
@@ -184,7 +184,7 @@
}
file->pos = f->p = sample;
- dreturn("%llx", f->p);
+ dreturn("%" PRIi64 , f->p);
return (off64_t)(f->p);
}
@@ -283,7 +283,7 @@
return -1;
}
- dreturn("%llx", statbuf.st_size / size);
+ dreturn("%zi", (ssize_t)(statbuf.st_size / size));
return (ssize_t)(statbuf.st_size / size);
}
@@ -407,7 +407,10 @@
/* truncate the file if necessary */
if (rin < rout)
- gd_truncate(fileno(f->fp), nrec - rout + rin);
+ if (gd_truncate(fileno(f->fp), nrec - rout + rin)) {
+ dreturn("%i", -1);
+ return -1;
+ }
/* update the current record */
memcpy(f->d, (char *)p + (rin - 1) * size, size);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|