[Getdata-commits] SF.net SVN: getdata:[883] trunk/getdata
Scientific Database Format
Brought to you by:
ketiltrout
|
From: <ket...@us...> - 2014-04-04 00:09:37
|
Revision: 883
http://sourceforge.net/p/getdata/code/883
Author: ketiltrout
Date: 2014-04-04 00:09:31 +0000 (Fri, 04 Apr 2014)
Log Message:
-----------
Don't duplicate code between the C99 and C89 gd_add_crecip, gd_madd_crecip, gd_alter_crecip functions. Fix calcuation of GD_MAX_CARRAY_LENGTH. Minor doc fixes.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/idl/test/getdata_idl_test_routines.pro
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_spec.3
trunk/getdata/man/gd_bof64.3
trunk/getdata/man/gd_cbopen.3
trunk/getdata/man/gd_eof64.3
trunk/getdata/man/gd_framenum_subset64.3
trunk/getdata/man/gd_frameoffset64.3
trunk/getdata/man/gd_getdata64.3
trunk/getdata/man/gd_madd_bit.3
trunk/getdata/man/gd_nframes64.3
trunk/getdata/man/gd_putdata64.3
trunk/getdata/man/gd_seek64.3
trunk/getdata/man/gd_tell64.3
trunk/getdata/src/add.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/mod.c
trunk/getdata/src/parse.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/ChangeLog 2014-04-04 00:09:31 UTC (rev 883)
@@ -1,3 +1,9 @@
+2014-04-03 D. V. Wiebe <ge...@ke...> svn:883
+ * src/add.c (gd_add_crecip gd_madd_crecip) src/mod.c (gd_alter_crecip): Call
+ the ...crecip89 function.
+
+ * src/getdata.h.in: Fix GD_MAX_CARRAY_LENGTH computation.
+
2014-03-20 D. V. Wiebe <ge...@ke...> svn:882
* bindings/php/getdata.c (gd_add_polynom gd_madd_polynom): Fix array size.
* bindings/python/pydirfile.c (gdpy_dirfile_getentry): Fix segfault.
Modified: trunk/getdata/bindings/idl/test/getdata_idl_test_routines.pro
===================================================================
--- trunk/getdata/bindings/idl/test/getdata_idl_test_routines.pro 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/bindings/idl/test/getdata_idl_test_routines.pro 2014-04-04 00:09:31 UTC (rev 883)
@@ -1,3 +1,25 @@
+; vim: ft=idlang
+;
+; Copyright (C) 2009-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
+
pro timed_demo_mode
print,""
print,"**********************************************"
Modified: trunk/getdata/man/gd_add.3
===================================================================
--- trunk/getdata/man/gd_add.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_add.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -205,8 +205,9 @@
to the value of the symbol GD_MAX_CARRAY_LENGTH defined in getdata.h. This is
done to be certain that the
.B CARRAY
-won't overrun the line when flushed to disk. On a 32-bit system, this number
-is 2**24. It is larger on a 64-bit system.
+won't overrun the line when flushed to disk. On platforms with a \fIn\fR-bit
+.BR size_t ,
+GD_MAX_CARRAY_LENGTH is 2**(\fIn\fR-8)-1.
.SH SEE ALSO
.BR gd_add_bit (3),
Modified: trunk/getdata/man/gd_add_bit.3
===================================================================
--- trunk/getdata/man/gd_add_bit.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_add_bit.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -307,8 +307,9 @@
to the value of the symbol GD_MAX_CARRAY_LENGTH defined in getdata.h. This is
done to be certain that the
.B CARRAY
-won't overrun the line when flushed to disk. On a 32-bit system, this number
-is 2**24. It is larger on a 64-bit system.
+won't overrun the line when flushed to disk. On platforms with a \fIn\fR-bit
+.BR size_t ,
+GD_MAX_CARRAY_LENGTH is 2**(\fIn\fR-8)-1.
The C89 GetData API provides different prototypes for
.BR gd_add_clincom "(), " gd_add_cpolynom (),
@@ -317,6 +318,7 @@
.PP
.nf
.B #define GD_C89_API
+.br
.B #include <getdata.h>
.fi
.HP
@@ -328,10 +330,10 @@
.HP
.BI "int gd_add_cpolynom(DIRFILE *" dirfile ", const char *" field_name ,
.BI "int " poly_ord ", const char *" in_fields ", const double *" ca ,
-.BI int " fragment_index );
+.BI "int " fragment_index );
.HP
.BI "int gd_add_crecip(DIRFILE *" dirfile ", const char *" field_name ,
-.BI "const char *" in_field ", const double " cdividend [2],
+.BI "const char *" in_field ", const double " cdividend\fR[2] ,
.BI "int " fragment_index );
.hy
.ad n
@@ -341,7 +343,7 @@
or
.IR ca
should have twice as many (purely real) elements, consisting of alternating
-real and imaginary parts for the complex data. For example,
+real and imaginary parts for the complex data. That is, for example,
.IR ca [0]
should be the real part of the first co-efficient,
.IR ca [1]
Modified: trunk/getdata/man/gd_alter_bit.3
===================================================================
--- trunk/getdata/man/gd_alter_bit.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_alter_bit.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -289,6 +289,7 @@
.PP
.nf
.B #define GD_C89_API
+.br
.B #include <getdata.h>
.fi
.HP
@@ -302,7 +303,7 @@
.BI "int " poly_ord ", const char *" in_fields ", const double *" ca );
.HP
.BI "int gd_alter_crecip(DIRFILE *" dirfile ", const char *" field_code ,
-.BI "const char *" in_field ", const double " cdividend [2]);
+.BI "const char *" in_field ", const double " cdividend\fR[2] );
.hy
.ad n
.PP
@@ -311,7 +312,7 @@
or
.IR ca
should have twice as many (purely real) elements, consisting of alternating
-real and imaginary parts for the complex data. For example,
+real and imaginary parts for the complex data. That is, for example,
.IR ca [0]
should be the real part of the first co-efficient,
.IR ca [1]
Modified: trunk/getdata/man/gd_alter_spec.3
===================================================================
--- trunk/getdata/man/gd_alter_spec.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_alter_spec.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -152,12 +152,13 @@
A descriptive error string for the last error encountered can be obtained from
a call to
.BR gd_error_string (3).
-.SH BUGS
+.SH NOTES
If a
.B CARRAY
field with more than GD_MAX_CARRAY_LENGTH elements is provided, subsequent
-elements will be silently truncated. GD_MAX_CARRAY_LENGTH is 2**24 on 32-bit
-systems. It is larger on 64-bit systems.
+elements will be silently truncated. On platforms with a \fIn\fR-bit
+.BR size_t ,
+GD_MAX_CARRAY_LENGTH is 2**(\fIn\fR-8)-1.
.SH SEE ALSO
.BR gd_alter_bit (3),
.BR gd_alter_const (3),
Modified: trunk/getdata/man/gd_bof64.3
===================================================================
--- trunk/getdata/man/gd_bof64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_bof64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_bof64 \(em retrieve data from a dirfile database, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_cbopen.3
===================================================================
--- trunk/getdata/man/gd_cbopen.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_cbopen.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -720,8 +720,10 @@
.B CARRAY
field to GD_MAX_CARRAY_LENGTH elements, to be certain it is always able to
write the CARRAY back to disk without overrunning its maximum line length.
-On 32-bit systems, GD_MAX_CARRAY_LENGTH is 2**24. It is larger on 64-bit
-systems. Excess elements are silently truncated on dirfile open.
+On platforms with a \fIn\fR-bit
+.BR size_t ,
+GD_MAX_CARRAY_LENGTH is 2**(\fIn\fR-8)-1. Excess elements are silently
+truncated on dirfile open.
GetData's parser assumes it is running on an ASCII-compatible platform. Format
specification parsing will fail gloriously on an EBCDIC platform.
Modified: trunk/getdata/man/gd_eof64.3
===================================================================
--- trunk/getdata/man/gd_eof64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_eof64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_eof64 \(em retrieve data from a dirfile database, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_framenum_subset64.3
===================================================================
--- trunk/getdata/man/gd_framenum_subset64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_framenum_subset64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -19,7 +19,7 @@
field, with largefile support.
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_frameoffset64.3
===================================================================
--- trunk/getdata/man/gd_frameoffset64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_frameoffset64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -19,7 +19,7 @@
offset of fields in a dirfile, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_getdata64.3
===================================================================
--- trunk/getdata/man/gd_getdata64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_getdata64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_getdata64 \(em retrieve data from a dirfile database, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_madd_bit.3
===================================================================
--- trunk/getdata/man/gd_madd_bit.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_madd_bit.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -260,6 +260,7 @@
.BR gd_madd_crecip ():
.PP
.B #define GD_C89_API
+.br
.B #include <getdata.h>
.HP
.nh
@@ -283,7 +284,7 @@
or
.IR ca
should have twice as many (purely real) elements, consisting of alternating
-real and imaginary parts for the complex data. For example,
+real and imaginary parts for the complex data. That is, for example,
.IR ca [0]
should be the real part of the first co-efficient,
.IR ca [1]
Modified: trunk/getdata/man/gd_nframes64.3
===================================================================
--- trunk/getdata/man/gd_nframes64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_nframes64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_nframes64 \(em report the size of a dirfile, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_putdata64.3
===================================================================
--- trunk/getdata/man/gd_putdata64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_putdata64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_putdata64 \(em write data to a dirfile database, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_seek64.3
===================================================================
--- trunk/getdata/man/gd_seek64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_seek64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_seek64 \(em retrieve data from a dirfile database, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/man/gd_tell64.3
===================================================================
--- trunk/getdata/man/gd_tell64.3 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/man/gd_tell64.3 2014-04-04 00:09:31 UTC (rev 883)
@@ -18,7 +18,7 @@
gd_tell64 \(em retrieve data from a dirfile database, with largefile support
.SH SYNOPSIS
.B #define GD_64BIT_API
-
+.br
.B #include <getdata.h>
.HP
.nh
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/src/add.c 2014-04-04 00:09:31 UTC (rev 883)
@@ -1087,22 +1087,9 @@
dtrace("%p, \"%s\", \"%s\", %g;%g, %i", D, field_code, in_field,
creal(cdividend), cimag(cdividend), 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;
- }
+ error = gd_add_crecip89(D, field_code, in_field, (const double*)(&cdividend),
+ fragment_index);
- gd_entry_t E;
- memset(&E, 0, sizeof(gd_entry_t));
- E.field = (char *)field_code;
- E.field_type = GD_RECIP_ENTRY;
- E.EN(recip,cdividend) = cdividend;
- E.flags = GD_EN_COMPSCAL;
- E.in_fields[0] = (char *)in_field;
- E.fragment_index = fragment_index;
- error = (_GD_Add(D, &E, NULL) == NULL) ? -1 : 0;
-
dreturn("%i", error);
return error;
}
@@ -1788,21 +1775,9 @@
dtrace("%p, \"%s\", \"%s\", \"%s\", %g;%g", D, parent, field_code, in_field,
creal(cdividend), cimag(cdividend));
- if (D->flags & GD_INVALID) {/* don't crash */
- _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
- dreturn("%i", -1);
- return -1;
- }
+ error = gd_madd_crecip89(D, parent, field_code, in_field,
+ (const double*)(&cdividend));
- gd_entry_t E;
- memset(&E, 0, sizeof(gd_entry_t));
- E.field = (char *)field_code;
- E.field_type = GD_RECIP_ENTRY;
- E.EN(recip,cdividend) = cdividend;
- E.flags = GD_EN_COMPSCAL;
- E.in_fields[0] = (char *)in_field;
- error = (_GD_Add(D, &E, parent) == NULL) ? -1 : 0;
-
dreturn("%i", error);
return error;
}
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/src/getdata.c 2014-04-04 00:09:31 UTC (rev 883)
@@ -1808,7 +1808,7 @@
return 0;
}
- dreturn("%i", len);
+ dreturn("%zu", len);
return len;
}
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/src/getdata.h.in 2014-04-04 00:09:31 UTC (rev 883)
@@ -120,7 +120,7 @@
* whatever fits on a format file line, but that's hard to calculate. This is
* 2**(n-8)-1 on a n-bit system.
*/
-#define GD_MAX_CARRAY_LENGTH ((int)(((unsigned int)-1) >> 8))
+#define GD_MAX_CARRAY_LENGTH (((size_t)-1) >> 8)
/* error codes */
Modified: trunk/getdata/src/mod.c
===================================================================
--- trunk/getdata/src/mod.c 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/src/mod.c 2014-04-04 00:09:31 UTC (rev 883)
@@ -1303,26 +1303,12 @@
double complex cdividend)
{
int ret;
- gd_entry_t N;
dtrace("%p, \"%s\", \"%s\", %g;%g", D, field_code, in_field, creal(cdividend),
cimag(cdividend));
- if (D->flags & GD_INVALID) {/* don't crash */
- _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
- dreturn("%i", -1);
- return -1;
- }
+ ret = gd_alter_crecip89(D, field_code, in_field, (const double*)(&cdividend));
- memset(&N, 0, sizeof(gd_entry_t));
- N.field_type = GD_RECIP_ENTRY;
- N.in_fields[0] = (char *)in_field;
- N.scalar[0] = (cdividend == 0) ? "" : NULL;
- N.EN(recip,cdividend) = cdividend;
- N.flags = GD_EN_COMPSCAL;
-
- ret = _GD_Change(D, field_code, &N, 0);
-
dreturn("%i", ret);
return ret;
}
@@ -1334,7 +1320,7 @@
int ret;
gd_entry_t N;
- dtrace("%p, \"%s\", \"%s\", {%g, %g}", D, field_code, in_field,
+ dtrace("%p, \"%s\", \"%s\", %p={%g, %g}", D, field_code, in_field, cdividend,
(cdividend == NULL) ? 0 : cdividend[0],
(cdividend == NULL) ? 0 : cdividend[1]);
Modified: trunk/getdata/src/parse.c
===================================================================
--- trunk/getdata/src/parse.c 2014-03-21 00:08:01 UTC (rev 882)
+++ trunk/getdata/src/parse.c 2014-04-04 00:09:31 UTC (rev 883)
@@ -1242,7 +1242,8 @@
int pedantic, int *restrict is_dot, char **outstring, const char *tok_pos)
{
unsigned dummy;
- int offset, c, first, n, new_z, s, z;
+ int offset, c, first, new_z, s, z;
+ size_t n;
gd_type_t t;
char* ptr;
void *data;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|