Thread: [Getdata-commits] SF.net SVN: getdata:[581] trunk/getdata (Page 3)
Scientific Database Format
Brought to you by:
ketiltrout
|
From: <ket...@us...> - 2011-04-20 22:42:54
|
Revision: 581
http://getdata.svn.sourceforge.net/getdata/?rev=581&view=rev
Author: ketiltrout
Date: 2011-04-20 22:42:47 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
gd_error_count bindings.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/TODO
trunk/getdata/bindings/cxx/dirfile.cpp
trunk/getdata/bindings/cxx/getdata/dirfile.h
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/f77/getdata.f.in
trunk/getdata/bindings/f77/getdata.f90.in
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/make_parameters.c
trunk/getdata/bindings/perl/GetData.pm.in
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/bindings/perl/simple_funcs.xsin
trunk/getdata/bindings/python/pydirfile.c
trunk/getdata/doc/README.cxx
trunk/getdata/doc/README.f77
trunk/getdata/doc/README.f95
trunk/getdata/doc/README.idl
trunk/getdata/man/gd_error_count.3
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/ChangeLog 2011-04-20 22:42:47 UTC (rev 581)
@@ -1,3 +1,18 @@
+2011-04-21 D. V. Wiebe <ge...@ke...> svn:581
+ * bindings/python/pydirfile.c (gdpy_dirfile_geterrorcount): Added.
+ * bindings/cxx/dirfile.cpp (Dirfile::ErrorCount): Added.
+ * bindings/f77/fgetdata.c (GDECNT): Added.
+ * bindings/f77/fgetdata.f90.in (fgd_error_count): Added.
+ * bindings/idl/getdata.c (gdidl_error_count): Added.
+
+ * bindings/perl/GetData.xs (gdp_to_entry): Fix initialisation of n for
+ LINCOM and POLYNOM.
+
+ * bindings/perl/GetData.pm.in: add constants and functions export tags.
+
+ * bindings/make_parameters.c (Perl): Don't insert unnecessary newlines.
+ * bindings/perl/Makefile.am: Use perl to generate funclist.sed.
+
2011-04-20 D. V. Wiebe <ge...@ke...> svn:580
* test/error_num.c: Added.
* src/errors.c (gd_error_count): Added.
Modified: trunk/getdata/TODO
===================================================================
--- trunk/getdata/TODO 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/TODO 2011-04-20 22:42:47 UTC (rev 581)
@@ -9,4 +9,3 @@
* aliasing [MT]
* Fix REFERENCE spam [MT]
* Fragment encapsulation [MT/CBN]
-* gd_error_count bindings
Modified: trunk/getdata/bindings/cxx/dirfile.cpp
===================================================================
--- trunk/getdata/bindings/cxx/dirfile.cpp 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/cxx/dirfile.cpp 2011-04-20 22:42:47 UTC (rev 581)
@@ -139,6 +139,11 @@
return gd_error(D);
}
+int Dirfile::ErrorCount()
+{
+ return gd_error_count(D);
+}
+
const char *Dirfile::ErrorString(size_t __gd_unused n)
{
return ErrorString();
Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/dirfile.h 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2011-04-20 22:42:47 UTC (rev 581)
@@ -111,6 +111,8 @@
int Error() const;
+ int ErrorCount();
+
const char *ErrorString();
const char *ErrorString(size_t n) gd_deprecated;
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/f77/fgetdata.c 2011-04-20 22:42:47 UTC (rev 581)
@@ -385,6 +385,16 @@
dreturn("%i", *error);
}
+/* gd_error_count wrapper */
+void F77_FUNC(gderor, GDECNT) (int* error_count, const int* dirfile)
+{
+ dtrace("%p, %i", error, *dirfile);
+
+ *error_count = gd_error_count(_GDF_GetDirfile(*dirfile));
+
+ dreturn("%i", *error_count);
+}
+
/* gd_error_string wrapper */
void F77_FUNC(gdestr, GDESTR) (const int* dirfile, char* buffer, const int* len)
{
Modified: trunk/getdata/bindings/f77/getdata.f.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f.in 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/f77/getdata.f.in 2011-04-20 22:42:47 UTC (rev 581)
@@ -115,6 +115,8 @@
EXTERNAL GDDELE
C Corresponding to gd_discard(3)
EXTERNAL GDDSCD
+C Corresponding to gd_error_count(3)
+ EXTERNAL GDECNT
C Corresponding to gd_entry_type(3)
EXTERNAL GDENTY
C Corresponding to gd_error(3)
Modified: trunk/getdata/bindings/f77/getdata.f90.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f90.in 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/f77/getdata.f90.in 2011-04-20 22:42:47 UTC (rev 581)
@@ -769,6 +769,14 @@
call gderor(fgd_error, dirfile)
end function
+function fgd_error_count (dirfile)
+ integer :: fgd_error_count
+ integer, intent(in) :: dirfile
+
+ ! call f77 library
+ call gdecnt(fgd_error_count, dirfile)
+end function
+
subroutine fgd_error_string (dirfile, buffer, len)
integer, intent(in) :: dirfile, len
character (len=*), intent(out) :: buffer
Modified: trunk/getdata/bindings/idl/getdata.c
===================================================================
--- trunk/getdata/bindings/idl/getdata.c 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/idl/getdata.c 2011-04-20 22:42:47 UTC (rev 581)
@@ -3803,6 +3803,18 @@
return r;
}
+/* @@DLM: F gdidl_error_count GD_ERROR_COUNT 1 1 */
+IDL_VPTR gdidl_error_count(int argc, IDL_VPTR argv[], char *argk)
+{
+ dtraceidl();
+
+ int err = gd_error_count(gdidl_get_dirfile(IDL_LongScalar(argv[0])));
+
+ IDL_VPTR r = IDL_GettmpInt(err);
+ dreturn("%p", r);
+ return r;
+}
+
/* @@DLM: F gdidl_error_string GD_ERROR_STRING 1 1 */
IDL_VPTR gdidl_error_string(int argc, IDL_VPTR argv[], char *argk)
{
Modified: trunk/getdata/bindings/make_parameters.c
===================================================================
--- trunk/getdata/bindings/make_parameters.c 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/make_parameters.c 2011-04-20 22:42:47 UTC (rev 581)
@@ -362,7 +362,7 @@
printf("s/@PARAMLIST@/");
for (i = 0; constant_list[i].lname != NULL; ++i)
- printf("%s\\\n", constant_list[i].sname, constant_list[i].value);
+ printf("%s ", constant_list[i].sname, constant_list[i].value);
printf("/\n");
}
Modified: trunk/getdata/bindings/perl/GetData.pm.in
===================================================================
--- trunk/getdata/bindings/perl/GetData.pm.in 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/perl/GetData.pm.in 2011-04-20 22:42:47 UTC (rev 581)
@@ -29,10 +29,8 @@
require Math::Complex;
our @ISA = qw(Exporter);
-our %EXPORT_TAGS = ( 'all' => [ qw(VERSION
- @FUNCLIST@
- @PARAMLIST@
- ) ] );
+our %EXPORT_TAGS = ( 'all' => [ qw(VERSION @FUNCLIST@ @PARAMLIST@) ],
+'constants' => [ qw(VERSION @PARAMLIST@) ], 'functions' => [ qw(@FUNCLIST@) ]);
our @EXPORT_OK = ( @{$EXPORT_TAGS{'all'}} );
our @EXPORT = qw();
Modified: trunk/getdata/bindings/perl/GetData.xs
===================================================================
--- trunk/getdata/bindings/perl/GetData.xs 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/perl/GetData.xs 2011-04-20 22:42:47 UTC (rev 581)
@@ -276,7 +276,7 @@
break;
case GD_LINCOM_ENTRY:
GDP_EHASH_FETCH_IV("n_fields", n_fields, int);
- n = (E->n_fields > GD_MAX_LINCOM) ? GD_MAX_LINCOM : n;
+ n = (E->n_fields > GD_MAX_LINCOM) ? GD_MAX_LINCOM : E->n_fields;
gdp_fetch_in_fields(E->in_fields, sv, n, pkg, func);
E->comp_scal = 1;
gdp_fetch_cmp_list(E->cm, (HV*)sv, "cm", n, pkg, func);
@@ -299,7 +299,7 @@
case GD_POLYNOM_ENTRY:
GDP_EHASH_FETCH_PV("in_field", in_fields[0]);
GDP_EHASH_FETCH_IV("poly_ord", poly_ord, int);
- n = (E->poly_ord > GD_MAX_POLYORD) ? GD_MAX_POLYORD : n;
+ n = (E->poly_ord > GD_MAX_POLYORD) ? GD_MAX_POLYORD : E->poly_ord;
E->comp_scal = 1;
gdp_fetch_cmp_list(E->ca, (HV*)sv, "ca", n, pkg, func);
gdp_fetch_scalars(E, (HV*)sv, (1 << (n + 1)) - 1, pkg, func);
Modified: trunk/getdata/bindings/perl/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/Makefile.am 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/perl/Makefile.am 2011-04-20 22:42:47 UTC (rev 581)
@@ -47,10 +47,9 @@
$(PERL) simple_funcs.pl $< > $@
funclist.sed: GetData.c
- echo $(ECHO_N) "s/@FUNCLIST@/" > $@
- $(AWK) '/^XS\(XS_GetData_.*\);/ {print $$1}' $< | \
- $(SED) -e 's/.*XS_GetData_\(.*\));/\1\\/' >> $@
- echo / >> $@
+ $(PERL) -ne 'BEGIN { print "s/\@FUNCLIST@/" }' \
+ -e 'print "$$1 " if /^XS\(XS_GetData_([a-z].*)\);/;' \
+ -e 'END { print "/\n" }' $< > $@
make_parameters.sed: ../make_parameters ../../src/getdata.h
../make_parameters P > $@
Modified: trunk/getdata/bindings/perl/simple_funcs.xsin
===================================================================
--- trunk/getdata/bindings/perl/simple_funcs.xsin 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/perl/simple_funcs.xsin 2011-04-20 22:42:47 UTC (rev 581)
@@ -117,3 +117,4 @@
off64_t nframes64(DIRFILE *dirfile)
off64_t bof64(DIRFILE *dirfile, const char* field_code)
off64_t eof64(DIRFILE *dirfile, const char* field_code)
+int error_count(DIRFILE *dirfile)
Modified: trunk/getdata/bindings/python/pydirfile.c
===================================================================
--- trunk/getdata/bindings/python/pydirfile.c 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/bindings/python/pydirfile.c 2011-04-20 22:42:47 UTC (rev 581)
@@ -728,6 +728,17 @@
return error;
}
+static PyObject* gdpy_dirfile_geterrorcount(struct gdpy_dirfile_t* self,
+ void* closure)
+{
+ dtrace("%p, %p", self, closure);
+
+ PyObject* count = PyInt_FromLong(gd_error_count(self->D));
+
+ dreturn("%p", count);
+ return count;
+}
+
static PyObject* gdpy_dirfile_getfragment(struct gdpy_dirfile_t* self,
void* args, void* keys)
{
@@ -2067,6 +2078,12 @@
"errors, it is typically not necessary to check this value; use a\n"
"try/except statement instead. See gd_error(3).",
NULL },
+ { "error_count", (getter)gdpy_dirfile_geterrorcount, NULL,
+ "The number of errors encountered by the GetData library for this\n"
+ /* -----------------------------------------------------------------| */
+ "dirfile since the last time this member was accessed. Note:\n"
+ "accessing this member, resets it to zero. See gd_error_count(3).",
+ NULL },
{ "error_string", (getter)gdpy_dirfile_geterrorstring, NULL,
"A human-readable description of the last error encountered by the\n"
"GetData library for this dirfile. See gd_error_string(3).",
@@ -2214,7 +2231,6 @@
"field. If NumPy support is present in pygetdata, and 'as_list' is\n"
"not given or zero, the values will be returned in NumPy arrays;\n"
"otherwise, the values will be returned as lists.\n\n"
- /* -----------------------------------------------------------------| */
"The 'return_type' parameter indicates the desired type of the values\n"
"returned, and should be (typically) one of: pygetdata.INT,\n"
"pygetdata.LONG, pygetdata.ULONG, pygetdata.FLOAT, or\n"
Modified: trunk/getdata/doc/README.cxx
===================================================================
--- trunk/getdata/doc/README.cxx 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/doc/README.cxx 2011-04-20 22:42:47 UTC (rev 581)
@@ -47,9 +47,15 @@
* int Dirfile::Error()
- The Error method provides access to the error member of the underlying
- DIRFILE* object.
+ The Error method calls gd_error(3) to return the error status of the last
+ GetData library call on this Dirfile object.
+* int Dirfile::ErrorCount()
+
+ The ErrorCount method calls gd_error_count(3) to return the number of errors
+ encountered by the GetData library on this Dirfile object since this method
+ was last called (or, the first time, since the object was created)..
+
* const char *Dirfile::ErrorString()
* const char *Dirfile::ErrorString(size_t len)
Modified: trunk/getdata/doc/README.f77
===================================================================
--- trunk/getdata/doc/README.f77 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/doc/README.f77 2011-04-20 22:42:47 UTC (rev 581)
@@ -466,6 +466,18 @@
This wraps gd_nframes(3). It takes the dirfile unit number as input and
returns the number of frames in the dirfile in nframes.
+* GDECNT(error_count, dirfile_unit)
+
+ Output:
+ INTEGER error_count
+ Input:
+ INTEGER dirfile_unit
+
+ This subroutine wraps gd_error_count(3). It takes the dirfile unit number as
+ input and returns the number of errors encountered by GetData since the last
+ call to this subroutine (or since the dirfile was first opened) in
+ error_count.
+
* GDEROR(error, dirfile_unit)
Output:
@@ -473,9 +485,9 @@
Input:
INTEGER dirfile_unit
- This subroutine takes a dirfile unit as input and returns the DIRFILE.error
- value associated with it in error. The value of error will equal one of the
- error codes defined in getdata.f.
+ This subroutine wraps gd_error(3). It takes the dirfile unit number as input
+ and returns the error value arising from the last library call in error. The
+ value of error will equal one of the error codes defined in getdata.f.
* GDESTR(dirfile_unit, buffer, buffer_len)
Modified: trunk/getdata/doc/README.f95
===================================================================
--- trunk/getdata/doc/README.f95 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/doc/README.f95 2011-04-20 22:42:47 UTC (rev 581)
@@ -107,6 +107,12 @@
integer, intent(in) :: dirfile
character (len=*), intent(in) :: field_code
+* integer function fgd_error (dirfile_unit)
+ integer, intent(in) :: dirfile_unit
+
+* integer function fgd_error_count (dirfile_unit)
+ integer, intent(in) :: dirfile_unit
+
* integer function fgd_error_string (dirfile, buffer, len)
integer, intent(in) :: dirfile, len
character (len=<len>), intent(out) :: buffer
@@ -656,11 +662,6 @@
integer, intent(inout) :: field_len
character (len=*), intent(in) :: parent
-* integer function fgd_error (dirfile_unit)
- integer, intent(in) :: dirfile_unit
-
- This returns the DIRFILE error associated with the supplied dirfile unit.
-
* integer function fgd_entry (dirfile_unit, field_code, ent)
integer, intent(in) :: dirfile_unit
character (len=*), intent(in) :: field_code
Modified: trunk/getdata/doc/README.idl
===================================================================
--- trunk/getdata/doc/README.idl 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/doc/README.idl 2011-04-20 22:42:47 UTC (rev 581)
@@ -81,19 +81,20 @@
IDL supports all GetData data types with the exception of INT8. Attempting to
return data as INT8 will result in an error.
-Except for the functions GETDATA_CONSTANTS, GD_ERROR, GD_ERROR_STRING, and
-GD_INVALID_DIRFILE, all IDL GetData functions and procedures may take two
-optional keyword parameters which deal with error reporting:
+Except for the functions GETDATA_CONSTANTS, GD_ERROR, GD_ERROR_COUNT,
+GD_ERROR_STRING, and GD_INVALID_DIRFILE, all IDL GetData functions and
+procedures may take two optional keyword parameters which deal with error
+reporting:
ERROR: a variable in which the dirfile error number resulting from this
- call will be stored. It will be the !GD.E_* error codes
- corresponding to the C API error code. On success this will be
- !GD.E_OK (= 0). If this parameter is not specified, the dirfile
- error can still be retrieved by calling GD_ERROR() after this call.
+ call will be stored. It will be the !GD.E_* error code corresponding
+ to the C API error code. On success this will be !GD.E_OK (= 0). If
+ this parameter is not specified, the dirfile error can still be
+ retrieved by calling GD_ERROR() after this call.
ESTRING: a variable in which the string representation of the error resulting
from this call will be stored. If this parameter is not specified,
the the dirfile error string can still be retrieved by calling
- GD_ERROR_STRING().
+ GD_ERROR_STRING() after the call.
For brevity, these keyword parameters are omitted from the subroutine prototypes
given below.
@@ -555,6 +556,13 @@
This function does not take the normal ERROR and ESTRING keyword parameters.
See gd_error(3).
+FUNCTION GD_ERROR_COUNT(dirfile_unit)
+
+ This function returns the number of errors encountered by the GetData library
+ on the specified dirfile since this function was last called (or since the
+ dirfile was opened, if this is the first call to this function). See
+ gd_error_count(3).
+
FUNCTION GD_ERROR_STRING(dirfile_unit)
This function returns a human readable string describing the error status of
Modified: trunk/getdata/man/gd_error_count.3
===================================================================
--- trunk/getdata/man/gd_error_count.3 2011-04-19 22:51:58 UTC (rev 580)
+++ trunk/getdata/man/gd_error_count.3 2011-04-20 22:42:47 UTC (rev 581)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_error_count 3 "19 April 2011" "Version 0.8.0" "GETDATA"
+.TH gd_error_count 3 "20 April 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_error_count \(em report the number of errors encountered by the GetData
library
@@ -26,22 +26,18 @@
.hy
.ad n
.SH DESCRIPTION
-The
-.BR gd_error_count ()
-function returns the number of errors encountered by the GetData library
-on the DIRFILE object
-.I dirfile
-since this function was last called on
-.IR dirfile .
The first time
.BR gd_error_count ()
-is called on the supplied
-.I dirfile
-object, the count is since
-.I dirfile
-was created.
+is called with the DIRFILE object
+.IR dirfile ,
+it returns the number of errors encountered by the GetData library while
+operating on the specified DIRFILE object, since the DIRFILE's creation.
+Calling this function resets the internal count, so that subsequent calls to
+.BR gd_error_count ()
+return the number of errors encountered only since the previous call to this
+function, for the specified DIRFILE.
-The
+The errors themselves are not cached by the library. The
.I last
error encountered by the library for
.I dirfile
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-04-29 00:36:16
|
Revision: 583
http://getdata.svn.sourceforge.net/getdata/?rev=583&view=rev
Author: ketiltrout
Date: 2011-04-29 00:36:09 +0000 (Fri, 29 Apr 2011)
Log Message:
-----------
Debuggery.
Modified Paths:
--------------
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/src/getdata.c
Modified: trunk/getdata/bindings/perl/GetData.xs
===================================================================
--- trunk/getdata/bindings/perl/GetData.xs 2011-04-21 16:14:09 UTC (rev 582)
+++ trunk/getdata/bindings/perl/GetData.xs 2011-04-29 00:36:09 UTC (rev 583)
@@ -1659,6 +1659,7 @@
CLEANUP:
if (din.arg_type != GDP_DATA_IN_PACK)
safefree(din.data_in);
+ dreturn("%i", RETVAL);
int
add_carray(dirfile, field_code, const_type, fragment_index, d, ...)
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2011-04-21 16:14:09 UTC (rev 582)
+++ trunk/getdata/src/getdata.c 2011-04-29 00:36:09 UTC (rev 583)
@@ -158,6 +158,8 @@
_GD_SetError(D, GD_E_BAD_TYPE, type, NULL, 0, NULL);
break;
}
+
+ dreturnvoid();
}
/* _GD_FillFileFrame: fill dataout with frame indices
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-05-05 15:24:38
|
Revision: 586
http://getdata.svn.sourceforge.net/getdata/?rev=586&view=rev
Author: ketiltrout
Date: 2011-05-05 15:24:29 +0000 (Thu, 05 May 2011)
Log Message:
-----------
A big update concerning how we deal with directories. The first part of the solution to Matt's chdir() problem. Basically, we now open() the directories which concern us to keep track of them, and then use the POSIX.1-2008 at functions to run around. This doesn't really work yet.
Also fixed a few minor bugs.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/m4/version.m4
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/del.c
trunk/getdata/src/encoding.c
trunk/getdata/src/endian.c
trunk/getdata/src/entry.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/gzip.c
trunk/getdata/src/include.c
trunk/getdata/src/internal.h
trunk/getdata/src/legacy.c
trunk/getdata/src/lzma.c
trunk/getdata/src/mod.c
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/putdata.c
trunk/getdata/src/raw.c
trunk/getdata/src/slim.c
trunk/getdata/test/add_raw.c
trunk/getdata/test/error_num.c
trunk/getdata/test/file.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/ChangeLog 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,3 +1,67 @@
+2011-05-05 D. V. Wiebe <ge...@ke...> svn:586
+ * src/internal.h: The encoding framework has changed: open, touch, size,
+ move, unlink, and temp now all take the dirfd. Furthermore, to allow
+ operation on non-POSIX.1-2008 systems, we hide the DIRFILE pointer in
+ _gd_raw_file, so callback can be made to the compatibility layer. All
+ framework callers have been updated to pass dirfds. fragment->sname is no
+ longer malloc'd and is now marked const; also, fragments now carry their
+ dirfd. D->dir and D->ndir added.
+ * src/encoding.c (gd_MakeTempFile) src/compat.c (gd_OpenAt gd_RenameAt
+ gd_StatAt gd_StatAt64 gd_UnlinkAt) src/common.c (_GD_DirName
+ _GD_MakeFullPath _GD_GrabDir _GD_ReleaseDir): Added.
+ * src/open.c (gd_cbopen): Open the dirfile directory as soon as possible,
+ then work as much as possible with the descriptor instead of the path
+ itself.
+ * src/open.c (_GD_CreateDirfile): Use the dirfd produced by cb_open()
+ instead of relying on the pathname except with GD_CREAT. As a side effect,
+ no longer need to compute fullname when truncating.
+ * src/entry.c (_GD_FreeE): Release LUT directory. This requires passing the
+ DIRFILE to this function.
+ * src/close.c (_GD_FreeD): Don't free fragment->sname (it's no longer
+ malloc'd). Free D->dir.
+ * src/close.c (_GD_ShutdownDirfile): Close all open directories.
+ * src/flush.c (_GD_FlushFragment): Call gd_MakeTempFile instead of mkstemp.
+ * src/encoding.c (_GD_SetEncodedName): set file->D to the DIRFILE pointer,
+ so the encoding framework has access to it.
+ * src/encoding.c (_GD_ResolveEncoding): Take dirfd for I/O purposes.
+ * src/move.c (_GD_MogrifyFile): Consider changes in dirfd.
+ * src/parse.c (_GD_ParseRaw): E->e->u.raw.filebase is a copy of E->field
+ now, (and could be removed, except we'll need it shortly). The fragment
+ index (me) is no longer needed in this function.
+ * src/mod.c (_GD_Change): Release the LUT directory if it changes.
+ * src/include.c (_GD_Include): Open the grab the included fragment's
+ directory and store it in fragment->dirfd. fragment->sname is now just the
+ value returned by _GD_DirName, and not malloc'd.
+ * src/include.c (gd_uninclude): Release the directory.
+ * src/compat.c (mkstemp _GD_Rename): Removed.
+ * src/common.c (_GD_SetTablePath): Open the directory. table_path is
+ replaced with table_file.
+
+ * src/encoding.c (_GD_GenericTouch _GD_GenericUnlink _GD_GenericMove)
+ src/slim.c (_GD_SlimOpen _GD_SlimSize) src/gzip.c (_GD_GzipOpen _GD_GzipSize)
+ src/ascii.c (_GD_AsciiOpen _GD_AsciiSize _GD_AsciiTemp) src/lzma.c
+ (_GD_LzmaOpen _GD_LzmaSize) src/bzip.c (_GD_Bzip2Open _GD_Bzip2Size): Update
+ for changes in the encoding framework.
+
+ * src/slim.c (_GD_SlimOpen _GD_SlimSize): Slimlib doesn't accept file
+ descriptors, so compute the full path before calling it. This has the
+ potential for breakage.
+ * src/gzip.c (_GD_GzipOpen _GD_GzipSize): Use gzdopen instead of gzopen.
+ * src/lzma.c (_GD_LzmaDoOpen) src/bzip.c (_GD_Bzip2DoOpen): Use dirfd to
+ create stream.
+
+ * src/legacy.c (_GD_GetDirfile) src/name.c (gd_rename) src/encoding.c
+ (_GD_MissingFramework _GD_ResolveEncoding) src/move.c (gd_move)
+ src/include.c (_GD_Include) src/add.c (_GD_Add): Remove the FILENAME_MAX
+ crutch.
+
+ * src/add.c (_GD_Add): Fix memory leak of new_ref.
+
+ * src/entry.c (gd_raw_filename): Return a malloc'd string.
+
+ * configure.ac: Fix am__fastdepCXX_* for --disable-cplusplus. This is
+ presumably a autotools bug. Look for ...at() functions.
+
2011-04-21 D. V. Wiebe <ge...@ke...> svn:581
* bindings/python/pydirfile.c (gdpy_dirfile_geterrorcount): Added.
* bindings/cxx/dirfile.cpp (Dirfile::ErrorCount): Added.
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/configure.ac 2011-05-05 15:24:29 UTC (rev 586)
@@ -139,6 +139,7 @@
make_f77bindings="no"
make_pybindings="no"
make_idlbindings="no"
+ make_perlbindings="no"
fi
])
@@ -334,6 +335,9 @@
echo
AC_PROG_CXX
AC_PROG_CXX_C_O
+else
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
fi
if test "x$make_f77bindings" != "xno"; then
echo
@@ -508,10 +512,11 @@
fi
dnl functions
-AC_CHECK_FUNCS([_commit fchmod _fdopen fseeko fseeko64 fsync ftello ftello64 \
- getcwd _getcwd getdelim gmtime_r _lseeki64 _mkdir mkstemp nan \
- _open _read _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
- _strtoui64 strtoull _unlink _write])
+AC_CHECK_FUNCS([_commit fchmod _fdopen fdopendir fseeko fseeko64 _fstat \
+ fstatat fstatat64 fsync ftello ftello64 getcwd _getcwd \
+ getdelim gmtime_r _lseeki64 _mkdir nan _open openat _read \
+ renameat _rmdir _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/m4/version.m4
===================================================================
--- trunk/getdata/m4/version.m4 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/m4/version.m4 2011-05-05 15:24:29 UTC (rev 586)
@@ -19,9 +19,9 @@
dnl 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
m4_define(getdata_major, 0)
-m4_define(getdata_minor, 7)
-m4_define(getdata_revision, 2)
-m4_define(getdata_extra, [])
+m4_define(getdata_minor, 8)
+m4_define(getdata_revision, 0)
+m4_define(getdata_extra, [a])
m4_define(getdata_version,
getdata_major.getdata_minor.getdata_revision[]getdata_extra)
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/add.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -22,7 +22,6 @@
#ifdef STDC_HEADERS
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <errno.h>
#endif
@@ -34,7 +33,7 @@
/* add an entry */
static int _GD_Add(DIRFILE* D, const gd_entry_t* entry, const char* parent)
{
- char temp_buffer[FILENAME_MAX];
+ char *temp_buffer;
int i, is_dot;
int copy_scalar[GD_MAX_POLYORD + 1];
void* new_list;
@@ -89,18 +88,28 @@
return -1;
}
- snprintf(temp_buffer, FILENAME_MAX, "%s/%s", parent, entry->field);
+ temp_buffer = (char *)malloc(strlen(parent) + strlen(entry->field) + 2);
+ if (temp_buffer)
+ strcat(strcat(strcpy(temp_buffer, parent), "/"), entry->field);
} else
- snprintf(temp_buffer, FILENAME_MAX, "%s", entry->field);
+ temp_buffer = strdup(entry->field);
+ if (temp_buffer == NULL) {
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
/* check for duplicate field */
E = _GD_FindField(D, temp_buffer, D->entry, D->n_entries, &u);
if (E != NULL) { /* matched */
_GD_SetError(D, GD_E_DUPLICATE, 0, NULL, 0, temp_buffer);
+ free(temp_buffer);
dreturn("%i", -1);
return -1;
}
+ free(temp_buffer);
/* check for bad field type */
if (entry->field_type != GD_RAW_ENTRY &&
@@ -153,12 +162,12 @@
if (E->field == entry->field) {
_GD_SetError(D, GD_E_BAD_CODE, 0, NULL, 0, entry->field);
E->field = NULL;
- _GD_FreeE(E, 1);
+ _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);
- _GD_FreeE(E, 1);
+ _GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
}
@@ -190,14 +199,10 @@
E->e->u.raw.file[0].fp = E->e->u.raw.file[1].fp = -1;
E->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN;
- if ((E->e->u.raw.filebase = (char *)malloc(FILENAME_MAX)) == NULL) {
+ if ((E->e->u.raw.filebase = strdup(E->field)) == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
break;
}
-
- snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s",
- D->fragment[E->fragment_index].sname ?
- D->fragment[E->fragment_index].sname : D->name, E->field);
if ((E->EN(raw,spf) = entry->EN(raw,spf)) == 0)
_GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_SPF, NULL,
@@ -209,7 +214,8 @@
; /* error already set */
else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
; /* error already set */
- else if ((*_gd_ef[E->e->u.raw.file[0].encoding].touch)(E->e->u.raw.file))
+ else if ((*_gd_ef[E->e->u.raw.file[0].encoding].touch)(
+ D->fragment[E->fragment_index].dirfd, E->e->u.raw.file))
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
NULL);
else if (D->fragment[E->fragment_index].ref_name == NULL) {
@@ -413,7 +419,7 @@
if (D->error != GD_E_OK) {
free(new_ref);
- _GD_FreeE(E, 1);
+ _GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
}
@@ -421,7 +427,7 @@
new_list = realloc(D->entry, (D->n_entries + 1) * sizeof(gd_entry_t*));
if (new_list == NULL) {
free(new_ref);
- _GD_FreeE(E, 1);
+ _GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
}
@@ -431,7 +437,7 @@
new_list = realloc(D->dot_list, (D->n_dot + 1) * sizeof(gd_entry_t*));
if (new_list == NULL) {
free(new_ref);
- _GD_FreeE(E, 1);
+ _GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
}
@@ -443,7 +449,7 @@
sizeof(gd_entry_t*));
if (ptr == NULL) {
free(new_ref);
- _GD_FreeE(E, 1);
+ _GD_FreeE(D, E, 1);
dreturn("%i", -1);
return -1;
}
@@ -485,6 +491,7 @@
if (D->reference_field == NULL)
D->reference_field = E;
+ free(new_ref);
}
}
@@ -801,7 +808,7 @@
gd_entry_t B;
int error;
- dtrace("%p, \"%s\", \"%s\", %i, %i, %i\n", D, field_code, in_field, bitnum,
+ dtrace("%p, \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field, bitnum,
numbits, fragment_index);
if (D->flags & GD_INVALID) {/* don't crash */
@@ -830,7 +837,7 @@
gd_entry_t B;
int error;
- dtrace("%p, \"%s\", \"%s\", %i, %i, %i\n", D, field_code, in_field, bitnum,
+ dtrace("%p, \"%s\", \"%s\", %i, %i, %i", D, field_code, in_field, bitnum,
numbits, fragment_index);
if (D->flags & GD_INVALID) {/* don't crash */
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/ascii.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -34,14 +34,14 @@
/* The ASCII encoding uses file->fp as to indicate the current line and
* file->edata for the stream pointer */
-int _GD_AsciiOpen(struct _gd_raw_file* file, int mode, int creat)
+int _GD_AsciiOpen(int dirfd, struct _gd_raw_file* file, int mode, int creat)
{
int fp;
- dtrace("%p, %i, %i", file, mode, creat);
+ dtrace("%i, %p, %i, %i", dirfd, file, mode, creat);
- fp = open(file->name, ((mode == GD_RDWR) ? O_RDWR : O_RDONLY) |
- (creat ? O_CREAT : 0) | O_BINARY, 0666);
+ fp = gd_OpenAt(file->D, dirfd, file->name, ((mode == GD_RDWR) ? O_RDWR :
+ O_RDONLY) | (creat ? O_CREAT : 0) | O_BINARY, 0666);
file->edata = fdopen(fp, (mode == GD_RDWR) ? "r+" : "r");
@@ -351,18 +351,25 @@
return 1;
}
-off64_t _GD_AsciiSize(struct _gd_raw_file* file,
+off64_t _GD_AsciiSize(int dirfd, struct _gd_raw_file* file,
gd_type_t data_type __gd_unused)
{
FILE* stream;
char *buffer = NULL;
size_t len = 0;
off64_t n = 0;
+ int fd;
- dtrace("%p, <unused>", file);
+ dtrace("%i, %p, <unused>", dirfd, file);
- stream = fopen(file->name, "r");
+ fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY, 0666);
+ if (fd == -1) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ stream = fdopen(fd, "r");
+
if (stream == NULL) {
dreturn("%i", -1);
return -1;
@@ -378,18 +385,18 @@
return n;
}
-int _GD_AsciiTemp(struct _gd_raw_file *file, int method)
+int _GD_AsciiTemp(int dirfd0, int dirfd1, struct _gd_raw_file *file, int method)
{
int move_error = 0;
struct stat stat_buf;
mode_t mode;
int fp;
- dtrace("%p, %i", file, method);
+ dtrace("%i, %i, %p, %i", dirfd0, dirfd1, file, method);
switch(method) {
case GD_TEMP_OPEN:
- fp = mkstemp(file[1].name);
+ fp = gd_MakeTempFile(file[1].D, dirfd1, file[1].name);
file[1].edata = fdopen(fp, "r+");
@@ -409,7 +416,7 @@
else
mode = stat_buf.st_mode;
- if (!_GD_Rename(file[1].name, file[0].name)) {
+ if (!gd_RenameAt(file->D, dirfd1, file[1].name, dirfd0, file[0].name)) {
chmod(file[0].name, mode);
free(file[1].name);
file[1].name = NULL;
Modified: trunk/getdata/src/bzip.c
===================================================================
--- trunk/getdata/src/bzip.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/bzip.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -59,23 +59,31 @@
/* The bzip encoding scheme uses edata as a gd_bzdata pointer. If a file is
* open, fp = 0 otherwise fp = -1. */
-static struct gd_bzdata *_GD_Bzip2DoOpen(struct _gd_raw_file* file)
+static struct gd_bzdata *_GD_Bzip2DoOpen(int dirfd, struct _gd_raw_file* file)
{
+ int fd;
struct gd_bzdata *ptr;
- dtrace("%p", file);
+ dtrace("%i, %p", dirfd, file);
if ((ptr = (struct gd_bzdata *)malloc(sizeof(struct gd_bzdata))) == NULL) {
dreturn("%p", NULL);
return NULL;
}
- if ((ptr->stream = fopen(file->name, "rb")) == NULL) {
+ if ((fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY, 0666)) == -1) {
free(ptr);
dreturn("%p", NULL);
return NULL;
}
+ if ((ptr->stream = fdopen(fd, "rb")) == NULL) {
+ close(fd);
+ free(ptr);
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
ptr->bzerror = ptr->stream_end = 0;
ptr->bzfile = BZ2_bzReadOpen(&ptr->bzerror, ptr->stream, 0, 0, NULL, 0);
@@ -93,12 +101,12 @@
return ptr;
}
-int _GD_Bzip2Open(struct _gd_raw_file* file, int mode __gd_unused,
+int _GD_Bzip2Open(int dirfd, struct _gd_raw_file* file, int mode __gd_unused,
int creat __gd_unused)
{
- dtrace("%p, <unused>, <unused>", file);
+ dtrace("%i, %p, <unused>, <unused>", dirfd, file);
- file->edata = _GD_Bzip2DoOpen(file);
+ file->edata = _GD_Bzip2DoOpen(dirfd, file);
if (file->edata == NULL) {
dreturn("%i", 1);
@@ -238,14 +246,14 @@
return 1;
}
-off64_t _GD_Bzip2Size(struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_Bzip2Size(int dirfd, struct _gd_raw_file *file, gd_type_t data_type)
{
struct gd_bzdata *ptr;
off_t n;
- dtrace("%p, %x", file, data_type);
+ dtrace("%i, %p, %x", dirfd, file, data_type);
- ptr = _GD_Bzip2DoOpen(file);
+ ptr = _GD_Bzip2DoOpen(dirfd, file);
if (ptr == NULL) {
dreturn("%i", -1);
Modified: trunk/getdata/src/close.c
===================================================================
--- trunk/getdata/src/close.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/close.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -34,11 +34,10 @@
dtrace("%p", D);
for (i = 0; i < D->n_entries; ++i)
- _GD_FreeE(D->entry[i], 1);
+ _GD_FreeE(D, D->entry[i], 1);
for (j = 0; j < D->n_fragment; ++j) {
free(D->fragment[j].cname);
- free(D->fragment[j].sname);
free(D->fragment[j].ename);
free(D->fragment[j].ref_name);
}
@@ -59,6 +58,9 @@
free(D->carray_value_list);
free(D->fragment);
free(D->name);
+ for (i = 0; i < D->ndir; ++i)
+ free(D->dir[i].path);
+ free(D->dir);
free(D);
dreturnvoid();
@@ -90,6 +92,10 @@
return -1;
}
+ /* close the directory */
+ for (i = 0; i < (unsigned int)D->ndir; ++i)
+ close(D->dir[i].fd);
+
_GD_FreeD(D);
dreturn("%i", 0);
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/common.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,5 +1,5 @@
/* Copyright (C) 2002-2005 C. Barth Netterfield
- * Copyright (C) 2005-2010 D. V. Wiebe
+ * Copyright (C) 2005-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -188,27 +188,25 @@
dtrace("%p, %p, %p", D, E, e);
- if (E->EN(linterp,table)[0] == '/') {
- e->u.linterp.table_path = strdup(E->EN(linterp,table));
- if (e->u.linterp.table_path == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- dreturn("%i", 1);
- return 1;
- }
- } else {
- e->u.linterp.table_path = (char *)malloc(strlen(E->EN(linterp,table)) + 2 +
- strlen(D->fragment[E->fragment_index].cname));
- if (e->u.linterp.table_path == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- dreturn("%i", 1);
- return 1;
- }
- temp_buffer = strdup(D->fragment[E->fragment_index].cname);
- strcpy(e->u.linterp.table_path, dirname(temp_buffer));
- strcat(e->u.linterp.table_path, "/");
- strcat(e->u.linterp.table_path, E->EN(linterp,table));
+ 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));
+ 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));
+ 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;
}
+ free(temp_buffer);
dreturn("%i", 0);
return 0;
@@ -227,7 +225,7 @@
{
FILE *fp;
struct _gd_lut *ptr;
- int i;
+ int i, fd;
int dir = -1;
char *line;
size_t n = 0;
@@ -237,16 +235,25 @@
dtrace("%p, %p", D, E);
- if (E->e->u.linterp.table_path == NULL)
+ if (E->e->u.linterp.table_file == NULL)
if (_GD_SetTablePath(D, E, E->e)) {
dreturnvoid();
return;
}
- fp = fopen(E->e->u.linterp.table_path, "r");
+ fd = gd_OpenAt(D, E->e->u.linterp.table_dirfd, E->e->u.linterp.table_file,
+ O_RDONLY, 0666);
+ if (fd == -1) {
+ _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_OPEN, NULL, 0,
+ E->EN(linterp,table));
+ dreturnvoid();
+ return;
+ }
+
+ fp = fdopen(fd, "r");
if (fp == NULL) {
_GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_OPEN, NULL, 0,
- E->e->u.linterp.table_path);
+ E->EN(linterp,table));
dreturnvoid();
return;
}
@@ -259,12 +266,12 @@
} else {
if (errno == EOVERFLOW)
/* line too long */
- _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->e->u.linterp.table_path,
- linenum, NULL);
+ _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->EN(linterp,table), linenum,
+ NULL);
else
/* no data in file! */
_GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, NULL, 0,
- E->e->u.linterp.table_path);
+ E->EN(linterp,table));
fclose(fp);
dreturnvoid();
return;
@@ -321,7 +328,7 @@
if (i < 2) {
free(E->e->u.linterp.lut);
_GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, NULL, 0,
- E->e->u.linterp.table_path);
+ E->EN(linterp,table));
fclose(fp);
dreturnvoid();
return;
@@ -677,7 +684,7 @@
do { \
for (i = 0; i < n_read; i++) { \
const t d = ((t *)data)[2 * i] * ((t *)data)[2 * i] + \
- ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
+ ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
((t *)data)[2 * i] = (t)(dividend * ((t *)data)[2 * i] / d); \
((t *)data)[2 * i + 1] = (t)(-dividend * ((t *)data)[2 * i + 1] / d); \
} \
@@ -725,7 +732,7 @@
do { \
for (i = 0; i < n_read; i++) { \
const t d = ((t *)data)[2 * i] * ((t *)data)[2 * i] + \
- ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
+ ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
((t *)data)[2 * i] = (t)((dividend[0] * ((t *)data)[2 * i] - \
dividend[1] * ((t *)data)[2 * i + 1]) / d); \
((t *)data)[2 * i + 1] = (t)((dividend[1] * ((t *)data)[2 * i] - \
@@ -737,7 +744,7 @@
do { \
for (i = 0; i < n_read; i++) { \
const t d = ((t *)data)[2 * i] * ((t *)data)[2 * i] + \
- ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
+ ((t *)data)[2 * i + 1] * ((t *)data)[2 * i + 1]; \
((t *)data)[2 * i] = (t)((dividend[0] * ((t *)data)[2 * i] - \
dividend[1] * ((t *)data)[2 * i + 1]) / d); \
} \
@@ -883,5 +890,149 @@
dreturn("%p %i", E, *repr);
return E;
}
+
+const char *_GD_DirName(const DIRFILE *D, int dirfd)
+{
+ unsigned int i;
+
+ dtrace("%p, %i", D, dirfd);
+
+ for (i = 0; i < D->ndir; ++i)
+ if (dirfd == D->dir[i].fd) {
+ dreturn("\"%s\"", D->dir[i].path);
+ return D->dir[i].path;
+ }
+
+ /* we only get here in the early stages of opening a dirfile */
+ dreturn("%p", D->name);
+ return D->name;
+}
+
+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;
+ }
+
+ filepath = (char *)malloc(strlen(dir) + strlen(name) + 2);
+ if (filepath == NULL) {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ strcat(strcat(strcpy(filepath, dir), "/"), name);
+
+ dreturn("\"%s\"", filepath);
+ return filepath;
+}
+
+int _GD_GrabDir(DIRFILE *D, int dirfd, const char *name)
+{
+ unsigned int i;
+ char *path, *dir = NULL;
+ void *ptr;
+ int abs = (
+#if defined _WIN32 || defined _WIN64
+ name[0] != '\0' && name[1] == ':'
+#else
+ name[0] == '/'
+#endif
+ );
+
+ dtrace("%p, %i, \"%s\"", D, dirfd, name);
+
+ if (abs)
+ path = strdup(name);
+ else
+ path = _GD_MakeFullPath(D, dirfd, name);
+
+ if (path == NULL) {
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ dir = dirname(path);
+
+ for (i = 0; i < D->ndir; ++i)
+ if (strcmp(dir, D->dir[i].path) == 0) {
+ D->dir[i].rc++;
+ free(path);
+ dreturn("%i", D->dir[i].fd);
+ return D->dir[i].fd;
+ }
+
+ /* new one */
+ ptr = realloc(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);
+
+ if (D->dir[D->ndir].path == NULL) {
+ free(path);
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ dreturn("%i", -1);
+ return -1;
+ }
+
+ if (abs) {
+ D->dir[D->ndir].fd = open(dir, O_RDONLY);
+ } else {
+ free(path);
+ path = strdup(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;
+ }
+ D->dir[D->ndir].fd = gd_OpenAt(D, dirfd, dirname(path), O_RDONLY, 0666);
+ }
+ free(path);
+
+ if (D->dir[D->ndir].fd == -1) {
+ free(D->dir[D->ndir].path);
+ dreturn("%i", -1);
+ return -1;
+ }
+ D->ndir++;
+
+ dreturn("%i", D->dir[D->ndir - 1].fd);
+ return D->dir[D->ndir - 1].fd;
+}
+
+void _GD_ReleaseDir(DIRFILE *D, int dirfd)
+{
+ unsigned int i;
+
+ dtrace("%p, %i", D, dirfd);
+
+ for (i = 0; i < D->ndir; ++i)
+ if (D->dir[i].fd == dirfd) {
+ if (--D->dir[i].rc == 0) {
+ free(D->dir[i].path);
+ close(D->dir[i].fd);
+ D->dir[i] = D->dir[--D->ndir];
+ }
+ break;
+ }
+
+ dreturnvoid();
+}
+
/* vim: ts=2 sw=2 et tw=80
*/
Modified: trunk/getdata/src/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/compat.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 D. V. Wiebe
+/* Copyright (C) 2010, 2011 D. V. Wiebe
*
***************************************************************************
*
@@ -49,59 +49,111 @@
}
#endif
-/* MSVCRT based implementation of mkstemp(3). */
-#ifndef HAVE_MKSTEMP
-int mkstemp(char *template) {
- int ret = -1;
- char *template_template;
+#ifndef HAVE_OPENAT
+int gd_OpenAt(const DIRFILE *D, int dirfd, const char *name, int flags,
+ mode_t mode)
+{
+ int ret;
+ char *path;
- dtrace("\"%s\"", template);
+ dtrace("%p, %i, \"%s\", %x, 0%o", D, dirfd, name, flags, mode);
- template_template = strdup(template);
+ path = _GD_MakeFullPath(D, dirfd, name);
+ ret = open(path, flags, mode);
+ free(path);
- /* for sanity's sake */
- errno = 0;
-
- /* loop while open returns EEXIST */
- do {
- char *ptr;
- strcpy(template, template_template);
- ptr = mktemp(template);
-
- if (ptr == NULL)
- errno = EINVAL;
- else
- ret = open(ptr, O_RDWR | O_BINARY | O_CREAT | O_EXCL | O_BINARY, 0600);
- } while (errno == EEXIST);
-
- free(template_template);
dreturn("%i", ret);
return ret;
}
#endif
-/* An overwriting rename for use with the MSVCRT */
-#ifdef __MSVCRT__
-int _GD_Rename(const char *oldname, const char *newname)
+#ifndef HAVE_RENAMEAT
+int gd_RenameAt(const DIRFILE *D, int olddirfd, const char *oldname,
+ int newdirfd, const char *newname)
{
int ret;
+ char *oldpath, *newpath;
- dtrace("\"%s\", \"%s\"", oldname, newname);
+ dtrace("%p, %i, \"%s\", %i, \"%s\"", D, olddirfd, oldname, newdirfd, newname);
- if (unlink(newname)) {
+ newpath = _GD_MakeFullPath(D, newdirfd, newname);
+#ifdef __MSVCRT__
+ if (unlink(newpath)) {
if (errno != ENOENT) {
+ free(newpath);
dreturn("%i", -1);
return -1;
}
}
+#endif
- ret = rename(oldname, newname);
+ oldpath = _GD_MakeFullPath(D, olddirfd, oldname);
+ ret = rename(oldpath, newpath);
+ free(newpath);
+ free(oldpath);
dreturn("%i", ret);
return ret;
}
#endif
+#ifndef HAVE_FSTATAT
+int gd_StatAt(const DIRFILE* D, int dirfd, const char* name, struct stat* buf,
+ int flags)
+{
+ int ret;
+ char *path;
+
+ dtrace("%p, %i, \"%s\", %p, %x", D, dirfd, name, buf, flags);
+
+ path = _GD_MakeFullPath(D, dirfd, name);
+ if (flags & AT_SYMLINK_NOFOLLOW)
+ ret = lstat(path, buf);
+ else
+ ret = stat(path, buf);
+ free(path);
+
+ dreturn("%i", ret);
+ return ret;
+}
+#endif
+
+#ifndef HAVE_FSTATAT64
+int gd_StatAt64(const DIRFILE* D, int dirfd, const char* name, gd_stat64_t* buf,
+ int flags __gd_unused)
+{
+ int ret;
+ char *path;
+
+ dtrace("%p, %i, \"%s\", %p, <unused>", D, dirfd, name, buf);
+
+ path = _GD_MakeFullPath(D, dirfd, name);
+ ret = gd_stat64(path, buf);
+ free(path);
+
+ dreturn("%i", ret);
+ return ret;
+}
+#endif
+
+#ifndef HAVE_UNLINKAT
+int gd_UnlinkAt(const DIRFILE *D, int dirfd, const char *name,
+ int flags __gd_unused)
+{
+ int ret;
+ char *path;
+
+ dtrace("%p, %i, \"%s\", <unused>", D, dirfd, name);
+
+ path = _GD_MakeFullPath(D, dirfd, name);
+ ret = unlink(path);
+ free(path);
+
+ dreturn("%i", ret);
+ return ret;
+}
+#endif
+
/* Non-threadsafe version of strerror_r */
#ifndef HAVE_STRERROR_R
int strerror_r(int errnum, char *buf, size_t buflen)
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-05-03 20:08:44 UTC (rev 585)
+++ trunk/getdata/src/del.c 2011-05-05 15:24:29 UTC (rev 586)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V....
[truncated message content] |
|
From: <ket...@us...> - 2011-05-05 15:53:21
|
Revision: 587
http://getdata.svn.sourceforge.net/getdata/?rev=587&view=rev
Author: ketiltrout
Date: 2011-05-05 15:53:15 +0000 (Thu, 05 May 2011)
Log Message:
-----------
Handle missing fdopendir. Perl tweaks.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/bindings/perl/test/Makefile.am
trunk/getdata/configure.ac
trunk/getdata/src/internal.h
trunk/getdata/src/open.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-05-05 15:24:29 UTC (rev 586)
+++ trunk/getdata/ChangeLog 2011-05-05 15:53:15 UTC (rev 587)
@@ -1,3 +1,6 @@
+2011-05-05 D. V. Wiebe <ge...@ke...> svn:587
+ * src/open.c (_GD_CreateDirfile): Handle missing fdopendir.
+
2011-05-05 D. V. Wiebe <ge...@ke...> svn:586
* src/internal.h: The encoding framework has changed: open, touch, size,
move, unlink, and temp now all take the dirfd. Furthermore, to allow
Modified: trunk/getdata/bindings/perl/GetData.xs
===================================================================
--- trunk/getdata/bindings/perl/GetData.xs 2011-05-05 15:24:29 UTC (rev 586)
+++ trunk/getdata/bindings/perl/GetData.xs 2011-05-05 15:53:15 UTC (rev 587)
@@ -911,8 +911,8 @@
ALIAS:
GetData::Dirfile::get_carray = 1
PPCODE:
- dtrace("%p, \"%s\", %03x; %lu", dirfile, field_code, return_type,
- GIMME_V);
+ dtrace("%p, \"%s\", %03x; %i", dirfile, field_code, return_type,
+ (int)GIMME_V);
size_t len = gd_carray_len(dirfile, field_code);
data_out = safemalloc(GD_SIZE(return_type) * len);
gd_get_carray(dirfile, field_code, return_type, data_out);
@@ -940,8 +940,8 @@
ALIAS:
GetData::Dirfile::get_carray_slice = 1
PPCODE:
- dtrace("%p, \"%s\", %u, %zi, %03x; %lu", dirfile, field_code, return_type,
- start, len, GIMME_V);
+ dtrace("%p, \"%s\", %u, %zi, %03x; %i", dirfile, field_code, start, len,
+ return_type, (int)GIMME_V);
data_out = safemalloc(GD_SIZE(return_type) * len);
gd_get_carray_slice(dirfile, field_code, start, len, return_type, data_out);
@@ -1007,7 +1007,7 @@
ALIAS:
GetData::Dirfile::constants = 1
PPCODE:
- dtrace("%p, %03x; %lu", dirfile, return_type, GIMME_V);
+ dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
int len = gd_nfields_by_type(dirfile, GD_CONST_ENTRY);
data_out = gd_constants(dirfile, return_type);
@@ -1030,7 +1030,7 @@
ALIAS:
GetData::Dirfile::carrays = 1
PPCODE:
- dtrace("%p, %03x; %lu", dirfile, return_type, GIMME_V);
+ dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
I32 i, len = (I32)gd_nfields_by_type(dirfile, GD_CARRAY_ENTRY);
data_out = gd_carrays(dirfile, return_type);
@@ -1061,7 +1061,7 @@
ALIAS:
GetData::Dirfile::entry = 1
PPCODE:
- dtrace("%p, \"%s\"; %lu", dirfile, field_code, GIMME_V);
+ dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
if (GIMME_V == G_ARRAY) {
gd_entry_t E;
@@ -1219,7 +1219,7 @@
ALIAS:
GetData::Dirfile::mconstants = 1
PPCODE:
- dtrace("%p, %03x; %lu", dirfile, return_type, GIMME_V);
+ dtrace("%p, %03x; %i", dirfile, return_type, (int)GIMME_V);
int len = gd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY);
data_out = gd_mconstants(dirfile, parent, return_type);
@@ -1340,9 +1340,9 @@
ALIAS:
GetData::Dirfile::getdata = 1
PPCODE:
- dtrace("%p, \"%s\", %lli, %lli, %zi, %zi, %03x; %lu", dirfile, field_code,
+ dtrace("%p, \"%s\", %lli, %lli, %zi, %zi, %03x; %i", dirfile, field_code,
(long long)first_frame, (long long)first_samp, num_frames, num_samp,
- return_type, GIMME_V);
+ return_type, (int)GIMME_V);
if (num_frames) {
spf = gd_spf(dirfile, field_code);
@@ -1375,7 +1375,7 @@
ALIAS:
GetData::Dirfile::field_list = 1
PPCODE:
- dtrace("%p; %lu", dirfile, GIMME_V);
+ dtrace("%p; %i", dirfile, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1405,7 +1405,7 @@
ALIAS:
GetData::Dirfile::field_list_by_type = 1
PPCODE:
- dtrace("%p, %i; %lu", dirfile, type, GIMME_V);
+ dtrace("%p, %i; %i", dirfile, type, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1434,7 +1434,7 @@
ALIAS:
GetData::Dirfile::vector_list = 1
PPCODE:
- dtrace("%p; %lu", dirfile, GIMME_V);
+ dtrace("%p; %i", dirfile, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1463,7 +1463,7 @@
ALIAS:
GetData::Dirfile::strings = 1
PPCODE:
- dtrace("%p; %lu", dirfile, GIMME_V);
+ dtrace("%p; %i", dirfile, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1493,7 +1493,7 @@
ALIAS:
GetData::Dirfile::mfield_list = 1
PPCODE:
- dtrace("%p, \"%s\"; %lu", dirfile, field_code, GIMME_V);
+ dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1524,7 +1524,7 @@
ALIAS:
GetData::Dirfile::mfield_list_by_type = 1
PPCODE:
- dtrace("%p, \"%s\", %i; %lu", dirfile, parent, type, GIMME_V);
+ dtrace("%p, \"%s\", %i; %i", dirfile, parent, type, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1554,7 +1554,7 @@
ALIAS:
GetData::Dirfile::mvector_list = 1
PPCODE:
- dtrace("%p; %lu", dirfile, GIMME_V);
+ dtrace("%p; %i", dirfile, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1584,7 +1584,7 @@
ALIAS:
GetData::Dirfile::mstrings = 1
PPCODE:
- dtrace("%p, \"%s\"; %lu", dirfile, field_code, GIMME_V);
+ dtrace("%p, \"%s\"; %i", dirfile, field_code, (int)GIMME_V);
/* in array context, return the field list, otherwise return nfields */
if (GIMME_V == G_ARRAY) {
@@ -1617,7 +1617,7 @@
ALIAS:
GetData::Dirfile::put_carray = 1
CODE:
- dtrace("%p, \"%s\", %p, ...[%li]", dirfile, field_code, d, items - 3);
+ dtrace("%p, \"%s\", %p, ...[%li]", dirfile, field_code, d, (long)items - 3);
din = gdp_convert_data(d, items, ax, 2, gdp_package, "put_carray");
@@ -1645,7 +1645,7 @@
GetData::Dirfile::put_carray_slice = 1
CODE:
dtrace("%p, \"%s\", %lli, %p, ...[%li]", dirfile, field_code,
- (long long)start, d, items - 4);
+ (long long)start, d, (long)items - 4);
din = gdp_convert_data(d, items, ax, 3, gdp_package, "put_carray");
@@ -1675,7 +1675,7 @@
GetData::Dirfile::add_carray = 1
CODE:
dtrace("%p, \"%s\", %03x, %i, %p, ...[%li]", dirfile, field_code,
- const_type, fragment_index, d, items - 5);
+ const_type, fragment_index, d, (long)items - 5);
din = gdp_convert_data(d, items, ax, 4, gdp_package, "put_carray");
@@ -1705,7 +1705,7 @@
GetData::Dirfile::madd_carray = 1
CODE:
dtrace("%p, \"%s\", \"%s\", %03x, %p, ...[%li]", dirfile, parent,
- field_code, const_type, d, items - 5);
+ field_code, const_type, d, (long)items - 5);
din = gdp_convert_data(d, items, ax, 4, gdp_package, "put_carray");
@@ -1735,7 +1735,7 @@
GetData::Dirfile::putdata = 1
CODE:
dtrace("%p, \"%s\", %lli, %lli, %p, ...[%li]", dirfile, field_code,
- (long long)first_frame, (long long)first_sample, d, items - 5);
+ (long long)first_frame, (long long)first_sample, d, (long)items - 5);
din = gdp_convert_data(d, items, ax, 4, gdp_package, "putdata");
@@ -1843,7 +1843,7 @@
ALIAS:
GetData::Dirfile::fragments = 1
PPCODE:
- dtrace("%p; %lu", dirfile, GIMME_V);
+ dtrace("%p; %i", dirfile, (int)GIMME_V);
nf = gd_nfragments(dirfile);
Modified: trunk/getdata/bindings/perl/test/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/test/Makefile.am 2011-05-05 15:24:29 UTC (rev 586)
+++ trunk/getdata/bindings/perl/test/Makefile.am 2011-05-05 15:53:15 UTC (rev 587)
@@ -20,8 +20,7 @@
#
AUTOMAKE_OPTIONS = foreign
-TESTS_ENVIRONMENT=${PERL} -I.. -I../.libs
-#TESTS_ENVIRONMENT=valgrind --leak-check=full --track-origins=yes ${PERL} -I.. -I../.libs
+TESTS_ENVIRONMENT=${DL_LIBRARY_PATH}=../.libs:${${DL_LIBRARY_PATH}}:../../../src/.libs ${PERL} -I.. -I../.libs
perlTESTS=callback.pl big_test.pl
TESTS=$(addprefix ${srcdir}/,$(perlTESTS))
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-05-05 15:24:29 UTC (rev 586)
+++ trunk/getdata/configure.ac 2011-05-05 15:53:15 UTC (rev 587)
@@ -239,7 +239,7 @@
esac
])
-AC_MSG_CHECKING([whether to include the Python bindings])
+AC_MSG_CHECKING([whether to include the Perl bindings])
if test "x$disable_c99" = "xyes"; then
make_perlbindings="no";
AC_MSG_RESULT([no (requires C99 compiler)])
@@ -460,17 +460,21 @@
GD_LANG_F77_COMPILER_INTEL
fi
+dnl F77 stuff
+if test "x$make_f77bindings" != "xno"; then
+ AC_F77_WRAPPERS
+ if test "x$ac_cv_f77_mangling" == "xunknown"; then
+ make_f77bindings=no
+ make_f95bindings=no
+ fi
+fi
+
if test "x$make_f95bindings" != "xno"; then
GD_PROG_FC_WALL
GD_PROG_FC_WEXTRA
GD_LANG_FC_COMPILER_INTEL
fi
-dnl F77 stuff
-if test "x$make_f77bindings" != "xno"; then
- AC_F77_WRAPPERS
-fi
-
AC_MSG_CHECKING([if we're linking against the Microsoft C Run-Time]) #'
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __MSVCRT__
choke me
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-05-05 15:24:29 UTC (rev 586)
+++ trunk/getdata/src/internal.h 2011-05-05 15:53:15 UTC (rev 587)
@@ -703,7 +703,7 @@
#define _GD_MakeFullPath gd_MakeFullPath
char *_GD_MakeFullPath(const DIRFILE *D, int dirfd, const char *name);
int gd_MakeTempFile(const DIRFILE*, int, char*);
-int _GD_MissingFramework(unsigned long encoding, unsigned int funcs);
+int _GD_MissingFramework(int encoding, unsigned int funcs);
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);
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2011-05-05 15:24:29 UTC (rev 586)
+++ trunk/getdata/src/open.c 2011-05-05 15:53:15 UTC (rev 587)
@@ -124,13 +124,19 @@
return NULL;
}
+#ifdef HAVE_FDOPENDIR
/* crawl the directory, and delete everything */
if ((fd = dup(dirfd)) == -1) {
_GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, filedir, errno, NULL);
dreturn("%p", NULL);
return NULL;
}
- if ((dir = fdopendir(fd)) == NULL) {
+ dir = fdopendir(fd);
+#else
+ dir = opendir(filedir);
+#endif
+
+ if (dir == NULL) {
_GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, filedir, errno, NULL);
dreturn("%p", NULL);
return NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-06-14 01:42:45
|
Revision: 588
http://getdata.svn.sourceforge.net/getdata/?rev=588&view=rev
Author: ketiltrout
Date: 2011-06-14 01:42:39 +0000 (Tue, 14 Jun 2011)
Log Message:
-----------
Fix perl CFLAGS computation. Fix GD_E_CREAT_EXCL error message.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/m4/perl.m4
trunk/getdata/src/errors.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-05-05 15:53:15 UTC (rev 587)
+++ trunk/getdata/ChangeLog 2011-06-14 01:42:39 UTC (rev 588)
@@ -1,3 +1,8 @@
+2011-06-13 D. V. Wiebe <ge...@ke...> svn:588
+ * src/errors.c: Don't append strerror to the GD_E_CREAT_EXCL message.
+
+ * m4/perl.m4: Fix perl CFLAGS.
+
2011-05-05 D. V. Wiebe <ge...@ke...> svn:587
* src/open.c (_GD_CreateDirfile): Handle missing fdopendir.
Modified: trunk/getdata/m4/perl.m4
===================================================================
--- trunk/getdata/m4/perl.m4 2011-05-05 15:53:15 UTC (rev 587)
+++ trunk/getdata/m4/perl.m4 2011-06-14 01:42:39 UTC (rev 588)
@@ -53,7 +53,8 @@
[
first_perl=5.8.0
perl_prog_list="perl perl5 \
-perl5.12 perl5.10 perl5.8 \
+perl5.14 perl5.12 perl5.10 perl5.8 \
+perl5.14.0 \
perl5.12.3 perl5.12.2 perl5.12.1 perl5.12.0 \
perl5.10.1 perl5.10.0 \
perl5.8.9 perl5.8.8 perl5.8.7 perl5.8.6 perl5.8.5 perl5.8.4 perl5.8.3 \
@@ -114,15 +115,18 @@
dnl calculate build flags
GD_PERL_CONFIG([perl_archdir], [archlibexp])
PERL_CPPFLAGS="-I${perl_archdir}/CORE"
- GD_PERL_CONFIG([PERL_CFLAGS], [cccdlflags])
- GD_PERL_CONFIG([PERL_LDFLAGS], [lddlflags])
-
AC_MSG_CHECKING([Perl includes])
AC_MSG_RESULT([$PERL_CPPFLAGS])
AC_SUBST([PERL_CPPFLAGS])
+
+ GD_PERL_CONFIG([PERL_CCCDLFLAGS], [cccdlflags])
+ GD_PERL_CONFIG([PERL_CCFLAGS], [ccflags])
+ PERL_CFLAGS="${PERL_CCCDLFLAGS} ${PERL_CCFLAGS}"
AC_MSG_CHECKING([Perl compiler flags])
AC_MSG_RESULT([$PERL_CFLAGS])
AC_SUBST([PERL_CFLAGS])
+
+ GD_PERL_CONFIG([PERL_LDFLAGS], [lddlflags])
AC_MSG_CHECKING([Perl linker flags])
AC_MSG_RESULT([$PERL_LDFLAGS])
AC_SUBST([PERL_LDFLAGS])
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-05-05 15:53:15 UTC (rev 587)
+++ trunk/getdata/src/errors.c 2011-06-14 01:42:39 UTC (rev 588)
@@ -82,7 +82,7 @@
{ GD_E_CREAT, GD_E_CREAT_DIR, "Unable to create directory {2}: ", 1 },
{ GD_E_CREAT, GD_E_CREAT_FORMAT, "Unable to create format file {2}: ", 1 },
{ GD_E_CREAT, GD_E_CREAT_EXCL, "Unable to create dirfile {2}: already exists",
- 1 },
+ 0 },
/* GD_E_BAD_CODE: 4 = field code */
{ GD_E_BAD_CODE, 0, "Field not found: {4}", 0 },
/* GD_E_BAD_TYPE: 1 = data type */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-07-17 03:57:30
|
Revision: 590
http://getdata.svn.sourceforge.net/getdata/?rev=590&view=rev
Author: ketiltrout
Date: 2011-07-17 03:57:23 +0000 (Sun, 17 Jul 2011)
Log Message:
-----------
Win32: No symlinks.
Modified Paths:
--------------
trunk/getdata/configure.ac
trunk/getdata/src/compat.c
trunk/getdata/src/internal.h
trunk/getdata/src/open.c
trunk/getdata/src/raw.c
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-06-27 22:46:00 UTC (rev 589)
+++ trunk/getdata/configure.ac 2011-07-17 03:57:23 UTC (rev 590)
@@ -518,9 +518,9 @@
dnl functions
AC_CHECK_FUNCS([_commit fchmod _fdopen fdopendir fseeko fseeko64 _fstat \
fstatat fstatat64 fsync ftello ftello64 getcwd _getcwd \
- getdelim gmtime_r _lseeki64 _mkdir nan _open openat _read \
- renameat _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
- _strtoui64 strtoull _unlink unlinkat _write])
+ getdelim gmtime_r _lseeki64 lstat _mkdir nan _open openat \
+ _read renameat _rmdir _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/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2011-06-27 22:46:00 UTC (rev 589)
+++ trunk/getdata/src/compat.c 2011-07-17 03:57:23 UTC (rev 590)
@@ -30,6 +30,10 @@
#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)
@@ -161,7 +165,7 @@
char *ptr;
dtrace("%i, %p, %zu", errnum, buf, buflen);
-
+
ptr = strerror(errnum);
strncpy(buf, ptr, buflen);
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-06-27 22:46:00 UTC (rev 589)
+++ trunk/getdata/src/internal.h 2011-07-17 03:57:23 UTC (rev 590)
@@ -30,6 +30,7 @@
#include <string.h>
#include <errno.h>
#include <fcntl.h>
+#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -218,6 +219,10 @@
# endif
#endif
+#ifndef HAVE_LSTAT
+# define lstat stat
+#endif
+
#ifdef HAVE__STRTOI64
# define gd_strtoll _strtoi64
#elif defined(HAVE_STRTOLL)
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2011-06-27 22:46:00 UTC (rev 589)
+++ trunk/getdata/src/open.c 2011-07-17 03:57:23 UTC (rev 590)
@@ -155,7 +155,12 @@
}
/* only delete regular files */
- if (S_ISREG(statbuf.st_mode) || S_ISLNK(statbuf.st_mode)) {
+ if (S_ISREG(statbuf.st_mode)
+#ifdef S_ISLNK
+ || S_ISLNK(statbuf.st_mode)
+#endif
+ )
+ {
if (gd_UnlinkAt(D, dirfd, lamb->d_name, 0)) {
char *name = (char *)malloc(strlen(filedir) + strlen(lamb->d_name)
+ 2);
Modified: trunk/getdata/src/raw.c
===================================================================
--- trunk/getdata/src/raw.c 2011-06-27 22:46:00 UTC (rev 589)
+++ trunk/getdata/src/raw.c 2011-07-17 03:57:23 UTC (rev 590)
@@ -151,7 +151,9 @@
if (!gd_RenameAt(file->D, dirfd1, file[1].name, dirfd0, file[0].name)) {
int fd = gd_OpenAt(file->D, dirfd0, file[0].name, O_RDONLY, 0666);
+#ifdef HAVE_FCHMOD
fchmod(fd, mode);
+#endif
close(fd);
free(file[1].name);
file[1].name = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-07-18 20:35:01
|
Revision: 591
http://getdata.svn.sourceforge.net/getdata/?rev=591&view=rev
Author: ketiltrout
Date: 2011-07-18 20:34:48 +0000 (Mon, 18 Jul 2011)
Log Message:
-----------
Build perl bindings via ExtUtils.
Modified Paths:
--------------
trunk/getdata/bindings/perl/GetData.pm.in
trunk/getdata/bindings/perl/GetData.xs
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/configure.ac
trunk/getdata/m4/perl.m4
Added Paths:
-----------
trunk/getdata/bindings/perl/Makefile.PL.in
trunk/getdata/bindings/perl/funclist.pl
trunk/getdata/bindings/perl/t/
trunk/getdata/bindings/perl/t/big_test.t
trunk/getdata/bindings/perl/t/callback.t
Removed Paths:
-------------
trunk/getdata/bindings/perl/t/Makefile.am
trunk/getdata/bindings/perl/t/big_test.pl
trunk/getdata/bindings/perl/t/callback.pl
trunk/getdata/bindings/perl/test/
Property Changed:
----------------
trunk/getdata/bindings/perl/
Property changes on: trunk/getdata/bindings/perl
___________________________________________________________________
Modified: svn:ignore
- simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
funclist.sed
deps
make_parameters.sed
Makefile
.deps
.libs
+ simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
Modified: trunk/getdata/bindings/perl/GetData.pm.in
===================================================================
--- trunk/getdata/bindings/perl/GetData.pm.in 2011-07-17 03:57:23 UTC (rev 590)
+++ trunk/getdata/bindings/perl/GetData.pm.in 2011-07-18 20:34:48 UTC (rev 591)
@@ -113,6 +113,8 @@
the caller should check GetData::error() on the returned dirfile to test for
success.
+=back
+
=head1 COPYRIGHT
Copyright (C) 2011 D. V. Wiebe
Modified: trunk/getdata/bindings/perl/GetData.xs
===================================================================
--- trunk/getdata/bindings/perl/GetData.xs 2011-07-17 03:57:23 UTC (rev 590)
+++ trunk/getdata/bindings/perl/GetData.xs 2011-07-18 20:34:48 UTC (rev 591)
@@ -4,6 +4,7 @@
#undef _BSD_SOURCE
#undef _POSIX_SOURCE
#undef _SVID_SOURCE
+#undef VERSION
#include "../../src/internal.h"
/* Perl 5.8.9 and earlier don't provide hv_fetchs */
Added: trunk/getdata/bindings/perl/Makefile.PL.in
===================================================================
--- trunk/getdata/bindings/perl/Makefile.PL.in (rev 0)
+++ trunk/getdata/bindings/perl/Makefile.PL.in 2011-07-18 20:34:48 UTC (rev 591)
@@ -0,0 +1,16 @@
+use 5.00800;
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ ABSTRACT_FROM => "GetData.pm",
+ AUTHOR => "The GetData Progject <@PACKAGE_BUGREPORT@>",
+ C => [ qw(GetData.c) ],
+ DEFINE => "@DEFS@",
+ FIRST_MAKEFILE => "perl.mk",
+ INC => '-I. -I@top_builddir@/src',
+ LIBS => ['-L@top_builddir@/src/.libs/ -lgetdata'],
+ NAME => "GetData",
+ PM => { "GetData.pm" => "\$(INST_LIBDIR)/GetData.pm" },
+ PREREQ_FATAL => 1,
+ PREREQ_PM => { "Math::Complex" => 1.34 },
+ VERSION_FROM => "GetData.pm",
+);
Modified: trunk/getdata/bindings/perl/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/Makefile.am 2011-07-17 03:57:23 UTC (rev 590)
+++ trunk/getdata/bindings/perl/Makefile.am 2011-07-18 20:34:48 UTC (rev 591)
@@ -20,50 +20,33 @@
#
AUTOMAKE_OPTIONS = foreign
-if CC_WALL
-WALL=-Wall
-endif
-
-if GETDATA_DEBUG
-DEBUG_C = ../../src/debug.c
-endif
-
-SUBDIRS=test
-
-perl_LTLIBRARIES=GetData.la
-perl_SCRIPTS=GetData.pm
-
-BUILT_SOURCES=simple_funcs.xs GetData.pm GetData.c
-AM_CFLAGS=${WALL} ${PERL_CFLAGS}
-AM_CPPFLAGS=${PERL_CPPFLAGS}
-
-GetData_la_LDFLAGS = -module -avoid-version
-GetData_la_LIBADD = ${PERL_LDLFLAGS} ../../src/libgetdata.la
-nodist_GetData_la_SOURCES = GetData.c ${DEBUG_C}
-
-EXTRA_DIST=GetData.xs
-
simple_funcs.xs: $(srcdir)/simple_funcs.xsin $(srcdir)/simple_funcs.pl
$(PERL) simple_funcs.pl $< > $@
-funclist.sed: GetData.c
- $(PERL) -ne 'BEGIN { print "s/\@FUNCLIST@/" }' \
- -e 'print "$$1 " if /^XS\(XS_GetData_([a-z].*)\);/;' \
- -e 'END { print "/\n" }' $< > $@
-
make_parameters.sed: ../make_parameters ../../src/getdata.h
../make_parameters P > $@
../make_parameters: $(srcdir)/../make_parameters.c
cd .. && ${MAKE} make_parameters
-GetData.pm: $(srcdir)/GetData.pm.in make_parameters.sed funclist.sed
+GetData.pm: $(srcdir)/GetData.pm.in make_parameters.sed funclist.pl \
+ GetData.xs simple_funcs.xs
rm -f $@
- $(SED) -f make_parameters.sed $< | $(SED) -f funclist.sed > $@
+ $(SED) -f make_parameters.sed $< | \
+ $(PERL) funclist.pl GetData.xs simple_funcs.xs > $@
chmod a-w $@
-GetData.c: GetData.xs simple_funcs.xs typemap
- $(XSUBPP) -typemap $(srcdir)/typemap $< > $@
+all-local: perl.mk
+ $(MAKE) -f perl.mk
-clean-local:
- rm -f $(BUILT_SOURCES) make_parameters.sed funclist.sed
+perl.mk: Makefile.PL GetData.pm GetData.xs simple_funcs.xs typemap
+ perl $<
+
+clean-local:
+ $(MAKE) -f perl.mk clean
+ rm -f $(BUILT_SOURCES) make_parameters.sed perl.mk.old
+
+test testdb:
+ $(MAKE) -f perl.mk $@
+
+.PHONY: test
Added: trunk/getdata/bindings/perl/funclist.pl
===================================================================
--- trunk/getdata/bindings/perl/funclist.pl (rev 0)
+++ trunk/getdata/bindings/perl/funclist.pl 2011-07-18 20:34:48 UTC (rev 591)
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+my $preamble = 1;
+
+# Generate the list
+my @funclist;
+for (<>) {
+ $preamble = 0 if (/^MODULE/);
+ next if $preamble;
+ next unless /^(\w*)\(/;
+ push @funclist, $1;
+}
+my $funclist = join(' ', sort @funclist);
+
+for (<STDIN>) {
+ s/\@FUNCLIST@/$funclist/g;
+ print $_;
+}
Deleted: trunk/getdata/bindings/perl/t/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/test/Makefile.am 2011-07-17 03:57:23 UTC (rev 590)
+++ trunk/getdata/bindings/perl/t/Makefile.am 2011-07-18 20:34:48 UTC (rev 591)
@@ -1,38 +0,0 @@
-# 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
-#
-AUTOMAKE_OPTIONS = foreign
-
-TESTS_ENVIRONMENT=${DL_LIBRARY_PATH}=../.libs:${${DL_LIBRARY_PATH}}:../../../src/.libs ${PERL} -I.. -I../.libs
-perlTESTS=callback.pl big_test.pl
-TESTS=$(addprefix ${srcdir}/,$(perlTESTS))
-
-EXTRA_DIST=${perlTESTS}
-
-# clean up after the tests
-check-local: check-TESTS
- $(MAKE) getdata-clean-dirs
-
-getdata-clean-dirs:
- echo rm -rf dirfile
-
-clean-local:
- $(MAKE) getdata-clean-dirs
- rm -rf *~
Deleted: trunk/getdata/bindings/perl/t/big_test.pl
===================================================================
--- trunk/getdata/bindings/perl/test/big_test.pl 2011-07-17 03:57:23 UTC (rev 590)
+++ trunk/getdata/bindings/perl/t/big_test.pl 2011-07-18 20:34:48 UTC (rev 591)
@@ -1,1459 +0,0 @@
-#!/usr/bin/perl -w
-# 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
-
-use GetData;
-use Math::Complex;
-use strict;
-
-my $ne = 0;
-my ($s, @a, %h);
-
-sub CheckError {
- my $e = $_->error;
- if ($e != $_[1]) {
- print "e[$_[0]] = $e, expected $_[1]\n";
- $ne++;
- }
-}
-
-sub CheckError2 {
- my $e = $_->error;
- if ($e != $_[2]) {
- print "e[$_[0],$_[1]] = $e, expected $_[2]\n";
- $ne++;
- }
-}
-
-sub CheckArray {
- my $i;
- if ($#{$_[1]} != $#_ - 2) {
- print "a[$_[0]]: ", 1 + $#{$_[1]}, " elements, expected ", $#_ - 1, "\n";
- $ne++;
- }
- for $i (0 .. $#_ - 2) {
- next unless (defined ${$_[1]}[$i] or defined $_[$i + 2]);
- if (${$_[1]}[$i] != $_[$i + 2]) {
- print "a($i)[$_[0]] = ${$_[1]}[$i], expected ", $_[$i + 2], "\n";
- $ne++;
- }
- }
-}
-
-sub CheckArray2 {
- my $i;
- if ($#{$_[2]} != $#_ - 3) {
- print "a[$_[0],$_[1]]: ", 1 + $#{$_[2]}, " elements, expected ", $#_ - 2,
- "\n";
- $ne++;
- }
- for $i (0 .. $#_ - 3) {
- next unless (defined ${$_[2]}[$i] or defined $_[$i + 3]);
- if (${$_[2]}[$i] != $_[$i + 3]) {
- print "a($i)[$_[0],$_[1]] = ${$_[2]}[$i], expected ", $_[$i + 3], "\n";
- $ne++;
- }
- }
-}
-
-sub CheckSArray {
- my $i;
- if ($#{$_[1]} != $#_ - 2) {
- print "a[$_[0]]: ", 1 + $#{$_[1]}, " elements, expected ", $#_ - 1, "\n";
- $ne++;
- }
- for $i (0 .. $#_ - 2) {
- next unless (defined ${$_[1]}[$i] or defined $_[$i + 2]);
- if (${$_[1]}[$i] ne $_[$i + 2]) {
- print "n($i)[$_[0]] = \"${$_[1]}[$i]\", expected \"", $_[$i + 2], "\"\n";
- $ne++;
- }
- }
-}
-
-sub CheckSArray2 {
- my $i;
- if ($#{$_[2]} != $#_ - 3) {
- print "a[$_[0],$_[1]]: ", 1 + $#{$_[2]}, " elements, expected ", $#_ - 2,
- "\n";
- $ne++;
- }
- for $i (0 .. $#_ - 3) {
- next unless (defined ${$_[2]}[$i] or defined $_[$i + 3]);
- if (${$_[2]}[$i] ne $_[$i + 3]) {
- print "n($i)[$_[0],$_[1]] = \"${$_[2]}[$i]\", expected \"", $_[$i + 3],
- "\"\n";
- $ne++;
- }
- }
-}
-
-sub CheckNum {
- return unless (defined $_[1] or defined $_[2]);
- if ($_[1] != $_[2]) {
- print "n[$_[0]] = $_[1], expected $_[2]\n";
- $ne++;
- }
-}
-
-sub CheckNum2 {
- return unless (defined $_[2] or defined $_[3]);
- if ($_[2] != $_[3]) {
- print "n[$_[0],$_[1]] = $_[2], expected $_[3]\n";
- $ne++;
- }
-}
-
-sub CheckString {
- if ($_[1] ne $_[2]) {
- print "s[$_[0]] = \"$_[1]\", expected \"$_[2]\"\n";
- $ne++;
- }
-}
-
-sub CheckString2 {
- if ($_[2] ne $_[3]) {
- print "s[$_[0],$_[1]] = \"$_[2]\", expected \"$_[3]\"\n";
- $ne++;
- }
-}
-
-sub CheckOK { &CheckError($_[0], 0) }
-sub CheckOK2 { &CheckError2(@_, 0) }
-
-my $nfields = 14;
-my @fields = (qw(INDEX bit carray const data div lincom linterp mult phase
-polynom recip sbit string));
-
-#create the dirfile
-system "rm -rf dirfile" if (-e "dirfile" and not -d "dirfile");
-(mkdir "dirfile" or die) unless -e "dirfile";
-
-open GLOB, ">dirfile/data" or die;
-print GLOB map chr, 1 .. 81;
-
-open GLOB, ">dirfile/format" or die;
-print GLOB <<EOF
-/ENDIAN little
-data RAW INT8 8
-lincom LINCOM data 1.1 2.2 INDEX 2.2 3.3;4.4 linterp const const
-/META data mstr STRING "This is a string constant."
-/META data mconst CONST COMPLEX128 3.3;4.4
-/META data mlut LINTERP DATA ./lut
-const CONST FLOAT64 5.5
-carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6
-linterp LINTERP data /look/up/file
-polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const
-bit BIT data 3 4
-sbit SBIT data 5 6
-mult MULTIPLY data sbit
-div DIVIDE mult bit
-recip RECIP div 6.5;4.3
-phase PHASE data 11
-string STRING \"Zaphod Beeblebrox\"
-EOF
- or die;
-
-open GLOB, ">dirfile/form2" or die;
-print GLOB "const2 CONST INT8 -19\n" or die;
-close GLOB;
-
-# 0: error check
-$_ = &GetData::open("x", $GetData::RDONLY);
-CheckError(0, $GetData::E_OPEN);
-
-# 1: open check
-$_ = &GetData::open("dirfile", $GetData::RDWR);
-CheckOK(1);
-
-# 2: getdata (INT8) check
-$s = $_->getdata("data", 5, 0, 1, 0, $GetData::INT8);
-CheckOK(2);
-CheckString(2, $s, join "", map chr, 41 .. 48);
-
-# 102: getdata (unpacked) check
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::INT16);
-CheckOK(102);
-CheckArray(102, \@a, 41 .. 48);
-
-# 108: getdata (complex unpacked) check
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::COMPLEX128);
-CheckOK(108);
-CheckArray(108, \@a, 41 .. 48);
-
-# 3: constant (INT8) check
-$s = $_->get_constant("const", $GetData::INT8);
-CheckOK(3);
-CheckNum(3, $s, 5);
-
-# 116: constant (COMPLEX128) check
-$s = $_->get_constant("const", $GetData::COMPLEX128);
-CheckOK(116);
-CheckNum(116, $s, 5.5);
-
-# 6: nfields check
-$s = $_->field_list;
-CheckOK(6);
-CheckNum(6, $s, $nfields);
-
-# 8: field_list check
-@a = $_->field_list;
-CheckOK(8);
-CheckSArray(8, \@a, @fields);
-
-# 9: nmfields check
-$s = $_->mfield_list("data");
-CheckOK(9);
-CheckNum(9, $s, 3);
-
-# 10: mfield_list check
-@a = $_->mfield_list("data");
-CheckOK(10);
-CheckSArray(10, \@a, qw(mstr mconst mlut));
-
-# 11: nframes check
-$s = $_->nframes;
-CheckOK(11);
-CheckNum(11, $s, 10);
-
-# 12: spf check
-$s = $_->spf("data");
-CheckOK(12);
-CheckNum(12, $s, 8);
-
-# 13: putdata (packed) check
-$s = $_->putdata("data", 5, 1, $GetData::UINT8, "\15\16\17\20");
-CheckOK2(13,1);
-CheckNum(13,$s,4);
-
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
-CheckOK2(13,2);
-CheckArray(13, \@a, 41, 015, 016, 017, 020, 46, 47, 48);
-
-# 118: putdata (typed ref) check
-$s = $_->putdata("data", 5, 1, $GetData::UINT16, [ 23, 24, 25, 26 ]);
-CheckOK2(118,1);
-CheckNum(118,$s,4);
-
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
-CheckOK2(118,2);
-CheckArray(118, \@a, 41, 23, 24, 25, 26, 46, 47, 48);
-
-# 120: putdata (untyped ref) check
-$s = $_->putdata("data", 5, 1, [ 33, 34, 35, 36 ]);
-CheckOK2(120,1);
-CheckNum(120,$s,4);
-
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
-CheckOK2(120,2);
-CheckArray(120, \@a, 41, 33, 34, 35, 36, 46, 47, 48);
-
-# 122: putdata (simple list) check
-$s = $_->putdata("data", 5, 1, 23., 24., 25., 26.);
-CheckOK2(122,1);
-CheckNum(122,$s,4);
-
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
-CheckOK2(122,2);
-CheckArray(122, \@a, 41, 23, 24, 25, 26, 46, 47, 48);
-
-# 124: putdata (undef list) check
-$s = $_->putdata("data", 5, 1, undef, 13.+0*i, 14.+0*i, 15.+0*i, 16.+0*i);
-CheckOK2(124,1);
-CheckNum(124,$s,4);
-
-@a = $_->getdata("data", 5, 0, 1, 0, $GetData::UINT8);
-CheckOK2(124,2);
-CheckArray(124, \@a, 41, 13, 14, 15, 16, 46, 47, 48);
-
-# 14: error_string check
-$s = $_->getdata("x", 5, 0, 1, 0, $GetData::UINT8);
-CheckError(14,$GetData::E_BAD_CODE);
-CheckString(14, $_->error_string, "Field not found: x");
-
-# 15: get_entry check
-$s = $_->entry("data");
-CheckOK(15);
-CheckNum(15,$s,$GetData::RAW_ENTRY);
-
-# 16: get_entry check
-%h = $_->entry("data");
-CheckOK(16);
-CheckSArray2(16, 0, [ sort keys %h ],
- qw(data_type field field_type fragment_index scalar scalar_ind spf));
-CheckNum2(16, 1, $h{'data_type'}, $GetData::INT8);
-CheckString2(16, 2, $h{'field'}, "data");
-CheckNum2(16, 3, $h{'field_type'}, $GetData::RAW_ENTRY);
-CheckNum2(16, 4, $h{'fragment_index'}, 0);
-CheckSArray2(16, 6, $h{'scalar'}, undef);
-CheckArray2(16, 7, $h{'scalar_ind'}, undef);
-CheckNum2(16, 8, $h{'spf'}, 8);
-
-# 18: get_entry check
-%h = $_->entry("lincom");
-CheckOK(18);
-CheckSArray2(18, 1, [ sort keys %h ], qw(b field field_type),
- qw(fragment_index in_fields m n_fields scalar scalar_ind));
-CheckArray2(18, 2, $h{'b'}, 2.2, 3.3+4.4*i, 5.5);
-CheckString2(18, 5, $h{'field'}, "lincom");
-CheckNum2(18, 6, $h{'field_type'}, $GetData::LINCOM_ENTRY);
-CheckNum2(18, 7, $h{'fragment_index'}, 0);
-CheckSArray2(18, 8, $h{'in_fields'}, qw(data INDEX linterp));
-CheckArray2(18, 3, $h{'m'}, 1.1, 2.2, 5.5);
-CheckNum2(18, 10, $h{'n_fields'}, 3);
-CheckSArray2(18, 11, $h{'scalar'}, undef, undef, "const", undef, undef,
- "const");
-CheckArray2(18, 12, $h{'scalar_ind'}, undef, undef, -1, undef, undef, -1);
-
-# 20: get_entry check
-%h = $_->entry("polynom");
-CheckOK(20);
-CheckSArray2(20, 1, [ sort keys %h ], qw(a field field_type),
- qw(fragment_index in_field poly_ord scalar scalar_ind));
-CheckArray2(20, 2, $h{'a'}, 1.1, 2.2, 2.2, 3.3+4.4*i, 5.5, 5.5);
-CheckString2(20, 4, $h{'field'}, "polynom");
-CheckNum2(20, 5, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
-CheckNum2(20, 6, $h{'fragment_index'}, 0);
-CheckString2(20, 7, $h{'in_field'}, "data");
-CheckNum2(20, 8, $h{'poly_ord'}, 5);
-CheckSArray2(20, 9, $h{'scalar'}, undef, undef, undef, undef, "const", "const");
-CheckArray2(20, 10, $h{'scalar_ind'}, undef, undef, undef, undef, -1, -1);
-
-# 21: get_entry check
-%h = $_->entry("linterp");
-CheckOK(21);
-CheckSArray2(21, 0, [ sort keys %h ], qw(field field_type fragment_index),
- qw(in_field table));
-CheckString2(21, 1, $h{'field'}, "linterp");
-CheckNum2(21, 2, $h{'field_type'}, $GetData::LINTERP_ENTRY);
-CheckNum2(21, 3, $h{'fragment_index'}, 0);
-CheckString2(21, 4, $h{'in_field'}, "data");
-CheckString2(21, 5, $h{'table'}, "/look/up/file");
-
-# 22: get_entry check
-%h = $_->entry("bit");
-CheckOK(22);
-CheckSArray2(22, 0, [ sort keys %h ], qw(bitnum field field_type),
- qw(fragment_index in_field numbits scalar scalar_ind));
-CheckNum2(22, 1, $h{'bitnum'}, 3);
-CheckString2(22, 2, $h{'field'}, "bit");
-CheckNum2(22, 3, $h{'field_type'}, $GetData::BIT_ENTRY);
-CheckNum2(22, 4, $h{'fragment_index'}, 0);
-CheckString2(22, 5, $h{'in_field'}, "data");
-CheckNum2(22, 6, $h{'numbits'}, 4);
-CheckSArray2(22, 7, $h{'scalar'}, undef, undef);
-CheckArray2(22, 8, $h{'scalar_ind'}, undef, undef);
-
-# 23: get_entry check
-%h = $_->entry("sbit");
-CheckOK(23);
-CheckSArray2(23, 0, [ sort keys %h ], qw(bitnum field field_type),
- qw(fragment_index in_field numbits scalar scalar_ind));
-CheckNum2(23, 1, $h{'bitnum'}, 5);
-CheckString2(23, 2, $h{'field'}, "sbit");
-CheckNum2(23, 3, $h{'field_type'}, $GetData::SBIT_ENTRY);
-CheckNum2(23, 4, $h{'fragment_index'}, 0);
-CheckString2(23, 5, $h{'in_field'}, "data");
-CheckNum2(23, 6, $h{'numbits'}, 6);
-CheckSArray2(23, 7, $h{'scalar'}, undef, undef);
-CheckArray2(23, 8, $h{'scalar_ind'}, undef, undef);
-
-# 24: get_entry check
-%h = $_->entry("mult");
-CheckOK(24);
-CheckSArray2(24, 0, [ sort keys %h ], qw(field field_type fragment_index),
- "in_fields");
-CheckString2(24, 1, $h{'field'}, "mult");
-CheckNum2(24, 2, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
-CheckNum2(24, 3, $h{'fragment_index'}, 0);
-CheckSArray2(24, 4, $h{'in_fields'}, qw(data sbit));
-
-# 25: get_entry check
-%h = $_->entry("phase");
-CheckOK(25);
-CheckSArray2(25, 0, [ sort keys %h ], qw(field field_type fragment_index),
- qw(in_field scalar scalar_ind shift));
-CheckString2(25, 1, $h{'field'}, "phase");
-CheckNum2(25, 2, $h{'field_type'}, $GetData::PHASE_ENTRY);
-CheckNum2(25, 3, $h{'fragment_index'}, 0);
-CheckString2(25, 4, $h{'in_field'}, "data");
-CheckSArray2(25, 5, $h{'scalar'}, undef);
-CheckArray2(25, 6, $h{'scalar_ind'}, undef);
-CheckNum2(25, 7, $h{'shift'}, 11);
-
-# 26: get_entry check
-%h = $_->entry("const");
-CheckOK(26);
-CheckSArray2(26, 0, [ sort keys %h ], qw(const_type field field_type),
- "fragment_index");
-CheckNum2(26, 1, $h{'const_type'}, $GetData::FLOAT64);
-CheckString2(26, 2, $h{'field'}, "const");
-CheckNum2(26, 3, $h{'field_type'}, $GetData::CONST_ENTRY);
-CheckNum2(26, 4, $h{'fragment_index'}, 0);
-
-# 134: get_entry check
-%h = $_->entry("string");
-CheckOK(134);
-CheckSArray2(134, 0, [ sort keys %h ], qw(field field_type fragment_index));
-CheckString2(134, 1, $h{'field'}, "string");
-CheckNum2(134, 2, $h{'field_type'}, $GetData::STRING_ENTRY);
-CheckNum2(134, 3, $h{'fragment_index'}, 0);
-
-# 27: fragment_index check
-$s = $_->fragment_index("data");
-CheckOK(27);
-CheckNum(27, $s, 0);
-
-# 28: add_raw check
-$s = $_->add_raw("new1", $GetData::FLOAT64, 3);
-CheckOK2(28, 1);
-CheckNum2(28, 2, $s, 0);
-
-%h = $_->entry("new1");
-CheckOK2(28, 3);
-CheckNum2(28, 4, $h{'data_type'}, $GetData::FLOAT64);
-CheckString2(28, 5, $h{'field'}, "new1");
-CheckNum2(28, 6, $h{'field_type'}, $GetData::RAW_ENTRY);
-CheckNum2(28, 7, $h{'fragment_index'}, 0);
-CheckSArray2(28, 8, $h{'scalar'}, undef);
-CheckArray2(28, 9, $h{'scalar_ind'}, undef);
-CheckNum2(28, 10, $h{'spf'}, 3);
-
-#30: add_lincom check
-$s = $_->add_lincom("new3", 2, [ qw(in1 in2) ], [ 1.1+1.2*i, 1.4+1.5*i ],
- [ 1.3+1.4*i, 1.6+1.7*i ], 0);
-CheckOK2(30, 1);
-CheckNum2(30, 2, $s, 0);
-
-%h = $_->entry("new3");
-CheckOK2(30, 3);
-CheckArray2(30, 4, $h{'b'}, 1.3+1.4*i, 1.6+1.7*i);
-CheckString2(30, 6, $h{'field'}, "new3");
-CheckNum2(30, 7, $h{'field_type'}, $GetData::LINCOM_ENTRY);
-CheckNum2(30, 8, $h{'fragment_index'}, 0);
-CheckSArray2(30, 9, $h{'in_fields'}, qw(in1 in2));
-CheckArray2(30, 10, $h{'m'}, 1.1+1.2*i, 1.4+1.5*i);
-CheckNum2(30, 11, $h{'n_fields'}, 2);
-CheckSArray2(30, 12, $h{'scalar'}, undef, undef, undef, undef, undef);
-CheckArray2(30, 13, $h{'scalar_ind'}, undef, undef, undef, undef, undef);
-
-# 31: add_polynom
-$s = $_->add_polynom("new4", 3, "in1", [ 3.9, 4.8, 5.7, 6.6 ], 0);
-CheckOK2(31, 1);
-CheckNum2(31, 2, $s, 0);
-
-%h = $_->entry("new4");
-CheckOK2(31, 3);
-CheckArray2(31, 4, $h{'a'}, 3.9, 4.8, 5.7, 6.6);
-CheckString2(31, 7, $h{'field'}, "new4");
-CheckNum2(31, 8, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
-CheckNum2(31, 9, $h{'fragment_index'}, 0);
-CheckString2(31, 10, $h{'in_field'}, "in1");
-CheckNum2(31, 11, $h{'poly_ord'}, 3);
-CheckSArray2(31, 12, $h{'scalar'}, undef, undef, undef, undef);
-CheckArray2(31, 13, $h{'scalar_ind'}, undef, undef, undef, undef);
-
-# 33: add_linterp
-$s = $_->add_linterp("new6", "in", "./some/table");
-CheckOK2(33, 1);
-CheckNum2(33, 2, $s, 0);
-
-%h = $_->entry("new6");
-CheckOK2(33, 2);
-CheckString2(33, 3, $h{'field'}, "new6");
-CheckNum2(33, 4, $h{'field_type'}, $GetData::LINTERP_ENTRY);
-CheckNum2(33, 5, $h{'fragment_index'}, 0);
-CheckString2(33, 6, $h{'in_field'}, "in");
-CheckString2(33, 7, $h{'table'}, "./some/table");
-
-# 34: add_bit
-$s = $_->add_bit("new7", "in1", 11, 22);
-CheckOK2(34, 1);
-CheckNum2(34, 2, $s, 0);
-
-%h = $_->entry("new7");
-CheckOK(34, 2);
-CheckNum2(34, 3, $h{'bitnum'}, 11);
-CheckString2(34, 4, $h{'field'}, "new7");
-CheckNum2(34, 5, $h{'field_type'}, $GetData::BIT_ENTRY);
-CheckNum2(34, 6, $h{'fragment_index'}, 0);
-CheckString2(34, 7, $h{'in_field'}, "in1");
-CheckNum2(34, 8, $h{'numbits'}, 22);
-CheckSArray2(34, 9, $h{'scalar'}, undef, undef);
-CheckArray2(34, 10, $h{'scalar_ind'}, undef, undef);
-
-# 35: add_sbit
-$s = $_->add_sbit("new8", "in2", 5, 10);
-CheckOK2(35, 1);
-CheckNum2(35, 2, $s, 0);
-
-%h = $_->entry("new8");
-CheckOK(35, 2);
-CheckNum2(35, 3, $h{'bitnum'}, 5);
-CheckString2(35, 4, $h{'field'}, "new8");
-CheckNum2(35, 5, $h{'field_type'}, $GetData::SBIT_ENTRY);
-CheckNum2(35, 6, $h{'fragment_index'}, 0);
-CheckString2(35, 7, $h{'in_field'}, "in2");
-CheckNum2(35, 8, $h{'numbits'}, 10);
-CheckSArray2(35, 9, $h{'scalar'}, undef, undef);
-CheckArray2(35, 10, $h{'scalar_ind'}, undef, undef);
-
-# 36: add_mutiply
-$s = $_->add_multiply("new9", "in2", "in3");
-CheckOK2(36, 1);
-CheckNum2(36, 2, $s, 0);
-
-%h = $_->entry("new9");
-CheckOK2(36, 3);
-CheckString2(36, 4, $h{'field'}, "new9");
-CheckNum2(36, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
-CheckNum2(36, 6, $h{'fragment_index'}, 0);
-CheckSArray2(36, 7, $h{'in_fields'}, qw(in2 in3));
-
-# 37: add_phase
-$s = $_->add_phase("new10", "in6", 42);
-CheckOK2(37, 1);
-CheckNum2(37, 2, $s, 0);
-
-%h = $_->entry("new10");
-CheckOK2(37, 2);
-CheckString2(37, 3, $h{'field'}, "new10");
-CheckNum2(37, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
-CheckNum2(37, 5, $h{'fragment_index'}, 0);
-CheckString2(37, 6, $h{'in_field'}, "in6");
-CheckSArray2(37, 7, $h{'scalar'}, undef);
-CheckArray2(37, 8, $h{'scalar_ind'}, undef);
-CheckNum2(37, 9, $h{'shift'}, 42);
-
-# 38: add_const
-$s = $_->add_const("new11", $GetData::FLOAT64, "33.3");
-CheckOK2(38, 1);
-CheckNum2(38, 2, $s, 0);
-
-%h = $_->entry("new11");
-CheckOK2(38, 3);
-CheckNum2(38, 4, $h{'const_type'}, $GetData::FLOAT64);
-CheckString2(38, 5, $h{'field'}, "new11");
-CheckNum2(38, 6, $h{'field_type'}, $GetData::CONST_ENTRY);
-CheckNum2(38, 7, $h{'fragment_index'}, 0);
-
-$s = $_->get_constant("new11", $GetData::FLOAT64);
-CheckOK2(38, 8);
-CheckNum2(38, 9, $s, 33.3);
-
-# 125: add check
-$s = $_->add({
- field => "new13",
- field_type => $GetData::PHASE_ENTRY,
- fragment_index => 0,
- in_field => "new9",
- shift => -88
- });
-CheckOK2(125,1);
-CheckNum2(125, 2, $s, 0);
-
-%h = $_->entry("new13");
-CheckOK2(125, 2);
-CheckString2(125, 3, $h{'field'}, "new13");
-CheckNum2(125, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
-CheckNum2(125, 5, $h{'fragment_index'}, 0);
-CheckString2(125, 6, $h{'in_field'}, "new9");
-CheckSArray2(125, 7, $h{'scalar'}, undef);
-CheckArray2(125, 8, $h{'scalar_ind'}, undef);
-CheckNum2(125, 9, $h{'shift'}, -88);
-
-# 39: fragment_name
-$s = $_->fragmentname(0);
-CheckOK(39);
-CheckString(39, $s, "dirfile/format");
-
-# 40: nfragments
-$s = $_->fragments;
-CheckOK(40);
-CheckNum(40, $s, 1);
-
-# 182: fragment list
-@a = $_->fragments;
-CheckOK(182);
-CheckSArray(182, \@a, "dirfile/format");
-
-# 41: include
-$s = $_->include("form2", 0, 0);
-CheckOK2(41, 1);
-CheckNum2(41, 2, $s, 1);
-
-$s = $_->get_constant("const2", $GetData::INT32);
-CheckOK2(41, 3);
-CheckNum2(41, 4, $s, -19);
-
-# 42: nfields_by_type
-$s = $_->field_list_by_type($GetData::LINCOM_ENTRY);
-CheckOK(42);
-CheckNum(42, $s, 2);
-
-# 43: field_list_by_type
-@a = $_->field_list_by_type($GetData::LINCOM_ENTRY);
-CheckOK(43);
-CheckSArray(43, \@a, qw(lincom new3));
-
-# 44: nvectors
-$s = $_->vector_list;
-CheckOK(44);
-CheckNum(44, $s, 20);
-
-# 45: vector_list
-@a = $_->vector_list;
-CheckOK(45);
-CheckSArray(45, \@a, qw(INDEX bit data div lincom linterp mult new1 new10),
- qw(new13 new3 new4 new6 new7 new8 new9 phase polynom recip sbit));
-
-#47: madd_lincom check
-$s = $_->madd_lincom("data", "mnew2", 2, [ qw(in1 in2) ], [ 9.9+8.8*i, 7.7 ],
- [ 6.6, 5.5 ]);
-CheckOK2(47, 1);
-CheckNum2(47, 2, $s, 0);
-
-%h = $_->entry("data/mnew2");
-CheckOK2(47, 3);
-CheckArray2(47, 4, $h{'b'}, 6.6, 5.5);
-CheckArray2(47, 5, $h{'m'}, 9.9+8.8*i, 7.7);
-CheckString2(47, 7, $h{'field'}, "data/mnew2");
-CheckNum2(47, 8, $h{'field_type'}, $GetData::LINCOM_ENTRY);
-CheckNum2(47, 9, $h{'fragment_index'}, 0);
-CheckSArray2(47, 10, $h{'in_fields'}, qw(in1 in2));
-CheckNum2(47, 11, $h{'n_fields'}, 2);
-CheckSArray2(47, 12, $h{'scalar'}, undef, undef, undef, undef, undef);
-CheckArray2(47, 13, $h{'scalar_ind'}, undef, undef, undef, undef, undef);
-
-# 48: madd_polynom
-$s = $_->madd_polynom("data", "mnew3", 3, "in1", [ 3.9, 4.8, 5.7, 6.6 ]);
-CheckOK2(48, 1);
-CheckNum2(48, 2, $s, 0);
-
-%h = $_->entry("data/mnew3");
-CheckOK2(48, 3);
-CheckArray2(48, 4, $h{'a'}, 3.9, 4.8, 5.7, 6.6);
-CheckString2(48, 7, $h{'field'}, "data/mnew3");
-CheckNum2(48, 8, $h{'field_type'}, $GetData::POLYNOM_ENTRY);
-CheckNum2(48, 9, $h{'fragment_index'}, 0);
-CheckString2(48, 10, $h{'in_field'}, "in1");
-CheckNum2(48, 11, $h{'poly_ord'}, 3);
-CheckSArray2(48, 12, $h{'scalar'}, undef, undef, undef, undef);
-CheckArray2(48, 13, $h{'scalar_ind'}, undef, undef, undef, undef);
-
-# 50: madd_linterp
-$s = $_->madd_linterp("data", "mnew6", "in", "./more/table");
-CheckOK2(50, 1);
-CheckNum2(50, 2, $s, 0);
-
-%h = $_->entry("data/mnew6");
-CheckOK2(50, 2);
-CheckString2(50, 3, $h{'field'}, "data/mnew6");
-CheckNum2(50, 4, $h{'field_type'}, $GetData::LINTERP_ENTRY);
-CheckNum2(50, 5, $h{'fragment_index'}, 0);
-CheckString2(50, 6, $h{'in_field'}, "in");
-CheckString2(50, 7, $h{'table'}, "./more/table");
-
-# 51: madd_bit
-$s = $_->madd_bit("data", "mnew7", "in1", 3, 2);
-CheckOK2(51, 1);
-CheckNum2(51, 2, $s, 0);
-
-%h = $_->entry("data/mnew7");
-CheckOK(51, 2);
-CheckNum2(51, 3, $h{'bitnum'}, 3);
-CheckString2(51, 4, $h{'field'}, "data/mnew7");
-CheckNum2(51, 5, $h{'field_type'}, $GetData::BIT_ENTRY);
-CheckNum2(51, 6, $h{'fragment_index'}, 0);
-CheckString2(51, 7, $h{'in_field'}, "in1");
-CheckNum2(51, 8, $h{'numbits'}, 2);
-CheckSArray2(51, 9, $h{'scalar'}, undef, undef);
-CheckArray2(51, 10, $h{'scalar_ind'}, undef, undef);
-
-# 52: madd_sbit
-$s = $_->madd_sbit("data", "mnew8", "in2", 4, 5);
-CheckOK2(52, 1);
-CheckNum2(52, 2, $s, 0);
-
-%h = $_->entry("data/mnew8");
-CheckOK(52, 2);
-CheckNum2(52, 3, $h{'bitnum'}, 4);
-CheckString2(52, 4, $h{'field'}, "data/mnew8");
-CheckNum2(52, 5, $h{'field_type'}, $GetData::SBIT_ENTRY);
-CheckNum2(52, 6, $h{'fragment_index'}, 0);
-CheckString2(52, 7, $h{'in_field'}, "in2");
-CheckNum2(52, 8, $h{'numbits'}, 5);
-CheckSArray2(52, 9, $h{'scalar'}, undef, undef);
-CheckArray2(52, 10, $h{'scalar_ind'}, undef, undef);
-
-# 53: madd_mutiply
-$s = $_->madd_multiply("data", "mnew9", "in3", "in2");
-CheckOK2(53, 1);
-CheckNum2(53, 2, $s, 0);
-
-%h = $_->entry("data/mnew9");
-CheckOK2(53, 3);
-CheckString2(53, 4, $h{'field'}, "data/mnew9");
-CheckNum2(53, 5, $h{'field_type'}, $GetData::MULTIPLY_ENTRY);
-CheckNum2(53, 6, $h{'fragment_index'}, 0);
-CheckSArray2(53, 7, $h{'in_fields'}, qw(in3 in2));
-
-# 54: madd_phase
-$s = $_->madd_phase("data", "mnew10", "in6", 44);
-CheckOK2(54, 1);
-CheckNum2(54, 2, $s, 0);
-
-%h = $_->entry("data/mnew10");
-CheckOK2(54, 2);
-CheckString2(54, 3, $h{'field'}, "data/mnew10");
-CheckNum2(54, 4, $h{'field_type'}, $GetData::PHASE_ENTRY);
-CheckNum2(54, 5, $h{'fragment_index'}, 0);
-CheckString2(54, 6, $h{'in_field'}, "in6");
-CheckSArray2(54, 7, $h{'scalar'}, undef);
-CheckArray2(54, 8, $h{'scalar_ind'}, undef);
-CheckNum2(54, 9, $h{'shift'}, 44);
-
-# 55: madd_const
-$s = $_->madd_const("data", "mnew11", $GetData::FLOAT64, 9.2);
-CheckOK2(55, 1);
-CheckNum2(55, 2, $s, 0);
-
-%h = $_->entry("data/mnew11");
-CheckOK2(55, 3);
-CheckNum2(55, 4, $h{'const_type'}, $GetData::FLOAT6...
[truncated message content] |
|
From: <ket...@us...> - 2011-07-19 19:48:06
|
Revision: 592
http://getdata.svn.sourceforge.net/getdata/?rev=592&view=rev
Author: ketiltrout
Date: 2011-07-19 19:47:55 +0000 (Tue, 19 Jul 2011)
Log Message:
-----------
Make the perl test-suite work.
Modified Paths:
--------------
trunk/getdata/bindings/perl/Makefile.PL.in
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/bindings/perl/t/callback.t
trunk/getdata/configure.ac
trunk/getdata/src/open.c
Property Changed:
----------------
trunk/getdata/bindings/perl/
Property changes on: trunk/getdata/bindings/perl
___________________________________________________________________
Modified: svn:ignore
- simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
+ simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
debug.c
Modified: trunk/getdata/bindings/perl/Makefile.PL.in
===================================================================
--- trunk/getdata/bindings/perl/Makefile.PL.in 2011-07-18 20:34:48 UTC (rev 591)
+++ trunk/getdata/bindings/perl/Makefile.PL.in 2011-07-19 19:47:55 UTC (rev 592)
@@ -1,16 +1,23 @@
use 5.00800;
use ExtUtils::MakeMaker;
+
+my @gd_cfiles = ("GetData.c");
+push @gd_cfiles, "debug.c" if (@GETDATA_DEBUG@);
+my $gd_objects = "GetData\${OBJ_EXT}" . ((@GETDATA_DEBUG@) ? " debug\${OBJ_EXT}" : "");
+
WriteMakefile(
ABSTRACT_FROM => "GetData.pm",
AUTHOR => "The GetData Progject <@PACKAGE_BUGREPORT@>",
- C => [ qw(GetData.c) ],
+ C => \@gd_cfiles,
DEFINE => "@DEFS@",
FIRST_MAKEFILE => "perl.mk",
INC => '-I. -I@top_builddir@/src',
LIBS => ['-L@top_builddir@/src/.libs/ -lgetdata'],
NAME => "GetData",
+ OBJECT => $gd_objects,
PM => { "GetData.pm" => "\$(INST_LIBDIR)/GetData.pm" },
PREREQ_FATAL => 1,
PREREQ_PM => { "Math::Complex" => 1.34 },
VERSION_FROM => "GetData.pm",
+ depend => { "perl.mk" => "\${VERSION_FROM}" }
);
Modified: trunk/getdata/bindings/perl/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/Makefile.am 2011-07-18 20:34:48 UTC (rev 591)
+++ trunk/getdata/bindings/perl/Makefile.am 2011-07-19 19:47:55 UTC (rev 592)
@@ -20,6 +20,14 @@
#
AUTOMAKE_OPTIONS = foreign
+if GETDATA_DEBUG
+DEBUG_C = debug.c
+TEST_VERBOSE="TEST_VERBOSE=1"
+debug.c: $(top_srcdir)/src/debug.c
+ echo "#undef VERSION" > $@
+ cat $< >> $@
+endif
+
simple_funcs.xs: $(srcdir)/simple_funcs.xsin $(srcdir)/simple_funcs.pl
$(PERL) simple_funcs.pl $< > $@
@@ -36,7 +44,9 @@
$(PERL) funclist.pl GetData.xs simple_funcs.xs > $@
chmod a-w $@
-all-local: perl.mk
+all-local: blib/man3/GetData.3pm
+
+blib/man3/GetData.3pm: perl.mk $(DEBUG_C)
$(MAKE) -f perl.mk
perl.mk: Makefile.PL GetData.pm GetData.xs simple_funcs.xs typemap
@@ -44,9 +54,12 @@
clean-local:
$(MAKE) -f perl.mk clean
- rm -f $(BUILT_SOURCES) make_parameters.sed perl.mk.old
+ rm -f $(BUILT_SOURCES) make_parameters.sed perl.mk.old debug.c
+check:
+ $(MAKE) test
+
test testdb:
- $(MAKE) -f perl.mk $@
+ ${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(MAKE) -f perl.mk $@ ${TEST_VERBOSE}
.PHONY: test
Modified: trunk/getdata/bindings/perl/t/callback.t
===================================================================
--- trunk/getdata/bindings/perl/t/callback.t 2011-07-18 20:34:48 UTC (rev 591)
+++ trunk/getdata/bindings/perl/t/callback.t 2011-07-19 19:47:55 UTC (rev 592)
@@ -1,15 +1,15 @@
use GetData;
use strict;
-use Test::More tests => 7;
+use Test::More tests => 8;
# callback
sub callback {
my ($pdata, $extra) = @_;
- is ($extra, "extra stuff");
- is ($$pdata{'suberror'}, $GetData::E_FORMAT_BAD_LINE);
- is ($$pdata{'linenum'}, 2);
- is ($$pdata{'filename'}, "dirfile/format");
+ is ($extra, "extra stuff", "\$extra parameter good");
+ is ($$pdata{'suberror'}, $GetData::E_FORMAT_BAD_LINE, "suberror good");
+ is ($$pdata{'linenum'}, 2, "linenum good");
+ is ($$pdata{'filename'}, "dirfile/format", "filename good");
$GetData::SYNTAX_IGNORE
}
@@ -25,8 +25,7 @@
my $d = &GetData::open("dirfile", $GetData::RDONLY, \&callback, "extra stuff");
ok (defined $d, "open created an object");
my $e = &GetData::error($d);
-$d.close();
+is ($e, $GetData::E_OK, "no error from open");
+is ($d->close(), 0, "close succeeded");
system "rm -rf dirfile";
-
-is($e, $GetData::E_OK);
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-07-18 20:34:48 UTC (rev 591)
+++ trunk/getdata/configure.ac 2011-07-19 19:47:55 UTC (rev 592)
@@ -104,7 +104,11 @@
AC_DEFINE([GETDATA_DEBUG], [],
[ Define to enable debugging messages ])
enable_assert="yes"
+ GETDATA_DEBUG=1
+else
+ GETDATA_DEBUG=0
fi
+AC_SUBST([GETDATA_DEBUG])
AC_MSG_CHECKING([whether to enable assertions])
AC_MSG_RESULT([$enable_assert])
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2011-07-18 20:34:48 UTC (rev 591)
+++ trunk/getdata/src/open.c 2011-07-19 19:47:55 UTC (rev 592)
@@ -46,7 +46,7 @@
struct stat statbuf;
DIR* dir;
struct dirent* lamb;
- int fd;
+ int fd = -1;
int format_error = 0;
FILE* fp = NULL;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-08-10 10:17:15
|
Revision: 593
http://getdata.svn.sourceforge.net/getdata/?rev=593&view=rev
Author: ketiltrout
Date: 2011-08-10 10:17:09 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Convert perl test to TAP.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/perl/t/big_test.t
Property Changed:
----------------
trunk/getdata/bindings/perl/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-07-19 19:47:55 UTC (rev 592)
+++ trunk/getdata/ChangeLog 2011-08-10 10:17:09 UTC (rev 593)
@@ -1,3 +1,6 @@
+2011-08-10 D. V. Wiebe <ge...@ke...> svn:593
+ * bindings/perl/t/big_test.t: Convert to TAP.
+
2011-06-13 D. V. Wiebe <ge...@ke...> svn:588
* src/errors.c: Don't append strerror to the GD_E_CREAT_EXCL message.
Property changes on: trunk/getdata/bindings/perl
___________________________________________________________________
Modified: svn:ignore
- simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
debug.c
+ simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
.deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
debug.c
GetData.bs
Modified: trunk/getdata/bindings/perl/t/big_test.t
===================================================================
--- trunk/getdata/bindings/perl/t/big_test.t 2011-07-19 19:47:55 UTC (rev 592)
+++ trunk/getdata/bindings/perl/t/big_test.t 2011-08-10 10:17:09 UTC (rev 593)
@@ -22,117 +22,90 @@
use GetData;
use Math::Complex;
use strict;
+use Test::More tests => 1135;
my $ne = 0;
my ($s, @a, %h);
sub CheckError {
my $e = $_->error;
- if ($e != $_[1]) {
- print "e[$_[0]] = $e, expected $_[1]\n";
- $ne++;
- }
+ print "\n";
+ is ($e, $_[1], "e[$_[0]] = $e, expected $_[1]");
+ print "\n";
}
sub CheckError2 {
my $e = $_->error;
- if ($e != $_[2]) {
- print "e[$_[0],$_[1]] = $e, expected $_[2]\n";
- $ne++;
- }
+ print "\n";
+ is ($e, $_[2], "e[$_[0],$_[1]] = $e, expected $_[2]");
+ print "\n";
}
sub CheckArray {
my $i;
- if ($#{$_[1]} != $#_ - 2) {
- print "a[$_[0]]: ", 1 + $#{$_[1]}, " elements, expected ", $#_ - 1, "\n";
- $ne++;
- }
+ print "\n";
+ is ($#{$_[1]}, $#_ - 2,
+ "a[$_[0]]: " . (1 + $#{$_[1]}) . " elements, expected " . ($#_ - 1));
for $i (0 .. $#_ - 2) {
- next unless (defined ${$_[1]}[$i] or defined $_[$i + 2]);
- if (${$_[1]}[$i] != $_[$i + 2]) {
- print "a($i)[$_[0]] = ${$_[1]}[$i], expected ", $_[$i + 2], "\n";
- $ne++;
- }
+ is (${$_[1]}[$i], $_[$i + 2],
+ "a($i)[$_[0]] = ${$_[1]}[$i], expected " . $_[$i + 2]);
}
+ print "\n";
}
sub CheckArray2 {
my $i;
- if ($#{$_[2]} != $#_ - 3) {
- print "a[$_[0],$_[1]]: ", 1 + $#{$_[2]}, " elements, expected ", $#_ - 2,
- "\n";
- $ne++;
- }
+ print "\n";
+ is ($#{$_[2]}, $#_ - 3,
+ "a[$_[0],$_[1]]: " . (1 + $#{$_[2]}) . " elements, expected " . ($#_ - 2));
for $i (0 .. $#_ - 3) {
- next unless (defined ${$_[2]}[$i] or defined $_[$i + 3]);
- if (${$_[2]}[$i] != $_[$i + 3]) {
- print "a($i)[$_[0],$_[1]] = ${$_[2]}[$i], expected ", $_[$i + 3], "\n";
- $ne++;
- }
+ is (${$_[2]}[$i], $_[$i + 3], "a($i)[$_[0],$_[1]] = " .
+ ((defined ${$_[2]}[$i]) ? ${$_[2]}[$i] : "undef") . ", expected " .
+ ((defined $_[$i + 3]) ? $_[$i + 3] : "undef") . "\n");
}
+ print "\n";
}
sub CheckSArray {
my $i;
- if ($#{$_[1]} != $#_ - 2) {
- print "a[$_[0]]: ", 1 + $#{$_[1]}, " elements, expected ", $#_ - 1, "\n";
- $ne++;
- }
+ is ($#{$_[1]}, $#_ - 2,
+ "a[$_[0]]: " . (1 + $#{$_[1]}) . " elements, expected " . ($#_ - 1));
for $i (0 .. $#_ - 2) {
- next unless (defined ${$_[1]}[$i] or defined $_[$i + 2]);
- if (${$_[1]}[$i] ne $_[$i + 2]) {
- print "n($i)[$_[0]] = \"${$_[1]}[$i]\", expected \"", $_[$i + 2], "\"\n";
- $ne++;
- }
+ is (${$_[1]}[$i], $_[$i + 2],
+ "n($i)[$_[0]] = \"${$_[1]}[$i]\", expected \"" . $_[$i + 2] . "\"");
}
}
sub CheckSArray2 {
my $i;
- if ($#{$_[2]} != $#_ - 3) {
- print "a[$_[0],$_[1]]: ", 1 + $#{$_[2]}, " elements, expected ", $#_ - 2,
- "\n";
- $ne++;
- }
+ is ($#{$_[2]}, $#_ - 3,
+ "a[$_[0],$_[1]]: " . (1 + $#{$_[2]}) . " elements, expected " . ($#_ - 2));
for $i (0 .. $#_ - 3) {
- next unless (defined ${$_[2]}[$i] or defined $_[$i + 3]);
- if (${$_[2]}[$i] ne $_[$i + 3]) {
- print "n($i)[$_[0],$_[1]] = \"${$_[2]}[$i]\", expected \"", $_[$i + 3],
- "\"\n";
- $ne++;
- }
+ is (${$_[2]}[$i], $_[$i + 3], "n($i)[$_[0],$_[1]] = " .
+ ((defined ${$_[2]}[$i]) ? "\"" . ${$_[2]}[$i] . "\"" : "undef") .
+ ", expected " .
+ ((defined $_[$i + 3]) ? "\"" . $_[$i + 3] . "\"" : "undef") . "\n");
}
}
sub CheckNum {
- return unless (defined $_[1] or defined $_[2]);
- if ($_[1] != $_[2]) {
- print "n[$_[0]] = $_[1], expected $_[2]\n";
- $ne++;
- }
+ is ($_[1], $_[2], "n[$_[0]] = " .
+ ((defined $_[1]) ? $_[1] : "undef") . ", expected " .
+ ((defined $_[2]) ? $_[2] : "undef"));
}
sub CheckNum2 {
- return unless (defined $_[2] or defined $_[3]);
- if ($_[2] != $_[3]) {
- print "n[$_[0],$_[1]] = $_[2], expected $_[3]\n";
- $ne++;
- }
+ is ($_[2], $_[3], "n[$_[0],$_[1]] = " .
+ ((defined $_[2]) ? $_[2] : "undef") . ", expected " .
+ ((defined $_[3]) ? $_[3] : "undef"));
}
sub CheckString {
- if ($_[1] ne $_[2]) {
- print "s[$_[0]] = \"$_[1]\", expected \"$_[2]\"\n";
- $ne++;
- }
+ is ($_[1], $_[2], "s[$_[0]] = \"$_[1]\", expected \"$_[2]\"");
}
sub CheckString2 {
- if ($_[2] ne $_[3]) {
- print "s[$_[0],$_[1]] = \"$_[2]\", expected \"$_[3]\"\n";
- $ne++;
- }
+ is ($_[2], $_[3], "s[$_[0],$_[1]] = \"$_[2]\", expected \"$_[3]\"");
}
sub CheckOK { &CheckError($_[0], 0) }
@@ -1452,8 +1425,5 @@
-
$d = $_ = undef;
system "rm -rf dirfile";
-
-die "ne = $ne" if ($ne > 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-08-11 19:37:04
|
Revision: 594
http://getdata.svn.sourceforge.net/getdata/?rev=594&view=rev
Author: ketiltrout
Date: 2011-08-11 19:36:53 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
Sample Index Encoding along with a few changes to the encoding framework.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/src/Makefile.am
trunk/getdata/src/add.c
trunk/getdata/src/ascii.c
trunk/getdata/src/bzip.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/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/gzip.c
trunk/getdata/src/internal.h
trunk/getdata/src/lzma.c
trunk/getdata/src/mod.c
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/nframes.c
trunk/getdata/src/parse.c
trunk/getdata/src/putdata.c
trunk/getdata/src/raw.c
trunk/getdata/test/Makefile.am
Added Paths:
-----------
trunk/getdata/src/sie.c
trunk/getdata/test/sie_get_big.c
trunk/getdata/test/sie_get_little.c
trunk/getdata/test/sie_move_from.c
trunk/getdata/test/sie_move_to.c
trunk/getdata/test/sie_nframes_big.c
trunk/getdata/test/sie_nframes_little.c
trunk/getdata/test/sie_put_big.c
trunk/getdata/test/sie_put_little.c
Property Changed:
----------------
trunk/getdata/bindings/perl/
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/ChangeLog 2011-08-11 19:36:53 UTC (rev 594)
@@ -1,3 +1,46 @@
+2011-08-11 D. V. Wiebe <ge...@ke...> svn:594
+ * test/sie_nframes_big.c test/sie_get_big.c test/sie_get_little.c
+ test/sie_nframes_little.c test/sie_move_to.c test/sie_put_little.c
+ test/sie_move_from.c test/sie_put_big.c: Added.
+
+ * configure.ac src/internal.h: Handle missing fstat64, ftruncate64, and byte
+ swapping routines.
+
+ * src/internal.h src/errors.c: Differentiate GD_E_UNKNOWN_ENCODING errors
+ arising from existing, unknown encodings on disk from errors arising from
+ attempts to convert to an unknown encoding.
+
+ * src/endian.c (_GD_FixEndianness): Use standard system byte-swapping
+ routines, where possible, with the assumption that they're not slower than
+ our old implementation.
+
+ * src/encoding.c: Redo the way _gd_ef is initialised to try and make it
+ a little easier to maintain.
+
+ * src/internal.h: In struct _gd_raw_file, rename .fp to .idata and .encoding
+ to .subenc to reduce code obfuscation.
+
+ * src/encoding.c: Added SIE encoding hooks.
+ * src/sie.c: Added.
+
+ * src/internal.h (_GD_FileSwapBytes): Added.
+ * src/internal.h: _gd_ef->open(), ->size(), ->touch(), and ->topen() now take
+ a "swap" parameter, indicating whether bytes are opposite-endian.
+
+ * src/internal.h: Split _gd_ef->temp() into ->topen, ->tmove, and ->tunlink.
+ Also typedef all the framework method prototypes.
+ * src/ascii.c (_GD_AsciiTOpen _GD_AsciiTUnlink) src/raw.c (_GD_RawTOpen
+ _GD_RawTUnlink): Added.
+ * src/ascii.c (_GD_AsciiTemp) src/raw.c (_GD_RawTemp): Deleted.
+ * src/encoding.c (_GD_GenericTMove): Added.
+ * src/endian.c (_GD_ByteSwapFragment) src/encoding.c (_GD_MissingFramework
+ _GD_RecodeFragment) src/move.c (_GD_MogrifyFile) src/flimits.c
+ (_GD_ShiftFragment) src/mod.c (_GD_Change): Replace _gd_ef->temp() calls with
+ t{open|move|unlink} calls.
+
+ * src/move.c (_GD_MogrifyFile) src/mod.c (_GD_Change): Call _GD_MakeTempFile
+ before calling _gd_ef->topen.
+
2011-08-10 D. V. Wiebe <ge...@ke...> svn:593
* bindings/perl/t/big_test.t: Convert to TAP.
Property changes on: trunk/getdata/bindings/perl
___________________________________________________________________
Modified: svn:ignore
- simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
.deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
debug.c
GetData.bs
+ simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
.deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
debug.c
MYMETA.yml
GetData.bs
GetData.bs
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/configure.ac 2011-08-11 19:36:53 UTC (rev 594)
@@ -51,7 +51,7 @@
dnl Features
BUINDINGS_BUILT=
BINDINGS_LEFT=
-ENCODINGS_BUILT=" raw ascii"
+ENCODINGS_BUILT=" raw ascii sie"
ENCODINGS_LEFT=
PRIVATE_LIBS=
@@ -504,7 +504,7 @@
dnl libraries
echo
-echo "*** Looking for library functions"
+echo "*** Looking for additional libraries"
echo
AC_SEARCH_LIBS([ceil],[m])
@@ -519,56 +519,17 @@
AC_CHECK_HEADERS(pthread.h)
fi
-dnl functions
-AC_CHECK_FUNCS([_commit fchmod _fdopen fdopendir fseeko fseeko64 _fstat \
- fstatat fstatat64 fsync ftello ftello64 getcwd _getcwd \
- getdelim gmtime_r _lseeki64 lstat _mkdir nan _open openat \
- _read renameat _rmdir _snprintf stat64 _stat64 _strtoi64 \
- strtoll _strtoui64 strtoull _unlink unlinkat _write])
-if test "x$disable_c99" = "xno"; then
- AC_CHECK_FUNCS([cabs])
-fi
-AC_FUNC_STRERROR_R
-
dnl headers
echo
echo "*** Looking for additional header files"
echo
-AC_CHECK_HEADERS([direct.h fcntl.h libgen.h stdint.h unistd.h])
+AC_CHECK_HEADERS([byteswap.h direct.h fcntl.h io.h libgen.h \
+ libkern/OSByteOrder.h stdint.h sys/endian.h unistd.h])
if test "x$disable_c99" = "xno"; then
AC_CHECK_HEADERS([complex.h])
fi
AC_HEADER_DIRENT
-AC_CHECK_HEADERS([io.h])
-
-AC_MSG_CHECKING([whether mkdir accepts two arguments])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_IO_H
-#include <io.h>
-#endif
-], [[
-#ifdef HAVE__MKDIR
-_mkdir("x", 00777);
-#else
-mkdir("x", 00777);
-#endif
-]])],
-[gd_2arg_mkdir=yes],
-[gd_2arg_mkdir=no])
-AC_MSG_RESULT([$gd_2arg_mkdir])
-
-if test $gd_2arg_mkdir = "no"; then
- AC_DEFINE([MKDIR_NO_MODE], [1],
- [ Define to 1 if the `mkdir' function takes only one argument.])
-fi dnl`
-
dnl types
echo
echo "*** Checking data types"
@@ -693,6 +654,61 @@
AC_SUBST([DEFINE_gd_uint16_t])
AC_SUBST([DEFINE_gd_int64_t])
+dnl library functions
+echo
+echo "*** Looking for additional library functions"
+echo
+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 _lseeki64 lstat _mkdir nan _open openat _read \
+ renameat _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
+ _strtoui64 strtoull _unlink unlinkat _write])
+if test "x$disable_c99" = "xno"; then
+ AC_CHECK_FUNCS([cabs])
+fi
+AC_FUNC_STRERROR_R
+
+AC_MSG_CHECKING([whether mkdir accepts two arguments])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_IO_H
+#include <io.h>
+#endif
+], [[
+#ifdef HAVE__MKDIR
+_mkdir("x", 00777);
+#else
+mkdir("x", 00777);
+#endif
+]])],
+[gd_2arg_mkdir=yes],
+[gd_2arg_mkdir=no])
+AC_MSG_RESULT([$gd_2arg_mkdir])
+
+if test $gd_2arg_mkdir = "no"; then
+ AC_DEFINE([MKDIR_NO_MODE], [1],
+ [ Define to 1 if the `mkdir' function takes only one argument.])
+fi dnl`
+
+AC_CHECK_DECLS([bswap16, bswap_16, OSSwapInt16],,,
+ [
+#ifdef HAVE_BYTESWAP_H
+#include <byteswap.h>
+#endif
+#ifdef HAVE_SYS_ENDIAN_H
+#include <sys/endian.h>
+#endif
+#ifdef HAVE_LIBKERN_OSBYTEORDER_H
+#include <libkern/OSByteOrder.h>
+#endif
+])
+
dnl python
if test "x$make_pybindings" = "xyes"; then
echo
Modified: trunk/getdata/src/Makefile.am
===================================================================
--- trunk/getdata/src/Makefile.am 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/src/Makefile.am 2011-08-11 19:36:53 UTC (rev 594)
@@ -109,9 +109,9 @@
fragment.c getdata.c globals.c ${GZIP_C} index.c \
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 ${SLIM_C} \
- spf.c string.c types.c ${GETDATA_LEGACY_H} internal.h \
- nan.h
+ 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
libgetdata_la_LDFLAGS = $(EXPORT_DYNAMIC) -export-symbols-regex '^[^_]' \
-version-info \
${GETDATA_IFACE_VERSION}:${GETDATA_IMPL_REVISION}:${GETDATA_IFACE_AGE} \
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/src/add.c 2011-08-11 19:36:53 UTC (rev 594)
@@ -196,8 +196,8 @@
}
E->EN(raw,data_type) = entry->EN(raw,data_type);
- E->e->u.raw.file[0].fp = E->e->u.raw.file[1].fp = -1;
- E->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN;
+ 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);
@@ -214,8 +214,9 @@
; /* error already set */
else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
; /* error already set */
- else if ((*_gd_ef[E->e->u.raw.file[0].encoding].touch)(
- D->fragment[E->fragment_index].dirfd, E->e->u.raw.file))
+ else if ((*_gd_ef[E->e->u.raw.file[0].subenc].touch)(
+ D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
+ _GD_FileSwapBytes(D, E->fragment_index)))
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
NULL);
else if (D->fragment[E->fragment_index].ref_name == NULL) {
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/src/ascii.c 2011-08-11 19:36:53 UTC (rev 594)
@@ -31,28 +31,35 @@
#include <errno.h>
#endif
-/* The ASCII encoding uses file->fp as to indicate the current line and
+/* The ASCII encoding uses file->idata to indicate the current line and
* file->edata for the stream pointer */
-int _GD_AsciiOpen(int dirfd, struct _gd_raw_file* file, int mode, int creat)
+int _GD_AsciiOpen(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
+ int mode, int creat)
{
- int fp;
+ int fd;
- dtrace("%i, %p, %i, %i", dirfd, file, mode, creat);
+ dtrace("%i, %p, <unused>, %i, %i", dirfd, file, mode, creat);
- fp = gd_OpenAt(file->D, dirfd, file->name, ((mode == GD_RDWR) ? O_RDWR :
+ fd = gd_OpenAt(file->D, dirfd, file->name, ((mode == GD_RDWR) ? O_RDWR :
O_RDONLY) | (creat ? O_CREAT : 0) | O_BINARY, 0666);
- file->edata = fdopen(fp, (mode == GD_RDWR) ? "r+" : "r");
+ if (fd < 0) {
+ dreturn("%i", -1);
+ return -1;
+ }
- if (file->edata != NULL) {
- file->fp = 0;
- dreturn("%i", 0);
- return 0;
+ file->edata = fdopen(fd, (mode == GD_RDWR) ? "r+" : "r");
+
+ if (file->edata == NULL) {
+ close(fd);
+ dreturn("%i", -1);
+ return -1;
}
- dreturn("%i", -1);
- return -1;
+ file->idata = 0;
+ dreturn("%i", 0);
+ return 0;
}
off64_t _GD_AsciiSeek(struct _gd_raw_file* file, off64_t count,
@@ -62,23 +69,23 @@
dtrace("%p, %lli, <unused>, %i", file, count, pad);
- if (count < file->fp) {
+ if (count < file->idata) {
rewind((FILE *)file->edata);
- file->fp = 0;
+ file->idata = 0;
}
- for (; count > file->fp; ++file->fp)
+ for (; count > file->idata; ++file->idata)
if (fgets(line, 64, (FILE *)file->edata) == NULL)
break;
- if (pad && count > file->fp) {
+ if (pad && count > file->idata) {
strcpy(line, "0\n");
- for (; count > file->fp; ++file->fp)
+ for (; count > file->idata; ++file->idata)
fputs(line, (FILE *)file->edata);
}
- dreturn("%i", file->fp);
- return file->fp;
+ dreturn("%i", file->idata);
+ return file->idata;
}
static void _GD_ScanFormat(char* fmt, gd_type_t data_type)
@@ -159,7 +166,7 @@
ret = -1;
break;
}
- file->fp++;
+ file->idata++;
}
} else {
for (n = 0; n < nmemb; ++n) {
@@ -189,7 +196,7 @@
break;
}
}
- file->fp++;
+ file->idata++;
}
}
@@ -342,7 +349,7 @@
ret = fclose((FILE *)file->edata);
if (ret != EOF) {
- file->fp = -1;
+ file->idata = -1;
dreturn("%i", 0);
return 0;
}
@@ -352,7 +359,7 @@
}
off64_t _GD_AsciiSize(int dirfd, struct _gd_raw_file* file,
- gd_type_t data_type __gd_unused)
+ gd_type_t data_type __gd_unused, int swap __gd_unused)
{
FILE* stream;
char *buffer = NULL;
@@ -360,10 +367,10 @@
off64_t n = 0;
int fd;
- dtrace("%i, %p, <unused>", dirfd, file);
+ dtrace("%i, %p, <unused>, <unused>", dirfd, file);
fd = gd_OpenAt(file->D, dirfd, file->name, O_RDONLY, 0666);
- if (fd == -1) {
+ if (fd < 0) {
dreturn("%i", -1);
return -1;
}
@@ -385,68 +392,41 @@
return n;
}
-int _GD_AsciiTemp(int dirfd0, int dirfd1, struct _gd_raw_file *file, int method)
+int _GD_AsciiTOpen(int fd, struct _gd_raw_file *file, int swap __gd_unused)
{
- int move_error = 0;
- struct stat stat_buf;
- mode_t mode;
- int fp;
+ dtrace("%i, %p, <unused>", fd, file);
- dtrace("%i, %i, %p, %i", dirfd0, dirfd1, file, method);
+ file->edata = fdopen(fd, "r+");
- switch(method) {
- case GD_TEMP_OPEN:
- fp = gd_MakeTempFile(file[1].D, dirfd1, file[1].name);
+ if (file->edata == NULL) {
+ dreturn("%i", -1);
+ return -1;
+ }
- file[1].edata = fdopen(fp, "r+");
+ file->idata = 0;
- if (file[1].edata == NULL) {
+ dreturn("%i", 0);
+ return 0;
+}
+
+int _GD_AsciiTUnlink(int dirfd, struct _gd_raw_file *file)
+{
+ dtrace("%i, %p", dirfd, file);
+
+ if (file->name != NULL) {
+ if (file->idata >= 0)
+ if (_GD_AsciiClose(file)) {
dreturn("%i", -1);
return -1;
}
- file[1].fp = 0;
- break;
- case GD_TEMP_MOVE:
- if (file[1].name == NULL)
- break;
+ if (gd_UnlinkAt(file->D, dirfd, file->name, 0)) {
+ dreturn("%i", -1);
+ return -1;
+ }
- if (stat(file[0].name, &stat_buf))
- mode = 0644;
- else
- mode = stat_buf.st_mode;
-
- if (!gd_RenameAt(file->D, dirfd1, file[1].name, dirfd0, file[0].name)) {
- chmod(file[0].name, mode);
- free(file[1].name);
- file[1].name = NULL;
- dreturn("%i", 0);
- return 0;
- }
- move_error = errno;
- /* fallthrough on error */
- case GD_TEMP_DESTROY:
- if (file[1].name != NULL) {
- if (file[1].fp >= 0)
- if (_GD_AsciiClose(file + 1)) {
- dreturn("%i", -1);
- return -1;
- }
-
- if (unlink(file[1].name)) {
- dreturn("%i", -1);
- return -1;
- }
-
- if (method == GD_TEMP_MOVE) {
- errno = move_error;
- dreturn("%i", -1);
- return -1;
- }
- free(file[1].name);
- file[1].name = NULL;
- }
- break;
+ free(file[1].name);
+ file[1].name = NULL;
}
dreturn("%i", 0);
Modified: trunk/getdata/src/bzip.c
===================================================================
--- trunk/getdata/src/bzip.c 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/src/bzip.c 2011-08-11 19:36:53 UTC (rev 594)
@@ -57,7 +57,7 @@
};
/* The bzip encoding scheme uses edata as a gd_bzdata pointer. If a file is
- * open, fp = 0 otherwise fp = -1. */
+ * open, idata = 0 otherwise idata = -1. */
static struct gd_bzdata *_GD_Bzip2DoOpen(int dirfd, struct _gd_raw_file* file)
{
@@ -101,10 +101,10 @@
return ptr;
}
-int _GD_Bzip2Open(int dirfd, struct _gd_raw_file* file, int mode __gd_unused,
- int creat __gd_unused)
+int _GD_Bzip2Open(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
+ int mode __gd_unused, int creat __gd_unused)
{
- dtrace("%i, %p, <unused>, <unused>", dirfd, file);
+ dtrace("%i, %p, <unused>, <unused>, <unused>", dirfd, file);
file->edata = _GD_Bzip2DoOpen(dirfd, file);
@@ -113,7 +113,7 @@
return 1;
}
- file->fp = 0;
+ file->idata = 0;
dreturn("%i", 0);
return 0;
}
@@ -236,7 +236,7 @@
ptr->bzerror = 0;
BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile);
if (!fclose(ptr->stream)) {
- file->fp = -1;
+ file->idata = -1;
free(file->edata);
dreturn("%i", 0);
return 0;
@@ -246,12 +246,13 @@
return 1;
}
-off64_t _GD_Bzip2Size(int dirfd, struct _gd_raw_file *file, gd_type_t data_type)
+off64_t _GD_Bzip2Size(int dirfd, struct _gd_raw_file *file, gd_type_t data_type,
+ int swap __gd_unused)
{
struct gd_bzdata *ptr;
off_t n;
- dtrace("%i, %p, %x", dirfd, file, data_type);
+ dtrace("%i, %p, %x, <unused>", dirfd, file, data_type);
ptr = _GD_Bzip2DoOpen(dirfd, file);
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/src/del.c 2011-08-11 19:36:53 UTC (rev 594)
@@ -332,7 +332,7 @@
return -1;
}
- if ((*_gd_ef[E->e->u.raw.file[0].encoding].unlink)(
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].unlink)(
D->fragment[E->fragment_index].dirfd, E->e->u.raw.file))
{
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
@@ -340,8 +340,8 @@
dreturn("%i", -1);
return -1;
}
- } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->fp != -1) {
- if ((*_gd_ef[E->e->u.raw.file[0].encoding].close)(E->e->u.raw.file)) {
+ } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->idata != -1) {
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].close)(E->e->u.raw.file)) {
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
free(del_list);
dreturn("%i", -1);
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-08-10 10:17:09 UTC (rev 593)
+++ trunk/getdata/src/encoding.c 2011-08-11 19:36:53 UTC (rev 594)
@@ -43,113 +43,105 @@
#endif
/* encoding schemas */
+#define GD_EF_NULL_SET NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
+ &_GD_GenericMove, &_GD_GenericUnlink, NULL, &_GD_GenericTMove, NULL
+#ifdef USE_MODULES
+#define GD_EXT_ENCODING(sc,ex,ec,af,ff) \
+{ sc,ex,ec,af,ff,GD_EF_PROVIDES,GD_EF_NULL_SET }
+#else
+#define GD_EXT_ENCODING(sc,ex,ec,af,ff) { sc,ex,ec,af,ff,0,GD_INT_FUNCS }
+#endif
struct encoding_t _gd_ef[GD_N_SUBENCODINGS] = {
{ GD_UNENCODED, "", 1, NULL, "none", 0,
- &_GD_RawOpen, &_GD_RawClose, &_GD_GenericTouch, &_GD_RawSeek,
- &_GD_RawRead, &_GD_RawSize, &_GD_RawWrite, &_GD_RawSync,
- &_GD_GenericMove, &_GD_GenericUnlink, &_GD_RawTemp
+ &_GD_RawOpen, &_GD_RawClose, &_GD_GenericTouch, &_GD_RawSeek, &_GD_RawRead,
+ &_GD_RawSize, &_GD_RawWrite, &_GD_RawSync, &_GD_GenericMove,
+ &_GD_GenericUnlink, &_GD_RawTOpen, &_GD_GenericTMove, &_GD_RawTUnlink
},
-#ifdef USE_MODULES
- /* Modules are external */
- { GD_GZIP_ENCODED, ".gz", 1, "Gzip", "gzip",
-# ifdef USE_GZIP
+
+#ifdef USE_GZIP
+#define GD_EF_PROVIDES \
+ GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+#define GD_INT_FUNCS \
+ &_GD_GzipOpen, &_GD_GzipClose, NULL /* TOUCH */, &_GD_GzipSeek, \
+ &_GD_GzipRead, &_GD_GzipSize, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
+ NULL /* TUNLINK */
+#else
+#define GD_EF_PROVIDES 0
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#endif
+ GD_EXT_ENCODING(GD_GZIP_ENCODED, ".gz", 1, "Gzip", "gzip"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_BZIP2
+#define GD_EF_PROVIDES \
GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
- 0,
-# endif
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL },
- { GD_BZIP2_ENCODED, ".bz2", 1, "Bzip2", "bzip2",
-# ifdef USE_BZIP2
+#define GD_INT_FUNCS \
+ &_GD_Bzip2Open, &_GD_Bzip2Close, NULL /* TOUCH */, &_GD_Bzip2Seek, \
+ &_GD_Bzip2Read, &_GD_Bzip2Size, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
+ NULL /* TUNLINK */
+#else
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
+#endif
+ GD_EXT_ENCODING(GD_BZIP2_ENCODED, ".bz2", 1, "Bzip2", "bzip2"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_SLIM
+#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, NULL /* TOUCH */, &_GD_SlimSeek, \
+ &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
+ NULL /* TUNLINK */
+#else
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
+#endif
+ GD_EXT_ENCODING(GD_SLIM_ENCODED, ".slm", 1, "Slim", "slim"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
+#ifdef USE_LZMA
+#define GD_EF_PROVIDES \
GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
- 0,
-# endif
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL },
- { GD_SLIM_ENCODED, ".slm", 1, "Slim", "slim",
-# ifdef USE_SLIM
- GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
- 0,
-# endif
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL },
- { GD_LZMA_ENCODED, ".xz", 1, "Lzma", "lzma",
-# ifdef USE_LZMA
- GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
- 0,
-# endif
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL },
- { GD_LZMA_ENCODED, ".lzma", 1, "Lzma", "lzma",
-# ifdef USE_LZMA
- GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE,
-# else
- 0,
-# endif
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL },
+#define GD_INT_FUNCS \
+ &_GD_LzmaOpen, &_GD_LzmaClose, NULL /* TOUCH */, &_GD_LzmaSeek, \
+ &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */, NULL /* SYNC */, \
+ &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
+ NULL /* TUNLINK */
#else
- /* Modules are internal */
- { GD_GZIP_ENCODED, ".gz", 1, NULL, "gzip", 0,
-# ifdef USE_GZIP
- &_GD_GzipOpen, &_GD_GzipClose, NULL /* TOUCH */,
- &_GD_GzipSeek, &_GD_GzipRead, &_GD_GzipSize, NULL /* WRITE */,
- NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL
-# endif
- },
- { GD_BZIP2_ENCODED, ".bz2", 1, NULL, "bzip2", 0,
-# ifdef USE_BZIP2
- &_GD_Bzip2Open, &_GD_Bzip2Close, NULL /* TOUCH */,
- &_GD_Bzip2Seek, &_GD_Bzip2Read, &_GD_Bzip2Size, NULL /* WRITE */,
- NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL
-# endif
- },
- { GD_SLIM_ENCODED, ".slm", 1, NULL, "slim", 0,
-# ifdef USE_SLIM
- &_GD_SlimOpen, &_GD_SlimClose, NULL /* TOUCH */,
- &_GD_SlimSeek, &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */,
- NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL
-# endif
- },
- { GD_LZMA_ENCODED, ".xz", 1, NULL, "lzma", 0,
-# ifdef USE_LZMA
- &_GD_LzmaOpen, &_GD_LzmaClose, NULL /* TOUCH */,
- &_GD_LzmaSeek, &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */,
- NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL
+#define GD_INT_FUNCS GD_EF_NULL_SET
+#define GD_EF_PROVIDES 0
#endif
- },
- { GD_LZMA_ENCODED, ".lzma", 1, NULL, "lzma", 0,
-# ifdef USE_LZMA
- &_GD_LzmaOpen, &_GD_LzmaClose, NULL /* TOUCH */,
- &_GD_LzmaSeek, &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */,
- NULL /* SYNC */, &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TEMP */
-# else
- NULL, NULL, NULL, NULL, NULL, NULL, NULL , NULL, &_GD_GenericMove,
- &_GD_GenericUnlink, NULL
-# endif
- },
-#endif
+ GD_EXT_ENCODING(GD_LZMA_ENCODED, ".xz", 1, "Lzma", "lzma"),
+ GD_EXT_ENCODING(GD_LZMA_ENCODED, ".lzma", 1, "Lzma", "lzma"),
+#undef GD_INT_FUNCS
+#undef GD_EF_PROVIDES
+
+
{ GD_TEXT_ENCODED, ".txt", 0, NULL, "text", 0,
- &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_GenericTouch,
- &_GD_AsciiSeek, &_GD_AsciiRead, &_GD_AsciiSize, &_GD_AsciiWrite,
- &_GD_AsciiSync, &_GD_GenericMove, &_GD_GenericUnlink, &_GD_AsciiTemp },
+ &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_GenericTouch, &_GD_AsciiSeek,
+ &_GD_AsciiRead, &_GD_AsciiSize, &_GD_AsciiWrite, &_GD_AsciiSync,
+ &_GD_GenericMove, &_GD_GenericUnlink, &_GD_AsciiTOpen, &_GD_GenericTMove,
+ &_GD_AsciiTUnlink },
+
+ { GD_SIE_ENCODED, ".sie", 0, NULL, "sie", 0,
+ &_GD_SampIndOpen, &_GD_SampIndClose, &_GD_GenericTouch, &_GD_SampIndSeek,
+ &_GD_SampIndRead, &_GD_SampIndSize, &_GD_SampIndWrite, &_GD_SampIndSync,
+ &_GD_GenericMove, &_GD_GenericUnlink, &_GD_SampIndTOpen, &_GD_GenericTMove,
+ &_GD_SampIndTUnlink },
+
{ GD_ENC_UNSUPPORTED, "", 0, "", "", 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ },
};
void _GD_InitialiseFramework(void)
@@ -173,7 +165,8 @@
#define _GD_EncodingUnderstood(encoding) \
((encoding == GD_UNENCODED || encoding == GD_SLIM_ENCODED || \
encoding == GD_GZIP_ENCODED || encoding == GD_BZIP2_ENCODED || \
- encoding == GD_TEXT_ENCODED || encoding == GD_LZMA_ENCODED))
+ encoding == GD_TEXT_ENCODED || encoding == GD_LZMA_ENCODED || \
+ encoding == GD_SIE_ENCODED))
#ifdef USE_MODULES
static void* _GD_ResolveSymbol(lt_dlhandle lib, struct encoding_t* enc,
@@ -275,8 +268,11 @@
struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding,
"Unlink");
if (_gd_ef[encoding].provides & GD_EF_TEMP)
- _gd_ef[encoding].temp = (int (*)(int, int, struct _gd_raw_file*,
+ _gd_ef[encoding].temp = (int (*)(int, int, struct _gd_raw_file*, int,
int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Temp");
+ if (_gd_ef[encoding].provides & GD_EF_TOPEN)
+ _gd_ef[encoding].topen = (gd_ef_topen_t)_GD_ResolveSymbol(lib,
+ _gd_ef + encoding, "TOpen");
/* we tried our best, don't bother trying again */
_gd_ef[encoding].provides = 0;
@@ -287,16 +283,18 @@
#endif
ret =
- (funcs & GD_EF_OPEN && _gd_ef[encoding].open == NULL) ||
- (funcs & GD_EF_CLOSE && _gd_ef[encoding].close == NULL) ||
- (funcs & GD_EF_TOUCH && _gd_ef[encoding].touch == NULL) ||
- (funcs & GD_EF_SEEK && _gd_ef[encoding].seek == NULL) ||
- (funcs & GD_EF_READ && _gd_ef[encoding].read == NULL) ||
- (funcs & GD_EF_SIZE && _gd_ef[encoding].size == NULL) ||
- (funcs & GD_EF_WRITE && _gd_ef[encoding].write == NULL) ||
- (funcs & GD_EF_SYNC && _gd_ef[encoding].sync == NULL) ||
- (funcs & GD_EF_UNLINK && _gd_ef[encoding].unlink == NULL) ||
- (funcs & GD_EF_TEMP && _gd_ef[encoding].temp == NULL);
+ (funcs & GD_EF_OPEN && _gd_ef[encoding].open == NULL) ||
+ (funcs & GD_EF_CLOSE && _gd_ef[encoding].close == NULL) ||
+ (funcs & GD_EF_TOUCH && _gd_ef[encoding].touch == NULL) ||
+ (funcs & GD_EF_SEEK && _gd_ef[encoding].seek == NULL) ||
+ (funcs & GD_EF_READ && _gd_ef[encoding].read == NULL) ||
+ (funcs & GD_EF_SIZE && _gd_ef[encoding].size == NULL) ||
+ (funcs & GD_EF_WRITE && _gd_ef[encoding].write == NULL) ||
+ (funcs & GD_EF_SYNC && _gd_ef[encoding].sync == NULL) ||
+ (funcs & GD_EF_UNLINK && _gd_ef[encoding].unlink == NULL) ||
+ (funcs & GD_EF_TOPEN && _gd_ef[encoding].topen == NULL) ||
+ (funcs & GD_EF_TMOVE && _gd_ef[encoding].tmove == NULL) ||
+ (funcs & GD_EF_TUNLINK && _gd_ef[encoding].tunlink == NULL);
dreturn("%i", ret);
return ret;
@@ -322,7 +320,7 @@
if (gd_StatAt(D, dirfd, candidate, &statbuf, 0) == 0)
if (S_ISREG(statbuf.st_mode)) {
if (file != NULL)
- file->encoding = i;
+ file->subenc = i;
free(candidate);
dreturn("%08lx", _gd_ef[i].scheme);
return _gd_ef[i].scheme;
@@ -334,7 +332,7 @@
if (scheme != 0 && file != NULL) {
for (i = 0; _gd_ef[i].scheme != GD_ENC_UNSUPPORTED; i++)
if (scheme == _gd_ef[i].scheme) {
- file->encoding = i;
+ file->subenc = i;
dreturn("0x%08lx", _gd_ef[i].scheme);
return _gd_ef[i].scheme;;
}
@@ -357,19 +355,19 @@
/* If the encoding scheme is unknown, complain */
if (D->fragment[E->fragment_index].encoding == GD_AUTO_ENCODED) {
- _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL);
+ _GD_SetError(D, GD_E_UNKNOWN_ENCODING, GD_E_UNENC_UNDET, NULL, 0, NULL);
dreturn("%i", 0);
return 0;
}
/* Figure out the encoding subtype, if required */
- if (E->e->u.raw.file[0].encoding == GD_ENC_UNKNOWN)
+ if (E->e->u.raw.file[0].subenc == GD_ENC_UNKNOWN)
_GD_ResolveEncoding(D, E->e->u.raw.filebase,
D->fragment[E->fragment_index].encoding,
D->fragment[E->fragment_index].dirfd, E->e->u.raw.file);
/* check for our function(s) */
- ...
[truncated message content] |
|
From: <ket...@us...> - 2011-08-17 15:20:38
|
Revision: 595
http://getdata.svn.sourceforge.net/getdata/?rev=595&view=rev
Author: ketiltrout
Date: 2011-08-17 15:20:30 +0000 (Wed, 17 Aug 2011)
Log Message:
-----------
Fix stat64 stuff for OSX.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/internal.h
trunk/getdata/src/sie.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-08-11 19:36:53 UTC (rev 594)
+++ trunk/getdata/ChangeLog 2011-08-17 15:20:30 UTC (rev 595)
@@ -1,3 +1,7 @@
+2011-08-11 D. V. Wiebe <ge...@ke...> svn:595
+ * src/internal.h: In cases where no explicitly 64-bit stat struct can be
+ found, don't bother trying to use explicitly 64-bit stat functions.
+
2011-08-11 D. V. Wiebe <ge...@ke...> svn:594
* test/sie_nframes_big.c test/sie_get_big.c test/sie_get_little.c
test/sie_nframes_little.c test/sie_move_to.c test/sie_put_little.c
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-08-11 19:36:53 UTC (rev 594)
+++ trunk/getdata/src/internal.h 2011-08-17 15:20:30 UTC (rev 595)
@@ -280,34 +280,40 @@
#define rmdir _rmdir
#endif
-#if HAVE_STAT64
+#if HAVE_STRUCT_STAT64
+typedef struct stat64 gd_stat64_t;
+#elif HAVE_STRUCT__STAT64
+typedef struct _stat64 gd_stat64_t;
+#elif HAVE_STRUCT___STAT64
+typedef struct __stat64 gd_stat64_t;
+#else
+typedef struct stat gd_stat64_t;
+#define GD_NO_64BIT_STAT
+#endif
+
+#ifdef GD_NO_64BIT_STAT
+# define gd_stat64 stat
+# define gd_fstat64 fstat
+#else
+# if HAVE_STAT64
# define gd_stat64 stat64
-#elif HAVE__STAT64
+# elif HAVE__STAT64
# define gd_stat64 _stat64
-#else
+# else
# define gd_stat64 stat
-#endif
+# endif
-#if HAVE_FSTAT64
+# if HAVE_FSTAT64
# define gd_fstat64 fstat64
-#elif HAVE__FSTAT64
+# elif HAVE__FSTAT64
# define gd_fstat64 _fstat64
-#elif HAVE__FSTAT
+# elif HAVE__FSTAT
# define gd_fstat64 _fstat
-#else
+# else
# define gd_fstat64 fstat
+# endif
#endif
-#if HAVE_STRUCT_STAT64
-typedef struct stat64 gd_stat64_t;
-#elif HAVE_STRUCT__STAT64
-typedef struct _stat64 gd_stat64_t;
-#elif HAVE_STRUCT___STAT64
-typedef struct __stat64 gd_stat64_t;
-#else
-typedef struct stat gd_stat64_t;
-#endif
-
#ifndef AT_SYMLINK_NOFOLLOW
#define AT_SYMLINK_NOFOLLOW 0x100
#endif
Modified: trunk/getdata/src/sie.c
===================================================================
--- trunk/getdata/src/sie.c 2011-08-11 19:36:53 UTC (rev 594)
+++ trunk/getdata/src/sie.c 2011-08-17 15:20:30 UTC (rev 595)
@@ -237,7 +237,7 @@
dtrace("%p, %p, 0x%03x, %zu", file, ptr, data_type, nelem);
/* not enough data in the current run */
- while (f->d[0] - f->p <= nelem - count) {
+ while (f->d[0] - f->p <= (int64_t)(nelem - count)) {
/* copy what we've got */
cur = _GD_Duplicate(cur, f->d + 1, GD_SIZE(data_type), f->d[0] - f->p + 1);
count += f->d[0] - f->p + 1;
@@ -252,7 +252,7 @@
}
/* copy the remnant */
- if (f->d[0] - f->p >= nelem - count) {
+ if (f->d[0] - f->p >= (int64_t)(nelem - count)) {
_GD_Duplicate(cur, f->d + 1, GD_SIZE(data_type), nelem - count);
f->p += nelem - count;
count = nelem;
@@ -369,7 +369,7 @@
}
if (fseek(f->fp, (fr + rout) * size, SEEK_SET) ||
(fread(buffer, size, nrec - (fr + rout), f->fp)
- < nrec - (fr + rout)))
+ < (size_t)(nrec - (fr + rout))))
{
free(buffer);
free(p);
@@ -377,7 +377,8 @@
return -1;
}
if (fseek(f->fp, (fr + rin) * size, SEEK_SET) ||
- (fwrite(buffer, size, nrec - (fr + rout), f->fp) < nrec - (fr + rout)))
+ (fwrite(buffer, size, nrec - (fr + rout), f->fp)
+ < (size_t)(nrec - (fr + rout))))
{
free(buffer);
free(p);
@@ -447,7 +448,7 @@
int64_t n;
const size_t size = sizeof(int64_t) + GD_SIZE(data_type);
- dtrace("%i, %p, 0x%03x, %i", dirfd, file, data_type, size);
+ dtrace("%i, %p, 0x%03x, %i", dirfd, file, data_type, swap);
/* open */
if (_GD_SampIndDoOpen(dirfd, file, &f, swap, GD_RDONLY, 0)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-08-19 01:27:54
|
Revision: 596
http://getdata.svn.sourceforge.net/getdata/?rev=596&view=rev
Author: ketiltrout
Date: 2011-08-19 01:27:46 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Error housekeeping including doc updates.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/man/gd_alter_spec.3
trunk/getdata/man/gd_bof.3
trunk/getdata/man/gd_carray_len.3
trunk/getdata/man/gd_carrays.3
trunk/getdata/man/gd_cbopen.3
trunk/getdata/man/gd_close.3
trunk/getdata/man/gd_constants.3
trunk/getdata/man/gd_entry.3
trunk/getdata/man/gd_entry_type.3
trunk/getdata/man/gd_eof.3
trunk/getdata/man/gd_error_count.3
trunk/getdata/man/gd_error_string.3
trunk/getdata/man/gd_field_list_by_type.3
trunk/getdata/man/gd_flush.3
trunk/getdata/man/gd_fragment_index.3
trunk/getdata/man/gd_framenum_subset.3
trunk/getdata/man/gd_get_carray_slice.3
trunk/getdata/man/gd_get_constant.3
trunk/getdata/man/gd_getdata.3
trunk/getdata/man/gd_include.3
trunk/getdata/man/gd_invalid_dirfile.3
trunk/getdata/man/gd_mcarrays.3
trunk/getdata/man/gd_mconstants.3
trunk/getdata/man/gd_metaflush.3
trunk/getdata/man/gd_mfield_list_by_type.3
trunk/getdata/man/gd_native_type.3
trunk/getdata/man/gd_nfields_by_type.3
trunk/getdata/man/gd_nframes.3
trunk/getdata/man/gd_nmfields_by_type.3
trunk/getdata/man/gd_put_carray_slice.3
trunk/getdata/man/gd_put_constant.3
trunk/getdata/man/gd_put_string.3
trunk/getdata/man/gd_putdata.3
trunk/getdata/man/gd_rename.3
trunk/getdata/man/gd_rewrite_fragment.3
trunk/getdata/man/gd_spf.3
trunk/getdata/man/gd_validate.3
trunk/getdata/man/make_html.pl
trunk/getdata/src/encoding.c
trunk/getdata/src/errors.c
trunk/getdata/src/flimits.c
trunk/getdata/src/flush.c
trunk/getdata/src/include.c
trunk/getdata/src/index.c
trunk/getdata/src/nmeta.c
trunk/getdata/src/open.c
trunk/getdata/src/parse.c
trunk/getdata/src/sie.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/ChangeLog 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,3 +1,27 @@
+2011-08-19 D. V. Wiebe <ge...@ke...> svn:596
+ * src/open.c (gd_invalid_dirfile gd_cbopen): If allocating the DIRFILE
+ itself fails, return NULL instead of segfaulting.
+
+ * src/nmeta.c (gd_nmfields_by_type): Throw GD_E_BAD_ENTRY on encountering
+ GD_NO_ENTRY.
+
+ * src/index.c (gd_framenum_subset64): Throw GD_E_DIMENSION if the caller
+ supplies the field code for a scalar.
+
+ * src/errors.c: Added GD_E_BOUNDS and GD_E_LINE_TOO_LONG.
+
+ * src/encoding.c (_GD_ResolveEncoding): Don't segfault on malloc error.
+
+ * src/flimits.c (_GD_GetBOF): Throw GD_INTERNAL_ERROR instead of
+ GD_E_BAD_FIELD_TYPE when encountering GD_NO_ENTRY.
+
+ * src/parse.c (_GD_UTF8Encode): Renamed from utf8encode for consistency.
+
+ * src/sie.c (_GD_SampIndTUnlink) src/include.c (gd_uninclude): Use
+ gd_UnlinkAt instead of bare unlink().
+
+ * man/make_html.pl: Handle multiparagraph .TPs.
+
2011-08-11 D. V. Wiebe <ge...@ke...> svn:595
* src/internal.h: In cases where no explicitly 64-bit stat struct can be
found, don't bother trying to use explicitly 64-bit stat functions.
Modified: trunk/getdata/man/gd_alter_spec.3
===================================================================
--- trunk/getdata/man/gd_alter_spec.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_alter_spec.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_alter_spec.3. The gd_alter_spec man page.
.\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 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_spec 3 "21 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_alter_spec 3 "17 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_alter_spec, gd_malter_spec \(em modify a field in a dirfile
.SH SYNOPSIS
@@ -64,7 +64,7 @@
and the
.I recode
argument is non-zero, the look-up table file will be moved if
-.IR entry -> table
+.I line
specifies a different path, overwriting an existing file with the new
pathname, if present. If the field specified by
.I field_code
@@ -152,6 +152,12 @@
A descriptive error string for the last error encountered can be obtained from
a call to
.BR gd_error_string (3).
+.SH BUGS
+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.
.SH SEE ALSO
.BR gd_alter_bit (3),
.BR gd_alter_const (3),
Modified: trunk/getdata/man/gd_bof.3
===================================================================
--- trunk/getdata/man/gd_bof.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_bof.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_bof.3. The gd_bof man page.
.\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 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_bof 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_bof 3 "17 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_bof \(em report the start of data in a field
.SH SYNOPSIS
@@ -67,6 +67,9 @@
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_ALLOC
+The library was unable to allocate memory.
+.TP
.B GD_E_BAD_CODE
The field specified by
.I field_code
@@ -88,6 +91,11 @@
.I field_code
itself specified a scalar field.
.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library. Please report the incident to the
+GetData developers.
+.TP
.B GD_E_RECURSE_LEVEL
Too many levels of recursion were encountered while trying to resolve
.IR field_code .
Modified: trunk/getdata/man/gd_carray_len.3
===================================================================
--- trunk/getdata/man/gd_carray_len.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_carray_len.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_carray_len.3. The gd_carray_len man page.
.\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 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_carray_len 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_carray_len 3 "15 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_carray_len \(em returns the length of a CARRAY field in a dirfile
.SH SYNOPSIS
@@ -48,6 +48,9 @@
returns the length of the field specified. On error, it returns zero 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 field specified by
.I field_code
Modified: trunk/getdata/man/gd_carrays.3
===================================================================
--- trunk/getdata/man/gd_carrays.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_carrays.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_carrays.3. The gd_carrays man page.
.\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 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_carrays 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_carrays 3 "17 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_carrays \(em retrieve a list of CARRAY values from a dirfile
.SH SYNOPSIS
@@ -123,6 +123,11 @@
The
.I return_type
specified was invalid.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library. Please report the incident to the
+GetData developers.
.PP
The dirfile error may be retrieved by calling
.BR gd_error (3).
Modified: trunk/getdata/man/gd_cbopen.3
===================================================================
--- trunk/getdata/man/gd_cbopen.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_cbopen.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -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 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_cbopen 3 "17 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_cbopen, gd_open \(em open or create a dirfile
.SH SYNOPSIS
@@ -74,7 +74,7 @@
.TP
.PD
.B GD_NOT_ARM_ENDIAN
-Specifies that double precision floating point raw data on disk is, or is not,
+Specifies that double precision floating point raw data on disk are, or are not,
stored in the middle-endian format used by older ARM processors.
These flag only set the default endianness, and will be overridden when an
@@ -197,7 +197,7 @@
section below for full details.
.TP
.B GD_PRETTY_PRINT
-When dirfile metadata is flushed to disk (either explicitly via
+When dirfile metadata are flushed to disk (either explicitly via
.BR gd_metaflush (),\~ gd_rewrite_fragment (),
or
.BR gd_flush ()
@@ -302,9 +302,10 @@
The GetData parser can operate in two modes: a
.I permissive
mode, in which much
-non-Standards compliant syntax is allowed, and a
+non-Standards-compliant syntax is allowed, and a
.I pedantic
-mode, in which the parser adheres strictly to the Standards. If
+mode, in which the parser adheres strictly to the Standards. The mode made
+change during the parsing of a dirfile. If
.B GD_PEDANTIC
is passed to
.BR gd_cbopen (),
@@ -569,11 +570,12 @@
.BR gd_cbopen ()
or
.BR gd_open ()
-always returns a pointer to a newly allocated DIRFILE object. The DIRFILE
-object is an opaque structure containing the parsed dirfile metadata.
-If an error occurred, the dirfile error will be set to a non-zero error value.
-The DIRFILE object will also be internally flagged as invalid. Possible error
-values are:
+always returns a pointer to a newly allocated DIRFILE object, except in
+instances when it is unable to allocate memory for the DIRFILE object itself,
+in which case it will return NULL. The DIRFILE object is an opaque structure
+containing the parsed dirfile metadata. If an error occurred, the dirfile
+error will be set to a non-zero error value. The DIRFILE object will also
+be internally flagged as invalid. Possible error values are:
.TP 8
.B GD_E_ACCMODE
The library was asked to create or truncate a dirfile opened read-only (i.e.
@@ -612,11 +614,6 @@
.B The Callback Function
section above.
.TP
-.B GD_E_INTERNAL_ERROR
-An internal error occurred in the library while trying to perform the task.
-This indicates a bug in the library. Please report the incident to the
-GetData developers.
-.TP
.B GD_E_LINE_TOO_LONG
The parser encountered a line in the format specification longer than it was
able to deal with. Lines are limited by the storage size of
Modified: trunk/getdata/man/gd_close.3
===================================================================
--- trunk/getdata/man/gd_close.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_close.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_close.3. The gd_close man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_close 3 "20 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_close 3 "17 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_close, gd_discard \(em close a dirfile and free associated memory.
.SH SYNOPSIS
@@ -51,9 +51,9 @@
data files are still flushed to disk by this function. If
.I dirfile
was opened in read-only mode,
-.BR gd_discard()
+.BR gd_discard ()
and
-.BR gd_close()
+.BR gd_close ()
behave identically.
One of these functions should be called on all pointers returned by
@@ -64,7 +64,7 @@
even if the call to those function failed. After
.BR gd_close ()
or
-.BR gd_discard()
+.BR gd_discard ()
returns successfully, the pointer
.I dirfile
should be considered invalid.
@@ -85,6 +85,9 @@
and set 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_FLUSH
A temporary file could not be opened into which to write the modified metadata,
or renaming the temporary file over the original fragment failed.
Modified: trunk/getdata/man/gd_constants.3
===================================================================
--- trunk/getdata/man/gd_constants.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_constants.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_constants 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_constants 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_constants \(em retrieve a list of constant values from a dirfile
.SH SYNOPSIS
@@ -89,6 +89,11 @@
The
.I return_type
specified was invalid.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library. Please report the incident to the
+GetData developers.
.PP
The dirfile error may be retrieved by calling
.BR gd_error (3).
Modified: trunk/getdata/man/gd_entry.3
===================================================================
--- trunk/getdata/man/gd_entry.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_entry.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_entry.3. The gd_entry man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_entry 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_entry 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_entry \(em retrieve a dirfile field's metadata
.SH SYNOPSIS
@@ -75,6 +75,9 @@
returns -1 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 field specified by
.I field_code
@@ -410,8 +413,9 @@
.I n_fields
member indicates the number of input fields. It will be between one and
.B GD_MAX_LINCOM
-inclusive, which is defined in getdata.h to the maximum number of input fields
-permitted by a
+inclusive.
+.B GD_MAX_LINCOM
+is defined in getdata.h as the maximum number of input fields permitted by a
.BR LINCOM .
.PP
The
@@ -588,8 +592,9 @@
.I poly_ord
member indicates the order of the polynomial. It will be between one and
.B GD_MAX_POLY_ORD
-inclusive, which is defined in getdata.h to the maximum order of polynomial
-permitted by a
+inclusive.
+.B GD_MAX_POLY_ORD
+is defined in getdata.h as the maximum order of polynomial permitted by a
.BR POLYNOM .
.PP
The
Modified: trunk/getdata/man/gd_entry_type.3
===================================================================
--- trunk/getdata/man/gd_entry_type.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_entry_type.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_entry_type.3. The gd_entry_type man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_entry_type 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_entry_type 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_entry_type \(em retrieve the type of a dirfile field
.SH SYNOPSIS
@@ -58,6 +58,9 @@
and sets the dirfile error 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_DIRFILE
The supplied dirfile was invalid.
.TP
Modified: trunk/getdata/man/gd_eof.3
===================================================================
--- trunk/getdata/man/gd_eof.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_eof.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_eof.3. The gd_eof man page.
.\"
-.\" Copyright (C) 2010 D. V. Wiebe
+.\" Copyright (C) 2010, 2011 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_eof 3 "15 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_eof 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_eof \(em report the number of samples in a dirfile field
.SH SYNOPSIS
@@ -69,6 +69,9 @@
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_ALLOC
+The library was unable to allocate memory.
+.TP
.B GD_E_BAD_CODE
The field specified by
.I field_code
@@ -99,6 +102,11 @@
.I field_code
itself specified a scalar field.
.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library. Please report the incident to the
+GetData developers.
+.TP
.B GD_E_RAW_IO
An attempt to
.BR stat (2)
Modified: trunk/getdata/man/gd_error_count.3
===================================================================
--- trunk/getdata/man/gd_error_count.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_error_count.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_error_count 3 "20 April 2011" "Version 0.8.0" "GETDATA"
+.TH gd_error_count 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_error_count \(em report the number of errors encountered by the GetData
library
@@ -37,11 +37,14 @@
return the number of errors encountered only since the previous call to this
function, for the specified DIRFILE.
-The errors themselves are not cached by the library. The
+The errors themselves are not cached by the library. The error status of
+the
.I last
-error encountered by the library for
+library call on
.I dirfile
-can be obtained by calling
+(which might be
+.BR GD_E_OK ,
+indicating no error) can be obtained by calling
.BR gd_error (3).
.SH RETURN VALUE
Modified: trunk/getdata/man/gd_error_string.3
===================================================================
--- trunk/getdata/man/gd_error_string.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_error_string.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -67,4 +67,4 @@
is unchanged.
.SH SEE ALSO
.BR gd_error (3),
-.BR gd_error_string (3)
+.BR gd_error_count (3)
Modified: trunk/getdata/man/gd_field_list_by_type.3
===================================================================
--- trunk/getdata/man/gd_field_list_by_type.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_field_list_by_type.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_field_list_by_type.3. The gd_field_list_by_type man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_field_list_by_type 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_field_list_by_type 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_field_list_by_type \(em retrieve a list of fields in a dirfile
.SH SYNOPSIS
@@ -90,6 +90,16 @@
.TP
.B GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
+.TP
+.B GD_E_BAD_ENTRY
+The
+.I type
+parameter supplied was not one of the symbols listed above.
+.TP
+.B GD_E_INTERNAL_ERROR
+An internal error occurred in the library while trying to perform the task.
+This indicates a bug in the library. Please report the incident to the
+GetData developers.
.PP
The dirfile error may be retrieved by calling
.BR gd_error (3).
@@ -99,6 +109,7 @@
.SH SEE ALSO
.BR dirfile (5),
.BR gd_open (3),
+.BR gd_carrays (3),
.BR gd_constants (3),
.BR gd_error (3),
.BR gd_error_string (3),
Modified: trunk/getdata/man/gd_flush.3
===================================================================
--- trunk/getdata/man/gd_flush.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_flush.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_flush.3. The gd_flush man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_flush 3 "24 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_flush 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_flush \(em write all pending dirfile changes to disk.
.SH SYNOPSIS
@@ -54,6 +54,9 @@
On success, zero is returned. 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_ALLOC
+The library was unable to allocate memory.
+.TP
.B GD_E_BAD_CODE
The field specified by
.I field_code
@@ -76,6 +79,12 @@
.TP
.B GD_E_RAW_IO
An error occurred while trying to flush or close the field(s).
+.TP
+.B GD_E_RECURSE_LEVEL
+Too many levels of recursion were encountered while trying to resolve
+.IR field_code .
+This usually indicates a circular dependency in field specification in the
+dirfile.
.PP
The dirfile error may be retrieved by calling
.BR gd_error (3).
Modified: trunk/getdata/man/gd_fragment_index.3
===================================================================
--- trunk/getdata/man/gd_fragment_index.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_fragment_index.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_fragment_index.3. The gd_fragment_index man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_fragment_index 3 "15 July 2010" "Version 0.7.0" "GETDATA"
+.TH gd_fragment_index 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_fragment_index \(em retrieve the fragment containing a dirfile field
.SH SYNOPSIS
@@ -43,14 +43,17 @@
returns -1 and sets the dirfile error a non-zero error value. Possible error
values are:
.TP 8
-.B GD_E_BAD_DIRFILE
-The supplied dirfile was invalid.
+.B GD_E_ALLOC
+The library was unable to allocate memory.
.TP
.B GD_E_BAD_CODE
The field specified by
.I field_code
was not found in the database.
.TP
+.B GD_E_BAD_DIRFILE
+The supplied dirfile was invalid.
+.TP
.B GD_E_BAD_REPR
The representation suffix specified in
.I field_code
Modified: trunk/getdata/man/gd_framenum_subset.3
===================================================================
--- trunk/getdata/man/gd_framenum_subset.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_framenum_subset.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_framenum_subset.3. The gd_framenum man page.
.\"
-.\" Copyright (C) 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2009, 2010, 2011 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_framenum_subset 3 "23 October 2010" "Version 0.7.0" "GETDATA"
+.TH gd_framenum_subset 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_framenum_subset, gd_framenum \(em perform a reverse look-up on a
monotonic dirfile field
@@ -110,11 +110,6 @@
.B GD_E_BAD_DIRFILE
The supplied dirfile was invalid.
.TP
-.B GD_E_BAD_FIELD_TYPE
-The field specified by
-.I field_code
-was not a vector field.
-.TP
.B GD_E_BAD_REPR
The representation suffix specified in
.IR field_code ,
@@ -125,7 +120,10 @@
scalar type.
.TP
.B GD_E_DIMENSION
-A scalar field was found where a vector field was expected.
+The field specified by
+.I field_code
+was not a vector field. Or, a scalar field was found where a vector field was
+expected in the definition of the field or one of its inputs.
.TP
.B GD_E_DOMAIN
The specified field was complex valued, or the supplied frame range was too
Modified: trunk/getdata/man/gd_get_carray_slice.3
===================================================================
--- trunk/getdata/man/gd_get_carray_slice.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_get_carray_slice.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_get_carray_slice 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_get_carray_slice 3 "18 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_get_carray gd_get_carray_slice \(em retrieve CARRAY data from a dirfile
database
@@ -136,6 +136,9 @@
return zero. On error, they return -1 and set the dirfile error to a non-zero
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 field specified by
.I field_code
Modified: trunk/getdata/man/gd_get_constant.3
===================================================================
--- trunk/getdata/man/gd_get_constant.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_get_constant.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_get_constant.3. The gd_get_constant man page.
.\"
-.\" Copyright (C) 2008, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2010, 2011 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_get_constant 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_get_constant 3 "17 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_get_constant \(em retrieve a scalar constant from a dirfile database
.SH SYNOPSIS
@@ -111,6 +111,9 @@
returns zero. On error, it returns -1 and sets the dirfile error to a non-zero
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 field specified by
.I field_code
@@ -134,8 +137,8 @@
.TP
.B GD_E_BAD_REPR
The representation suffix specified in
-.IR field code ,
-or in one of the field codes it uses for input, was invalid.
+.I field_code
+was invalid.
.TP
.B GD_E_BAD_TYPE
An invalid
Modified: trunk/getdata/man/gd_getdata.3
===================================================================
--- trunk/getdata/man/gd_getdata.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_getdata.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_getdata.3. The gd_getdata man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 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_getdata 3 "3 November 2010" "Version 0.7.0" "GETDATA"
+.TH gd_getdata 3 "19 August 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_getdata \(em retrieve data from a dirfile database
.SH SYNOPSIS
@@ -168,19 +168,6 @@
.I dirfile
was supplied.
.TP
-.B GD_E_BAD_FIELD_TYPE
-The supplied
-.I field_code
-referred to a
-.BR CONST ,\~ CARRAY ,
-or
-.B STRING
-field. The caller should use
-.BR gd_get_constant (3),\~ gd_get_carray (3) ,
-or
-.BR gd_get_string (3)
-instead.
-.TP
.B GD_E_BAD_REPR
The representation suffix specified in
.IR field_code ,
@@ -196,7 +183,20 @@
was specified.
.TP
.B GD_E_DIMENSION
-A scalar field was found where a vector field was expected.
+The supplied
+.I field_code
+referred to a
+.BR CONST ,\~ CARRAY ,
+or
+.B STRING
+field. The caller should use
+.BR gd_get_constant (3),\~ gd_get_carray (3) ,
+or
+.BR gd_get_string (3)
+instead. Or, a scalar field was found where a vector field was expected in
+the definition of
+.I field_code
+or one of its inputs.
.TP
.B GD_E_INTERNAL_ERROR
An internal error occurred in the library while trying to perform the task.
Modified: trunk/getdata/man/gd_include.3
===================================================================
--- trunk/getdata/man/gd_include.3 2011-08-17 15:20:30 UTC (rev 595)
+++ trunk/getdata/man/gd_include.3 2011-08-19 01:27:46 UTC (rev 596)
@@ -1,6 +1,6 @@
.\" gd_include.3. The gd_include man page.
.\"
-.\" Copyright (C) 2008, 2009, 2010 D. V. Wiebe
+.\" Copyright (C) 2008, 2009, 2010, 2011 D. V. Wiebe
.\"
.\"""...
[truncated message content] |
|
From: <ket...@us...> - 2011-08-20 21:38:20
|
Revision: 599
http://getdata.svn.sourceforge.net/getdata/?rev=599&view=rev
Author: ketiltrout
Date: 2011-08-20 21:38:14 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
Update the current SIE record at the end of a write.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/open.c
trunk/getdata/src/sie.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-08-20 21:35:02 UTC (rev 598)
+++ trunk/getdata/ChangeLog 2011-08-20 21:38:14 UTC (rev 599)
@@ -1,3 +1,9 @@
+2011-08-20 D. V. Wiebe <ge...@ke...> svn:599
+ * src/open.c (gd_cbopen): Properly initialise bname; also check for malloc
+ errors.
+ * sie/sie.c (_GD_SampIndWrite): Update the current record to reflect the
+ updated position of the file pointer.
+
2011-08-20 D. V. Wiebe <ge...@ke...> svn:597
* src/internal.h: Added bname to fragment struct holding the basename of the
file.
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2011-08-20 21:35:02 UTC (rev 598)
+++ trunk/getdata/src/open.c 2011-08-20 21:38:14 UTC (rev 599)
@@ -364,8 +364,13 @@
return D;
}
D->fragment[0].cname = malloc(strlen(filedir) + 8);
+ D->fragment[0].bname = strdup("format");
+ if (D->fragment[0].cname == NULL || D->fragment[0].bname == NULL) {
+ _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ dreturn("%p", D);
+ return D;
+ }
strcat(strcpy(D->fragment[0].cname, filedir), "/format");
- D->fragment[0].bname = "format";
D->fragment[0].sname = NULL;
/* The root format file needs no external name */
D->fragment[0].ename = NULL;
Modified: trunk/getdata/src/sie.c
===================================================================
--- trunk/getdata/src/sie.c 2011-08-20 21:35:02 UTC (rev 598)
+++ trunk/getdata/src/sie.c 2011-08-20 21:38:14 UTC (rev 599)
@@ -322,7 +322,7 @@
dreturn("%i", -1);
return -1;
}
- p2 = p;
+ p = p2;
}
*cur_end = f->p + i - 1;
cur_end = (int64_t*)((char*)p + size * rin);
@@ -396,12 +396,19 @@
dreturn("%i", -1);
return -1;
}
- free(p);
/* truncate the file if necessary */
if (rin < rout)
gd_truncate(fileno(f->fp), nrec - rout + rin);
+ /* update the current record */
+ memcpy(f->d, (char *)p + (rin - 1) * size, size);
+ f->s = f->d[0];
+ f->p = f->d[0] + 1;
+ f->r = fr + rin - 1;
+
+ free(p);
+
dreturn("%llu", (unsigned long long)nelem);
return nelem;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-08-23 17:08:35
|
Revision: 600
http://getdata.svn.sourceforge.net/getdata/?rev=600&view=rev
Author: ketiltrout
Date: 2011-08-23 17:08:28 +0000 (Tue, 23 Aug 2011)
Log Message:
-----------
Make the new path rigmarole work with the MSVCRT. Third parties moving stuff around will still confuse us here more than it would on a POSIX system, but we're at least protected from the caller confusing us with chdir(). A few other minor things.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/src/bzip.c
trunk/getdata/src/close.c
trunk/getdata/src/common.c
trunk/getdata/src/compat.c
trunk/getdata/src/errors.c
trunk/getdata/src/internal.h
trunk/getdata/src/open.c
trunk/getdata/test/error_error.c
trunk/getdata/test/test.h
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/ChangeLog 2011-08-23 17:08:28 UTC (rev 600)
@@ -1,3 +1,41 @@
+2011-08-23 D. V. Wiebe <ge...@ke...> svn:600
+ * test/error_error.c: Simplify test.
+ * test/test.h (CHECKSp): Added.
+
+ * src/errors.c src/internal.h: Added GD_E_CREAT_OPEN.
+ * src/open.c (_GD_CreateDirfile): Distinguish GD_E_CREAT_DIR from
+ GD_E_CREAT_OPEN.
+
+ * src/internal.h: When linking to the MSVCRT, define GD_NO_DIR_OPEN to
+ indicate that the MSVCRT's open() prohibits openind directories. (This is
+ referred to as "the non-POSIX case".
+ * src/open.c (_GD_CreateDirfile): Take dirfile, a malloc'd copy instead of
+ filedir itself. In the non-POSIX case, this has the full pathname. Also,
+ handle non-POSIX computation of dirfd.
+ * src/open.c (gd_cbopen): In the non-POSIX case, prepend the CWD to filedir
+ if it's not absolute, and pass that string to _GD_CreateDirfile. Also need
+ to stat the directory in this case, in lieu of trying to open it.
+ * src/close.c (_GD_ShutdownDirfile): Don't try to close the dirfds in the
+ non-POSIX case.
+ * src/common.c (_GD_DirName): In the non-POSIX case, the dirfd parameter
+ simply contains the index into the dir array, so no need to search.
+ * src/common.c (_GD_GrabDir _GD_ReleaseDir): In the non-POSIX case, don't
+ try to open or close the directory: it just contains the index into dir, so
+ no need to search for it either.
+
+ * src/compat.c (gd_OpenAt): Or flags with O_BINARY for operation on Win32.
+
+ * src/open.c (gd_cbopen): Close dirfd on error.
+
+ * src/bzip.c (_GD_Bzip2Seek): Return -1 on error.
+
+ * src/internal.h (_GD_AbsPath): Added.
+
+ * src/internal.h (gd_swap64): Fix doubled backslashes.
+
+ * configure.ac: Fix perl check to properly exclude the bindings when
+ necessary.
+
2011-08-20 D. V. Wiebe <ge...@ke...> svn:599
* src/open.c (gd_cbopen): Properly initialise bname; also check for malloc
errors.
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/configure.ac 2011-08-23 17:08:28 UTC (rev 600)
@@ -660,7 +660,7 @@
echo
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 \
+ ftello ftello64 ftruncate ftruncate64 _getcwd getdelim \
gmtime_r _lseeki64 lstat _mkdir nan _open openat _read \
renameat _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
_strtoui64 strtoull _unlink unlinkat _write])
@@ -778,6 +778,9 @@
echo "*** Configuring Perl bindings"
echo
GD_PERL
+ if test "x$have_perl" != "xyes"; then
+ make_perlbindings=no
+ fi
fi
dnl external encodings
Modified: trunk/getdata/src/bzip.c
===================================================================
--- trunk/getdata/src/bzip.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/bzip.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -135,8 +135,8 @@
if (ptr->bzfile == NULL || ptr->bzerror != BZ_OK) {
fclose(ptr->stream);
- dreturn("%i", 1);
- return 1;
+ dreturn("%i", -1);
+ return -1;
}
ptr->pos = ptr->end = 0;
ptr->base = ptr->stream_end = 0;
Modified: trunk/getdata/src/close.c
===================================================================
--- trunk/getdata/src/close.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/close.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -93,9 +93,11 @@
return -1;
}
+#ifndef GD_NO_DIR_OPEN
/* close the directory */
for (i = 0; i < (unsigned int)D->ndir; ++i)
close(D->dir[i].fd);
+#endif
_GD_FreeD(D);
Modified: trunk/getdata/src/common.c
===================================================================
--- trunk/getdata/src/common.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/common.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -893,15 +893,25 @@
const char *_GD_DirName(const DIRFILE *D, int dirfd)
{
+#ifndef GD_NO_DIR_OPEN
unsigned int i;
+#endif
dtrace("%p, %i", D, dirfd);
+#ifdef GD_NO_DIR_OPEN
+ /* in the non-POSIX case, dirfd is just the index in the dir list */
+ if (D->ndir > 0) {
+ dreturn("\"%s\"", D->dir[dirfd].path);
+ return D->dir[dirfd].path;
+ }
+#else
for (i = 0; i < D->ndir; ++i)
if (dirfd == D->dir[i].fd) {
dreturn("\"%s\"", D->dir[i].path);
return D->dir[i].path;
}
+#endif
/* we only get here in the early stages of opening a dirfile */
dreturn("%p", D->name);
@@ -937,13 +947,7 @@
unsigned int i;
char *path, *dir = NULL;
void *ptr;
- int abs = (
-#if defined _WIN32 || defined _WIN64
- name[0] != '\0' && name[1] == ':'
-#else
- name[0] == '/'
-#endif
- );
+ int abs = _GD_AbsPath(name);
dtrace("%p, %i, \"%s\"", D, dirfd, name);
@@ -989,6 +993,10 @@
return -1;
}
+#ifdef GD_NO_DIR_OPEN
+ D->dir[D->ndir].fd = D->ndir;
+ free(path);
+#else
if (abs) {
D->dir[D->ndir].fd = open(dir, O_RDONLY);
} else {
@@ -1009,6 +1017,7 @@
dreturn("%i", -1);
return -1;
}
+#endif
D->ndir++;
dreturn("%i", D->dir[D->ndir - 1].fd);
@@ -1017,10 +1026,18 @@
void _GD_ReleaseDir(DIRFILE *D, int dirfd)
{
+#ifndef GD_NO_DIR_OPEN
unsigned int i;
+#endif
dtrace("%p, %i", D, dirfd);
+#ifdef GD_NO_DIR_OPEN
+ if (--D->dir[dirfd].rc == 0) {
+ free(D->dir[dirfd].path);
+ D->dir[dirfd] = D->dir[--D->ndir];
+ }
+#else
for (i = 0; i < D->ndir; ++i)
if (D->dir[i].fd == dirfd) {
if (--D->dir[i].rc == 0) {
@@ -1030,6 +1047,7 @@
}
break;
}
+#endif
dreturnvoid();
}
Modified: trunk/getdata/src/compat.c
===================================================================
--- trunk/getdata/src/compat.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/compat.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -63,7 +63,7 @@
dtrace("%p, %i, \"%s\", %x, 0%o", D, dirfd, name, flags, mode);
path = _GD_MakeFullPath(D, dirfd, name);
- ret = open(path, flags, mode);
+ ret = open(path, flags | O_BINARY, mode);
free(path);
dreturn("%i", ret);
@@ -169,6 +169,7 @@
ptr = strerror(errnum);
strncpy(buf, ptr, buflen);
+ dreturn("%i", 0);
return 0;
}
#endif
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/errors.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -80,6 +80,7 @@
{ GD_E_TRUNC, 0, "Error truncating {2}: ", 1 },
/* GD_E_CREAT: 1 = suberror, 2 = filename, 3 = errno */
{ GD_E_CREAT, GD_E_CREAT_DIR, "Unable to create directory {2}: ", 1 },
+ { GD_E_CREAT, GD_E_CREAT_OPEN, "Unable to open directory {2}: ", 1 },
{ GD_E_CREAT, GD_E_CREAT_FORMAT, "Unable to create format file {2}: ", 1 },
{ GD_E_CREAT, GD_E_CREAT_EXCL, "Unable to create dirfile {2}: already exists",
0 },
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/internal.h 2011-08-23 17:08:28 UTC (rev 600)
@@ -47,12 +47,16 @@
#ifdef _MSC_VER
-// missing in sys/stat.h
+/* missing in sys/stat.h */
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
-#define snprintf _snprintf
#endif
+/* the open() in the MSVCRT doesn't permit open()ing directories */
+#ifdef __MSVCRT__
+#define GD_NO_DIR_OPEN
+#endif
+
#ifdef __APPLE__
typedef off_t off64_t;
#endif
@@ -211,6 +215,16 @@
# endif
#endif
+#ifdef HAVE__GETCWD
+# define gd_getcwd _getcwd
+#else
+# define gd_getcwd getcwd
+#endif
+
+#ifdef HAVE__SNPRINTF
+# define snprintf _snprintf
+#endif
+
#ifndef HAVE_FTELLO64
# ifndef HAVE_FTELLO
# define ftello64 (off64_t)ftell
@@ -410,16 +424,22 @@
(((uint32_t)(x) >> 8) & 0xff00UL) | \
((uint32_t)(x) >> 24))
#define gd_swap64(x) ( \
- (((uint64_t)(x) << 56) | \\
- (((uint64_t)(x) << 40) & 0xff000000000000ULL) | \\
- (((uint64_t)(x) << 24) & 0xff0000000000ULL) | \\
- (((uint64_t)(x) << 8) & 0xff00000000ULL) | \\
- (((uint64_t)(x) >> 8) & 0xff000000ULL) | \\
- (((uint64_t)(x) >> 24) & 0xff0000ULL) | \\
- (((uint64_t)(x) >> 40) & 0xff00ULL) | \\
- ((uint64_t)(x) >> 56))
+ (((uint64_t)(x) << 56) | \
+ (((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
+ (((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
+ (((uint64_t)(x) << 8) & 0xff00000000ULL) | \
+ (((uint64_t)(x) >> 8) & 0xff000000ULL) | \
+ (((uint64_t)(x) >> 24) & 0xff0000ULL) | \
+ (((uint64_t)(x) >> 40) & 0xff00ULL) | \
+ ((uint64_t)(x) >> 56)))
#endif
+/* returns true if s is an absolute path */
+#if defined _WIN32 || defined _WIN64
+# define _GD_AbsPath(s) ((s)[0] != '\0' && (s)[1] == ':')
+#else
+# define _GD_AbsPath(s) ((s)[0] == '/')
+#endif
/* maximum number of recursions */
#define GD_MAX_RECURSE_LEVEL 32
@@ -438,6 +458,7 @@
#define GD_E_CREAT_FORMAT 1
#define GD_E_CREAT_EXCL 2
#define GD_E_CREAT_DIR 3
+#define GD_E_CREAT_OPEN 4
/* GD_E_FORMAT suberrors are in getdata.h */
Modified: trunk/getdata/src/open.c
===================================================================
--- trunk/getdata/src/open.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/src/open.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -41,7 +41,7 @@
/* attempt to open or create a new dirfile - set error appropriately */
static FILE* _GD_CreateDirfile(DIRFILE* D, int dirfd, int dir_error,
- const char* filedir)
+ char* dirfile)
{
struct stat statbuf;
DIR* dir;
@@ -50,7 +50,7 @@
int format_error = 0;
FILE* fp = NULL;
- dtrace("%p, %i, %i, \"%s\"", D, dirfd, dir_error, filedir);
+ dtrace("%p, %i, %i, \"%s\"", D, dirfd, dir_error, dirfile);
/* naively try to open the format file */
if (dirfd < 0)
@@ -59,11 +59,14 @@
{
format_error = errno;
+ /* in the non-POSIX case, this has already been done. */
+#ifndef GD_NO_DIR_OPEN
/* open failed, try to stat the directory itself */
if (fstat(dirfd, &statbuf))
dir_error = errno;
else if (!S_ISDIR(statbuf.st_mode))
dir_error = ENOTDIR;
+#endif
} else
dir_error = 0;
@@ -71,9 +74,10 @@
/* unable to read the format file */
if (format_error == EACCES || dir_error == EACCES) {
- char *format_file = (char *)malloc(strlen(filedir) + 8);
- strcat(strcpy(format_file, filedir), "/format");
+ char *format_file = (char *)malloc(strlen(dirfile) + 8);
+ strcat(strcpy(format_file, dirfile), "/format");
_GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NO_ACCESS, format_file, 0, NULL);
+ free(dirfile);
free(format_file);
dreturn("%p", NULL);
return NULL;
@@ -82,22 +86,25 @@
/* the directory exists, but it's not a dirfile, do nothing else -- even if we
* were asked to truncate it */
if (!dir_error && format_error) {
- _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_DIRFILE, filedir, 0, NULL);
+ _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_DIRFILE, dirfile, 0, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
/* Couldn't open the file, and we weren't asked to create it */
if (format_error && !(D->flags & GD_CREAT)) {
- _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_EXIST, filedir, format_error,
+ _GD_SetError(D, GD_E_OPEN, GD_E_OPEN_NOT_EXIST, dirfile, format_error,
NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
/* It does exist, but we were asked to exclusively create it */
if (!format_error && (D->flags & GD_CREAT) && (D->flags & GD_EXCL)) {
- _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_EXCL, filedir, 0, NULL);
+ _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_EXCL, dirfile, 0, NULL);
+ free(dirfile);
close(fd);
dreturn("%p", NULL);
return NULL;
@@ -105,7 +112,7 @@
/* If we made it here we either:
* 1) have no such directory, but plan to create it, or
- * 2) have a dirfile, which means the directory supplied contains a readable
+ * 2) have a "dirfile", i.e. the directory supplied contains a readable
* file called format */
/* Truncate, if needed -- dangerous! Truncating a dirfile deletes every
@@ -120,6 +127,7 @@
/* can't truncate a read-only dirfile */
if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
_GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
@@ -127,27 +135,30 @@
#ifdef HAVE_FDOPENDIR
/* crawl the directory, and delete everything */
if ((fd = dup(dirfd)) == -1) {
- _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, filedir, errno, NULL);
+ _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, dirfile, errno, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
dir = fdopendir(fd);
#else
- dir = opendir(filedir);
+ dir = opendir(dirfile);
#endif
if (dir == NULL) {
- _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, filedir, errno, NULL);
+ _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_DIR, dirfile, errno, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
while ((lamb = readdir(dir)) != NULL) {
if (gd_StatAt(D, dirfd, lamb->d_name, &statbuf, AT_SYMLINK_NOFOLLOW)) {
- char *name = (char *)malloc(strlen(filedir) + strlen(lamb->d_name) + 2);
- strcat(strcat(strcpy(name, filedir), "/"), lamb->d_name);
+ char *name = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name) + 2);
+ strcat(strcat(strcpy(name, dirfile), "/"), lamb->d_name);
_GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, name, errno, NULL);
+ free(dirfile);
free(name);
closedir(dir);
dreturn("%p", NULL);
@@ -162,10 +173,11 @@
)
{
if (gd_UnlinkAt(D, dirfd, lamb->d_name, 0)) {
- char *name = (char *)malloc(strlen(filedir) + strlen(lamb->d_name)
+ char *name = (char *)malloc(strlen(dirfile) + strlen(lamb->d_name)
+ 2);
- strcat(strcat(strcpy(name, filedir), "/"), lamb->d_name);
+ strcat(strcat(strcpy(name, dirfile), "/"), lamb->d_name);
_GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, name, errno, NULL);
+ free(dirfile);
free(name);
closedir(dir);
dreturn("%p", NULL);
@@ -183,32 +195,42 @@
/* can't create a read-only dirfile */
if ((D->flags & GD_ACCMODE) == GD_RDONLY) {
_GD_SetError(D, GD_E_ACCMODE, 0, NULL, 0, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
/* attempt to create the dirfile directory, if not present */
if (dir_error) {
- if (mkdir(filedir, 00777) < 0) {
- _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_DIR, filedir, errno, NULL);
+ if (mkdir(dirfile, 0777) < 0) {
+ _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_DIR, dirfile, errno, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
- if ((dirfd = open(filedir, O_RDONLY)) < 0) {
- _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_DIR, filedir, errno, NULL);
+#ifdef GD_NO_DIR_OPEN
+ /* in the non-POSIX situation, dirfd just holds the index in the
+ * directory entry */
+ dirfd = 0;
+#else
+ if ((dirfd = open(dirfile, O_RDONLY)) < 0) {
+ _GD_SetError(D, GD_E_CREAT, GD_E_CREAT_OPEN, dirfile, errno, NULL);
+ free(dirfile);
dreturn("%p", NULL);
return NULL;
}
+#endif
}
/* create a new, empty format file */
if ((fd = gd_OpenAt(D, dirfd, "format", O_CREAT | O_EXCL | O_BINARY, 0666))
< 0)
{
- char *format_file = (char *)malloc(strlen(filedir) + 8);
- strcat(strcpy(format_file, filedir), "/format");
+ char *format_file = (char *)malloc(strlen(dirfile) + 8);
+ strcat(strcpy(format_file, dirfile), "/format");
_GD_SetError(D, GD_E_CREAT, GD_E_CREAT_FORMAT, format_file, errno, NULL);
+ free(dirfile);
free(format_file);
dreturn("%p", NULL);
return NULL;
@@ -221,9 +243,10 @@
/* associate a stream with the format file */
if ((fp = fdopen(fd, "r")) == NULL) {
- char *format_file = (char *)malloc(strlen(filedir) + 8);
- strcat(strcpy(format_file, filedir), "/format");
+ char *format_file = (char *)malloc(strlen(dirfile) + 8);
+ strcat(strcpy(format_file, dirfile), "/format");
_GD_SetError(D, GD_E_CREAT, GD_E_CREAT_FORMAT, format_file, errno, NULL);
+ free(dirfile);
free(format_file);
close(fd);
dreturn("%p", NULL);
@@ -234,13 +257,7 @@
D->dir = (struct gd_dir_t *)malloc(sizeof(struct gd_dir_t));
D->dir[0].fd = dirfd;
D->dir[0].rc = 1;
- D->dir[0].path = strdup(filedir);
- if (D->dir[0].path == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- fclose(fp);
- dreturn("%p", NULL);
- return NULL;
- }
+ D->dir[0].path = dirfile;
D->ndir = 1;
dreturn("%p", fp);
@@ -280,23 +297,64 @@
gd_parser_callback_t sehandler, void* extra)
{
FILE *fp;
- char* ref_name;
+ char *ref_name;
+ char *dirfile;
DIRFILE* D;
gd_entry_t* E;
- int dirfd, dirfd_error;
+ int dirfd = -1, dirfd_error = 0;
+#ifdef GD_NO_DIR_OPEN
+ gd_stat64_t statbuf;
+#endif
+
dtrace("\"%s\", 0x%lx, %p, %p", filedir, (unsigned long)flags, sehandler,
extra);
+#ifdef GD_NO_DIR_OPEN
+ /* if we can't cache directory descriptors, we just have to remember paths,
+ * so get the current directory, so that we're protected against the caller
+ * using chdir.
+ */
+
+ /* get a full path, if necessary */
+ if (_GD_AbsPath(filedir))
+ dirfile = strdup(filedir);
+ else {
+ dirfile = gd_getcwd(NULL, 0);
+ if (dirfile) {
+ char *ptr = realloc(dirfile, strlen(dirfile) + strlen(filedir) + 2);
+ if (ptr == NULL) {
+ free(dirfile);
+ dirfile = NULL;
+ } else
+ dirfile = strcat(strcat(ptr, "/"), filedir);
+ }
+ }
+
+ /* that done, now stat the path to see if it exists (and is a directory) */
+ if (dirfile) {
+ if (gd_stat64(dirfile, &statbuf))
+ dirfd_error = errno;
+ else if (!S_ISDIR(statbuf.st_mode))
+ dirfd_error = ENOTDIR;
+ else
+ dirfd = 0;
+ }
+#else
/* quickly, before it goes away, grab the directory (if it exists) */
dirfd = open(filedir, O_RDONLY);
dirfd_error = errno;
+ dirfile = strdup(filedir);
+#endif
_GD_InitialiseFramework();
D = (DIRFILE *)malloc(sizeof(DIRFILE));
if (D == NULL) {
+ free(dirfile);
+#ifndef GD_NO_DIR_OPEN
close(dirfd);
+#endif
dreturn("%p", NULL);
return NULL;
}
@@ -312,7 +370,7 @@
D->sehandler_extra = extra;
D->standards = GD_DIRFILE_STANDARDS_VERSION;
- if (D->name == NULL) {
+ if (D->name == NULL || dirfile == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
dreturn("%p", D);
return D;
@@ -322,26 +380,30 @@
D->n_entries = 1;
D->entry = (gd_entry_t **)malloc(sizeof(gd_entry_t*));
- if (D->entry == NULL) {
+ if (D->entry)
+ D->entry[0] = (gd_entry_t *)malloc(sizeof(gd_entry_t));
+
+ if (D->entry == NULL || D->entry[0] == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ free(dirfile);
+#ifndef GD_NO_DIR_OPEN
+ close(dirfd);
+#endif
dreturn("%p", D);
return D;
}
- D->entry[0] = (gd_entry_t *)malloc(sizeof(gd_entry_t));
- if (D->entry == NULL) {
- _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
- dreturn("%p", D);
- return D;
- }
memset(D->entry[0], 0, sizeof(gd_entry_t));
-
D->entry[0]->field_type = GD_INDEX_ENTRY;
D->entry[0]->e =
(struct _gd_private_entry *)malloc(sizeof(struct _gd_private_entry));
D->entry[0]->field = strdup("INDEX");
if (D->entry[0]->field == NULL || D->entry[0]->e == NULL) {
_GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL);
+ free(dirfile);
+#ifndef GD_NO_DIR_OPEN
+ close(dirfd);
+#endif
dreturn("%p", D);
return D;
}
@@ -349,7 +411,10 @@
D->entry[0]->e->calculated = 1;
/* open the format file (or create it) */
- if ((fp = _GD_CreateDirfile(D, dirfd, dirfd_error, filedir)) == NULL) {
+ if ((fp = _GD_CreateDirfile(D, dirfd, dirfd_error, dirfile)) == NULL) {
+#ifndef GD_NO_DIR_OPEN
+ close(dirfd);
+#endif
dreturn("%p", D);
return D; /* errors have already been set */
}
Modified: trunk/getdata/test/error_error.c
===================================================================
--- trunk/getdata/test/error_error.c 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/test/error_error.c 2011-08-23 17:08:28 UTC (rev 600)
@@ -34,7 +34,7 @@
gd_close(D);
CHECKI(error, GD_E_OPEN);
- CHECKS(string, "Dirfile does not exist: a non_existant dirfile");
+ CHECKSp(string, "Dirfile does not exist");
return r;
}
Modified: trunk/getdata/test/test.h
===================================================================
--- trunk/getdata/test/test.h 2011-08-20 21:38:14 UTC (rev 599)
+++ trunk/getdata/test/test.h 2011-08-23 17:08:28 UTC (rev 600)
@@ -87,6 +87,8 @@
#define CHECKPNi(i,n) CHECKi(i,(n) == NULL,n,"%p","%s",n,"non-NULL")
#define CHECKS(n,v) CHECK(strcmp((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
#define CHECKSi(n,v) CHECKi(i,strcmp((n),(v)),n,"\"%s\"","\"%s\"",(n),(v));
+#define CHECKSp(n,v) CHECK(strncmp((n),(v), sizeof(v) - 1),n,"\"%s\"",\
+ "\"%s\"",(n),(v));
#define CHECKU(n,v) CHECK((n) != (v),n,"%llu","%llu",\
(unsigned long long)(n),(unsigned long long)(v))
#define CHECKUi(i,n,v) CHECKi(i,(n) != (v),n,"%llu","%llu",\
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-08-23 22:15:01
|
Revision: 601
http://getdata.svn.sourceforge.net/getdata/?rev=601&view=rev
Author: ketiltrout
Date: 2011-08-23 22:14:53 +0000 (Tue, 23 Aug 2011)
Log Message:
-----------
More perl config fixes.
Modified Paths:
--------------
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/configure.ac
trunk/getdata/m4/perl.m4
Modified: trunk/getdata/bindings/perl/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/Makefile.am 2011-08-23 17:08:28 UTC (rev 600)
+++ trunk/getdata/bindings/perl/Makefile.am 2011-08-23 22:14:53 UTC (rev 601)
@@ -56,6 +56,7 @@
$(MAKE) -f perl.mk clean
rm -f $(BUILT_SOURCES) make_parameters.sed perl.mk.old debug.c
+if TEST_PERL
check:
$(MAKE) test
@@ -63,3 +64,4 @@
${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(MAKE) -f perl.mk $@ ${TEST_VERBOSE}
.PHONY: test
+endif
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-08-23 17:08:28 UTC (rev 600)
+++ trunk/getdata/configure.ac 2011-08-23 22:14:53 UTC (rev 601)
@@ -778,7 +778,7 @@
echo "*** Configuring Perl bindings"
echo
GD_PERL
- if test "x$have_perl" != "xyes"; then
+ if test "x$have_perl" = "xno"; then
make_perlbindings=no
fi
fi
@@ -862,6 +862,7 @@
AM_CONDITIONAL(USE_MODULES, [test "x$use_modules" != "xno"])
AM_CONDITIONAL(TEST_PYTHON, [test "x$NO_DLOPEN_TESTS" = "x0"])
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(GDIDL_EXTERNAL, [false])
Modified: trunk/getdata/m4/perl.m4
===================================================================
--- trunk/getdata/m4/perl.m4 2011-08-23 17:08:28 UTC (rev 600)
+++ trunk/getdata/m4/perl.m4 2011-08-23 22:14:53 UTC (rev 601)
@@ -142,10 +142,10 @@
if test "x${have_perl}" != "xno"; then
GD_PERL_CHECK_MODULE([Math::Complex])
GD_PERL_CHECK_MODULE([ExtUtils::MakeMaker])
- GD_PERL_CHECK_MODULE([Test::Harness])
+ GD_PERL_CHECK_MODULE([Tost::Harness])
fi
-if test "$HAVE_MATH__COMPLEX$HAVE_EXTUTILS__MAKEMAKER" != "yesyes"; then
+if test "$HAVE_Math__Complex$HAVE_ExtUtils__MakeMaker" != "yesyes"; then
have_perl=no
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-09-07 21:36:56
|
Revision: 604
http://getdata.svn.sourceforge.net/getdata/?rev=604&view=rev
Author: ketiltrout
Date: 2011-09-07 21:36:47 +0000 (Wed, 07 Sep 2011)
Log Message:
-----------
Module::Build seems to handle VPATH builds better than ExtUtils::MakeMaker, so let's just go with that. Module::Build has been part of the core modules since perl5.9.4.
Modified Paths:
--------------
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/bindings/perl/simple_funcs.pl
trunk/getdata/configure.ac
trunk/getdata/m4/perl.m4
Added Paths:
-----------
trunk/getdata/bindings/perl/Build.PL.in
trunk/getdata/bindings/perl/MANIFEST
Removed Paths:
-------------
trunk/getdata/bindings/perl/Makefile.PL.in
Property Changed:
----------------
trunk/getdata/bindings/perl/
Property changes on: trunk/getdata/bindings/perl
___________________________________________________________________
Modified: svn:ignore
- simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
.deps
make_parameters.sed
Makefile
Makefile.PL
perl.mk
pm_to_blib
blib
debug.c
MYMETA.yml
GetData.bs
GetData.bs
+ simple_funcs.xs
Makefile.in
GetData.pm
GetData.c
.deps
make_parameters.sed
Makefile
MYMETA.yml
MYMETA.json
_build
Build
lib
debug.c
blib
Build.PL
Added: trunk/getdata/bindings/perl/Build.PL.in
===================================================================
--- trunk/getdata/bindings/perl/Build.PL.in (rev 0)
+++ trunk/getdata/bindings/perl/Build.PL.in 2011-09-07 21:36:47 UTC (rev 604)
@@ -0,0 +1,25 @@
+# @configure_input@
+
+use Module::Build;
+my $build = Module::Build->new(
+ c_source => '@srcdir@',
+ dist_abstract => "Perl bindings to the GetData library",
+ dist_author => 'The GetData Project <@PACKAGE_BUGREPORT@>',
+ dist_version_from => "GetData.pm",
+ extra_compiler_flags => '@DEFS@',
+ extra_linker_flags => ['-L@top_builddir@/src/.libs/', '-lgetdata'],
+ include_dirs => '@top_srcdir@/src',
+ license => 'lgpl',
+ module_name => "GetData",
+ pm_files => {
+ 'GetData.pm' => 'lib/GetData.pm',
+ },
+ requires => {
+ perl => '5.6.0',
+ 'Math::Complex' => '1.34'
+ },
+ xs_files => {
+ '@srcdir@/GetData.xs' => 'lib/GetData.xs'
+ }
+);
+$build->create_build_script;
Added: trunk/getdata/bindings/perl/MANIFEST
===================================================================
--- trunk/getdata/bindings/perl/MANIFEST (rev 0)
+++ trunk/getdata/bindings/perl/MANIFEST 2011-09-07 21:36:47 UTC (rev 604)
@@ -0,0 +1,2 @@
+MANIFEST This list of files
+GetData.pm
Deleted: trunk/getdata/bindings/perl/Makefile.PL.in
===================================================================
--- trunk/getdata/bindings/perl/Makefile.PL.in 2011-08-24 21:06:52 UTC (rev 603)
+++ trunk/getdata/bindings/perl/Makefile.PL.in 2011-09-07 21:36:47 UTC (rev 604)
@@ -1,23 +0,0 @@
-use 5.00800;
-use ExtUtils::MakeMaker;
-
-my @gd_cfiles = ("GetData.c");
-push @gd_cfiles, "debug.c" if (@GETDATA_DEBUG@);
-my $gd_objects = "GetData\${OBJ_EXT}" . ((@GETDATA_DEBUG@) ? " debug\${OBJ_EXT}" : "");
-
-WriteMakefile(
- ABSTRACT_FROM => "GetData.pm",
- AUTHOR => "The GetData Progject <@PACKAGE_BUGREPORT@>",
- C => \@gd_cfiles,
- DEFINE => "@DEFS@",
- FIRST_MAKEFILE => "perl.mk",
- INC => '-I. -I@top_builddir@/src',
- LIBS => ['-L@top_builddir@/src/.libs/ -lgetdata'],
- NAME => "GetData",
- OBJECT => $gd_objects,
- PM => { "GetData.pm" => "\$(INST_LIBDIR)/GetData.pm" },
- PREREQ_FATAL => 1,
- PREREQ_PM => { "Math::Complex" => 1.34 },
- VERSION_FROM => "GetData.pm",
- depend => { "perl.mk" => "\${VERSION_FROM}" }
-);
Modified: trunk/getdata/bindings/perl/Makefile.am
===================================================================
--- trunk/getdata/bindings/perl/Makefile.am 2011-08-24 21:06:52 UTC (rev 603)
+++ trunk/getdata/bindings/perl/Makefile.am 2011-09-07 21:36:47 UTC (rev 604)
@@ -20,6 +20,9 @@
#
AUTOMAKE_OPTIONS = foreign
+EXTRA_DIST=funclist.pl GetData.xs simple_funcs.pl simple_funcs.xsin typemap \
+ GetData.pm.in MANIFEST
+
if GETDATA_DEBUG
DEBUG_C = debug.c
TEST_VERBOSE="TEST_VERBOSE=1"
@@ -28,40 +31,51 @@
cat $< >> $@
endif
-simple_funcs.xs: $(srcdir)/simple_funcs.xsin $(srcdir)/simple_funcs.pl
- $(PERL) simple_funcs.pl $< > $@
+lib:
+ mkdir lib
+lib/typemap: $(srcdir)/typemap lib
+ cat $< > $@
+
+lib/simple_funcs.xs: $(srcdir)/simple_funcs.xsin $(srcdir)/simple_funcs.pl lib
+ $(PERL) $(srcdir)/simple_funcs.pl $< > $@
+
make_parameters.sed: ../make_parameters ../../src/getdata.h
../make_parameters P > $@
../make_parameters: $(srcdir)/../make_parameters.c
cd .. && ${MAKE} make_parameters
-GetData.pm: $(srcdir)/GetData.pm.in make_parameters.sed funclist.pl \
- GetData.xs simple_funcs.xs
+GetData.pm: $(srcdir)/GetData.pm.in make_parameters.sed $(srcdir)/funclist.pl \
+ $(srcdir)/GetData.xs lib/simple_funcs.xs
rm -f $@
$(SED) -f make_parameters.sed $< | \
- $(PERL) funclist.pl GetData.xs simple_funcs.xs > $@
+ $(PERL) $(srcdir)/funclist.pl $(srcdir)/GetData.xs lib/simple_funcs.xs > $@
chmod a-w $@
-all-local: blib/man3/GetData.3pm
+all-local: blib/arch/auto/GetData/GetData.so
-blib/man3/GetData.3pm: perl.mk $(DEBUG_C)
- $(MAKE) -f perl.mk
+blib/arch/auto/GetData/GetData.so: Build
+ $(PERL) $< build
-perl.mk: Makefile.PL GetData.pm GetData.xs simple_funcs.xs typemap
+.PRECIOUS: Build
+Build: Build.PL GetData.pm GetData.xs lib/simple_funcs.xs lib/typemap $(DEBUG_C)
perl $<
clean-local:
- $(MAKE) -f perl.mk clean
- rm -f $(BUILT_SOURCES) make_parameters.sed perl.mk.old debug.c
+ rm -rf lib
+ if test -e Build; then \
+ $(PERL) Build clean; \
+ fi
+ rm -f $(BUILT_SOURCES) make_parameters.sed debug.c MYMETA.yml MYMETA.json GetData.pm
+ rm -rf Build _build
if TEST_PERL
check:
$(MAKE) test
-test testdb:
- ${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(MAKE) -f perl.mk $@ ${TEST_VERBOSE}
+test testdb testcover:
+ ${DL_LIBRARY_PATH}=${${DL_LIBRARY_PATH}}:../../src/.libs $(PERL) ./Build $@
-.PHONY: test
+.PHONY: test testdb testcover
endif
Modified: trunk/getdata/bindings/perl/simple_funcs.pl
===================================================================
--- trunk/getdata/bindings/perl/simple_funcs.pl 2011-08-24 21:06:52 UTC (rev 603)
+++ trunk/getdata/bindings/perl/simple_funcs.pl 2011-09-07 21:36:47 UTC (rev 604)
@@ -64,8 +64,6 @@
}
}
-print "# This code is automatically generated. Changes made here will be lost.\n\n";
-
while (<>) {
chomp;
until (/\)/) {
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-08-24 21:06:52 UTC (rev 603)
+++ trunk/getdata/configure.ac 2011-09-07 21:36:47 UTC (rev 604)
@@ -821,7 +821,7 @@
AC_CONFIG_FILES([bindings/idl/makedlm.sh])
AC_CONFIG_FILES([bindings/idl/test/Makefile])
AC_CONFIG_FILES([bindings/perl/Makefile])
-AC_CONFIG_FILES([bindings/perl/Makefile.PL])
+AC_CONFIG_FILES([bindings/perl/Build.PL])
AC_CONFIG_FILES([bindings/python/Makefile])
AC_CONFIG_FILES([bindings/python/test/Makefile])
AC_CONFIG_FILES([doc/Makefile])
Modified: trunk/getdata/m4/perl.m4
===================================================================
--- trunk/getdata/m4/perl.m4 2011-08-24 21:06:52 UTC (rev 603)
+++ trunk/getdata/m4/perl.m4 2011-09-07 21:36:47 UTC (rev 604)
@@ -141,11 +141,11 @@
if test "x${have_perl}" != "xno"; then
GD_PERL_CHECK_MODULE([Math::Complex])
- GD_PERL_CHECK_MODULE([ExtUtils::MakeMaker])
+ GD_PERL_CHECK_MODULE([Module::Build])
GD_PERL_CHECK_MODULE([Test::Harness])
fi
-if test "$HAVE_Math__Complex$HAVE_ExtUtils__MakeMaker" != "yesyes"; then
+if test "$HAVE_Math__Complex$HAVE_Module__Build" != "yesyes"; then
have_perl=no
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-10-13 02:08:23
|
Revision: 606
http://getdata.svn.sourceforge.net/getdata/?rev=606&view=rev
Author: ketiltrout
Date: 2011-10-13 02:08:13 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Facilities to read/write at the "current position" (using GD_HERE). And
facilities to change and report this position (gd_seek, gd_tell). Also added
GD_ARGUMENT error; plus an attempt to curtail the excessive unnecessary linkings
discovered by Steve.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/NEWS
trunk/getdata/bindings/cxx/Makefile.am
trunk/getdata/bindings/f77/Makefile.am
trunk/getdata/bindings/idl/package/Makefile.am
trunk/getdata/bindings/python/Makefile.am
trunk/getdata/src/Makefile.am
trunk/getdata/src/ascii.c
trunk/getdata/src/encoding.c
trunk/getdata/src/endian.c
trunk/getdata/src/errors.c
trunk/getdata/src/flimits.c
trunk/getdata/src/getdata.c
trunk/getdata/src/getdata.h.in
trunk/getdata/src/gzip.c
trunk/getdata/src/index.c
trunk/getdata/src/internal.h
trunk/getdata/src/legacy.c
trunk/getdata/src/lzma.c
trunk/getdata/src/protect.c
trunk/getdata/src/putdata.c
trunk/getdata/src/raw.c
trunk/getdata/src/sie.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/legacy_put.c
trunk/getdata/test/put_complex128.c
trunk/getdata/test/put_complex64.c
trunk/getdata/test/put_ff.c
trunk/getdata/test/put_float32.c
trunk/getdata/test/put_float64.c
trunk/getdata/test/put_foffs.c
trunk/getdata/test/put_fs.c
trunk/getdata/test/put_int16.c
trunk/getdata/test/put_int32.c
trunk/getdata/test/put_int64.c
trunk/getdata/test/put_int8.c
trunk/getdata/test/put_lincom1.c
trunk/getdata/test/put_linterp.c
trunk/getdata/test/put_linterp_reverse.c
trunk/getdata/test/put_off64.c
trunk/getdata/test/put_phase.c
trunk/getdata/test/put_polynom1.c
trunk/getdata/test/put_recip.c
trunk/getdata/test/put_sf.c
trunk/getdata/test/put_ss.c
trunk/getdata/test/put_uint16.c
trunk/getdata/test/put_uint32.c
trunk/getdata/test/put_uint64.c
Added Paths:
-----------
trunk/getdata/src/fpos.c
trunk/getdata/test/entry_divide.c
trunk/getdata/test/entry_recip.c
trunk/getdata/test/get_here.c
trunk/getdata/test/get_heres.c
trunk/getdata/test/put_here.c
trunk/getdata/test/put_heres.c
trunk/getdata/test/seek64.c
trunk/getdata/test/seek_cur.c
trunk/getdata/test/seek_end.c
trunk/getdata/test/seek_set.c
trunk/getdata/test/tell.c
trunk/getdata/test/tell64.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/ChangeLog 2011-10-13 02:08:13 UTC (rev 606)
@@ -1,3 +1,47 @@
+2011-10-13 D. V. Wiebe <ge...@ke...> svn:606
+ * test/entry_divide.c test/entry_recip.c test/get_here.c test/get_heres.c
+ test/put_here.c test/put_heres.c test/seek64.c test/seek_cur.c test/seek_end.c
+ test/seek_set.c test/tell.c test/tell64.c: Added.
+
+ * test/legacy_put.c test/put_complex128.c test/put_complex64.c
+ test/put_float32.c test/put_float64.c test/put_ff.c test/put_foffs.c
+ test/put_fs.c test/put_int16.c test/put_int32.c test/put_int64.c
+ test/put_int8.c test/put_lincom1.c test/put_linterp.c
+ test/put_linterp_reverse.c test/put_off64.c test/put_phase.c
+ test/put_polynom1.c test/put_recip.c test/put_sf.c test/put_ss.c
+ test/put_uint16.c test/put_uint32.c test/put_uint64.c: Don't perform
+ unnecessary tests in the event the data file wasn't created.
+
+ * src/getdata.h.in: Combine GD_E_BAD_ENDIANNESS and GD_E_BAD_PROTECTION into
+ GD_ARGUMENT. The former are kept as aliases of the new symbol.
+ * src/endian.c (gd_alter_endianness) src/errors.c src/protect.c
+ (gd_alter_protection): Update for GD_E_ARGUMENT.
+
+ * src/internal.h: Add .pos to _gd_raw_file. Add .u.index_pos to
+ _gd_private_entry.
+ * src/ascii.c (_GD_AsciiOpen _GD_AsciiSeek _GD_AsciiRead _GD_AsciiTOpen
+ _GD_AsciiTUnlink) src/gzip.c (_GD_GzipOpen _GD_GzipSeek _GD_GzipRead)
+ src/lzma.c (_GD_LzmaOpen _GD_LzmaSeek _GD_LzmaRead) src/sie.c
+ (_GD_SampIndOpen _GD_SampIndSeek _GD_SampIndRead _GD_SampIndWrite
+ _GD_SampIndTOpen) src/raw.c (_GD_RawOpen _GD_RawSeek _GD_RawRead
+ _GD_RawWrite _GD_RawTOpen): Track file position.
+
+ * src/encoding.c (_GD_InitRawIO): Added.
+ * src/getdata.c (_GD_DoRaw) src/putdata.c (_GD_DoRawOut): Call _GD_InitRawIO.
+
+ * src/fpos.c: Added.
+ * src/flimits.c (_GD_GetEOF): Publicise.
+ * src/getdata.c (gd_getdata64) src/putdata.c (gd_putdata64): Regularise use of
+ GD_HERE. Also, only call _GD_GetSPF when necessary.
+ * src/getdata.c (_GD_DoField) src/putdata.c (_GD_DoFieldOut): Resolve
+ instances of GD_HERE.
+
+ * bindings/python/Makefile.am bindings/cxx/Makefile.am
+ bindings/f77/Makefile.am: Remove some unnecessary linking.
+
+ * bindings/idl/package/Makefile.am: Add $(DEFS) to the make_parameters rule
+ to ensure it builds properly.
+
2011-08-23 D. V. Wiebe <ge...@ke...> svn:600
* test/error_error.c: Simplify test.
* test/test.h (CHECKSp): Added.
Modified: trunk/getdata/NEWS
===================================================================
--- trunk/getdata/NEWS 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/NEWS 2011-10-13 02:08:13 UTC (rev 606)
@@ -1,3 +1,9 @@
+New in version 0.8.0a:
+
+ * Some stuff.
+
+|==============================================================================|
+
New in version 0.7.3:
Library Changes
Modified: trunk/getdata/bindings/cxx/Makefile.am
===================================================================
--- trunk/getdata/bindings/cxx/Makefile.am 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/bindings/cxx/Makefile.am 2011-10-13 02:08:13 UTC (rev 606)
@@ -30,6 +30,7 @@
endif
INCLUDES = ${WALL} $(WEXTRA) -I$(top_srcdir)/src
+LIBS=
SUBDIRS=test
Modified: trunk/getdata/bindings/f77/Makefile.am
===================================================================
--- trunk/getdata/bindings/f77/Makefile.am 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/bindings/f77/Makefile.am 2011-10-13 02:08:13 UTC (rev 606)
@@ -55,6 +55,7 @@
SUBDIRS = test
BUILT_SOURCES=getdata.f $(F95_INC)
+LIBS=
nodist_include_HEADERS=getdata.f $(F95_INC)
@@ -65,7 +66,7 @@
libfgetdata_la_LDFLAGS = -version-info @FGETDATA_VERSION@
nodist_libf95getdata_la_SOURCES=getdata.f90
-libf95getdata_la_LIBADD=libfgetdata.la ../../src/libgetdata.la
+libf95getdata_la_LIBADD=libfgetdata.la
libf95getdata_la_LDFLAGS = -version-info @F95GETDATA_VERSION@
getdata.mod: getdata.o
Modified: trunk/getdata/bindings/idl/package/Makefile.am
===================================================================
--- trunk/getdata/bindings/idl/package/Makefile.am 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/bindings/idl/package/Makefile.am 2011-10-13 02:08:13 UTC (rev 606)
@@ -35,7 +35,7 @@
EXTRA_DIST = ChangeLog README.idl
make_parameters$(EXEEXT): $(make_parameters_SOURCES)
- ${BUILDCC} -I../src -o make_parameters$(EXEEXT) $(srcdir)/$(make_parameters_SOURCES)
+ ${BUILDCC} $(DEFS) -Isrc -o make_parameters$(EXEEXT) $(srcdir)/$(make_parameters_SOURCES)
clean-local:
rm -rf *~
Modified: trunk/getdata/bindings/python/Makefile.am
===================================================================
--- trunk/getdata/bindings/python/Makefile.am 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/bindings/python/Makefile.am 2011-10-13 02:08:13 UTC (rev 606)
@@ -31,6 +31,7 @@
SUBDIRS=test
python_LTLIBRARIES = pygetdata.la
+LIBS=
BUILT_SOURCES = pyconstants.c
AM_CFLAGS = ${WALL} -fno-strict-aliasing
Modified: trunk/getdata/src/Makefile.am
===================================================================
--- trunk/getdata/src/Makefile.am 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/Makefile.am 2011-10-13 02:08:13 UTC (rev 606)
@@ -105,7 +105,7 @@
${LIBGETDATABZIP2_LA} ${LIBGETDATALZMA_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 \
+ entry.c errors.c field_list.c flimits.c flush.c fpos.c \
fragment.c getdata.c globals.c ${GZIP_C} index.c \
include.c ${LEGACY_C} ${LZMA_C} meta_list.c mod.c \
move.c name.c native.c nfields.c nframes.c nmeta.c \
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/ascii.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -31,8 +31,7 @@
#include <errno.h>
#endif
-/* The ASCII encoding uses file->idata to indicate the current line and
- * file->edata for the stream pointer */
+/* The ASCII encoding uses file->edata for the stream pointer */
int _GD_AsciiOpen(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
int mode, int creat)
@@ -57,6 +56,7 @@
return -1;
}
+ file->pos = 0;
file->idata = 0;
dreturn("%i", 0);
return 0;
@@ -69,23 +69,23 @@
dtrace("%p, %lli, <unused>, %i", file, count, pad);
- if (count < file->idata) {
+ if (count < file->pos) {
rewind((FILE *)file->edata);
- file->idata = 0;
+ file->pos = 0;
}
- for (; count > file->idata; ++file->idata)
+ for (; count > file->pos; ++file->pos)
if (fgets(line, 64, (FILE *)file->edata) == NULL)
break;
- if (pad && count > file->idata) {
+ if (pad && count > file->pos) {
strcpy(line, "0\n");
- for (; count > file->idata; ++file->idata)
+ for (; count > file->pos; ++file->pos)
fputs(line, (FILE *)file->edata);
}
- dreturn("%i", file->idata);
- return file->idata;
+ dreturn("%lli", (long long)file->pos);
+ return file->pos;
}
static void _GD_ScanFormat(char* fmt, gd_type_t data_type)
@@ -166,7 +166,7 @@
ret = -1;
break;
}
- file->idata++;
+ file->pos++;
}
} else {
for (n = 0; n < nmemb; ++n) {
@@ -196,7 +196,7 @@
break;
}
}
- file->idata++;
+ file->pos++;
}
}
@@ -403,7 +403,7 @@
return -1;
}
- file->idata = 0;
+ file->pos = 0;
dreturn("%i", 0);
return 0;
@@ -414,7 +414,7 @@
dtrace("%i, %p", dirfd, file);
if (file->name != NULL) {
- if (file->idata >= 0)
+ if (file->pos >= 0)
if (_GD_AsciiClose(file)) {
dreturn("%i", -1);
return -1;
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/encoding.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -300,6 +300,38 @@
return ret;
}
+/* Open a raw file, if necessary, also check for required functions */
+int _GD_InitRawIO(DIRFILE *D, gd_entry_t *E, unsigned int funcs, int creat)
+{
+ dtrace("%p, %p, %x, %i", D, E, funcs, creat);
+
+ if (E->e->u.raw.file[0].idata < 0) {
+ if (!_GD_Supports(D, E, GD_EF_OPEN | funcs)) {
+ dreturn("%i", 1);
+ return 1;
+ } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
+ {
+ dreturn("%i", 1);
+ return 1;
+ } else if ((*_gd_ef[E->e->u.raw.file[0].subenc].open)(
+ D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
+ _GD_FileSwapBytes(D, E->fragment_index), D->flags & GD_ACCMODE,
+ creat))
+ {
+ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
+ NULL);
+ dreturn("%i", 1);
+ return 1;
+ }
+ } else if (!_GD_Supports(D, E, funcs)) {
+ dreturn("%i", 1);
+ return 1;
+ }
+
+ dreturn("%i", 0);
+ return 0;
+}
+
/* Figure out the encoding scheme */
static unsigned long _GD_ResolveEncoding(const DIRFILE *D gd_unused_d,
const char* name, unsigned long scheme, int dirfd,
Modified: trunk/getdata/src/endian.c
===================================================================
--- trunk/getdata/src/endian.c 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/endian.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -147,7 +147,7 @@
}
if (byte_sex != GD_BIG_ENDIAN && byte_sex != GD_LITTLE_ENDIAN) {
- _GD_SetError(D, GD_E_BAD_ENDIANNESS, 0, NULL, 0, NULL);
+ _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_ENDIANNESS, NULL, 0, NULL);
dreturn("%i", -1);
return -1;
}
Modified: trunk/getdata/src/errors.c
===================================================================
--- trunk/getdata/src/errors.c 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/errors.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -165,12 +165,14 @@
"Cannot delete field {4} used in definiton of field {2}", 0 },
{ GD_E_DELETE, GD_E_DEL_DERIVED,
"Cannot delete field {4} used as input to field {2}", 0 },
- /* GD_E_BAD_ENDIANNESS: (nothing) */
- { GD_E_BAD_ENDIANNESS, 0, "Invalid endianness specified", 0 },
+ /* GD_E_ARGUMENT: (nothing) */
+ { GD_E_ARGUMENT, GD_E_ARG_WHENCE, "Invalid origin specified", 0 },
+ { GD_E_ARGUMENT, GD_E_ARG_ENDIANNESS, "Invalid endianness specified", 0 },
+ { GD_E_ARGUMENT, GD_E_ARG_PROTECTION, "Invalid protection level specified",
+ 0 },
+ { GD_E_ARGUMENT, 0, "Bad argument", 0 },
/* GD_E_CALLBACK: 3 = response */
{ GD_E_CALLBACK, 0, "Unrecognised response from callback function: {3}", 0 },
- /* GD_E_BAD_PROTECTION: (nothing) */
- { GD_E_BAD_PROTECTION, 0, "Invalid protection level specified", 0 },
/* GD_E_UNCLEAN_DB: 3 = fragment */
{ GD_E_UNCLEAN_DB, 0,
"Unexpected system error processing {3}; database unclean", 0 },
@@ -178,6 +180,7 @@
{ GD_E_DOMAIN, GD_E_DOMAIN_COMPLEX, "Improper domain: complex valued", 0 },
{ GD_E_DOMAIN, GD_E_DOMAIN_EMPTY, "Improper domain: empty set", 0 },
{ GD_E_DOMAIN, GD_E_DOMAIN_ANTITONIC, "Improper domain: not monotonic", 0 },
+ { GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, "I/O position mismatch in inputs", 0 },
/* GD_E_UNCLEAN_DB: 4 = repr */
{ GD_E_BAD_REPR, GD_E_REPR_UNKNOWN, "Unknown field representation: .{4}", 0 },
{ GD_E_BAD_REPR, GD_E_REPR_PUT, "Unable to write to field reprentation: .{4}",
Modified: trunk/getdata/src/flimits.c
===================================================================
--- trunk/getdata/src/flimits.c 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/flimits.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -187,8 +187,7 @@
return gd_frameoffset64(D, fragment);
}
-static off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent,
- int *is_index)
+off64_t _GD_GetEOF(DIRFILE *D, gd_entry_t* E, const char *parent, int *is_index)
{
off64_t ns = -1, ns1;
gd_spf_t spf0, spf1;
Added: trunk/getdata/src/fpos.c
===================================================================
--- trunk/getdata/src/fpos.c (rev 0)
+++ trunk/getdata/src/fpos.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -0,0 +1,306 @@
+/* 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 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;
+ off64_t pos = -1, pos2;
+
+ dtrace("%p, %p, %lli", D, E, (long long)index_pos);
+
+ if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
+ _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+ dreturn("%u", 0);
+ D->recurse_level--;
+ return 0;
+ }
+
+ switch (E->field_type) {
+ case GD_RAW_ENTRY:
+ /* We must open the file to know its starting offset */
+ if (_GD_InitRawIO(D, E, 0, 0))
+ break;
+ pos = E->e->u.raw.file[0].pos +
+ D->fragment[E->fragment_index].frame_offset;
+ break;
+ case GD_LINCOM_ENTRY:
+ if (_GD_BadInput(D, E, 0))
+ break;
+
+ pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+ if (!D->error)
+ for (i = 1; i < E->EN(lincom,n_fields); ++i) {
+ if (_GD_BadInput(D, E, i)) {
+ pos = -1;
+ break;
+ }
+ pos2 = _GD_GetFilePos(D, E->e->entry[i], pos);
+ if (pos2 != pos) {
+ _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, NULL, 0, NULL);
+ pos = -1;
+ break;
+ }
+ }
+ break;
+ case GD_LINTERP_ENTRY:
+ case GD_BIT_ENTRY:
+ case GD_POLYNOM_ENTRY:
+ case GD_SBIT_ENTRY:
+ case GD_RECIP_ENTRY:
+ if (_GD_BadInput(D, E, 0))
+ break;
+ pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+ break;
+ case GD_MULTIPLY_ENTRY:
+ case GD_DIVIDE_ENTRY:
+ if (_GD_BadInput(D, E, 0) || _GD_BadInput(D, E, 1))
+ break;
+ pos = _GD_GetFilePos(D, E->e->entry[0], 0);
+ pos2 = _GD_GetFilePos(D, E->e->entry[0], pos);
+ if (!D->error && pos != pos2) {
+ _GD_SetError(D, GD_E_DOMAIN, GD_E_DOMAIN_MULTIPOS, NULL, 0, NULL);
+ pos = -1;
+ }
+ break;
+ case GD_PHASE_ENTRY:
+ if (_GD_BadInput(D, E, 0))
+ break;
+ pos = _GD_GetFilePos(D, E->e->entry[0], -1);
+ if (pos >= 0)
+ pos += E->EN(phase,shift);
+ break;
+ case GD_INDEX_ENTRY:
+ if (index_pos == -1)
+ pos = E->e->u.index_pos;
+ else
+ pos = index_pos;
+ break;
+ case GD_NO_ENTRY:
+ case GD_CONST_ENTRY:
+ case GD_STRING_ENTRY:
+ case GD_CARRAY_ENTRY:
+ _GD_InternalError(D);
+ }
+
+ D->recurse_level--;
+ dreturn("%lli", (long long)pos);
+ return pos;
+}
+
+/* Get the current I/O position of the given field
+*/
+off64_t gd_tell64(DIRFILE *D, const char *field_code_in)
+{
+ off64_t pos = -1;
+ gd_entry_t* entry;
+ char* field_code;
+ int repr;
+
+ dtrace("%p, \"%s\"", D, field_code_in);
+
+ if (D->flags & GD_INVALID) {/* don't crash */
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%u", 0);
+ return 0;
+ }
+
+ _GD_ClearError(D);
+
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+
+ if (D->error) {
+ dreturn("%u", 0);
+ return 0;
+ }
+
+ if (entry->field_type & GD_SCALAR_ENTRY)
+ _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+ else
+ pos = _GD_GetFilePos(D, entry, -1);
+
+ if (field_code != field_code_in)
+ free(field_code);
+
+ dreturn("%lli", (long long)pos);
+ return pos;
+}
+
+off_t gd_tell(DIRFILE *D, const char *field_code)
+{
+ return (off_t)gd_tell64(D, field_code);
+}
+
+static int _GD_Seek(DIRFILE *D, gd_entry_t *E, off64_t offset, int pad)
+{
+ int i;
+
+ dtrace("%p, %p, %lli, %i", D, E, (long long)offset, pad);
+
+ if (++D->recurse_level >= GD_MAX_RECURSE_LEVEL) {
+ _GD_SetError(D, GD_E_RECURSE_LEVEL, 0, NULL, 0, E->field);
+ D->recurse_level--;
+ dreturn("%i", 1);
+ return 1;
+ }
+
+ switch (E->field_type) {
+ case GD_RAW_ENTRY:
+ /* open/create the file, if necessary */
+ if (_GD_InitRawIO(D, E, GD_EF_SEEK, pad))
+ break;
+
+ if ((*_gd_ef[E->e->u.raw.file[0].subenc].seek)(E->e->u.raw.file, offset,
+ E->EN(raw,data_type), pad) == -1)
+ {
+ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+ }
+ break;
+ case GD_LINCOM_ENTRY:
+ for (i = 0; i < E->EN(lincom,n_fields); ++i)
+ if (!_GD_BadInput(D, E, i))
+ _GD_Seek(D, E->e->entry[i], offset, pad);
+ else
+ break;
+ break;
+ case GD_MULTIPLY_ENTRY:
+ case GD_DIVIDE_ENTRY:
+ if (_GD_BadInput(D, E, 1))
+ break;
+ if (_GD_Seek(D, E->e->entry[1], offset, pad))
+ break;
+ /* fallthrough */
+ case GD_LINTERP_ENTRY:
+ case GD_BIT_ENTRY:
+ case GD_POLYNOM_ENTRY:
+ case GD_SBIT_ENTRY:
+ case GD_RECIP_ENTRY:
+ if (!_GD_BadInput(D, E, 0))
+ _GD_Seek(D, E->e->entry[0], offset, pad);
+ break;
+ case GD_PHASE_ENTRY:
+ if (!_GD_BadInput(D, E, 0))
+ _GD_Seek(D, E->e->entry[0], offset + E->EN(phase,shift), pad);
+ break;
+ case GD_INDEX_ENTRY:
+ E->e->u.index_pos = offset;
+ break;
+ case GD_NO_ENTRY:
+ case GD_CONST_ENTRY:
+ case GD_STRING_ENTRY:
+ case GD_CARRAY_ENTRY:
+ _GD_InternalError(D);
+ }
+
+ D->recurse_level--;
+ dreturn("%i", (D->error == 0) ? 0 : 1);
+ return (D->error == 0) ? 0 : 1;
+}
+
+/* Set the I/O position of the given field
+ */
+off64_t gd_seek64(DIRFILE *D, const char *field_code_in, off64_t frame_num,
+ off64_t sample_num, int whence)
+{
+ gd_spf_t spf = 0;
+ off64_t pos = 0;
+ gd_entry_t* entry;
+ char* field_code;
+ int repr, is_index = 0, pad = (whence & GD_SEEK_PAD) ? 1 : 0;
+
+ dtrace("%p, \"%s\", %lli, %lli, %x", D, field_code_in, frame_num, sample_num,
+ whence);
+
+ if (D->flags & GD_INVALID) {/* don't crash */
+ _GD_SetError(D, GD_E_BAD_DIRFILE, 0, NULL, 0, NULL);
+ dreturn("%u", 0);
+ return 0;
+ }
+
+ _GD_ClearError(D);
+
+ entry = _GD_FindFieldAndRepr(D, field_code_in, &field_code, &repr, NULL, 1);
+
+ if (D->error) {
+ dreturn("%u", -1);
+ return -1;
+ }
+
+ if (entry->field_type & GD_SCALAR_ENTRY) {
+ _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+ if (field_code != field_code_in)
+ free(field_code);
+ dreturn("%u", -1);
+ return -1;
+ }
+
+ if (frame_num) {
+ spf = _GD_GetSPF(D, entry);
+
+ if (D->error) {
+ if (field_code != field_code_in)
+ free(field_code);
+ dreturn("%u", -1);
+ return -1;
+ }
+ }
+
+ sample_num += frame_num * spf;
+
+ whence &= (GD_SEEK_SET | GD_SEEK_CUR | GD_SEEK_END);
+ if (whence == GD_SEEK_SET)
+ pos = 0;
+ else if (whence == GD_SEEK_CUR)
+ pos = _GD_GetFilePos(D, entry, 1);
+ else if (whence == GD_SEEK_END) {
+ pos = _GD_GetEOF(D, entry, NULL, &is_index);
+ if (is_index)
+ _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code);
+ } else
+ _GD_SetError(D, GD_E_ARGUMENT, GD_E_ARG_WHENCE, NULL, 0, NULL);
+
+ if (!D->error)
+ _GD_Seek(D, entry, sample_num + pos, pad);
+
+ if (field_code != field_code_in)
+ free(field_code);
+
+ if (D->error)
+ pos = -1;
+ else
+ pos = _GD_GetFilePos(D, entry, 1);
+
+ dreturn("%lli", (long long)pos);
+ return pos;
+}
+
+off_t gd_seek(DIRFILE *D, const char *field_code, off_t frame_num,
+ off_t sample_num, int whence)
+{
+ return (off_t)gd_seek64(D, field_code, frame_num, sample_num, whence);
+}
+/* vim: ts=2 sw=2 et tw=80
+*/
Modified: trunk/getdata/src/getdata.c
===================================================================
--- trunk/getdata/src/getdata.c 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/getdata.c 2011-10-13 02:08:13 UTC (rev 606)
@@ -293,27 +293,10 @@
if (ns > 0) {
/** open the file (and cache the fp) if it hasn't been opened yet. */
- if (E->e->u.raw.file[0].idata < 0) {
- if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_SEEK | GD_EF_READ)) {
- free(databuffer);
- dreturn("%i", 0);
- return 0;
- } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase,
- 0))
- {
- free(databuffer);
- dreturn("%i", 0);
- return 0;
- } else if ((*_gd_ef[E->e->u.raw.file[0].subenc].open)(
- D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
- _GD_FileSwapBytes(D, E->fragment_index), D->flags & GD_ACCMODE, 0))
- {
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
- NULL);
- free(databuffer);
- dreturn("%i", 0);
- return 0;
- }
+ if (_GD_InitRawIO(D, E, GD_EF_SEEK | GD_EF_READ, 0)) {
+ free(databuffer);
+ dreturn("%i", 0);
+ return 0;
}
if ((*_gd_ef[E->e->u.raw.file[0].subenc].seek)(E->e->u.raw.file, s0,
@@ -327,7 +310,7 @@
samples_read =
(*_gd_ef[E->e->u.raw.file[0].subenc].read)(E->e->u.raw.file,
- databuffer + n_read * E->e->u.raw.size, E->EN(raw,data_type), ns);
+ databuffer + n_read * E->e->u.raw.size, E->EN(raw,data_type), ns);
if (samples_read == -1) {
_GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
@@ -348,11 +331,11 @@
if (D->fragment[E->fragment_index].byte_sex &
#ifdef WORDS_BIGENDIAN
- GD_LITTLE_ENDIAN
+ GD_LITTLE_ENDIAN
#else
- GD_BIG_ENDIAN
+ GD_BIG_ENDIAN
#endif
- )
+ )
{
if (E->EN(raw,data_type) & GD_COMPLEX)
_GD_FixEndianness(databuffer + n_read * E->e->u.raw.size,
@@ -1457,6 +1440,14 @@
return 0;
}
+ if (first_samp == GD_HERE) {
+ first_samp = _GD_GetFilePos(D, E, -1);
+ if (D->error) {
+ dreturn("%i", 0);
+ return 0;
+ }
+ }
+
/* short circuit for purely real native types */
if (~ntype & GD_COMPLEX) {
if (repr == GD_REPR_IMAG) {
@@ -1581,17 +1572,30 @@
return 0;
}
- /* get the samples per frame */
- spf = _GD_GetSPF(D, entry);
+ if (first_frame == GD_HERE || first_samp == GD_HERE) {
+ first_samp = GD_HERE;
+ first_frame = 0;
+ }
- if (D->error) {
+ if (first_frame > 0 || num_frames > 0) {
+ /* get the samples per frame */
+ spf = _GD_GetSPF(D, entry);
+
+ if (D->error) {
+ dreturn("%i", 0);
+ return 0;
+ }
+
+ first_samp += spf * first_frame;
+ num_samp += spf * num_frames;
+ }
+
+ if (first_samp < 0 && (first_samp != GD_HERE || first_frame != 0)) {
+ _GD_SetError(D, GD_E_RANGE, GD_E_OUT_OF_RANGE, NULL, 0, NULL);
dreturn("%i", 0);
return 0;
}
- first_samp += spf * first_frame;
- num_samp += spf * num_frames;
-
n_read = _GD_DoField(D, entry, repr, first_samp, num_samp, return_type,
data_out);
Modified: trunk/getdata/src/getdata.h.in
===================================================================
--- trunk/getdata/src/getdata.h.in 2011-09-30 00:55:47 UTC (rev 605)
+++ trunk/getdata/src/getdata.h.in 2011-10-13 02:08:13 UTC (rev 606)
@@ -142,9 +142,8 @@
#define GD_E_BAD_REFERENCE 24
#define GD_E_PROTECTED 25
#define GD_E_DELETE 26
-#define GD_E_BAD_ENDIANNESS 27
+#define GD_E_ARGUMENT 27
#define GD_E_CALLBACK 28
-#define GD_E_BAD_PROTECTION 29
#define GD_E_UNCLEAN_DB 30
#define GD_E_DOMAIN 31
#define GD_E_BAD_REPR 32
@@ -156,7 +155,9 @@
#define GD_N_ERROR_CODES 37
/* Deprecated error codes */
-#define GD_E_OPEN_INCLUDE GD_E_OPEN_FRAGMENT
+#define GD_E_OPEN_INCLUDE GD_E_OPEN_FRAGMENT
+#define GD_E_BAD_ENDIANNESS GD_E_ARGUMENT
+#define GD_E_BAD_PROTECTION GD_E_ARGUMENT
#define GD_MAX_LINCOM 3
@@ -197,12 +198,12 @@
#define GD_PROTECT_ALL ( GD_PROTECT_DATA | GD_PROTECT_FORMAT )
/* Standards specifiers */
-#define GD_VERSION_CURRENT -1
-#define GD_VERSION_LATEST -2
-#define GD_VERSION_EARLIEST -3
+#define GD_VERSION_CURRENT (-1)
+#define GD_VERSION_LATEST (-2)
+#define GD_VERSION_EARLIEST (-3)
/* this MUST be one less than the lowest allowed fragment index */
-#define GD_ALL_FRAGMENTS -1
+#define GD_ALL_FRAGMENTS (-1)
#define GD_SCALAR_ENTRY 0x10
/* field types */
@@ -231,6 +232,8 @@
@DEFINE_gd_uint16_t@
@DEFINE_gd_int64_t@
+#define GD_HERE (-1)
+
#if ! defined GD_C89_API
# include <inttypes.h>
# define GD_DCOMPLEXM(v) double _Complex v
@@ -408,6 +411,12 @@
#define GD_DEL_DEREF 0x4
#define GD_DEL_FORCE 0x8
+/* seek flags */
+#define GD_SEEK_SET 0x0
+#define GD_SEEK_CUR 0x1
+#define GD_SEEK_END 0x2
+#define GD_SEEK_PAD 0x4
+
extern int gd_add_bit(DIRFILE *dirfile, const char *field_code,
const char *in_field, gd_bit_t bitnum, gd_bit_t numbits, int fragment_index)
gd_nothrow gd_nonnull ((1,2,3));
@@ -840,6 +849,12 @@
extern off_t gd_eof(DIRFILE *dirfile, const char *field_code)
gd_nonnull ((1,2));
+
+extern off_t gd_seek(DIRFILE *dirfile, const char *field_code, off_t frame_num,
+ off_t sample_num, int whence) gd_nonnull ((1,2));
+
+extern off_t gd_tell(DIRFILE *dirfile, const char *field_code) gd_nothrow
+gd_nonnull ((1,2));
#else
# ifdef __REDIRECT_NTH
extern off_t __REDIRECT_NTH (gd_bof, (DIRFILE *dirfile, const char *field_code),
@@ -847,9 +862,13 @@
extern off_t __REDIRECT_NTH (gd_frameoffset, (DIRFILE *dirfile, int fragment),
gd_frameoffset64) gd_nonnull ((1));
+
+extern off_t __REDIRECT_NTH (gd_tell, (DIRFILE *dirfile,
+ const char *field_code), gd_tell64) gd_nonnull ((1,2));
# else
# define gd_bof gd_bof64
# define gd_frameoffset gd_frameoffset64
+# define gd_tell gd_tell64
# endif
# ifdef __REDIRECT
@@ -874,6 +893,10 @@
extern double __REDIRECT (gd_framenum_subset, (DIRFILE *dirfile,
const char *field_code, double value, off_t field_start, off_t field_end),
gd_framenum_subset64) gd_nonnull ((1,2));
+
+extern off_t __REDIRECT (gd_seek, (DIRFILE *dirfile, const char *field_code,
+ off_t frame_num, off_t sample_num, int whence), gd_seek64)
+gd_nonnull ((1,2));
# else
# define gd_alter_frameoffset gd_alter_frameoffset64
# define gd_getdata gd_getdata64
@@ -881,6 +904,7 @@
# define gd_nframes gd_nframes64
# define gd_eof gd_eof64
# define gd_framenum_subset gd_framenum_subset64
+# define gd_seek gd_seek64
# endif
#endif
@@ -920,6 +944,12 @@
extern gd_off64_t gd_eof64(DIRFILE *dirfile, const char *field_code)
gd_nonnull ((1,2));
+
+extern off64_t gd_seek64(DIRFILE *di...
[truncated message content] |
|
From: <ket...@us...> - 2011-10-18 01:48:24
|
Revision: 607
http://getdata.svn.sourceforge.net/getdata/?rev=607&view=rev
Author: ketiltrout
Date: 2011-10-18 01:48:16 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
Bindings and docs for gd_seek/gd_tell.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/bindings/cxx/dirfile.cpp
trunk/getdata/bindings/cxx/getdata/dirfile.h
trunk/getdata/bindings/f77/fgetdata.c
trunk/getdata/bindings/f77/fgetdata.h
trunk/getdata/bindings/f77/getdata.f90.in
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/make_parameters.c
trunk/getdata/bindings/perl/simple_funcs.xsin
trunk/getdata/bindings/python/pydirfile.c
trunk/getdata/doc/README.cxx
trunk/getdata/doc/README.f77
trunk/getdata/doc/README.f95
trunk/getdata/man/Makefile.am
trunk/getdata/man/gd_getdata.3
trunk/getdata/man/gd_putdata.3
trunk/getdata/src/fpos.c
trunk/getdata/src/getdata.c
trunk/getdata/src/putdata.c
trunk/getdata/src/spf.c
Added Paths:
-----------
trunk/getdata/man/gd_seek.3
trunk/getdata/man/gd_tell.3
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/ChangeLog 2011-10-18 01:48:16 UTC (rev 607)
@@ -1,3 +1,20 @@
+2011-10-18 D. V. Wiebe <ge...@ke...> svn:607
+ * man/gd_seek.3 man/gd_tell.3: Added.
+
+ * src/spf.c (gd_spf): Throw GD_E_DIMENSION on scalar field specified per
+ documentation.
+ * src/fpos.c (gd_tell64 gd_seek64): Ditto.
+
+ * src/putdata.c (_GD_DoFieldOut): Don't return on error from _GD_GetFilePos;
+ a better error will be generated later.
+
+ * bindings/make_parameters.c: Add GD_E_ARGUMENT, GD_SEEK_*, GD_HERE.
+ * bindings/python/pydirfile.c (gdpy_dirfile_seek gdpy_dirfile_tell)
+ bindings/cxx/dirfile.cpp (Dirfile::Seek Dirfile::Tell)
+ bindings/perl/simple_funcs.xsin (seek tell) bindings/f77/fgetdata.c (GDSEEK
+ GDTELL) bindings/f77/getdata.f90.in (fgd_seek fgd_tell)
+ bindings/idl/getdata.c (gdidl_seek gdidl_tell): Added.
+
2011-10-13 D. V. Wiebe <ge...@ke...> svn:606
* test/entry_divide.c test/entry_recip.c test/get_here.c test/get_heres.c
test/put_here.c test/put_heres.c test/seek64.c test/seek_cur.c test/seek_end.c
Modified: trunk/getdata/bindings/cxx/dirfile.cpp
===================================================================
--- trunk/getdata/bindings/cxx/dirfile.cpp 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/cxx/dirfile.cpp 2011-10-18 01:48:16 UTC (rev 607)
@@ -1,4 +1,4 @@
-// Copyright (C) 2008-2010 D. V. Wiebe
+// Copyright (C) 2008-2011 D. V. Wiebe
//
///////////////////////////////////////////////////////////////////////////
//
@@ -139,7 +139,7 @@
return gd_error(D);
}
-int Dirfile::ErrorCount()
+int Dirfile::ErrorCount() const
{
return gd_error_count(D);
}
@@ -445,3 +445,14 @@
{
return gd_dirfile_standards(D, version);
}
+
+off_t Dirfile::Seek(const char* field_code, off_t frame_num,
+ off_t sample_num, int flags) const
+{
+ return gd_seek(D, field_code, frame_num, sample_num, flags);
+}
+
+off_t Dirfile::Tell(const char* field_code) const
+{
+ return gd_tell(D, field_code);
+}
Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h
===================================================================
--- trunk/getdata/bindings/cxx/getdata/dirfile.h 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2011-10-18 01:48:16 UTC (rev 607)
@@ -111,7 +111,7 @@
int Error() const;
- int ErrorCount();
+ int ErrorCount() const;
const char *ErrorString();
const char *ErrorString(size_t n) gd_deprecated;
@@ -205,6 +205,9 @@
unsigned int SamplesPerFrame(const char *field_code) const;
+ off_t Seek(const char* field_code, off_t frame_num, off_t sample_num,
+ int flags) const;
+
void SetCallback(gd_parser_callback_t sehandler, void* extra = NULL)
const;
@@ -212,6 +215,8 @@
const char **Strings() const;
+ off_t Tell(const char* field_code) const;
+
int UnInclude(int fragment_index, int del = 0) const;
int Validate(const char* field_code) const;
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/f77/fgetdata.c 2011-10-18 01:48:16 UTC (rev 607)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008-2010 D. V. Wiebe
+/* Copyright (C) 2008-2011 D. V. Wiebe
*
*************************************************************************
*
@@ -2926,3 +2926,33 @@
dreturn("%i", *vers);
}
+
+/* gd_seek wrapper */
+void F77_FUNC(gdseek, GDSEEK) (int* pos, const int* dirfile,
+ const char* field_code, const int* field_code_l, const int* frame_num,
+ const int* sample_num, const int* flags)
+{
+ char *fc = (char *)malloc(*field_code_l + 1);
+ dtrace("%p, %i, %p, %i, %i, %i, 0x%x", pos, *dirfile, field_code,
+ *field_code_l, *frame_num, *sample_num, *flags);
+
+ *pos = (int)gd_seek(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+ *field_code_l), *frame_num, *sample_num, *flags);
+
+ free(fc);
+ dreturn("%i", *pos);
+}
+
+/* gd_tell wrapper */
+void F77_FUNC(gdtell, GDTELL) (int* pos, const int* dirfile,
+ const char* field_code, const int* field_code_l)
+{
+ char *fc = (char *)malloc(*field_code_l + 1);
+ dtrace("%p, %i, %p, %i", pos, *dirfile, field_code, *field_code_l);
+
+ *pos = (int)gd_tell(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code,
+ *field_code_l));
+
+ free(fc);
+ dreturn("%i", *pos);
+}
Modified: trunk/getdata/bindings/f77/fgetdata.h
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.h 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/f77/fgetdata.h 2011-10-18 01:48:16 UTC (rev 607)
@@ -557,6 +557,13 @@
void F77_FUNC(gdpcas, GDPCAS) (const int *dirfile, const char *field_code,
const int *field_code_l, const int *start, const int *n,
const int *data_type, const void *data_in);
+
+void F77_FUNC(gdseek, GDSEEK) (int* pos, const int* dirfile,
+ const char* field_code, const int* field_code_l, const int* frame_num,
+ const int* sample_num, const int* flags);
+
+void F77_FUNC(gdtell, GDTELL) (int* pos, const int* dirfile,
+ const char* field_code, const int* field_code_l);
#ifdef __cplusplus
}
#endif
Modified: trunk/getdata/bindings/f77/getdata.f90.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f90.in 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/f77/getdata.f90.in 2011-10-18 01:48:16 UTC (rev 607)
@@ -1,4 +1,4 @@
-! Copyright (C) 2008-2010 D. V. Wiebe
+! Copyright (C) 2008-2011 D. V. Wiebe
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -2126,4 +2126,21 @@
array_len)
end subroutine
+function fgd_seek (dirfile, field_name, frame_num, sample_num, flags)
+ integer :: fgd_seek
+ integer, intent(in) :: dirfile, frame_num, sample_num, flags
+ character (len=*), intent(in) :: field_name
+
+ call gdseek(fgd_seek, dirfile, TRIM(field_name), LEN_TRIM(field_name), &
+ frame_num, sample_num, flags)
+end function
+
+function fgd_tell (dirfile, field_name)
+ integer :: fgd_tell
+ integer, intent(in) :: dirfile
+ character (len=*), intent(in) :: field_name
+
+ call gdtell(fgd_tell, dirfile, TRIM(field_name), LEN_TRIM(field_name))
+end function
+
end module
Modified: trunk/getdata/bindings/idl/getdata.c
===================================================================
--- trunk/getdata/bindings/idl/getdata.c 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/idl/getdata.c 2011-10-18 01:48:16 UTC (rev 607)
@@ -3476,7 +3476,7 @@
DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
const char *field_code = IDL_VarGetString(argv[1]);
- off64_t bof = gd_bof(D, field_code);
+ off64_t bof = gd_bof64(D, field_code);
GDIDL_SET_ERROR(D);
@@ -3839,7 +3839,7 @@
DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
const char *field_code = IDL_VarGetString(argv[1]);
- off64_t eof = gd_eof(D, field_code);
+ off64_t eof = gd_eof64(D, field_code);
GDIDL_SET_ERROR(D);
@@ -4688,8 +4688,81 @@
return r;
}
+/* @@DLM: F gdidl_seek GD_SEEK 2 2 KEYWORDS */
+IDL_VPTR gdidl_seek(int argc, IDL_VPTR argv[], char *argk)
+{
+ dtraceidl();
+ typedef struct {
+ IDL_KW_RESULT_FIRST_FIELD;
+ GDIDL_KW_RESULT_ERROR;
+ off64_t frame_num;
+ off64_t sample_num;
+ int whence;
+ int pad;
+ } KW_RESULT;
+ KW_RESULT kw;
+ kw.whence = GD_SEEK_SET;
+ kw.frame_num = kw.sample_num = 0;
+ kw.pad = 0;
+ GDIDL_KW_INIT_ERROR;
+
+ static IDL_KW_PAR kw_pars[] = {
+ GDIDL_KW_PAR_ERROR,
+ GDIDL_KW_PAR_ESTRING,
+ { "FRAME_NUM", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(frame_num) },
+ { "SAMPLE_NUM", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(sample_num) },
+ { "PAD", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pad) },
+ { "WHENCE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(whence) },
+ { NULL }
+ };
+
+ argc = IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw);
+
+ DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+ const char* field_code = IDL_VarGetString(argv[1]);
+
+ off64_t pos = gd_seek64(D, field_code, kw.frame_num, kw.sample_num,
+ (kw.whence & (GD_SEEK_SET | GD_SEEK_CUR | GD_SEEK_END)) |
+ (kw.pad ? GD_SEEK_PAD : 0));
+
+ GDIDL_SET_ERROR(D);
+
+ IDL_KW_FREE;
+
+ IDL_VPTR r = IDL_Gettmp();
+ r->type = IDL_TYP_LONG64;
+ r->value.l64 = (IDL_LONG64)pos;
+ dreturn("%p", r);
+ return r;
+}
+
+/* @@DLM: F gdidl_tell GD_TELL 2 2 KEYWORDS */
+IDL_VPTR gdidl_tell(int argc, IDL_VPTR argv[], char *argk)
+{
+ dtraceidl();
+
+ GDIDL_KW_ONLY_ERROR;
+
+ DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0]));
+ const char* field_code = IDL_VarGetString(argv[1]);
+
+ off64_t pos = gd_tell64(D, field_code);
+
+ GDIDL_SET_ERROR(D);
+
+ IDL_KW_FREE;
+
+ IDL_VPTR r = IDL_Gettmp();
+ r->type = IDL_TYP_LONG64;
+ r->value.l64 = (IDL_LONG64)pos;
+ dreturn("%p", r);
+ return r;
+}
+
+
+
/**** Module initialisation ****/
/* These are defined in the automatically generated sublist.c */
Modified: trunk/getdata/bindings/make_parameters.c
===================================================================
--- trunk/getdata/bindings/make_parameters.c 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/make_parameters.c 2011-10-18 01:48:16 UTC (rev 607)
@@ -29,6 +29,22 @@
#define NO_GETDATA_LEGACY_API
#include "getdata.h"
+/* The type parameter:
+ * 0: error codes
+ * 1: open flags represented as INT in IDL
+ * 2: open flags represented as LONG in IDL
+ * 3: entry types
+ * 4: data types
+ * 5: delete flags (not in IDL)
+ * 6: protection levels
+ * 7: callback actions (not in IDL)
+ * 8: GD_E_FORMAT suberrors (not in IDL)
+ * 9: special version codes not used by pygetdata
+ * 10: special version codes used by pygetdata
+ * 11: gd_seek whence values
+ * 12: gd_seek flags (not in IDL)
+ * 99: miscellaneous constants
+ */
#define CONSTANT(s,f,t) { "GD_" #s, #s, f, GD_ ## s, t }
static struct {
const char* lname; /* Long name */
@@ -46,7 +62,7 @@
CONSTANT(E_BAD_TYPE, "GD_EBT", 0),
CONSTANT(E_RAW_IO, "GD_ERW", 0),
CONSTANT(E_OPEN_FRAGMENT, "GD_EOF", 0),
- CONSTANT(E_OPEN_INCLUDE, "GD_EOI", 0),
+ CONSTANT(E_OPEN_INCLUDE, "GD_EOI", 0), /* deprecated */
CONSTANT(E_INTERNAL_ERROR, "GD_EIE", 0),
CONSTANT(E_ALLOC, "GD_EAL", 0),
CONSTANT(E_RANGE, "GD_ERA", 0),
@@ -64,9 +80,10 @@
CONSTANT(E_BAD_REFERENCE, "GD_EBR", 0),
CONSTANT(E_PROTECTED, "GD_EPT", 0),
CONSTANT(E_DELETE, "GD_EDL", 0),
- CONSTANT(E_BAD_ENDIANNESS, "GD_EEN", 0),
+ CONSTANT(E_ARGUMENT, "GD_EAR", 0),
+ CONSTANT(E_BAD_ENDIANNESS, "GD_EEN", 0), /* deprecated */
CONSTANT(E_CALLBACK, "GD_ECB", 0),
- CONSTANT(E_BAD_PROTECTION, "GD_EBP", 0),
+ CONSTANT(E_BAD_PROTECTION, "GD_EBP", 0), /* deprecated */
CONSTANT(E_UNCLEAN_DB, "GD_UCL", 0),
CONSTANT(E_DOMAIN, "GD_EDO", 0),
CONSTANT(E_BAD_REPR, "GD_ERP", 0),
@@ -170,9 +187,15 @@
CONSTANT(VERSION_LATEST, "GDSV_L", 10),
CONSTANT(VERSION_EARLIEST, "GDSV_E", 10),
- CONSTANT(MAX_LINE_LENGTH, "GD_MLL", 11),
- CONSTANT(ALL_FRAGMENTS, "GD_ALL", 11),
- CONSTANT(DIRFILE_STANDARDS_VERSION, "GD_DSV", 11),
+ CONSTANT(SEEK_SET, "GDSK_S", 11),
+ CONSTANT(SEEK_CUR, "GDSK_C", 11),
+ CONSTANT(SEEK_END, "GDSK_E", 11),
+ CONSTANT(SEEK_PAD, "GDSK_P", 12),
+
+ CONSTANT(MAX_LINE_LENGTH, "GD_MLL", 99),
+ CONSTANT(ALL_FRAGMENTS, "GD_ALL", 99),
+ CONSTANT(HERE, "GD_HER", 99),
+ CONSTANT(DIRFILE_STANDARDS_VERSION, "GD_DSV", 99),
{ NULL }
};
@@ -265,10 +288,17 @@
parameter(constant_list[j].lname, constant_list[j].fname,
constant_list[j].value, i);
+ printf("\\\n%c Seek flags\\\n", c);
+
+ for (j = 0; constant_list[j].lname != NULL; ++j)
+ if (constant_list[j].type == 11 || constant_list[j].type == 12)
+ parameter(constant_list[j].lname, constant_list[j].fname,
+ constant_list[j].value, i);
+
printf("\\\n%c Miscellaneous parameters\\\n", c);
for (j = 0; constant_list[j].lname != NULL; ++j)
- if (constant_list[j].type == 11)
+ if (constant_list[j].type == 99)
parameter(constant_list[j].lname, constant_list[j].fname,
constant_list[j].value, i);
@@ -316,7 +346,8 @@
for (i = 0; constant_list[i].lname != NULL; ++i)
if ((constant_list[i].type != 1) && (constant_list[i].type != 5) &&
- (constant_list[i].type != 7) && (constant_list[i].type != 8))
+ (constant_list[i].type != 7) && (constant_list[i].type != 8) &&
+ (constant_list[i].type != 12))
{
printf("{ \"%s\", 0, (void*)IDL_TYP_%s }, ", constant_list[i].sname,
(constant_list[i].type == 2) ? "LONG" : "INT");
@@ -336,7 +367,8 @@
for (n = i = 0; constant_list[i].lname != NULL; ++i)
if ((constant_list[i].type != 1) && (constant_list[i].type != 5) &&
- (constant_list[i].type != 7) && (constant_list[i].type != 8))
+ (constant_list[i].type != 7) && (constant_list[i].type != 8) &&
+ (constant_list[i].type != 12))
{
printf("*(IDL_%s*)(data + IDL_StructTagInfoByIndex(gdidl_const_def, %i, "
"IDL_MSG_LONGJMP, NULL)) = %li;\n", (constant_list[i].type == 2) ?
Modified: trunk/getdata/bindings/perl/simple_funcs.xsin
===================================================================
--- trunk/getdata/bindings/perl/simple_funcs.xsin 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/perl/simple_funcs.xsin 2011-10-18 01:48:16 UTC (rev 607)
@@ -118,3 +118,6 @@
off64_t bof64(DIRFILE *dirfile, const char* field_code)
off64_t eof64(DIRFILE *dirfile, const char* field_code)
int error_count(DIRFILE *dirfile)
+off64_t seek(DIRFILE *dirfile, const char* field_code, off64_t frame_num,
+ off64_t sample_num, int flags=GD_SEEK_SET)
+off64_t tell(DIRFILE *dirfile, const char* field_code)
Modified: trunk/getdata/bindings/python/pydirfile.c
===================================================================
--- trunk/getdata/bindings/python/pydirfile.c 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/bindings/python/pydirfile.c 2011-10-18 01:48:16 UTC (rev 607)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009, 2010 D. V. Wiebe
+/* Copyright (C) 2009-2011 D. V. Wiebe
*
***************************************************************************
*
@@ -2070,6 +2070,61 @@
return 0;
}
+static PyObject *gdpy_dirfile_seek(struct gdpy_dirfile_t *self, PyObject *args,
+ PyObject *keys)
+{
+ dtrace("%p, %p, %p", self, args, keys);
+
+ char *keywords[] = { "field_code", "flags", "frame_num", "sample_num", NULL };
+ const char *field_code;
+ long int frame_num = 0, sample_num = 0;
+ int flags;
+ off_t pos;
+
+ if (!PyArg_ParseTupleAndKeywords(args, keys, "si|LL:pygetdata.dirfile.seek",
+ keywords, &field_code, &flags, &frame_num, &sample_num))
+ {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ pos = gd_seek(self->D, field_code, (off_t)frame_num, (off_t)sample_num,
+ flags);
+
+ PYGD_CHECK_ERROR(self->D, NULL);
+
+ PyObject* pyobj = PyLong_FromLongLong((long long)pos);
+
+ dreturn("%p", pyobj);
+ return pyobj;
+}
+
+static PyObject *gdpy_dirfile_tell(struct gdpy_dirfile_t *self, PyObject *args,
+ PyObject *keys)
+{
+ dtrace("%p, %p, %p", self, args, keys);
+
+ char *keywords[] = { "field_code", NULL };
+ const char *field_code;
+ off_t pos;
+
+ if (!PyArg_ParseTupleAndKeywords(args, keys, "s:pygetdata.dirfile.tell",
+ keywords, &field_code))
+ {
+ dreturn("%p", NULL);
+ return NULL;
+ }
+
+ pos = gd_tell(self->D, field_code);
+
+ PYGD_CHECK_ERROR(self->D, NULL);
+
+ PyObject* pyobj = PyLong_FromLongLong((long long)pos);
+
+ dreturn("%p", pyobj);
+ return pyobj;
+}
+
static PyGetSetDef gdpy_dirfile_getset[] = {
{ "error", (getter)gdpy_dirfile_geterror, NULL,
"The numerical error code encountered by the last call to the GetData\n"
@@ -2080,7 +2135,6 @@
NULL },
{ "error_count", (getter)gdpy_dirfile_geterrorcount, NULL,
"The number of errors encountered by the GetData library for this\n"
- /* -----------------------------------------------------------------| */
"dirfile since the last time this member was accessed. Note:\n"
"accessing this member, resets it to zero. See gd_error_count(3).",
NULL },
@@ -2239,7 +2293,7 @@
"and values, unlike the C API counterpart."
},
{"getdata", (PyCFunction)gdpy_dirfile_getdata, METH_VARARGS | METH_KEYWORDS,
- "gd_getdata(field_code, return_type [, first_frame, first_sample,\n"
+ "getdata(field_code, return_type [, first_frame, first_sample,\n"
"num_frames, num_samples, as_list])\n\n"
"Retrieve a data vector from the dirfile. If NumPy support is\n"
"present in pygetdata, and 'as_list' is not given or zero, a NumPy\n"
@@ -2252,7 +2306,7 @@
"indicated. For list data it should be (typically) one of:\n"
"pygetdata.INT, pygetdata.LONG, pygetdata.ULONG, pygetdata.FLOAT, or\n"
"pygetdata.COMPLEX, although any GetData data type code is permitted.\n"
- "The 'first_frame' and 'first_samples' parameters indicate first\n"
+ "The 'first_frame' and 'first_sample' parameters indicate first\n"
"datum to read. If they are both omitted, data is read from the\n"
"first sample. Similarly, 'num_frames' and 'num_samples' indicate\n"
"the amount of data. Omitting both of these results in an error.\n"
@@ -2533,6 +2587,15 @@
"a RAW field, the file on disk will also be renamed accordingly.\n"
"See gd_rename(3)."
},
+ {"seek", (PyCFunction)gdpy_dirfile_seek, METH_VARARGS | METH_KEYWORDS,
+ "seek(field_code, flags [, frame_num, sample_num])\n\n"
+ "Set the field pointer of the field specified by 'field_code'. The\n"
+ "'frame_num' and 'sample_num' parameters indicate desired position.\n"
+ "If they are both omitted, the field pointer is set to sample zero.\n"
+ "The 'flags' parameter must contain one of pygetdata.SEEK_SET,\n"
+ "pygetdata.SEEK_CUR and pygetdata.SEEK_END, which may be bitwise or'd\n"
+ "with pygetdata.SEEK_PAD. See gd_seek(3)."
+ },
{"set_callback", (PyCFunction)gdpy_dirfile_callback,
METH_VARARGS | METH_KEYWORDS,
"set_callback(sehandler, extra)\n\n"
@@ -2544,6 +2607,12 @@
"handler, or None, if no such object is needed. See\n"
"gd_parser_callback(3)."
},
+ {"tell", (PyCFunction)gdpy_dirfile_tell, METH_VARARGS | METH_KEYWORDS,
+ "tell(field_code)\n\n"
+ /* -----------------------------------------------------------------| */
+ "Report the current position of the field pointer of 'field_code'.\n"
+ "See gd_tell(3)."
+ },
{"uninclude", (PyCFunction)gdpy_dirfile_uninclude,
METH_VARARGS | METH_KEYWORDS,
"uninclude(fragment_index [, del])\n\n"
Modified: trunk/getdata/doc/README.cxx
===================================================================
--- trunk/getdata/doc/README.cxx 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/doc/README.cxx 2011-10-18 01:48:16 UTC (rev 607)
@@ -182,7 +182,10 @@
GetData::DataType type, const void *data_in)
* size_t Dirfile::PutString(const char *field_code, const char *data_in)
* unsigned int Dirfile::SamplesPerFrame(const char *field_code)
+* off_t Dirfile::Seek(const char *field_code, off_t frame_num, off_t sample_num,
+ int whence)
* const char **Dirfile::Strings()
+* off_t Dirfile::Tell(const char *field_code)
* int Dirfile::Validate(const char *field_code)
* const char **Dirfile::VectorList()
Modified: trunk/getdata/doc/README.f77
===================================================================
--- trunk/getdata/doc/README.f77 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/doc/README.f77 2011-10-18 01:48:16 UTC (rev 607)
@@ -308,7 +308,32 @@
This subroutine wraps gd_framenum_subset(3), and performs a reverse
look-up on a field.
+* GDSEEK(pos, dirfile_unit, field_code, field_code_len, frame_num, sample_num,
+ flags)
+ Output:
+ INTEGER pos
+ Input:
+ INTEGER dirfile_unit, field_code_len, frame_num, sample_num, flags
+ CHARACTER*<field_code_len> field_code
+
+ This subroutine wraps gd_seek(3), and repositions the field pointer of the
+ specified field. It returns the new value of the field pointer. The
+ 'flags' argument should be one of GDSK_S, GDSK_C, or GDSK_E, optionally
+ bitwise or'd with GDSK_E.
+
+* GDTELL(pos, dirfile_unit, field_code)
+
+ Output:
+ INTEGER pos
+ Input:
+ INTEGER dirfile_unit, field_code_len
+ CHARACTER*<field_code_len> field_code
+
+ This subroutine wraps gd_tell(3), and returns the current value of the field
+ pointer for the specified field.
+
+
Subroutines interacting with global metadata
--------------------------------------------
@@ -1789,10 +1814,20 @@
GDSV_L GD_VERSION_LATEST
GDSV_E GD_VERSION_EARLIEST
+Seek flags:
+
+ F77 symbol C symbol
+ ---------- ---------------------
+ GDSK_C GD_SEEK_CUR
+ GDSK_E GD_SEEK_END
+ GDSK_P GD_SEEK_PAD
+ GDSK_S GD_SEEK_SET
+
Miscellaneous parameters:
F77 symbol C symbol
---------- -------------------------
GD_ALL GD_ALL_FRAGMENTS
GD_DSV DIRFILE_STANDARDS_VERSION
+ GD_HER GD_HERE
GD_MLL GD_MAX_LINE_LENGTH
Modified: trunk/getdata/doc/README.f95
===================================================================
--- trunk/getdata/doc/README.f95 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/doc/README.f95 2011-10-18 01:48:16 UTC (rev 607)
@@ -514,7 +514,15 @@
* integer function fgd_invalid_dirfile ()
+* integer function fgd_seek (dirfile, field_code, frame_num, sample_num, flags)
+ integer, intent(in) :: dirfile, frame_num, sample_num, flags
+ character (len=*), intent(in): field_code
+* integer function fgd_tell (dirfile, field_code)
+ integer, intent(in) :: dirfile
+ character (len=*), intent(in): field_code
+
+
In order to respect type safety, the gd_getdata and gd_putdata analogues encode
the data type of their array in their function name, rather than as a parameter.
Otherwise, they behave the same as their C counterparts.
Modified: trunk/getdata/man/Makefile.am
===================================================================
--- trunk/getdata/man/Makefile.am 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/man/Makefile.am 2011-10-18 01:48:16 UTC (rev 607)
@@ -35,22 +35,23 @@
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_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_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_spf.3 gd_get_string.3 gd_put_string.3 \
- gd_strings.3 gd_uninclude.3 gd_validate.3 gd_vector_list.3 \
- dirfile.5 dirfile-encoding.5 dirfile-format.5 \
- $(LFS_transitional_mans)
+ 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_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_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)
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 \
Modified: trunk/getdata/man/gd_getdata.3
===================================================================
--- trunk/getdata/man/gd_getdata.3 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/man/gd_getdata.3 2011-10-18 01:48:16 UTC (rev 607)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_getdata 3 "19 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_getdata 3 "14 October 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_getdata \(em retrieve data from a dirfile database
.SH SYNOPSIS
@@ -62,7 +62,9 @@
must point to a valid memory location of sufficient size to hold all data
requested.
-The first sample returned will be
+Unless using
+.B GD_HERE
+(see below), the first sample returned will be
.RS
.IR first_frame " * " samples_per_frame " + " first_sample
.RE
@@ -83,6 +85,18 @@
.IR num_frames " and " first_frames ,
equal to zero.
+Instead of explicitly specifying the origin of the read, the caller may pass the
+special symbol
+.B GD_HERE
+as
+.IR first_frame .
+This will result in the read occurring at the current position of the I/O
+pointer for the field (see
+.BR gd_seek (3)
+for a discussion of I/O pointers). In this case, the value of
+.I first_sample
+is ignored.
+
The
.I return_type
argument should be one of the following symbols, which indicates the desired
@@ -140,6 +154,10 @@
purely real one is required, only the real portion of the requested vector will
be returned.
+Upon successful completion, the I/O pointer of the field will be on the sample
+immediately following the last sample returned. On error, the position of the
+I/O pointer is not specified.
+
.SH RETURN VALUE
In all cases,
.BR gd_getdata ()
@@ -198,6 +216,12 @@
.I field_code
or one of its inputs.
.TP
+.B GD_E_DOMAIN
+An immediate read was attempted using
+.BR GD_HERE ,
+but the I/O pointer of the field was not well defined because two or more of
+the field's inputs did not agree as to the location of the I/O pointer.
+.TP
.B GD_E_INTERNAL_ERROR
An internal error occurred in the library while trying to perform the task.
This indicates a bug in the library. Please report the incident to the
@@ -225,7 +249,6 @@
supported by the library. See
.BR dirfile-encoding (5)
for details on dirfile encoding schemes.
-.RE
.PP
The dirfile error may be retrieved by calling
.BR gd_error (3).
@@ -284,6 +307,7 @@
.BR gd_error (3),
.BR gd_error_string (3),
.BR gd_nframes (3),
+.BR gd_seek (3),
.BR gd_spf (3),
.BR gd_get_string (3),
.BR gd_putdata (3)
Modified: trunk/getdata/man/gd_putdata.3
===================================================================
--- trunk/getdata/man/gd_putdata.3 2011-10-13 02:08:13 UTC (rev 606)
+++ trunk/getdata/man/gd_putdata.3 2011-10-18 01:48:16 UTC (rev 607)
@@ -13,7 +13,7 @@
.\" Texts. A copy of the license is included in the `COPYING.DOC' file
.\" as part of this distribution.
.\"
-.TH gd_putdata 3 "19 August 2011" "Version 0.8.0" "GETDATA"
+.TH gd_putdata 3 "14 October 2011" "Version 0.8.0" "GETDATA"
.SH NAME
gd_putdata \(em write data to a dirfile database
.SH SYNOPSIS
@@ -52,7 +52,9 @@
argument must point to a valid DIRFILE object previously created by a call to
.BR gd_open (3).
-The first sample written will be
+Unless using
+.B GD_HERE
+(see below), the first sample written will be
.RS
.IR first_frame " * " samples_per_frame " + " first_sample
.RE
@@ -75,6 +77,18 @@
.IR num_frames " and " first_frames ,
equal to zero.
+Instead of explicitly specifying the origin of the write, the caller may pass
+the special symbol
+.B GD_HERE
+as
+.IR first_frame .
+This will result in the write occurring at the current position of the I/O
+pointer for the field (see
+.BR gd_seek (3)
+for a discussion of I/O pointers). In this case, the value of
+.I first_sample
+is ignored.
+
The
.I data_type
argument should be one of the fo...
[truncated message content] |
|
From: <ket...@us...> - 2011-10-20 22:53:10
|
Revision: 609
http://getdata.svn.sourceforge.net/getdata/?rev=609&view=rev
Author: ketiltrout
Date: 2011-10-20 22:53:01 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Fix interoperability between seek/tell/HERE and FRAMEOFFSET. Add the missing
gd_[m]constants/gd_[m]strings Fortran bindings. All bindings tests for these
plus seek/tell.
Modified Paths:
--------------
trunk/getdata/ChangeLog
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/idl/getdata.c
trunk/getdata/bindings/idl/test/big_test.pro
trunk/getdata/bindings/make_parameters.c
trunk/getdata/bindings/perl/Makefile.am
trunk/getdata/bindings/perl/t/big_test.t
trunk/getdata/bindings/perl/typemap
trunk/getdata/bindings/python/pydirfile.c
trunk/getdata/bindings/python/test/big_test.py
trunk/getdata/doc/README.f77
trunk/getdata/doc/README.f95
trunk/getdata/doc/list.tests
trunk/getdata/man/gd_mstrings.3
trunk/getdata/man/gd_strings.3
trunk/getdata/src/fpos.c
trunk/getdata/src/getdata.c
trunk/getdata/test/Makefile.am
Added Paths:
-----------
trunk/getdata/test/get_here_foffs.c
trunk/getdata/test/seek_foffs.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/ChangeLog 2011-10-20 22:53:01 UTC (rev 609)
@@ -1,3 +1,31 @@
+2011-10-20 D. V. Wiebe <ge...@ke...> svn:609
+ * test/get_here_foffs.c test/seek_foffs.c: Added.
+
+ * src/getdata.c (_GD_DoRaw): Update file->pos after calling FillZero.
+ * src/fpos.c (_GD_GetFilePos): Adjust for SPF.
+ * src/fpos.c (_GD_Seek): If seeking before FRAMEOFFSET, set file->pos < 0.
+
+ * bindings/python/pydirfile.c (gdpy_dirfile_seek): Fix type of frame_num,
+ sample_num.
+
+ * bindings/perl/typemap: off64_t is signed.
+
+ * bindings/f77/fgetdata.c (GDCONS GDMCOS GDSTRS GDMSTS GDSTRX GDMSTX):
+ Added.
+ * bindings/f77/getdata.f90.in (fgd_constants_i1 fgd_constants_i2
+ fgd_constants_i4 fgd_constants_i8 fgd_constants_r4 fgd_constants_r8
+ fgd_constants_c8 fgd_constants_c16 fgd_mconstants_i1 fgd_mconstants_i2
+ fgd_mconstants_i4 fgd_mconstants_i8 fgd_mconstants_r4 fgd_mconstants_r8
+ fgd_mconstants_c8 fgd_mconstants_c16 fgd_string_value_max fgd_strings
+ fgd_mstring_value_max fgd_mstrings): Added.
+
+ * bindings/idl/getdata.c (gdidl_getdata gdidl_putdata): Add /HERE.
+
+ * 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: Added tests
+ 183-204.
+
2011-10-18 D. V. Wiebe <ge...@ke...> svn:607
* man/gd_seek.3 man/gd_tell.3: Added.
Modified: trunk/getdata/bindings/cxx/test/big_test.cpp
===================================================================
--- trunk/getdata/bindings/cxx/test/big_test.cpp 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/bindings/cxx/test/big_test.cpp 2011-10-20 22:53:01 UTC (rev 609)
@@ -80,13 +80,14 @@
ne++; cerr << "d(" << i << ")[" << t << ", " << m << "] = " << (v) << endl; }
#define CHECK_STRING(t,v,g) \
- if (strcmp((v), (g))) { ne++; cerr << "s[" << t << "] = " << (v) << endl; }
+ if (strcmp((v), (g))) { ne++; cerr << "s[" << t << "] = \"" << (v) << "\"" \
+ << endl; }
#define CHECK_STRING2(t,m,v,g) \
if (strcmp((v), (g))) { \
- ne++; cerr << "s[" << t << ", " << m << "] = " << (v) << endl; }
+ ne++; cerr << "s[" << t << ", " << m << "] = \"" << (v) << "\"" << endl; }
#define CHECK_STRING_ARRAY(t,m,v,g) \
for (i = 0; i < m; ++i) if (strcmp((v), (g))) { \
- ne++; cerr << "s(" << i << ")[" << t << "] = " << (v) << endl; }
+ ne++; cerr << "s(" << i << ")[" << t << "] = \"" << (v) << "\"" << endl; }
#define CHECK_COMPLEX2(t,m,v,g) \
if (abs((v) - (g)) > 1e-10) { \
@@ -127,9 +128,10 @@
unsigned char c[8];
unsigned char data_data[80];
signed char sc;
- int n, i, e, ne = 0;
+ int m, n, i, e, ne = 0;
float fl;
double dp, p[6], q[6];
+ const double *qp;
complex<double> cq[6];
const char **list;
const char* str;
@@ -156,6 +158,7 @@
(char*)"linterp", (char*)"mult", (char*)"phase", (char*)"polynom",
(char*)"recip", (char*)"sbit", (char*)"string", NULL, NULL, NULL, NULL,
NULL, NULL, NULL};
+ char *strings[3];
// Write the test dirfile
mkdir(filedir, 0777);
@@ -1311,8 +1314,55 @@
CHECK_INT2(181,4,ent->ArrayLen(),12);
delete ent;
+ // 183: gd_constants
+ p[0] = 61.;
+ p[1] = 0.;
+ n = d->NFieldsByType(ConstEntryType);
+ qp = reinterpret_cast<const double *>(d->Constants());
+ CHECK_OK(183);
+ CHECK_DOUBLE_ARRAY(183,0,n,qp[i],p[i]);
+ // 184: gd_mconstants
+ p[0] = 3.3;
+ p[1] = 0.;
+ n = d->NMFieldsByType("data", ConstEntryType);
+ qp = reinterpret_cast<const double *>(d->MConstants("data"));
+ CHECK_OK(184);
+ CHECK_DOUBLE_ARRAY(184,0,n,qp[i],p[i]);
+ // 199: gd_strings
+ strings[0] = (char *)"Lorem ipsum";
+ strings[1] = (char *)"";
+ strings[2] = (char *)"Arthur Dent";
+ n = d->NFieldsByType(StringEntryType);
+ list = d->Strings();
+ CHECK_OK(199);
+ CHECK_STRING_ARRAY(199,n,list[i],strings[i]);
+
+ // 200: gd_strings
+ strings[0] = (char *)"This is a string constant.";
+ n = d->NMFieldsByType("data", StringEntryType);
+ list = d->MStrings("data");
+ CHECK_OK(200);
+ CHECK_STRING_ARRAY(200,n,list[i],strings[i]);
+
+ // 203: gd_seek
+ n = d->Seek("data", 35, 0, GD_SEEK_SET);
+ CHECK_OK2(203,0);
+ m = d->GetData("data", GD_HERE, 0, 1, 0, UInt8, c);
+ CHECK_OK2(203,1);
+ CHECK_INT2(203,0,n,280);
+ CHECK_INT2(203,1,m,8);
+ CHECK_INT_ARRAY(203,8,c[i],17 + i);
+
+ // 204: gd_tell
+ n = d->Tell("data");
+ CHECK_OK(204);
+ CHECK_INT(204,n,288);
+
+
+
+
// ===================================================================
d->Discard();
delete d;
Modified: trunk/getdata/bindings/f77/fgetdata.c
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.c 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/bindings/f77/fgetdata.c 2011-10-20 22:53:01 UTC (rev 609)
@@ -219,12 +219,18 @@
const int* num_frames, const int* num_samples, const int* return_type,
void* data_out)
{
+ dtrace("%p, %i, %p, %i, %i, %i, %i, %i, 0x%x, %p", n_read, *dirfile,
+ field_code, *field_code_l, *first_frame, *first_sample, *num_frames,
+ *num_samples, *return_type, data_out);
+
char* out = (char *)malloc(*field_code_l + 1);
*n_read = gd_getdata(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code,
*field_code_l), *first_frame, *first_sample, *num_frames,
*num_samples, (gd_type_t)*return_type, data_out);
free(out);
+
+ dreturn("%i", *n_read);
}
/* Return the maximum field name length */
@@ -1312,7 +1318,11 @@
void F77_FUNC(gdnfdt, GDNFDT) (int* nfields, const int* dirfile,
const int* type)
{
+ dtrace("%p, %i, 0x%x", nfields, *dirfile, *type);
+
*nfields = gd_nfields_by_type(_GDF_GetDirfile(*dirfile), (gd_entype_t)*type);
+
+ dreturn("%i", *nfields);
}
/* gd_nvectors wrapper */
@@ -1331,7 +1341,7 @@
if (D->error)
return;
- if (*field_num <= (int)nfields) {
+ if (*field_num > 0 && *field_num <= (int)nfields) {
fl = gd_field_list_by_type(D, (gd_entype_t)*type);
_GDF_FString(name, name_l, fl[*field_num - 1]);
} else
@@ -1354,7 +1364,7 @@
if (D->error)
return;
- if (*field_num <= (int)nfields) {
+ if (*field_num > 0 && *field_num <= (int)nfields) {
fl = gd_vector_list(D);
_GDF_FString(name, name_l, fl[*field_num - 1]);
} else
@@ -1381,7 +1391,7 @@
return;
}
- if (*field_num <= (int)nfields) {
+ if (*field_num > 0 && *field_num <= (int)nfields) {
fl = gd_mfield_list_by_type(D, pa, (gd_entype_t)*type);
_GDF_FString(name, name_l, fl[*field_num - 1]);
} else
@@ -1407,7 +1417,7 @@
return;
}
- if (*field_num <= (int)nfields) {
+ if (*field_num > 0 && *field_num <= (int)nfields) {
fl = gd_mvector_list(D, pa);
_GDF_FString(name, name_l, fl[*field_num - 1]);
} else
@@ -2080,10 +2090,14 @@
void F77_FUNC(gdnmft, GDNMFT) (int* nfields, const int* dirfile,
const char* parent, const int* parent_l, const int* type)
{
+ dtrace("%p, %i, %p, %i, 0x%x", nfields, *dirfile, parent, *parent_l, *type);
+
char* pa = (char *)malloc(*parent_l + 1);
*nfields = gd_nmfields_by_type(_GDF_GetDirfile(*dirfile), _GDF_CString(pa,
parent, *parent_l), (gd_entype_t)*type);
free(pa);
+
+ dreturn("%i", *nfields);
}
/* gd_nmvectors wrapper */
@@ -2956,3 +2970,148 @@
free(fc);
dreturn("%i", *pos);
}
+
+/* gd_constants wrapper -- this only returns one value */
+void F77_FUNC(gdcons, GDCONS) (void *value, const int *dirfile,
+ const int *return_type, const int *field_num)
+{
+ const void *v;
+
+ dtrace("%p, %i, 0x%x, %i", value, *dirfile, *return_type, *field_num);
+
+ DIRFILE *D = _GDF_GetDirfile(*dirfile);
+ unsigned int nfields = gd_nfields_by_type(D, GD_CONST_ENTRY);
+
+ if (!D->error && (*field_num > 0) && (*field_num <= (int)nfields)) {
+ v = gd_constants(D, (gd_type_t)*return_type);
+ if (!D->error)
+ memcpy(value, (char*)v + (*field_num - 1) * GD_SIZE(*return_type),
+ GD_SIZE(*return_type));
+ }
+ dreturnvoid();
+}
+
+/* gd_mconstants wrapper -- this only returns one value */
+void F77_FUNC(gdmcos, GDMCOS) (void *value, const int *dirfile,
+ const char *parent, const int *parent_l, const int *return_type,
+ const int *field_num)
+{
+ const void *v;
+
+ dtrace("%p, %i, %p, %i, 0x%x, %i", value, *dirfile, parent, *parent_l,
+ *return_type, *field_num);
+
+ DIRFILE *D = _GDF_GetDirfile(*dirfile);
+
+ char *pa = (char *)malloc(*parent_l + 1);
+ _GDF_CString(pa, parent, *parent_l);
+
+ unsigned int nfields = gd_nmfields_by_type(D, pa, GD_CONST_ENTRY);
+
+ if (!D->error && (*field_num > 0) && (*field_num <= (int)nfields)) {
+ v = gd_mconstants(D, pa, (gd_type_t)*return_type);
+ if (!D->error)
+ memcpy(value, (char*)v + (*field_num - 1) * GD_SIZE(*return_type),
+ GD_SIZE(*return_type));
+ }
+
+ free(pa);
+ dreturnvoid();
+}
+
+/* gd_strings wrapper -- this only returns one value */
+void F77_FUNC(gdstrs, GDSTRS) (char *value, int *value_l, const int *dirfile,
+ const int *field_num)
+{
+ const char **v;
+
+ dtrace("%p, %i, %i, %i", value, *value_l, *dirfile, *field_num);
+
+ DIRFILE *D = _GDF_GetDirfile(*dirfile);
+ unsigned int nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
+
+ if (!D->error && (*field_num > 0) && (*field_num <= (int)nfields)) {
+ v = gd_strings(D);
+ _GDF_FString(value, value_l, D->error ? "" : v[*field_num - 1]);
+ } else
+ *value_l = 0;
+
+ dreturn("%i", *value_l);
+}
+
+/* gd_mstrings wrapper -- this only returns one value */
+void F77_FUNC(gdmsts, GDMSTS) (void *value, int *value_l, const int *dirfile,
+ const char *parent, const int *parent_l, const int *field_num)
+{
+ const char **v;
+
+ dtrace("%p, %i, %i, %p, %i, %i", value, *value_l, *dirfile, parent,
+ *parent_l, *field_num);
+
+ DIRFILE *D = _GDF_GetDirfile(*dirfile);
+
+ char *pa = (char *)malloc(*parent_l + 1);
+ _GDF_CString(pa, parent, *parent_l);
+
+ unsigned int nfields = gd_nmfields_by_type(D, pa, GD_STRING_ENTRY);
+
+ if (!D->error && (*field_num > 0) && (*field_num <= (int)nfields)) {
+ v = gd_mstrings(D, pa);
+ _GDF_FString(value, value_l, D->error ? "" : v[*field_num - 1]);
+ } else
+ *value_l = 0;
+
+ free(pa);
+ dreturnvoid();
+}
+
+/* Return the maximum string value length */
+void F77_FUNC(gdstrx, GDSTRX) (int *max, const int *dirfile)
+{
+ dtrace("%p, %i", max, *dirfile);
+
+ const char **v;
+ size_t len = 0;
+ DIRFILE *D = _GDF_GetDirfile(*dirfile);
+ unsigned int i, nfields = gd_nfields_by_type(D, GD_STRING_ENTRY);
+
+ if (!D->error) {
+ v = gd_strings(D);
+
+ for (i = 0; i < nfields; ++i)
+ if (strlen(v[i]) > len)
+ len = strlen(v[i]);
+ }
+
+ *max = (int)len;
+
+ dreturn("%i", *max);
+}
+
+/* Return the maximum meta string value length */
+void F77_FUNC(gdmstx, GDMSTX) (int *max, const int *dirfile, const char *parent,
+ const int *parent_l)
+{
+ dtrace("%p, %i, %p, %i", max, *dirfile, parent, *parent_l);
+
+ const char **v;
+ size_t len = 0;
+ DIRFILE *D = _GDF_GetDirfile(*dirfile);
+
+ char *pa = (char *)malloc(*parent_l + 1);
+ _GDF_CString(pa, parent, *parent_l);
+
+ unsigned int i, nfields = gd_nmfields_by_type(D, pa, GD_STRING_ENTRY);
+
+ if (!D->error) {
+ v = gd_mstrings(D, pa);
+
+ for (i = 0; i < nfields; ++i)
+ if (strlen(v[i]) > len)
+ len = strlen(v[i]);
+ }
+
+ *max = (int)len;
+
+ dreturn("%i", *max);
+}
Modified: trunk/getdata/bindings/f77/fgetdata.h
===================================================================
--- trunk/getdata/bindings/f77/fgetdata.h 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/bindings/f77/fgetdata.h 2011-10-20 22:53:01 UTC (rev 609)
@@ -564,6 +564,24 @@
void F77_FUNC(gdtell, GDTELL) (int* pos, const int* dirfile,
const char* field_code, const int* field_code_l);
+
+void F77_FUNC(gdcons, GDCONS) (void *value, const int *dirfile,
+ const int *return_type, const int *field_num);
+
+void F77_FUNC(gdmcos, GDMCOS) (void *value, const int *dirfile,
+ const char *parent, const int *parent_l, const int *return_type,
+ const int *field_num);
+
+void F77_FUNC(gdstrs, GDSTRS) (char *value, int *value_l, const int *dirfile,
+ const int *field_num);
+
+void F77_FUNC(gdmsts, GDMSTS) (void *value, int *value_l, const int *dirfile,
+ const char *parent, const int *parent_l, const int *field_num);
+
+void F77_FUNC(gdstrx, GDSTRX) (int *max, const int *dirfile);
+
+void F77_FUNC(gdmstx, GDMSTX) (int *max, const int *dirfile, const char *parent,
+ const int *parent_l);
#ifdef __cplusplus
}
#endif
Modified: trunk/getdata/bindings/f77/getdata.f.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f.in 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/bindings/f77/getdata.f.in 2011-10-20 22:53:01 UTC (rev 609)
@@ -107,6 +107,8 @@
EXTERNAL GDCLBK
C Corresponding to gd_close(3)
EXTERNAL GDCLOS
+C Corresponding to gd_constants(3) (sort of)
+ EXTERNAL GDCONS
C Corresponding to gd_copen(3)
EXTERNAL GDCOPN
C Check whether an entry contains complex scalars
@@ -197,6 +199,8 @@
EXTERNAL GDINCL
C Corresponding to gd_invalid_dirfile(3)
EXTERNAL GDINVD
+C Corresponding to gd_mconstants(3) (sort of)
+ EXTERNAL GDMCOS
C Corresponding to gd_madd_bit(3)
EXTERNAL GDMDBT
C Corresponding to gd_madd_carray(3)
@@ -241,6 +245,11 @@
EXTERNAL GDMLSP
C Correpsonding to gd_move(3)
EXTERNAL GDMOVE
+C Corresponding to gd_mstrings(3) (sort of)
+ EXTERNAL GDMSTS
+C Returns the maximum length of the longest string metafield for a
+C field
+ EXTERNAL GDMSTX
C Corresponding to gd_mvector_list(3) (sort of)
EXTERNAL GDMVEN
C Corresponding to gd_dirfilename(3)
@@ -285,8 +294,16 @@
EXTERNAL GDRFRG
C Corresponding to gd_raw_filename(3)
EXTERNAL GDRWFN
+C Corresponding to gd_seek(3)
+ EXTERNAL GDSEEK
C Corresponding to gd_dirfile_standards(3)
EXTERNAL GDSTDV
+C Corresponding to gd_strings(3) (sort of)
+ EXTERNAL GDSTRS
+C Returns the length of the longest string field
+ EXTERNAL GDSTRX
+C Corresponding to gd_tell(3)
+ EXTERNAL GDTELL
C Corresponding to gd_uninclude(3)
EXTERNAL GDUINC
C Corresponding to gd_vector_list(3) (sort of)
Modified: trunk/getdata/bindings/f77/getdata.f90.in
===================================================================
--- trunk/getdata/bindings/f77/getdata.f90.in 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/bindings/f77/getdata.f90.in 2011-10-20 22:53:01 UTC (rev 609)
@@ -2143,4 +2143,287 @@
call gdtell(fgd_tell, dirfile, TRIM(field_name), LEN_TRIM(field_name))
end function
+! gd_constants with return_type=GD_INT8
+subroutine fgd_constants_i1 (constants, dirfile)
+ integer*1, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_INT8, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_INT16
+subroutine fgd_constants_i2 (constants, dirfile)
+ integer*2, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_INT16, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_INT32
+subroutine fgd_constants_i4 (constants, dirfile)
+ integer*4, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_INT32, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_INT64
+subroutine fgd_constants_i8 (constants, dirfile)
+ integer*8, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_INT64, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_FLOAT32
+subroutine fgd_constants_r4 (constants, dirfile)
+ real*4, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_FLOAT32, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_FLOAT64
+subroutine fgd_constants_r8 (constants, dirfile)
+ real*8, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_FLOAT64, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_COMPLEX64
+subroutine fgd_constants_c8 (constants, dirfile)
+ complex, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_COMPLEX64, i)
+ end do
+end subroutine
+
+! gd_constants with return_type=GD_COMPLEX128
+subroutine fgd_constants_c16 (constants, dirfile)
+ double complex, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+
+ nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdcons(constants(i), dirfile, GD_COMPLEX128, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT8
+subroutine fgd_mconstants_i1 (constants, dirfile, parent)
+ integer*1, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_INT8, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT16
+subroutine fgd_mconstants_i2 (constants, dirfile, parent)
+ integer*2, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_INT16, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT32
+subroutine fgd_mconstants_i4 (constants, dirfile, parent)
+ integer*4, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_INT32, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_INT64
+subroutine fgd_mconstants_i8 (constants, dirfile, parent)
+ integer*8, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_INT64, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_FLOAT32
+subroutine fgd_mconstants_r4 (constants, dirfile, parent)
+ real*4, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_FLOAT32, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_FLOAT64
+subroutine fgd_mconstants_r8 (constants, dirfile, parent)
+ real*8, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_FLOAT64, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_COMPLEX64
+subroutine fgd_mconstants_c8 (constants, dirfile, parent)
+ complex, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_COMPLEX64, i)
+ end do
+end subroutine
+
+! gd_mconstants with return_type=GD_COMPLEX128
+subroutine fgd_mconstants_c16 (constants, dirfile, parent)
+ double complex, dimension(:), intent(out) :: constants
+ integer, intent(in) :: dirfile
+ integer :: nfields, i
+ character (len=*), intent(in) :: parent
+
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_CONST_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmcos(constants(i), dirfile, TRIM(parent), LEN_TRIM(parent), &
+ GD_COMPLEX128, i)
+ end do
+end subroutine
+
+function fgd_string_value_max (dirfile)
+ integer :: fgd_string_value_max
+ integer, intent(in) :: dirfile
+
+ ! call f77 library
+ call gdstrx(fgd_string_value_max, dirfile)
+end function
+
+subroutine fgd_strings (strings, dirfile, string_len)
+ character(len=*), dimension(:), intent(out) :: strings
+ integer, intent(in) :: dirfile
+ integer, intent(inout) :: string_len
+ integer :: max_len, nfields, i
+
+ ! make sure the string list is large enough
+ max_len = fgd_string_value_max(dirfile)
+
+ if (string_len .lt. max_len) then
+ string_len = max_len
+ else
+ nfields = fgd_nfields_by_type(dirfile, GD_STRING_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdstrs(strings(i), string_len, dirfile, i)
+ end do
+ end if
+end subroutine
+
+function fgd_mstring_value_max (dirfile, parent)
+ integer :: fgd_mstring_value_max
+ integer, intent(in) :: dirfile
+ character (len=*), intent(in) :: parent
+
+ ! call f77 library
+ call gdmstx(fgd_mstring_value_max, dirfile, TRIM(parent), LEN_TRIM(parent))
+end function
+
+subroutine fgd_mstrings (strings, dirfile, parent, string_len)
+ character(len=*), dimension(:), intent(out) :: strings
+ integer, intent(in) :: dirfile
+ integer, intent(inout) :: string_len
+ integer :: max_len, nfields, i
+ character (len=*), intent(in) :: parent
+
+ ! make sure the field list is large enough
+ max_len = fgd_mstring_value_max(dirfile, parent)
+
+ if (string_len .lt. max_len) then
+ string_len = max_len
+ else
+ nfields = fgd_nmfields_by_type(dirfile, parent, GD_STRING_ENTRY)
+ do i=1,nfields
+ ! call f77 library
+ call gdmsts(strings(i), string_len, dirfile, TRIM(parent), &
+ LEN_TRIM(parent), i)
+ end do
+ end if
+end subroutine
+
end module
Modified: trunk/getdata/bindings/f77/test/big_test.f
===================================================================
--- trunk/getdata/bindings/f77/test/big_test.f 2011-10-19 10:15:31 UTC (rev 608)
+++ trunk/getdata/bindings/f77/test/big_test.f 2011-10-20 22:53:01 UTC (rev 609)
@@ -40,10 +40,13 @@
PARAMETER (flen = 7)
INTEGER nfields
PARAMETER (nfields = 14)
+ INTEGER slen
+ PARAMETER (slen = 26)
+ CHARACTER*26 strings(3)
CHARACTER*7 fields(nfields + 7)
CHARACTER*7 fn
- CHARACTER*20 str
+ CHARACTER*26 str
INTEGER*1 c(8)
INTEGER*1 datdat(80)
INTEGER*1 k
@@ -121,7 +124,7 @@
ne = 0
IF (e .NE. GD_EOP) THEN
ne = ne + 1
- WRITE(*, 2001) 0, e
+ WRITE(*, 9001) 0, e
ENDIF
C 1: GDOPEN check
@@ -130,7 +133,7 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 1, e
+ WRITE(*, 9001) 1, e
ENDIF
C 2: GDGETD check
@@ -139,18 +142,18 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 2, e
+ WRITE(*, 9001) 2, e
ENDIF
IF (n .NE. 8) THEN
ne = ne + 1
- WRITE(*, 2002) 2, n
+ WRITE(*, 9002) 2, n
ENDIF
DO 20 i = 1, 8
IF (c(i) .NE. 40 + i) THEN
ne = ne + 1
- WRITE(*, 2004) i, 2, c(i)
+ WRITE(*, 9004) i, 2, c(i)
ENDIF
20 CONTINUE
@@ -160,12 +163,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 3, e
+ WRITE(*, 9001) 3, e
ENDIF
IF (abs(fl - 5.5) .gt. 0.001) THEN
ne = ne + 1
- WRITE(*, 2005) 3, fl
+ WRITE(*, 9005) 3, fl
ENDIF
C 4: GDFDNX check
@@ -174,12 +177,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 4, e
+ WRITE(*, 9001) 4, e
ENDIF
IF (i .NE. flen) THEN
ne = ne + 1
- WRITE(*, 2002) 4, i
+ WRITE(*, 9002) 4, i
ENDIF
C 5: GDMFNX check
@@ -188,12 +191,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 5, e
+ WRITE(*, 9001) 5, e
ENDIF
IF (i .NE. 6) THEN
ne = ne + 1
- WRITE(*, 2002) 5, i
+ WRITE(*, 9002) 5, i
ENDIF
C 6: GDNFLD check
@@ -202,12 +205,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 6, e
+ WRITE(*, 9001) 6, e
ENDIF
IF (n .NE. nfields) THEN
ne = ne + 1
- WRITE(*, 2002) 6, n
+ WRITE(*, 9002) 6, n
ENDIF
C 7: This is a check of (one of many instances of) _GDF_FString
@@ -217,12 +220,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 7, e
+ WRITE(*, 9001) 7, e
ENDIF
IF (l .NE. 5) THEN
ne = ne + 1
- WRITE(*, 2002) 7, l
+ WRITE(*, 9002) 7, l
ENDIF
C 8: GDFLDN check
@@ -233,17 +236,17 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2006) 8, i, e
+ WRITE(*, 9006) 8, i, e
ENDIF
IF (l .NE. flen) THEN
ne = ne + 1
- WRITE(*, 2007) 8, i, l
+ WRITE(*, 9007) 8, i, l
ENDIF
IF (fn .NE. fields(i)) THEN
ne = ne + 1
- WRITE(*, 2008) i, 8, fn
+ WRITE(*, 9008) i, 8, fn
ENDIF
80 CONTINUE
@@ -253,12 +256,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 9, e
+ WRITE(*, 9001) 9, e
ENDIF
IF (n .NE. 3) THEN
ne = ne + 1
- WRITE(*, 2002) 9, n
+ WRITE(*, 9002) 9, n
ENDIF
C 10: GDMFDN check
@@ -272,17 +275,17 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2006) 10, i, e
+ WRITE(*, 9006) 10, i, e
ENDIF
IF (l .NE. flen) THEN
ne = ne + 1
- WRITE(*, 2007) 10, i, l
+ WRITE(*, 9007) 10, i, l
ENDIF
IF (fn .NE. fields(i)) THEN
ne = ne + 1
- WRITE(*, 2008) i, 10, fn
+ WRITE(*, 9008) i, 10, fn
ENDIF
100 CONTINUE
@@ -292,12 +295,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 11, e
+ WRITE(*, 9001) 11, e
ENDIF
IF (n .NE. 10) THEN
ne = ne + 1
- WRITE(*, 2002) 11, n
+ WRITE(*, 9002) 11, n
ENDIF
C 12: GDGSPF check
@@ -306,12 +309,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 12, e
+ WRITE(*, 9001) 12, e
ENDIF
IF (n .NE. 8) THEN
ne = ne + 1
- WRITE(*, 2002) 12, n
+ WRITE(*, 9002) 12, n
ENDIF
C 13: GDPUTD check
@@ -328,12 +331,12 @@
IF (e .NE. GD_EOK) THEN
ne = ne + 1
- WRITE(*, 2001) 13, e
+ WRITE(*, 9001) 13, e
ENDIF
IF (n .NE. 4) THEN
ne = ne + 1
- WRITE(*, 2002) 13, n
+ WRITE(*, 9002) 13, n
ENDIF
CALL GDGETD(n, d, 'data', 4, 5, 0...
[truncated message content] |
|
From: <ket...@us...> - 2011-11-05 00:43:49
|
Revision: 610
http://getdata.svn.sourceforge.net/getdata/?rev=610&view=rev
Author: ketiltrout
Date: 2011-11-05 00:43:40 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
A major overhaul to the encoding framework to permit out-of-place writing of
encoded raw data. T{Open,Move,Unlink} and Touch have been removed. In their
place is a bookkeeping layer which takes care of calling various encoding
functions when necessary and cleaning up after them. As a result: write
support is now available for gzip compressed raw fields.
Also added gd_sync which does half of what gd_flush does (sync but not close).
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/TODO
trunk/getdata/bindings/idl/getdata.c
trunk/getdata/bindings/make_parameters.c
trunk/getdata/configure.ac
trunk/getdata/m4/encoding.m4
trunk/getdata/src/add.c
trunk/getdata/src/ascii.c
trunk/getdata/src/bzip.c
trunk/getdata/src/close.c
trunk/getdata/src/del.c
trunk/getdata/src/encoding.c
trunk/getdata/src/endian.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/gzip.c
trunk/getdata/src/include.c
trunk/getdata/src/internal.h
trunk/getdata/src/lzma.c
trunk/getdata/src/mod.c
trunk/getdata/src/move.c
trunk/getdata/src/name.c
trunk/getdata/src/parse.c
trunk/getdata/src/putdata.c
trunk/getdata/src/raw.c
trunk/getdata/src/sie.c
trunk/getdata/src/slim.c
trunk/getdata/test/Makefile.am
trunk/getdata/test/alter_entry_recode.c
trunk/getdata/test/gzip_put.c
trunk/getdata/test/put_here.c
trunk/getdata/test/put_heres.c
trunk/getdata/test/put_rofs.c
trunk/getdata/test/test.h
Added Paths:
-----------
trunk/getdata/test/ascii_add.c
trunk/getdata/test/endian_alter_sie.c
trunk/getdata/test/get_rofs.c
trunk/getdata/test/gzip_add.c
trunk/getdata/test/gzip_get_put.c
trunk/getdata/test/gzip_move_to.c
trunk/getdata/test/gzip_put_get.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/ChangeLog 2011-11-05 00:43:40 UTC (rev 610)
@@ -1,3 +1,48 @@
+2011-11-05 D. V. Wiebe <ge...@ke...> svn:610
+ * test/gzip_put_get.c test/ascii_add.c test/get_rofs.c test/gzip_move_to.c
+ test/gzip_add.c test/endian_alter_sie.c test/gzip_get_put.c: Added.
+ * test/gzip_put.c: Update.
+
+ * m4/encoding.m4: Add a AC_CHECK_FUNCS call.
+
+ * src/slim.c (_GD_SlimOpen): Update for the (non-existant) slimdopen().
+
+ * src/getdata.h.in: Renamed GD_SEEK_PAD to GD_SEEK_WRITE to better reflect
+ its purpose.
+ * bindings/idl/getdata.c (gdidl_seek): Update keywords for same.
+
+ * src/flush.c (_GD_Flush): Add a third parameter, clo, to distinguish
+ sync from sync-and-close.
+ * src/flush.c (_GD_SyncOrClose): Renamed from gd_flush.
+ * src/flush.c (gd_sync gd_flush): Added.
+
+ * src/internal.h: Added _gd_raw_file.mode. Replaced encoding_t.ecor with
+ encoding_t.flags;
+ * src/encoding.c: Deleted touch, topen, tmove, tunlink from the encoding
+ framework. Changed signature of open and seek.
+ * src/encoding.c (_GD_MoveOver): Renamed from _GD_GenericTMove.
+ * src/encoding.c (_GD_FiniRawIO) src/fpos.c (_GD_WriteSeek): Added.
+ * src/gzip.c (_GD_GzipOpen _GD_GzipSeek _GD_GzipClose) src/encoding.c
+ (_GD_InitRawIO): Update for out-of-place writes.
+ * src/endian.c (_GD_ByteSwapFragment) src/name.c (gd_rename) src/flush.c
+ (_GD_Flush) src/encoding.c (_GD_RecodeFragment) src/del.c (gd_delete)
+ src/flimits.c (_GD_ShiftFragment): Use _GD_FiniRawIO to clean up.
+ * src/encoding.c (_GD_GenericTouch) src/ascii.c (_GD_AsciiTOpen
+ _GD_AsciiTUnlink) src/sie.c (_GD_SampIndTOpen _GD_SampIndTUnlink) src/raw.c
+ (_GD_RawTOpen _GD_RawTUnlink): Deleted.
+ * src/move.c (_GD_MogrifyFile) src/mod.c (_GD_Change): Use _GD_FiniRawIO and
+ _GD_InitRawIO.
+ * src/parse.c (_GD_ParseFieldSpec) add.c (_GD_Add): Use _GD_InitRawIO for
+ touch.
+ * src/gzip.c (_GD_GzipOpen) src/ascii.c (_GD_AsciiOpen) src/sie.c
+ (_GD_SampIndDoOpen _GD_SampIndOpen) src/raw.c (_GD_RawOpen): Handle temp file
+ opens.
+ * src/putdata.c (_GD_DoRawOut) src/fpos.c (_GD_Seek): Use _GD_WriteSeek.
+
+ * src/fpos.c (_GD_GetFilePos): Only try to open the file if necessary.
+
+ * src/gzip.c (_GD_GzipWrite _GD_GzipSync): Added.
+
2011-10-20 D. V. Wiebe <ge...@ke...> svn:609
* test/get_here_foffs.c test/seek_foffs.c: Added.
Modified: trunk/getdata/TODO
===================================================================
--- trunk/getdata/TODO 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/TODO 2011-11-05 00:43:40 UTC (rev 610)
@@ -1,11 +1,8 @@
* Locking
* Hashed compressed files
-* Streaming/Appending
* linterp table path munging [MH]
* Make webpage suck less
-* Handle RW dirfile on RO data better [JPF]
+
+* Fix VERSION leakage / Fragment encapsulation [MT/CBN]
* INCLUDE name munging [RW/MT]
-* Fix VERSION leakage [MT]
* aliasing [MT]
-* Fix REFERENCE spam [MT]
-* Fragment encapsulation [MT/CBN]
Modified: trunk/getdata/bindings/idl/getdata.c
===================================================================
--- trunk/getdata/bindings/idl/getdata.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/bindings/idl/getdata.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -4711,13 +4711,13 @@
off64_t frame_num;
off64_t sample_num;
int whence;
- int pad;
+ int write;
} KW_RESULT;
KW_RESULT kw;
kw.whence = GD_SEEK_SET;
kw.frame_num = kw.sample_num = 0;
- kw.pad = 0;
+ kw.write = 0;
GDIDL_KW_INIT_ERROR;
static IDL_KW_PAR kw_pars[] = {
@@ -4725,8 +4725,8 @@
GDIDL_KW_PAR_ESTRING,
{ "FRAME_NUM", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(frame_num) },
{ "SAMPLE_NUM", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(sample_num) },
- { "PAD", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pad) },
{ "WHENCE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(whence) },
+ { "WRITE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(write) },
{ NULL }
};
@@ -4737,7 +4737,7 @@
off64_t pos = gd_seek64(D, field_code, kw.frame_num, kw.sample_num,
(kw.whence & (GD_SEEK_SET | GD_SEEK_CUR | GD_SEEK_END)) |
- (kw.pad ? GD_SEEK_PAD : 0));
+ (kw.write ? GD_SEEK_WRITE : 0));
GDIDL_SET_ERROR(D);
Modified: trunk/getdata/bindings/make_parameters.c
===================================================================
--- trunk/getdata/bindings/make_parameters.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/bindings/make_parameters.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -189,7 +189,7 @@
CONSTANT(SEEK_SET, "GDSK_S", 10),
CONSTANT(SEEK_CUR, "GDSK_C", 10),
CONSTANT(SEEK_END, "GDSK_E", 10),
- CONSTANT(SEEK_PAD, "GDSK_P", 11),
+ CONSTANT(SEEK_WRITE, "GDSK_W", 11),
CONSTANT(MAX_LINE_LENGTH, "GD_MLL", 99),
CONSTANT(ALL_FRAGMENTS, "GD_ALL", 99),
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/configure.ac 2011-11-05 00:43:40 UTC (rev 610)
@@ -414,7 +414,7 @@
LIBS=$saved_libs
if test "x$have_ltdl" == "xno"; then
- AC_MSG_ERROR([libltdl is required to build modules. Please either specify the location of the libltdl library using --with-ldtl-prefix=PREFIX or else disable the building of modules by using --disable-modules.])
+ AC_MSG_ERROR([libltdl is required to build modules. Please either specify the location of the libltdl library using --with-ldtl=PREFIX or else disable the building of modules by using --disable-modules.])
fi
if test "x$ltdl_prefix" != "x"; then
@@ -660,7 +660,7 @@
echo
AC_CHECK_FUNCS([_chsize _chsize_s _commit fchmod _fdopen fdopendir fseeko \
fseeko64 _fstat fstat64 _fstat64 fstatat fstatat64 fsync \
- ftello ftello64 ftruncate ftruncate64 _getcwd getdelim \
+ ftello ftello64 ftruncate ftruncate64 getcwd _getcwd getdelim \
gmtime_r _lseeki64 lstat _mkdir nan _open openat _read \
renameat _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
_strtoui64 strtoull _unlink unlinkat _write])
@@ -784,8 +784,9 @@
fi
dnl external encodings
-GD_CHECK_ENCODING([bzip2],[bz2],[BZ2_bzReadOpen],[bzlib.h],[bzip2],[bunzip2])
-GD_CHECK_ENCODING([slim],[slim],[slimopen],[slimlib.h],[slim slimdata],[unslim],[])
+GD_CHECK_ENCODING([bzip2],[bz2],[BZ2_bzReadOpen],[bzlib.h],[bzip2],[bunzip2],[])
+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],[],[])
Modified: trunk/getdata/m4/encoding.m4
===================================================================
--- trunk/getdata/m4/encoding.m4 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/m4/encoding.m4 2011-11-05 00:43:40 UTC (rev 610)
@@ -54,9 +54,14 @@
if test "x$gd_encoding[]_prefix" != "x"; then
LDFLAGS="$LDFLAGS -L$gd_encoding[]_prefix/lib"
fi
- AC_CHECK_LIB([$2],[$3],[have_this_lib=yes]
+ AC_CHECK_LIB([$2],[$3],[have_this_lib=yes
+ LIBS="$LIBS -l$2"]
AC_DEFINE(AS_TR_CPP([HAVE_LIB$2]), 1,
[Define to 1 if you have the `$2' library (-l$2).]))
+
+ifelse(`x$7', `x',,[
+ AC_CHECK_FUNCS([$7])
+])
LDFLAGS=$saved_ldflags
LIBS=$saved_libs
@@ -106,7 +111,6 @@
AC_DEFINE_UNQUOTED(AS_TR_CPP(gd_unprogname), ["$path_]gd_unprogname["],
[ Define to the full path to the `]gd_unprogname[' binary ])
fi
-$7
])
AM_CONDITIONAL(AS_TR_CPP([USE_]gd_encoding), [test "x$use_]gd_encoding[" = "xyes"])
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/src/add.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -210,16 +210,11 @@
else if (E->EN(raw,data_type) & 0x40 || (E->e->u.raw.size =
GD_SIZE(E->EN(raw,data_type))) == 0)
_GD_SetError(D, GD_E_BAD_TYPE, entry->EN(raw,data_type), NULL, 0, NULL);
- else if (!_GD_Supports(D, E, GD_EF_TOUCH))
- ; /* error already set */
- else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0))
- ; /* error already set */
- else if ((*_gd_ef[E->e->u.raw.file[0].subenc].touch)(
- D->fragment[E->fragment_index].dirfd, E->e->u.raw.file,
- _GD_FileSwapBytes(D, E->fragment_index)))
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno,
- NULL);
- else if (D->fragment[E->fragment_index].ref_name == NULL) {
+ else if (_GD_InitRawIO(D, E, NULL, 0, NULL, 0,
+ GD_FILE_WRITE | GD_FILE_TOUCH, 0))
+ {
+ ;
+ } 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)
@@ -307,13 +302,13 @@
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)
- _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NUMBITS, NULL,
+ _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)
- _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITNUM, NULL,
+ _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITNUM, NULL,
entry->EN(bit,bitnum), NULL);
else if (E->EN(bit,bitnum) + E->EN(bit,numbits) - 1 > 63)
- _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITSIZE, NULL,
+ _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_BITSIZE, NULL,
E->EN(bit,bitnum) + E->EN(bit,numbits) - 1, NULL);
copy_scalar[0] = copy_scalar[1] = 1;
break;
@@ -565,7 +560,7 @@
"dirfile_madd_spec()", 0, D->standards, D->flags & GD_PERMISSIVE);
/* Directive parsing is skipped -- The Field Spec parser will add the field */
- if (!D->error)
+ if (!D->error)
_GD_ParseFieldSpec(D, n_cols, in_cols, E, "dirfile_madd_spec()", 0, me,
D->standards, 1, GD_PEDANTIC, 1, &outstring, tok_pos);
@@ -628,7 +623,7 @@
/* Directive parsing is skipped -- The Field Spec parser will add the field */
if (!D->error)
- _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_add_spec()", 0,
+ _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_add_spec()", 0,
fragment_index, D->standards, 1, GD_PEDANTIC, 1, &outstring, tok_pos);
free(outstring);
@@ -669,7 +664,7 @@
gd_entry_t R;
int error;
- dtrace("%p, \"%s\", %x, %i, %i", D, field_code, data_type, spf,
+ dtrace("%p, \"%s\", 0x%X, %i, %i", D, field_code, data_type, spf,
fragment_index);
if (D->flags & GD_INVALID) {/* don't crash */
@@ -1155,7 +1150,7 @@
gd_entry_t C;
int error;
- dtrace("%p, \"%s\", 0x%x, 0x%x, %p, %i", D, field_code, const_type, data_type,
+ dtrace("%p, \"%s\", 0x%X, 0x%X, %p, %i", D, field_code, const_type, data_type,
value, fragment_index);
if (D->flags & GD_INVALID) {/* don't crash */
@@ -1197,7 +1192,7 @@
gd_entry_t C;
int error;
- dtrace("%p, \"%s\", 0x%x, %zi, 0x%x, %p, %i", D, field_code, const_type,
+ dtrace("%p, \"%s\", 0x%X, %zi, 0x%X, %p, %i", D, field_code, const_type,
array_len, data_type, values, fragment_index);
if (D->flags & GD_INVALID) {
@@ -1723,7 +1718,7 @@
gd_entry_t *entry;
gd_entry_t C;
- dtrace("%p, \"%s\", \"%s\", 0x%x, 0x%x, %p", D, parent, field_code,
+ dtrace("%p, \"%s\", \"%s\", 0x%X, 0x%X, %p", D, parent, field_code,
const_type, data_type, value);
if (D->flags & GD_INVALID) {/* don't crash */
@@ -1774,7 +1769,7 @@
gd_entry_t *entry;
gd_entry_t C;
- dtrace("%p, \"%s\", \"%s\", 0x%x, %zi 0x%x, %p", D, parent, field_code,
+ dtrace("%p, \"%s\", \"%s\", 0x%X, %zi 0x%X, %p", D, parent, field_code,
const_type, array_len, data_type, values);
if (D->flags & GD_INVALID) {/* don't crash */
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/src/ascii.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -33,41 +33,49 @@
/* The ASCII encoding uses file->edata for the stream pointer */
-int _GD_AsciiOpen(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
- int mode, int creat)
+int _GD_AsciiOpen(int fd, int fd2 __gd_unused, struct _gd_raw_file* file,
+ int swap __gd_unused, unsigned int mode)
{
- int fd;
+ dtrace("%i, <unused>, %p, <unused>, %u", fd, file, mode);
- dtrace("%i, %p, <unused>, %i, %i", dirfd, file, mode, creat);
+ if (!(mode & GD_FILE_TEMP)) {
+ if (file->mode & mode) {
+ dreturn("%i", 0);
+ return 0;
+ } else if (file->edata != NULL)
+ fclose(file->edata);
- fd = gd_OpenAt(file->D, dirfd, file->name, ((mode == GD_RDWR) ? O_RDWR :
- O_RDONLY) | (creat ? O_CREAT : 0) | O_BINARY, 0666);
+ file->idata = gd_OpenAt(file->D, fd, file->name, ((mode & GD_FILE_WRITE)
+ ? (O_RDWR | O_CREAT) : O_RDONLY) | O_BINARY, 0666);
- if (fd < 0) {
- dreturn("%i", -1);
- return -1;
- }
+ if (file->idata < 0) {
+ dreturn("%i", -1);
+ return -1;
+ }
+ } else
+ file->idata = fd;
- file->edata = fdopen(fd, (mode == GD_RDWR) ? "r+" : "r");
+ file->edata = fdopen(file->idata, (mode & GD_FILE_WRITE) ? "r+" : "r");
if (file->edata == NULL) {
- close(fd);
+ close(file->idata);
+ file->idata = -1;
dreturn("%i", -1);
return -1;
}
+ file->mode = mode | GD_FILE_READ;
file->pos = 0;
- file->idata = 0;
dreturn("%i", 0);
return 0;
}
off64_t _GD_AsciiSeek(struct _gd_raw_file* file, off64_t count,
- gd_type_t data_type __gd_unused, int pad)
+ gd_type_t data_type __gd_unused, unsigned int mode)
{
char line[64];
- dtrace("%p, %lli, <unused>, %i", file, count, pad);
+ dtrace("%p, %lli, <unused>, 0x%X", file, count, mode);
if (count < file->pos) {
rewind((FILE *)file->edata);
@@ -78,7 +86,7 @@
if (fgets(line, 64, (FILE *)file->edata) == NULL)
break;
- if (pad && count > file->pos) {
+ if (mode & GD_FILE_WRITE && count > file->pos) {
strcpy(line, "0\n");
for (; count > file->pos; ++file->pos)
fputs(line, (FILE *)file->edata);
@@ -90,7 +98,7 @@
static void _GD_ScanFormat(char* fmt, gd_type_t data_type)
{
- dtrace("%p, %x", fmt, data_type);
+ dtrace("%p, 0x%X", fmt, data_type);
switch(data_type) {
case GD_UINT8:
@@ -151,7 +159,7 @@
short int i16;
#endif
- dtrace("%p, %p, 0x%x, %zu", file, ptr, data_type, nmemb);
+ dtrace("%p, %p, 0x%X, %zu", file, ptr, data_type, nmemb);
_GD_ScanFormat(fmt, data_type);
if (data_type & GD_COMPLEX) {
@@ -210,7 +218,7 @@
ssize_t ret = 0;
size_t n = 0;
- dtrace("%p, %p, 0x%x, %zu", file, ptr, data_type, nmemb);
+ dtrace("%p, %p, 0x%X, %zu", file, ptr, data_type, nmemb);
switch(data_type) {
case GD_UINT8:
@@ -348,14 +356,15 @@
dtrace("%p", file);
ret = fclose((FILE *)file->edata);
- if (ret != EOF) {
- file->idata = -1;
- dreturn("%i", 0);
- return 0;
+ if (ret == EOF) {
+ dreturn("%i", 1);
+ return 1;
}
- dreturn("%i", 1);
- return 1;
+ file->idata = -1;
+ file->mode = 0;
+ dreturn("%i", 0);
+ return 0;
}
off64_t _GD_AsciiSize(int dirfd, struct _gd_raw_file* file,
@@ -391,44 +400,3 @@
dreturn("%lli", n);
return n;
}
-
-int _GD_AsciiTOpen(int fd, struct _gd_raw_file *file, int swap __gd_unused)
-{
- dtrace("%i, %p, <unused>", fd, file);
-
- file->edata = fdopen(fd, "r+");
-
- if (file->edata == NULL) {
- dreturn("%i", -1);
- return -1;
- }
-
- file->pos = 0;
-
- dreturn("%i", 0);
- return 0;
-}
-
-int _GD_AsciiTUnlink(int dirfd, struct _gd_raw_file *file)
-{
- dtrace("%i, %p", dirfd, file);
-
- if (file->name != NULL) {
- if (file->pos >= 0)
- if (_GD_AsciiClose(file)) {
- dreturn("%i", -1);
- return -1;
- }
-
- if (gd_UnlinkAt(file->D, dirfd, file->name, 0)) {
- dreturn("%i", -1);
- return -1;
- }
-
- free(file[1].name);
- file[1].name = NULL;
- }
-
- dreturn("%i", 0);
- return 0;
-}
Modified: trunk/getdata/src/bzip.c
===================================================================
--- trunk/getdata/src/bzip.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/src/bzip.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -101,10 +101,10 @@
return ptr;
}
-int _GD_Bzip2Open(int dirfd, struct _gd_raw_file* file, int swap __gd_unused,
- int mode __gd_unused, int creat __gd_unused)
+int _GD_Bzip2Open(int dirfd, int fd2 __gd_unused, struct _gd_raw_file* file,
+ int swap __gd_unused, unsigned int mode __gd_unused)
{
- dtrace("%i, %p, <unused>, <unused>, <unused>", dirfd, file);
+ dtrace("%i, <unused>, %p, <unused>, <unused>", dirfd, file);
file->edata = _GD_Bzip2DoOpen(dirfd, file);
@@ -113,17 +113,18 @@
return 1;
}
+ file->mode = GD_FILE_READ;
file->idata = 0;
dreturn("%i", 0);
return 0;
}
off64_t _GD_Bzip2Seek(struct _gd_raw_file* file, off64_t count,
- gd_type_t data_type, int pad __gd_unused)
+ gd_type_t data_type, unsigned int mode __gd_unused)
{
struct gd_bzdata *ptr = (struct gd_bzdata *)file->edata;
- dtrace("%p, %lli, %x, <unused>", file, (long long)count, data_type);
+ dtrace("%p, %lli, 0x%X, <unused>", file, (long long)count, data_type);
count *= GD_SIZE(data_type);
@@ -179,7 +180,7 @@
struct gd_bzdata *ptr = (struct gd_bzdata *)file->edata;
unsigned long long nbytes = nmemb * GD_SIZE(data_type);
- dtrace("%p, %p, %x, %zu", file, data, data_type, nmemb);
+ dtrace("%p, %p, 0x%X, %zu", file, data, data_type, nmemb);
while (nbytes > (unsigned long long)(ptr->end - ptr->pos)) {
int n;
@@ -235,15 +236,16 @@
ptr->bzerror = 0;
BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile);
- if (!fclose(ptr->stream)) {
- file->idata = -1;
- free(file->edata);
- dreturn("%i", 0);
- return 0;
+ if (fclose(ptr->stream)) {
+ dreturn("%i", 1);
+ return 1;
}
- dreturn("%i", 1);
- return 1;
+ file->idata = -1;
+ file->mode = 0;
+ free(file->edata);
+ dreturn("%i", 0);
+ return 0;
}
off64_t _GD_Bzip2Size(int dirfd, struct _gd_raw_file *file, gd_type_t data_type,
@@ -252,7 +254,7 @@
struct gd_bzdata *ptr;
off_t n;
- dtrace("%i, %p, %x, <unused>", dirfd, file, data_type);
+ dtrace("%i, %p, 0x%X, <unused>", dirfd, file, data_type);
ptr = _GD_Bzip2DoOpen(dirfd, file);
Modified: trunk/getdata/src/close.c
===================================================================
--- trunk/getdata/src/close.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/src/close.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -33,7 +33,7 @@
dtrace("%p", D);
- for (i = 0; i < D->n_entries; ++i)
+ for (i = 0; i < D->n_entries; ++i)
_GD_FreeE(D, D->entry[i], 1);
for (j = 0; j < D->n_fragment; ++j) {
@@ -86,7 +86,7 @@
for(i = 0; i < D->n_entries; ++i)
if (D->entry[i]->field_type == GD_RAW_ENTRY)
- _GD_Flush(D, D->entry[i]);
+ _GD_Flush(D, D->entry[i], 1);
if (D->error) {
dreturn("%i", 1);
Modified: trunk/getdata/src/del.c
===================================================================
--- trunk/getdata/src/del.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/src/del.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -201,7 +201,7 @@
gd_entry_t *reference = NULL, *E;
gd_entry_t **del_list;
- dtrace("%p, \"%s\", %x", D, field_code_in, flags);
+ 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);
@@ -340,9 +340,8 @@
dreturn("%i", -1);
return -1;
}
- } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->idata != -1) {
- if ((*_gd_ef[E->e->u.raw.file[0].subenc].close)(E->e->u.raw.file)) {
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL);
+ } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->idata >= 0) {
+ if (_GD_FiniRawIO(D, E, E->fragment_index, GD_FINIRAW_DISCARD)) {
free(del_list);
dreturn("%i", -1);
return -1;
@@ -450,7 +449,7 @@
struct _gd_private_entry *Pe = E->e->p.parent->e;
/* search and destroy */
- for (i = 0; i < Pe->n_meta; ++i)
+ for (i = 0; i < Pe->n_meta; ++i)
if (Pe->p.meta_entry[i] == E) {
Pe->p.meta_entry[i] = Pe->p.meta_entry[Pe->n_meta - 1];
break;
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-10-20 22:53:01 UTC (rev 609)
+++ trunk/getdata/src/encoding.c 2011-11-05 00:43:40 UTC (rev 610)
@@ -44,7 +44,7 @@
/* encoding schemas */
#define GD_EF_NULL_SET NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
- &_GD_GenericMove, &_GD_GenericUnlink, NULL, &_GD_GenericTMove, 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 }
@@ -52,25 +52,24 @@
#define GD_EXT_ENCODING(sc,ex,ec,af,ff) { sc,ex,ec,af,ff,0,GD_INT_FUNCS }
#endif
struct encoding_t _gd_ef[GD_N_SUBENCODINGS] = {
- { GD_UNENCODED, "", 1, NULL, "none", 0,
- &_GD_RawOpen, &_GD_RawClose, &_GD_GenericTouch, &_GD_RawSeek, &_GD_RawRead,
- &_GD_RawSize, &_GD_RawWrite, &_GD_RawSync, &_GD_GenericMove,
- &_GD_GenericUnlink, &_GD_RawTOpen, &_GD_GenericTMove, &_GD_RawTUnlink
+ { 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
},
#ifdef USE_GZIP
#define GD_EF_PROVIDES \
- GD_EF_OPEN | GD_EF_CLOSE | GD_EF_SEEK | GD_EF_READ | GD_EF_SIZE
+ 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, NULL /* TOUCH */, &_GD_GzipSeek, \
- &_GD_GzipRead, &_GD_GzipSize, NULL /* WRITE */, NULL /* SYNC */, \
- &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
- NULL /* TUNLINK */
+ &_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
#endif
- GD_EXT_ENCODING(GD_GZIP_ENCODED, ".gz", 1, "Gzip", "gzip"),
+ GD_EXT_ENCODING(GD_GZIP_ENCODED, ".gz", GD_EF_ECOR | GD_EF_OOP, "Gzip",
+ "gzip"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -79,15 +78,14 @@
#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, NULL /* TOUCH */, &_GD_Bzip2Seek, \
- &_GD_Bzip2Read, &_GD_Bzip2Size, NULL /* WRITE */, NULL /* SYNC */, \
- &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
- NULL /* TUNLINK */
+ &_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
#endif
- GD_EXT_ENCODING(GD_BZIP2_ENCODED, ".bz2", 1, "Bzip2", "bzip2"),
+ GD_EXT_ENCODING(GD_BZIP2_ENCODED, ".bz2", GD_EF_ECOR, "Bzip2", "bzip2"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -96,15 +94,13 @@
#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, NULL /* TOUCH */, &_GD_SlimSeek, \
- &_GD_SlimRead, &_GD_SlimSize, NULL /* WRITE */, NULL /* SYNC */, \
- &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
- NULL /* TUNLINK */
+ &_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
#endif
- GD_EXT_ENCODING(GD_SLIM_ENCODED, ".slm", 1, "Slim", "slim"),
+ GD_EXT_ENCODING(GD_SLIM_ENCODED, ".slm", GD_EF_ECOR, "Slim", "slim"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
@@ -113,34 +109,32 @@
#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, NULL /* TOUCH */, &_GD_LzmaSeek, \
- &_GD_LzmaRead, &_GD_LzmaSize, NULL /* WRITE */, NULL /* SYNC */, \
- &_GD_GenericMove, &_GD_GenericUnlink, NULL /* TOPEN */, &_GD_GenericTMove, \
- NULL /* TUNLINK */
+ &_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
#endif
- GD_EXT_ENCODING(GD_LZMA_ENCODED, ".xz", 1, "Lzma", "lzma"),
- GD_EXT_ENCODING(GD_LZMA_ENCODED, ".lzma", 1, "Lzma", "lzma"),
+ GD_EXT_ENCODING(GD_LZMA_ENCODED, ".xz", GD_EF_ECOR, "Lzma", "lzma"),
+ GD_EXT_ENCODING(GD_LZMA_ENCODED, ".lzma", GD_EF_ECOR, "Lzma", "lzma"),
#undef GD_INT_FUNCS
#undef GD_EF_PROVIDES
{ GD_TEXT_ENCODED, ".txt", 0, NULL, "text", 0,
- &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_GenericTouch, &_GD_AsciiSeek,
- &_GD_AsciiRead, &_GD_AsciiSize, &_GD_AsciiWrite, &_GD_AsciiSync,
- &_GD_GenericMove, &_GD_GenericUnlink, &_GD_AsciiTOpen, &_GD_GenericTMove,
- &_GD_AsciiTUnlink },
+ &_GD_AsciiOpen, &_GD_AsciiClose, &_GD_AsciiSeek, &_GD_AsciiRead,
+ &_GD_AsciiSize, &_GD_AsciiWrite, &_GD_AsciiSync, &_GD_GenericMove,
+ &_GD_GenericUnlink
+ },
- { GD_SIE_ENCODED, ".sie", 0, NULL, "sie", 0,
- &_GD_SampIndOpen, &_GD_SampIndClose, &_GD_GenericTouch, &_GD_SampIndSeek,
- &_GD_SampIndRead, &_GD_SampIndSize, &_GD_SampIndWrite, &_GD_SampIndSync,
- &_GD_GenericMove, &_GD_GenericUnlink, &_GD_SampIndTOpen, &_GD_GenericTMove,
- &_GD_SampIndTUnlink },
+ { 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_ENC_UNSUPPORTED, "", 0, "", "", 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
},
};
@@ -190,7 +184,7 @@
{
int ret;
- dtrace("%i, %x", encoding, funcs);
+ dtrace("%i, 0x%X", encoding, funcs);
#ifdef USE_MODULES
#ifdef USE_PTHREAD
@@ -242,9 +236,6 @@
_gd_ef[encoding].close =
(int (*)(struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding,
"Close");
- if (_gd_ef[encoding].provides & GD_EF_TOUCH)
- _gd_ef[encoding].touch = (int (*)(int, struct _gd_raw_file*))
- _GD_ResolveSymbol(lib, _gd_ef + encoding, "Touch");
if (_gd_ef[encoding].provides & GD_EF_SEEK)
_gd_ef[encoding].seek = (off64_t (*)(struct _gd_raw_file*, off64_t,
gd_type_t, int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Seek");
@@ -270,9 +261,6 @@
if (_gd_ef[encoding].provides & GD_EF_TEMP)
_gd_ef[encoding].temp = (int (*)(int, int, struct _gd_raw_file*, int,
int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Temp");
- if (_gd_ef[encoding].provides & GD_EF_TOPEN)
- _gd_ef[encoding].topen = (gd_ef_topen_t)_GD_ResolveSymbol(lib,
- _gd_ef + encoding, "TOpen");
/* we tried our best, don't bother trying again */
_gd_ef[encoding].provides = 0;
@@ -285,49 +273,208 @@
ret =
(funcs & GD_EF_OPEN && _gd_ef[encoding].open == NULL) ||
(funcs & GD_EF_CLOSE && _gd_ef[encoding].close == NULL) ||
- (funcs & GD_EF_TOUCH && _gd_ef[encoding].touch == NULL) ||
(funcs & GD...
[truncated message content] |
|
From: <ket...@us...> - 2011-11-05 22:52:07
|
Revision: 612
http://getdata.svn.sourceforge.net/getdata/?rev=612&view=rev
Author: ketiltrout
Date: 2011-11-05 22:52:00 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
Cygwin.
Modified Paths:
--------------
trunk/getdata/configure.ac
trunk/getdata/src/internal.h
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-11-05 00:53:18 UTC (rev 611)
+++ trunk/getdata/configure.ac 2011-11-05 22:52:00 UTC (rev 612)
@@ -661,9 +661,9 @@
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 _lseeki64 lstat _mkdir nan _open openat _read \
- renameat _rmdir _snprintf stat64 _stat64 _strtoi64 strtoll \
- _strtoui64 strtoull _unlink unlinkat _write])
+ gmtime_r lseek64 _lseeki64 lstat _mkdir nan _open openat _read \
+ 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/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-11-05 00:53:18 UTC (rev 611)
+++ trunk/getdata/src/internal.h 2011-11-05 22:52:00 UTC (rev 612)
@@ -49,6 +49,9 @@
typedef int mode_t;
#endif
+#ifndef HAVE_OFF64_T
+typedef off_t off64_t;
+#endif
#ifdef _MSC_VER
/* missing in sys/stat.h */
@@ -61,10 +64,6 @@
#define GD_NO_DIR_OPEN
#endif
-#ifdef __APPLE__
-typedef off_t off64_t;
-#endif
-
#ifdef GD_NO_C99_API
# define GD_DCOMPLEXP_t double *
# define GD_DCOMPLEXA(v) double v[2]
@@ -225,8 +224,10 @@
# define gd_getcwd getcwd
#endif
-#ifdef HAVE__SNPRINTF
-# define snprintf _snprintf
+#ifndef HAVE_SNPRINTF
+# ifdef HAVE__SNPRINTF
+# define snprintf _snprintf
+# endif
#endif
#ifndef HAVE_FTELLO64
@@ -270,8 +271,12 @@
struct tm *gmtime_r(const time_t *timep, struct tm *result);
#endif
-#ifdef HAVE__LSEEKI64
-#define lseek64 (off64_t)_lseeki64
+#ifndef HAVE_LSEEK64
+# ifdef HAVE__LSEEKI64
+# define lseek64 (off64_t)_lseeki64
+# else
+# define lseek64 (off64_t)lseek
+# endif
#endif
#ifdef MKDIR_NO_MODE
@@ -624,14 +629,6 @@
#define BUFFER_SIZE 9000000
-#ifndef HAVE_OFF64_T
-# ifndef __APPLE__
-typedef off_t off64_t;
-# endif
-# define lseek64 lseek
-# define stat64 stat
-#endif
-
/* helper macro */
#if defined ARM_ENDIAN_FLOATS || \
((defined WORDS_BIGENDIAN) ^ (defined FLOATS_BIGENDIAN))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-11-06 08:40:00
|
Revision: 613
http://getdata.svn.sourceforge.net/getdata/?rev=613&view=rev
Author: ketiltrout
Date: 2011-11-06 08:39:54 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
MSVCRT fixes.
Modified Paths:
--------------
trunk/getdata/src/ascii.c
trunk/getdata/src/entry.c
trunk/getdata/src/sie.c
trunk/getdata/test/gzip_get_put.c
trunk/getdata/test/seek64.c
trunk/getdata/test/tell64.c
Modified: trunk/getdata/src/ascii.c
===================================================================
--- trunk/getdata/src/ascii.c 2011-11-05 22:52:00 UTC (rev 612)
+++ trunk/getdata/src/ascii.c 2011-11-06 08:39:54 UTC (rev 613)
@@ -342,8 +342,10 @@
ret = fflush((FILE *)file->edata);
+#ifndef __MSVCRT__
if (!ret)
ret = fsync(fileno((FILE *)file->edata));
+#endif
dreturn("%i", ret);
return ret;
Modified: trunk/getdata/src/entry.c
===================================================================
--- trunk/getdata/src/entry.c 2011-11-05 22:52:00 UTC (rev 612)
+++ trunk/getdata/src/entry.c 2011-11-06 08:39:54 UTC (rev 613)
@@ -318,13 +318,13 @@
}
}
- filename = _GD_MakeFullPath(D, D->fragment[E->fragment_index].dirfd,
- E->e->u.raw.file->name);
+ filename = malloc(strlen(D->name) + strlen(E->e->u.raw.file->name) + 2);
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/sie.c
===================================================================
--- trunk/getdata/src/sie.c 2011-11-05 22:52:00 UTC (rev 612)
+++ trunk/getdata/src/sie.c 2011-11-06 08:39:54 UTC (rev 613)
@@ -123,24 +123,16 @@
if (f->swap)
f->d[0] = gd_swap64(f->d[0]);
- if (ferror(f->fp)) {
- dreturn("%i", -2);
- return -2;
- } else if (n != 1) {
- /* ignore short reads, resulting from corrupted files .. go back to
- * the last good record */
- fseek(f->fp, -n, SEEK_CUR);
- /* and restore it */
- memcpy(f->d, p, 3 * sizeof(int64_t));
- f->s = f->d[0];
- f->p = f->d[0] + 1;
- dreturn("%i", -1);
- return -1;
- } else if (feof(f->fp)) {
- f->s = f->d[0];
- f->p = f->d[0] + 1;
- dreturn("%i", -1);
- return -1;
+ if (n != 1) {
+ if (ferror(f->fp)) {
+ dreturn("%i", -2);
+ return -2;
+ } else {
+ f->s = f->d[0];
+ f->p = f->d[0] + 1;
+ dreturn("%i", -1);
+ return -1;
+ }
}
f->s = f->p = p[0] + 1;
@@ -190,11 +182,14 @@
/* back up and update the file */
fseek(f->fp, -size, SEEK_CUR);
fwrite(f->d, size, 1, f->fp);
+ /* The MSVCRT's stdio seems to screw up without the following: */
+ fflush(f->fp);
} else {
/* add a new record */
f->d[0] = sample;
f->d[1] = f->d[2] = 0;
fwrite(f->d, size, 1, f->fp);
+ fflush(f->fp);
}
f->s = sample;
}
Modified: trunk/getdata/test/gzip_get_put.c
===================================================================
--- trunk/getdata/test/gzip_get_put.c 2011-11-05 22:52:00 UTC (rev 612)
+++ trunk/getdata/test/gzip_get_put.c 2011-11-06 08:39:54 UTC (rev 613)
@@ -96,7 +96,7 @@
write(fd, format_data, strlen(format_data));
close(fd);
- fd = open(data_gz, O_CREAT | O_EXCL | O_WRONLY, 0666);
+ fd = open(data_gz, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
write(fd, gzdata, 279);
close(fd);
Modified: trunk/getdata/test/seek64.c
===================================================================
--- trunk/getdata/test/seek64.c 2011-11-05 22:52:00 UTC (rev 612)
+++ trunk/getdata/test/seek64.c 2011-11-06 08:39:54 UTC (rev 613)
@@ -19,6 +19,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* gd_seek() */
+#define _LARGEFILE64_SOURCE 1
+
#include "test.h"
#include <stdlib.h>
Modified: trunk/getdata/test/tell64.c
===================================================================
--- trunk/getdata/test/tell64.c 2011-11-05 22:52:00 UTC (rev 612)
+++ trunk/getdata/test/tell64.c 2011-11-06 08:39:54 UTC (rev 613)
@@ -19,6 +19,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* gd_tell() */
+#define _LARGEFILE64_SOURCE 1
+
#include "test.h"
#include <stdlib.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-11-08 04:56:13
|
Revision: 614
http://getdata.svn.sourceforge.net/getdata/?rev=614&view=rev
Author: ketiltrout
Date: 2011-11-08 04:56:06 +0000 (Tue, 08 Nov 2011)
Log Message:
-----------
* Fix gzip tests for TEST_GZIP && !USE_GZIP.
* Fix descriptor leak in sie.c.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/encoding.c
trunk/getdata/src/sie.c
trunk/getdata/test/gzip_add.c
trunk/getdata/test/gzip_get_put.c
trunk/getdata/test/gzip_move_to.c
trunk/getdata/test/gzip_put.c
trunk/getdata/test/gzip_put_get.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/ChangeLog 2011-11-08 04:56:06 UTC (rev 614)
@@ -1,3 +1,11 @@
+2011-11-08 D. V. Wiebe <ge...@ke...> svn:614
+ * test/gzip_put_get.c test/gzip_move_to.c test/gzip_add.c
+ test/gzip_get_put.c test/gzip_put.c: Handle TEST_GZIP && !USE_GZIP.
+
+ * src/encoding.c (_GD_FiniRawIO): Don't change error code if already set.
+
+ * src/sie.c (_GD_SampIndSize): Fix descriptor leak.
+
2011-11-05 D. V. Wiebe <ge...@ke...> svn:610
* test/gzip_put_get.c test/ascii_add.c test/get_rofs.c test/gzip_move_to.c
test/gzip_add.c test/endian_alter_sie.c test/gzip_get_put.c: Added.
Modified: trunk/getdata/src/encoding.c
===================================================================
--- trunk/getdata/src/encoding.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/src/encoding.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -331,8 +331,9 @@
if ((*_gd_ef[E->e->u.raw.file[clotemp].subenc].close)(E->e->u.raw.file +
clotemp))
{
- _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[clotemp].name, errno,
- NULL);
+ if (D->error == GD_E_OK)
+ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[clotemp].name, errno,
+ NULL);
dreturn("%i", 1);
return 1;
}
@@ -352,7 +353,8 @@
if (gd_UnlinkAt(D, D->fragment[fragment].dirfd, 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);
+ if (D->error == GD_E_OK)
+ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL);
dreturn("%i", -1);
return -1;
}
Modified: trunk/getdata/src/sie.c
===================================================================
--- trunk/getdata/src/sie.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/src/sie.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -503,6 +503,8 @@
if (swap)
n = gd_swap64(n);
+ fclose(f.fp);
+
dreturn("%llx", (long long unsigned)n);
return (off64_t)n;
}
Modified: trunk/getdata/test/gzip_add.c
===================================================================
--- trunk/getdata/test/gzip_add.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/test/gzip_add.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -38,36 +38,47 @@
const char *format = "dirfile/format";
const char *data = "dirfile/data.gz";
gd_entry_t e;
- int error, r = 0;
+ int e1, e2, unlink_data, r = 0;
DIRFILE *D;
rmdirfile();
+#ifdef USE_GZIP
D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE | GD_GZIP_ENCODED);
+#else
+ D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_GZIP_ENCODED);
+#endif
gd_add_raw(D, "data", GD_UINT8, 2, 0);
- error = gd_error(D);
+ e1 = gd_error(D);
/* check */
- gd_entry(D, "data", &e);
- if (gd_error(D))
- r = 1;
- else {
+ e2 = gd_entry(D, "data", &e);
+#ifdef USE_GZIP
+ CHECKI(e2, 0);
+ if (e2 == 0) {
CHECKI(e.field_type, GD_RAW_ENTRY);
CHECKI(e.fragment_index, 0);
CHECKI(e.EN(raw,spf), 2);
CHECKI(e.EN(raw,data_type), GD_UINT8);
gd_free_entry_strings(&e);
}
+#else
+ CHECKI(e2, -1);
+#endif
gd_close(D);
+ unlink_data = unlink(data);
- if (unlink(data)) {
- perror("unlink");
- r = 1;
- }
+#ifdef USE_GZIP
+ CHECKI(unlink_data, 0);
+ CHECKI(e1, GD_E_OK);
+#else
+ CHECKI(unlink_data, -1);
+ CHECKI(e1, GD_E_UNSUPPORTED);
+#endif
+
unlink(format);
rmdir(filedir);
- CHECKI(error, GD_E_OK);
return r;
#endif
}
Modified: trunk/getdata/test/gzip_get_put.c
===================================================================
--- trunk/getdata/test/gzip_get_put.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/test/gzip_get_put.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -82,7 +82,7 @@
};
uint8_t b, c[8], d[8];
char command[4096];
- int fd, i, m, n, e1, e2, r = 0;
+ int fd, i, m, n, e1, e2, unlink_data, unlink_datagz, r = 0;
DIRFILE *D;
memset(c, 0, 8);
@@ -100,7 +100,11 @@
write(fd, gzdata, 279);
close(fd);
+#ifdef USE_GZIP
D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
+#else
+ D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED);
+#endif
n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
e1 = gd_error(D);
m = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, d);
@@ -108,6 +112,7 @@
gd_close(D);
+#ifdef USE_GZIP
/* uncompress */
snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data);
if (gd_system(command)) {
@@ -130,15 +135,28 @@
for (i = 0; i < 8; ++i)
CHECKIi(i, c[i], 40 + i);
+#endif
- unlink(data);
+ unlink_data = unlink(data);
+ unlink_datagz = unlink(data_gz);
unlink(format);
rmdir(filedir);
+#ifdef USE_GZIP
+ CHECKI(unlink_data, 0);
+ CHECKI(unlink_datagz, -1);
CHECKI(e1, GD_E_OK);
CHECKI(e2, GD_E_OK);
CHECKI(n, 8);
CHECKI(m, 8);
+#else
+ CHECKI(unlink_data, -1);
+ CHECKI(unlink_datagz, 0);
+ CHECKI(e1, GD_E_UNSUPPORTED);
+ CHECKI(e2, GD_E_UNSUPPORTED);
+ CHECKI(n, 0);
+ CHECKI(m, 0);
+#endif
return r;
#endif
Modified: trunk/getdata/test/gzip_move_to.c
===================================================================
--- trunk/getdata/test/gzip_move_to.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/test/gzip_move_to.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -33,10 +33,14 @@
const char *data_gz = "dirfile/data.gz";
const char *data_raw = "dirfile/data";
const char *format_data = "data RAW UINT8 8\n/ENCODING none\n/ENDIAN little\n";
- uint8_t data_in[256], d;
+ uint8_t data_in[256];
DIRFILE *D;
+#ifdef USE_GZIP
+ uint8_t d;
char command[4096];
- int fd, i, error, r = 0;
+ int i;
+#endif
+ int fd, error, unlink_raw, unlink_gz, r = 0;
struct stat buf;
rmdirfile();
@@ -53,18 +57,31 @@
write(fd, data_in, 256);
close(fd);
+#ifdef USE_GZIP
D = gd_open(filedir, GD_RDWR | GD_VERBOSE);
+#else
+ D = gd_open(filedir, GD_RDWR);
+#endif
gd_alter_encoding(D, GD_GZIP_ENCODED, 0, 1);
error = gd_error(D);
gd_close(D);
+#ifdef USE_GZIP
if (stat(data_gz, &buf)) {
perror("stat");
r = 1;
}
CHECKI(stat(data_raw, &buf), -1);
+#else
+ if (stat(data_raw, &buf)) {
+ perror("stat");
+ r = 1;
+ }
+ CHECKI(stat(data_gz, &buf), -1);
+#endif
+#ifdef USE_GZIP
/* uncompress */
snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data_gz);
if (gd_system(command)) {
@@ -81,12 +98,22 @@
close(fd);
}
}
+#endif
- unlink(data_raw);
+ unlink_raw = unlink(data_raw);
+ unlink_gz = unlink(data_gz);
unlink(format);
rmdir(filedir);
- CHECKI(error, 0);
+#ifdef USE_GZIP
+ CHECKI(unlink_raw, -1);
+ CHECKI(unlink_gz, 0);
+ CHECKI(error, GD_E_OK);
+#else
+ CHECKI(unlink_raw, 0);
+ CHECKI(unlink_gz, -1);
+ CHECKI(error, GD_E_UNSUPPORTED);
+#endif
return r;
}
Modified: trunk/getdata/test/gzip_put.c
===================================================================
--- trunk/getdata/test/gzip_put.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/test/gzip_put.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -43,10 +43,13 @@
const char *data_gz = "dirfile/data.gz";
const char *data = "dirfile/data";
const char *format_data = "data RAW UINT8 8\n";
- uint8_t c[8], d;
+ uint8_t c[8];
+#ifdef USE_GZIP
char command[4096];
+ uint8_t d;
+#endif
struct stat buf;
- int fd, i, n, error, r = 0;
+ int fd, i, n, error, stat_data, unlink_data, unlink_datagz, r = 0;
DIRFILE *D;
memset(c, 0, 8);
@@ -60,17 +63,27 @@
write(fd, format_data, strlen(format_data));
close(fd);
+#ifdef USE_GZIP
D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
+#else
+ D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED);
+#endif
n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
error = gd_error(D);
gd_close(D);
- if (stat(data_gz, &buf)) {
+ stat_data = stat(data_gz, &buf);
+#ifdef USE_GZIP
+ if (stat_data) {
perror("stat");
- r = 1;
}
+ CHECKI(stat_data, 0);
+#else
+ CHECKI(stat_data, -1);
+#endif
+#ifdef USE_GZIP
/* uncompress */
snprintf(command, 4096, "%s -f %s > /dev/null", GUNZIP, data);
if (gd_system(command)) {
@@ -90,13 +103,24 @@
close(fd);
}
}
+#endif
- unlink(data);
+ unlink_datagz = unlink(data_gz);
+ unlink_data = unlink(data);
unlink(format);
rmdir(filedir);
+#ifdef USE_GZIP
+ CHECKI(unlink_datagz, 0);
+ CHECKI(unlink_data, -1);
CHECKI(error, GD_E_OK);
CHECKI(n, 8);
+#else
+ CHECKI(unlink_datagz, -1);
+ CHECKI(unlink_data, -1);
+ CHECKI(error, GD_E_UNSUPPORTED);
+ CHECKI(n, 0);
+#endif
return r;
#endif
Modified: trunk/getdata/test/gzip_put_get.c
===================================================================
--- trunk/getdata/test/gzip_put_get.c 2011-11-06 08:39:54 UTC (rev 613)
+++ trunk/getdata/test/gzip_put_get.c 2011-11-08 04:56:06 UTC (rev 614)
@@ -43,7 +43,7 @@
const char *data = "dirfile/data.gz";
const char *format_data = "data RAW UINT8 8\n";
uint8_t c[8], d[8];
- int fd, i, m, n, e1, e2, r = 0;
+ int fd, i, m, n, e1, e2, unlink_data, r = 0;
DIRFILE *D;
memset(c, 0, 8);
@@ -57,7 +57,11 @@
write(fd, format_data, strlen(format_data));
close(fd);
+#ifdef USE_GZIP
D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED | GD_VERBOSE);
+#else
+ D = gd_open(filedir, GD_RDWR | GD_GZIP_ENCODED);
+#endif
n = gd_putdata(D, "data", 5, 0, 1, 0, GD_UINT8, c);
e1 = gd_error(D);
m = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, d);
@@ -65,14 +69,23 @@
gd_close(D);
- unlink(data);
+ unlink_data = unlink(data);
unlink(format);
rmdir(filedir);
+#ifdef USE_GZIP
+ CHECKI(unlink_data, 0);
CHECKI(e1, GD_E_OK);
CHECKI(e2, GD_E_OK);
CHECKI(n, 8);
CHECKI(m, 8);
+#else
+ CHECKI(unlink_data, -1);
+ CHECKI(e1, GD_E_UNSUPPORTED);
+ CHECKI(e2, GD_E_UNSUPPORTED);
+ CHECKI(n, 0);
+ CHECKI(m, 0);
+#endif
for (i = 0; i < m; ++i)
CHECKIi(i, d[i], c[i]);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-11-08 21:21:13
|
Revision: 615
http://getdata.svn.sourceforge.net/getdata/?rev=615&view=rev
Author: ketiltrout
Date: 2011-11-08 21:21:05 +0000 (Tue, 08 Nov 2011)
Log Message:
-----------
Copy scalar_ind elements passed to gd_add. Patch from S. J. Benton. Also test
for same.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/src/add.c
trunk/getdata/test/Makefile.am
Added Paths:
-----------
trunk/getdata/test/add_scalar_carray.c
Property Changed:
----------------
trunk/getdata/test/
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-11-08 04:56:06 UTC (rev 614)
+++ trunk/getdata/ChangeLog 2011-11-08 21:21:05 UTC (rev 615)
@@ -1,3 +1,9 @@
+2011-11-08 D. V. Wiebe <ge...@ke...> svn:615
+ * test/add_scalar_carray.c: Added.
+
+ * src/add.c (_GD_Add): Copy scalar_ind when copying scalars. Patch from
+ S. J. Benton.
+
2011-11-08 D. V. Wiebe <ge...@ke...> svn:614
* test/gzip_put_get.c test/gzip_move_to.c test/gzip_add.c
test/gzip_get_put.c test/gzip_put.c: Handle TEST_GZIP && !USE_GZIP.
Modified: trunk/getdata/src/add.c
===================================================================
--- trunk/getdata/src/add.c 2011-11-08 04:56:06 UTC (rev 614)
+++ trunk/getdata/src/add.c 2011-11-08 21:21:05 UTC (rev 615)
@@ -408,6 +408,7 @@
E->scalar[i] = NULL;
else {
E->scalar[i] = strdup(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);
}
Property changes on: trunk/getdata/test
___________________________________________________________________
Modified: svn:ignore
- Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
convert_uint8_int8
convert_uint8_uint16
convert_uint8_int16
convert_uint8_uint32
convert_uint8_int32
convert_uint8_float32
convert_uint8_uint64
convert_uint8_int64
convert_uint8_float64
convert_int8_uint8
convert_int8_uint16
convert_int8_int16
convert_int8_uint32
convert_int8_int32
convert_int8_float32
convert_int8_uint64
convert_int8_int64
convert_int8_float64
convert_uint16_uint8
convert_uint16_int8
convert_uint16_int16
convert_uint16_uint32
convert_uint16_int32
convert_uint16_float32
convert_uint16_uint64
convert_uint16_int64
convert_uint16_float64
convert_int16_uint8
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_int32
convert_int16_float32
convert_int16_uint64
convert_int16_int64
convert_int16_float64
convert_uint32_uint8
convert_uint32_int8
convert_uint32_uint16
convert_uint32_int16
convert_uint32_int32
convert_uint32_float32
convert_uint32_uint64
convert_uint32_int64
convert_uint32_float64
convert_int32_uint8
convert_int32_int8
convert_int32_uint16
convert_int32_int16
convert_int32_uint32
convert_int32_float32
convert_int32_uint64
convert_int32_int64
convert_int32_float64
convert_uint64_uint8
convert_uint64_int8
convert_uint64_uint16
convert_uint64_int16
convert_uint64_uint32
convert_uint64_int32
convert_uint64_float32
convert_uint64_int64
convert_uint64_float64
convert_int64_uint8
convert_int64_int8
convert_int64_uint16
convert_int64_int16
convert_int64_uint32
convert_int64_int32
convert_int64_float32
convert_int64_uint64
convert_int64_float64
convert_float32_uint8
convert_float32_int8
convert_float32_uint16
convert_float32_int16
convert_float32_uint32
convert_float32_int32
convert_float32_uint64
convert_float32_int64
convert_float32_float64
convert_float64_uint8
convert_float64_int8
convert_float64_uint16
convert_float64_int16
convert_float64_uint32
convert_float64_int32
convert_float64_float32
convert_float64_uint64
convert_float64_int64
creat
creat_excl
creat_rdonly
flist
flist_invalid
get64
get_bad_code
get_bit
get_char
get_endian8
get_endian16
get_endian32
get_endian64
get_endian_float32_big
get_endian_float32_arm
get_endian_float32_little
get_endian_float64_big
get_endian_float64_arm
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_int8
get_int16
get_int32
get_int64
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_linterp
get_linterp_noin
get_linterp_notab
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_recurse
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
legacy_get
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
nfields
nfields_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
open
open_eaccess
open_nonexistent
open_notdirfile
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_endian_bad
parse_endian_big
parse_endian_force
parse_endian_little
parse_foffs
parse_include
parse_include_nonexistent
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_linterp
parse_linterp_ncols
parse_multiply
parse_multiply_ncols
parse_ncols
parse_phase
parse_phase_ncols
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_spf
parse_raw_type
parse_version
parse_version_include
put64
put_bad_code
put_bit
put_bof
put_char
put_endian8
put_endian16
put_endian32
put_endian64
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_int8
put_int16
put_int32
put_int64
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_notab
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_rdonly
put_recurse
put_rofs
put_sf
put_ss
put_type
put_uint16
put_uint32
put_uint64
spf
spf_lincom
spf_multiply
spf_recurse
trunc
trunc_rdonly
trunc_rofs
flush_invalid
parse_version_slash
flush_all
flush
close_null
close
parse_endian_slash
error_error
parse_name
parse_include_slash
close_bad
parse_foffs_slash
flush_bad_code
dfes_bit
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_zero
entry_bad_code
entry_bit
entry_invalid
entry_lincom
entry_linterp
entry_multiply
entry_phase
entry_raw
legacy_get_put
legacy_get_rofs
add_phase
add_lincom_nfields
add_raw
add_multiply
add_bit_bitsize
flush_meta
add_type
add_raw_type
add_bit_bitnum
add_bit
add_format
add_raw_spf
put_linterp_noin
error_short
error
add
add_linterp
nfragments
add_duplicate
add_code
add_bit_numbits
add_lincom
add_rdonly
ascii_get
ascii_put
ascii_nframes
slim_get
slim_nframes
slim_put
add_many
add_sort
nfields_type
nfields_type_invalid
nmeta
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_invalid
nmeta_vectors_parent
nvectors
nvectors_invalid
parse_const
parse_const_ncols
parse_duplicate
parse_meta
parse_meta_parent
parse_meta_raw
parse_quote
parse_sort
parse_string
parse_string_ncols
parse_whitespace
madd_linterp_invalid
madd_lincom_invalid
vlist_invalid
vlist_meta
add_raw_invalid
cvlist_invalid
svlist_invalid
cvlist
svlist
madd_phase_invalid
add_invalid
madd_phase
add_phase_invalid
add_spec_directive
add_string
add_linterp_invalid
madd_multiply
flist_type_invalid
clist
cvlist_meta_invalid
flist_meta_invalid
flist_type
svlist_meta_invalid
cvlist_meta
vlist_meta_invalid
svlist_meta
parse_string_null
madd_linterp
madd_lincom
vlist
add_bit_invalid
add_lincom_invalid
madd_bit_invalid
madd_bit
add_multiply_invalid
add_const
madd_multiply_invalid
madd
add_spec_invalid
flist_type_meta_invalid
add_spec
flist_type_meta
flist_meta
parse_meta_index
entry_raw_scalar_code
parse_bit_scalar
entry_raw_scalar_type
entry_lincom_scalar
entry_phase_scalar
entry_raw_scalar
parse_lincom_scalar
entry_bit_scalar
parse_raw_scalar
parse_phase_scalar
include
include_nonexistent
include_creat
include_invalid
include_accmode
include_index
madd_spec_directive
madd_spec_invalid
madd_spec
parse_quote_mismatch
parse_eol
parse_foffs_include
put_string
parse_protect_data
put_const
put_string_protect
ref
put_const_protect
parse_protect_all
ref_none
parse_ref
add_protect
parse_protect_format
parse_protect_bad
ref_two
put_protect
include_rdonly
parse_ref_nonexistent
parse_protect_none
parse_name_pedantic
parse_name_dot
parse_name_ext
parse_duplicate_ignore
gzip_get
gzip_nframes
gzip_put
gzip_get_get
bzip_get
bzip_nframes
bzip_put
bzip_get_get
global_name
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_rescan
open_cb_invalid
del_const_force
del_const
del_derived_force
del_const_deref
del_meta_force
del_data
del_meta
del
del_derived
close_discard
global_ref_set
global_ref_empty
include_ignore
global_ref
include_ref
include_auto
move
move_index
move_protect
move_data_enc_ar
bzip_move_from
gzip_move_from
move_data_foffs
move_data_enc_ra
move_data_endian
move_data_nop
alter_multiply
alter_bit_bitnum
alter_entry_recode
alter_linterp_move
alter_raw_spf
alter_entry
alter_bit_numbits
alter_lincom_slope
alter_raw_type
alter_lincom_input
alter_const
alter_phase
alter_lincom_offset
alter_linterp
foffs_get
foffs_move
foffs_alter
endian_alter
endian_move
endian_get
encode_alter
encode_get
encode_move
protect_alter
move_subdir
unclude_del
name_move
unclude
file
name
file_type
unclude_move
file_code
parent
protect_get
global_ref_get
alter_mspec
alter_spec
include_cb
include_pc
include_syntax
fragment_index
fragment_name
fragment_name_oor
entry_type
alter_polynom_coeff
get_polynom_noin
get_polynom
put_polynom_noin
madd_polynom
parse_polynom_scalar
alter_polynom_ord
parse_polynom
spf_polynom
entry_polynom_scalar
put_polynom1
put_polynom2
parse_polynom_ncols1
parse_polynom_ncols2
alter_polynom_input
add_polynom
entry_polynom
parse_lincom_non_ncols
parse_lincom_non
get_lincom_non
xz_get
xz_nframes
lzma_get
lzma_nframes
add_sbit
parse_sbit
put_sbit
get_sbit
madd_sbit
flush_spec
index_domain
madd_clincom
index
madd_const
index_range
add_clincom
add_cpolynom
get_clincom
convert_float32_complex64
convert_int32_complex128
get_endian_complex128_big
get_endian_complex128_arm
get_endian_complex128_little
convert_complex64_float64
parse_meta_index2
convert_uint16_complex128
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
convert_uint16_complex64
convert_float64_complex128
repr_int8
convert_complex64_int64
convert_uint64_complex64
convert_complex64_complex128
get_const
convert_uint8_complex128
parse_meta_implicit2
convert_float32_complex128
get_complex64
add_spec_meta
convert_float64_complex64
convert_int16_complex128
alter_cpolynom
madd_cpolynom
convert_int32_complex64
alter_lincom_23
convert_complex64_uint64
repr_uint8
put_complex128
get_endian_complex64_big
get_endian_complex64_arm
get_endian_complex64_little
alter_spec_meta
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_int16
convert_uint8_complex64
repr_int32
madd_string
convert_complex128_float64
repr_uint16
repr_int64
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
get_complex128
repr_uint32
convert_complex128_uint64
get_const_repr
convert_complex128_int64
repr_float32
repr_uint64
convert_int16_complex64
repr_float64
put_complex64
convert_uint64_complex128
convert_int64_complex64
repr_a
repr_i
repr_m
repr_r
get_const_complex
convert_int8_complex128
convert_uint32_complex128
parse_meta_implicit
get_cpolynom
put_repr
convert_complex128_complex64
convert_int8_complex64
convert_uint32_complex64
convert_int64_complex128
move_meta
add_scalar
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
get_zero
entry_scalar_repr
header_complex
version_5_strict
parse_version_permissive
version_7_strict
version_0
version_1
version_2
version_3
version_4
version_5
version_6
version_7
version_6_strict
eof
eof_index
eof_lincom
eof_phase
bof
bof_lincom
bof_phase
put_linterp_nomono
get_linterp_sort
put_linterp_reverse
alter_lincom_32
parse_recip
parse_divide
alter_recip
dfes_recip
add_crecip89
add_divide
put_divide
madd_recip
add_crecip
get_recip_const
spf_divide
add_divide_invalid
version_8
alter_crecip89
put_recip
spf_recip
madd_crecip89
alter_divide
get_recip
alter_crecip
madd_divide
dfes_divide
madd_crecip
add_recip
get_divide
version_8_strict
version_5_write
version_0_write
version_7_write
version_2_write
version_4_write
version_6_write
version_1_write
version_8_write
version_3_write
put_carray_slice
cvlist_array_meta
del_carray
get_carray_slice
cvlist_array
del_carray_deref
nmeta_vectors_del
get_carray
parse_carray
madd_carray
add_carray
put_carray
get_carray_len
parse_carray_long
alter_carray_len
alter_carray_type
ascii_get_get
parse_include_relabs
parse_include_absrel
parse_include_relrel
parse_include_absolute
add_raw_include
alter_crecip_zero
alter_recip_zero
error_num
sie_put_little
sie_get_big
sie_move_to
sie_nframes_big
sie_get_little
sie_nframes_little
sie_move_from
sie_put_big
seek_end
get_here
entry_divide
tell
get_heres
entry_recip
seek_cur
put_here
seek64
seek_set
tell64
put_heres
get_here_foffs
seek_foffs
get_rofs
endian_alter_sie
gzip_get_put
gzip_put_get
gzip_move_to
ascii_add
gzip_add
+ Makefile
Makefile.in
*.o
*.odirfile
*.swp
*.exe
.deps
.libs
convert_uint8_int8
convert_uint8_uint16
convert_uint8_int16
convert_uint8_uint32
convert_uint8_int32
convert_uint8_float32
convert_uint8_uint64
convert_uint8_int64
convert_uint8_float64
convert_int8_uint8
convert_int8_uint16
convert_int8_int16
convert_int8_uint32
convert_int8_int32
convert_int8_float32
convert_int8_uint64
convert_int8_int64
convert_int8_float64
convert_uint16_uint8
convert_uint16_int8
convert_uint16_int16
convert_uint16_uint32
convert_uint16_int32
convert_uint16_float32
convert_uint16_uint64
convert_uint16_int64
convert_uint16_float64
convert_int16_uint8
convert_int16_int8
convert_int16_uint16
convert_int16_uint32
convert_int16_int32
convert_int16_float32
convert_int16_uint64
convert_int16_int64
convert_int16_float64
convert_uint32_uint8
convert_uint32_int8
convert_uint32_uint16
convert_uint32_int16
convert_uint32_int32
convert_uint32_float32
convert_uint32_uint64
convert_uint32_int64
convert_uint32_float64
convert_int32_uint8
convert_int32_int8
convert_int32_uint16
convert_int32_int16
convert_int32_uint32
convert_int32_float32
convert_int32_uint64
convert_int32_int64
convert_int32_float64
convert_uint64_uint8
convert_uint64_int8
convert_uint64_uint16
convert_uint64_int16
convert_uint64_uint32
convert_uint64_int32
convert_uint64_float32
convert_uint64_int64
convert_uint64_float64
convert_int64_uint8
convert_int64_int8
convert_int64_uint16
convert_int64_int16
convert_int64_uint32
convert_int64_int32
convert_int64_float32
convert_int64_uint64
convert_int64_float64
convert_float32_uint8
convert_float32_int8
convert_float32_uint16
convert_float32_int16
convert_float32_uint32
convert_float32_int32
convert_float32_uint64
convert_float32_int64
convert_float32_float64
convert_float64_uint8
convert_float64_int8
convert_float64_uint16
convert_float64_int16
convert_float64_uint32
convert_float64_int32
convert_float64_float32
convert_float64_uint64
convert_float64_int64
creat
creat_excl
creat_rdonly
flist
flist_invalid
get64
get_bad_code
get_bit
get_char
get_endian8
get_endian16
get_endian32
get_endian64
get_endian_float32_big
get_endian_float32_arm
get_endian_float32_little
get_endian_float64_big
get_endian_float64_arm
get_endian_float64_little
get_ff
get_float32
get_float64
get_foffs
get_fs
get_int8
get_int16
get_int32
get_int64
get_invalid
get_lincom1
get_lincom2
get_lincom3
get_lincom_noin
get_linterp
get_linterp_noin
get_linterp_notab
get_multiply
get_multiply_noin
get_nonexistent
get_null
get_off64
get_phase
get_recurse
get_sf
get_ss
get_type
get_uint16
get_uint32
get_uint64
legacy_get
legacy_nframes
legacy_nonexistent
legacy_put
legacy_spf
nfields
nfields_invalid
nframes
nframes64
nframes_empty
nframes_invalid
nframes_off64
nframes_spf
open
open_eaccess
open_nonexistent
open_notdirfile
parse_badline
parse_bit
parse_bit4
parse_bit_bitnum
parse_bit_bitsize
parse_bit_ncols
parse_bit_numbits
parse_endian_bad
parse_endian_big
parse_endian_force
parse_endian_little
parse_foffs
parse_include
parse_include_nonexistent
parse_index
parse_lincom
parse_lincom_ncols1
parse_lincom_ncols2
parse_lincom_nfields
parse_lincom_nofields
parse_linterp
parse_linterp_ncols
parse_multiply
parse_multiply_ncols
parse_ncols
parse_phase
parse_phase_ncols
parse_raw
parse_raw_char
parse_raw_ncols
parse_raw_spf
parse_raw_type
parse_version
parse_version_include
put64
put_bad_code
put_bit
put_bof
put_char
put_endian8
put_endian16
put_endian32
put_endian64
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_int8
put_int16
put_int32
put_int64
put_invalid
put_lincom1
put_lincom2
put_lincom_noin
put_linterp
put_linterp_notab
put_multiply
put_null
put_off64
put_phase
put_phase_noin
put_rdonly
put_recurse
put_rofs
put_sf
put_ss
put_type
put_uint16
put_uint32
put_uint64
spf
spf_lincom
spf_multiply
spf_recurse
trunc
trunc_rdonly
trunc_rofs
flush_invalid
parse_version_slash
flush_all
flush
close_null
close
parse_endian_slash
error_error
parse_name
parse_include_slash
close_bad
parse_foffs_slash
flush_bad_code
dfes_bit
dfes_lincom
dfes_linterp
dfes_multiply
dfes_null
dfes_phase
dfes_raw
dfes_zero
entry_bad_code
entry_bit
entry_invalid
entry_lincom
entry_linterp
entry_multiply
entry_phase
entry_raw
legacy_get_put
legacy_get_rofs
add_phase
add_lincom_nfields
add_raw
add_multiply
add_bit_bitsize
flush_meta
add_type
add_raw_type
add_bit_bitnum
add_bit
add_format
add_raw_spf
put_linterp_noin
error_short
error
add
add_linterp
nfragments
add_duplicate
add_code
add_bit_numbits
add_lincom
add_rdonly
ascii_get
ascii_put
ascii_nframes
slim_get
slim_nframes
slim_put
add_many
add_sort
nfields_type
nfields_type_invalid
nmeta
nmeta_invalid
nmeta_parent
nmeta_type
nmeta_type_invalid
nmeta_type_parent
nmeta_vectors
nmeta_vectors_invalid
nmeta_vectors_parent
nvectors
nvectors_invalid
parse_const
parse_const_ncols
parse_duplicate
parse_meta
parse_meta_parent
parse_meta_raw
parse_quote
parse_sort
parse_string
parse_string_ncols
parse_whitespace
madd_linterp_invalid
madd_lincom_invalid
vlist_invalid
vlist_meta
add_raw_invalid
cvlist_invalid
svlist_invalid
cvlist
svlist
madd_phase_invalid
add_invalid
madd_phase
add_phase_invalid
add_spec_directive
add_string
add_linterp_invalid
madd_multiply
flist_type_invalid
clist
cvlist_meta_invalid
flist_meta_invalid
flist_type
svlist_meta_invalid
cvlist_meta
vlist_meta_invalid
svlist_meta
parse_string_null
madd_linterp
madd_lincom
vlist
add_bit_invalid
add_lincom_invalid
madd_bit_invalid
madd_bit
add_multiply_invalid
add_const
madd_multiply_invalid
madd
add_spec_invalid
flist_type_meta_invalid
add_spec
flist_type_meta
flist_meta
parse_meta_index
entry_raw_scalar_code
parse_bit_scalar
entry_raw_scalar_type
entry_lincom_scalar
entry_phase_scalar
entry_raw_scalar
parse_lincom_scalar
entry_bit_scalar
parse_raw_scalar
parse_phase_scalar
include
include_nonexistent
include_creat
include_invalid
include_accmode
include_index
madd_spec_directive
madd_spec_invalid
madd_spec
parse_quote_mismatch
parse_eol
parse_foffs_include
put_string
parse_protect_data
put_const
put_string_protect
ref
put_const_protect
parse_protect_all
ref_none
parse_ref
add_protect
parse_protect_format
parse_protect_bad
ref_two
put_protect
include_rdonly
parse_ref_nonexistent
parse_protect_none
parse_name_pedantic
parse_name_dot
parse_name_ext
parse_duplicate_ignore
gzip_get
gzip_nframes
gzip_put
gzip_get_get
bzip_get
bzip_nframes
bzip_put
bzip_get_get
global_name
open_cb_abort
open_cb_cont
open_cb_ignore
open_cb_rescan
open_cb_invalid
del_const_force
del_const
del_derived_force
del_const_deref
del_meta_force
del_data
del_meta
del
del_derived
close_discard
global_ref_set
global_ref_empty
include_ignore
global_ref
include_ref
include_auto
move
move_index
move_protect
move_data_enc_ar
bzip_move_from
gzip_move_from
move_data_foffs
move_data_enc_ra
move_data_endian
move_data_nop
alter_multiply
alter_bit_bitnum
alter_entry_recode
alter_linterp_move
alter_raw_spf
alter_entry
alter_bit_numbits
alter_lincom_slope
alter_raw_type
alter_lincom_input
alter_const
alter_phase
alter_lincom_offset
alter_linterp
foffs_get
foffs_move
foffs_alter
endian_alter
endian_move
endian_get
encode_alter
encode_get
encode_move
protect_alter
move_subdir
unclude_del
name_move
unclude
file
name
file_type
unclude_move
file_code
parent
protect_get
global_ref_get
alter_mspec
alter_spec
include_cb
include_pc
include_syntax
fragment_index
fragment_name
fragment_name_oor
entry_type
alter_polynom_coeff
get_polynom_noin
get_polynom
put_polynom_noin
madd_polynom
parse_polynom_scalar
alter_polynom_ord
parse_polynom
spf_polynom
entry_polynom_scalar
put_polynom1
put_polynom2
parse_polynom_ncols1
parse_polynom_ncols2
alter_polynom_input
add_polynom
entry_polynom
parse_lincom_non_ncols
parse_lincom_non
get_lincom_non
xz_get
xz_nframes
lzma_get
lzma_nframes
add_sbit
parse_sbit
put_sbit
get_sbit
madd_sbit
flush_spec
index_domain
madd_clincom
index
madd_const
index_range
add_clincom
add_cpolynom
get_clincom
convert_float32_complex64
convert_int32_complex128
get_endian_complex128_big
get_endian_complex128_arm
get_endian_complex128_little
convert_complex64_float64
parse_meta_index2
convert_uint16_complex128
put_endian_complex64_arm
put_endian_complex64_big
put_endian_complex64_little
convert_uint16_complex64
convert_float64_complex128
repr_int8
convert_complex64_int64
convert_uint64_complex64
convert_complex64_complex128
get_const
convert_uint8_complex128
parse_meta_implicit2
convert_float32_complex128
get_complex64
add_spec_meta
convert_float64_complex64
convert_int16_complex128
alter_cpolynom
madd_cpolynom
convert_int32_complex64
alter_lincom_23
convert_complex64_uint64
repr_uint8
put_complex128
get_endian_complex64_big
get_endian_complex64_arm
get_endian_complex64_little
alter_spec_meta
repr_real_a
repr_real_i
repr_real_m
repr_real_r
repr_int16
convert_uint8_complex64
repr_int32
madd_string
convert_complex128_float64
repr_uint16
repr_int64
put_endian_complex128_arm
put_endian_complex128_big
put_endian_complex128_little
get_complex128
repr_uint32
convert_complex128_uint64
get_const_repr
convert_complex128_int64
repr_float32
repr_uint64
convert_int16_complex64
repr_float64
put_complex64
convert_uint64_complex128
convert_int64_complex64
repr_a
repr_i
repr_m
repr_r
get_const_complex
convert_int8_complex128
convert_uint32_complex128
parse_meta_implicit
get_cpolynom
put_repr
convert_complex128_complex64
convert_int8_complex64
convert_uint32_complex64
convert_int64_complex128
move_meta
add_scalar
alter_entry_scalar2a
alter_entry_scalar2n
alter_entry_scalar3
alter_entry_scalar4
get_zero
entry_scalar_repr
header_complex
version_5_strict
parse_version_permissive
version_7_strict
version_0
version_1
version_2
version_3
version_4
version_5
version_6
version_7
version_6_strict
eof
eof_index
eof_lincom
eof_phase
bof
bof_lincom
bof_phase
put_linterp_nomono
get_linterp_sort
put_linterp_reverse
alter_lincom_32
parse_recip
parse_divide
alter_recip
dfes_recip
add_crecip89
add_divide
put_divide
madd_recip
add_crecip
get_recip_const
spf_divide
add_divide_invalid
version_8
alter_crecip89
put_recip
spf_recip
madd_crecip89
alter_divide
get_recip
alter_crecip
madd_divide
dfes_divide
madd_crecip
add_recip
get_divide
version_8_strict
version_5_write
version_0_write
version_7_write
version_2_write
version_4_write
version_6_write
version_1_write
version_8_write
version_3_write
put_carray_slice
cvlist_array_meta
del_carray
get_carray_slice
cvlist_array
del_carray_deref
nmeta_vectors_del
get_carray
parse_carray
madd_carray
add_carray
put_carray
get_carray_len
parse_carray_long
alter_carray_len
alter_carray_type
ascii_get_get
parse_include_relabs
parse_include_absrel
parse_include_relrel
parse_include_absolute
add_raw_include
alter_crecip_zero
alter_recip_zero
error_num
sie_put_little
sie_get_big
sie_move_to
sie_nframes_big
sie_get_little
sie_nframes_little
sie_move_from
sie_put_big
seek_end
get_here
entry_divide
tell
get_heres
entry_recip
seek_cur
put_here
seek64
seek_set
tell64
put_heres
get_here_foffs
seek_foffs
get_rofs
endian_alter_sie
gzip_get_put
gzip_put_get
gzip_move_to
ascii_add
gzip_add
add_scalar_carray
Modified: trunk/getdata/test/Makefile.am
===================================================================
--- trunk/getdata/test/Makefile.am 2011-11-08 04:56:06 UTC (rev 614)
+++ trunk/getdata/test/Makefile.am 2011-11-08 21:21:05 UTC (rev 615)
@@ -51,9 +51,9 @@
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_sbit add_scalar add_sort \
- add_spec add_spec_directive add_spec_invalid add_spec_meta \
- add_string add_type
+ add_raw_type add_rdonly add_recip add_sbit add_scalar \
+ add_scalar_carray add_sort add_spec add_spec_directive \
+ add_spec_invalid add_spec_meta add_string add_type
ALTER_TESTS=alter_bit_bitnum alter_bit_numbits alter_carray_len \
alter_carray_type alter_const alter_cpolynom alter_crecip \
@@ -314,7 +314,8 @@
XZ_TESTS=xz_get xz_nframes
-TESTS=$(ADD_TESTS) $(ALTER_TESTS) $(ASCII_TESTS) \
+TESTS=$(ADD_TESTS)
+TEeTS=$(ADD_TESTS) $(ALTER_TESTS) $(ASCII_TESTS) \
$(BOF_TESTS) $(BZIP_TESTS) $(CLOSE_TESTS) \
$(CONVERT_TESTS) $(CREAT_TESTS) $(CVLIST_TESTS) \
$(DEL_TESTS) $(DFES_TESTS) $(ENCODE_TESTS) \
Added: trunk/getdata/test/add_scalar_carray.c
===================================================================
--- trunk/getdata/test/add_scalar_carray.c (rev 0)
+++ trunk/getdata/test/add_scalar_carray.c 2011-11-08 21:21:05 UTC (rev 615)
@@ -0,0 +1,81 @@
+/* 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
+ */
+/* Add a dirfile field */
+#include "test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+
+int main(void)
+{
+ const char *filedir = "dirfile";
+ const char *format = "dirfile/format";
+ int error, r = 0;
+ DIRFILE *D;
+
+ gd_entry_t E, e;
+ E.field = "data";
+ E.field_type = GD_LINCOM_ENTRY;
+ E.fragment_index = 0;
+ E.EN(lincom,n_fields) = 1;
+ E.comp_scal = 0;
+ E.in_fields[0] = "INDEX";
+ E.EN(lincom,m)[0] = 1.;
+ E.scalar[0] = NULL;
+ E.scalar[0 + GD_MAX_LINCOM] = "c";
+ E.scalar_ind[0 + GD_MAX_LINCOM] = 3;
+
+ D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE);
+ gd_add_spec(D, "c CARRAY INT64 1 2 3 4", 0);
+ gd_add(D, &E);
+ error = gd_error(D);
+
+ /* check */
+ gd_entry(D, "data", &e);
+ if (gd_error(D))
+ r = 1;
+ else {
+ CHECKI(e.field_type, GD_LINCOM_ENTRY);
+ CHECKI(e.fragment_index, 0);
+ CHECKI(e.EN(lincom,n_fields), 1);
+ CHECKF(e.EN(lincom,m)[0], 1);
+ CHECKF(e.EN(lincom,b)[0], 4);
+ CHECKP(e.scalar[0]);
+ CHECKS(e.scalar[0 + GD_MAX_LINCOM], "c");
+ CHECKI(e.scalar_ind[0 + GD_MAX_LINCOM], 3);
+ gd_free_entry_strings(&e);
+ }
+
+ gd_close(D);
+
+ unlink(format);
+ rmdir(filedir);
+
+ CHECKI(error, GD_E_OK);
+
+ return r;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ket...@us...> - 2011-11-10 04:56:16
|
Revision: 622
http://getdata.svn.sourceforge.net/getdata/?rev=622&view=rev
Author: ketiltrout
Date: 2011-11-10 04:56:10 +0000 (Thu, 10 Nov 2011)
Log Message:
-----------
Handle CPUs which don't allow unaligned memory access.
Modified Paths:
--------------
trunk/getdata/ChangeLog
trunk/getdata/configure.ac
trunk/getdata/src/internal.h
trunk/getdata/src/sie.c
Modified: trunk/getdata/ChangeLog
===================================================================
--- trunk/getdata/ChangeLog 2011-11-10 04:50:59 UTC (rev 621)
+++ trunk/getdata/ChangeLog 2011-11-10 04:56:10 UTC (rev 622)
@@ -1,3 +1,8 @@
+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
+ * src/sie.c (_GD_SampIndWrite): Handle unaligned memory access.
+
2011-11-08 D. V. Wiebe <ge...@ke...> svn:615
* test/add_scalar_carray.c: Added.
Modified: trunk/getdata/configure.ac
===================================================================
--- trunk/getdata/configure.ac 2011-11-10 04:50:59 UTC (rev 621)
+++ trunk/getdata/configure.ac 2011-11-10 04:56:10 UTC (rev 622)
@@ -60,6 +60,7 @@
dnl Build/Host triplets
AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
dnl Legacy API
AC_ARG_ENABLE(legacy-api, AS_HELP_STRING([--disable-legacy-api],
@@ -310,6 +311,17 @@
AC_PROG_SED
AC_CHECK_PROGS([DIFF], [diff], [])
GD_MSYS_SHELL
+
+AC_MSG_CHECKING([whether ${host} supports fast unaligned memory access])
+case "${host}" in
+ 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])
+ ;;
+ *) gd_unaligned_ok=no ;;
+esac
+AC_MSG_RESULT([$gd_unaligned_ok])
+
echo
echo "*** Checking C compiler characteristics"
echo
@@ -523,7 +535,7 @@
echo
echo "*** Looking for additional header files"
echo
-AC_CHECK_HEADERS([byteswap.h direct.h fcntl.h io.h libgen.h \
+AC_CHECK_HEADERS([asm/unaligned.h byteswap.h direct.h fcntl.h io.h libgen.h \
libkern/OSByteOrder.h stdint.h sys/endian.h unistd.h])
if test "x$disable_c99" = "xno"; then
AC_CHECK_HEADERS([complex.h])
@@ -709,6 +721,13 @@
#endif
])
+AC_CHECK_DECLS([get_unaligned, put_unaligned],,,
+ [
+#ifdef HAVE_ASM_UNALIGNED_H
+#include <asm/unaligned.h>
+#endif
+])
+
dnl python
if test "x$make_pybindings" = "xyes"; then
echo
Modified: trunk/getdata/src/internal.h
===================================================================
--- trunk/getdata/src/internal.h 2011-11-10 04:50:59 UTC (rev 621)
+++ trunk/getdata/src/internal.h 2011-11-10 04:56:10 UTC (rev 622)
@@ -117,6 +117,41 @@
#endif
#endif
+#ifdef _MSC_VER
+# define _gd_static_inline static
+#else
+# define _gd_static_inline static inline
+#endif
+
+/* unaligned access */
+#ifdef UNALIGNED_ACCESS_OK
+#define gd_get_unaligned64(p) (*(p))
+#define gd_put_unaligned64(v,p) *(p) = (v)
+#else
+#ifdef HAVE_ASM_UNALIGNED_H
+#include <asm/unaligned.h>
+#endif
+#ifdef HAVE_DECL_GET_UNALIGNED
+#define gd_get_unaligned64 get_unaligned
+#else
+_gd_static_inline int64_t gd_get_unaligned64(const void *p)
+{
+ int64_t v;
+ memcpy(&v, p, 8);
+ return v;
+}
+#endif
+#ifdef HAVE_DECL_PUT_UNALIGNED
+#define gd_put_unaligned64 put_unaligned
+#else
+_gd_static_inline int64_t gd_put_unalinged64(int64_t v, void *p)
+{
+ memcpy(p, v, 8);
+ return v;
+}
+#endif
+#endif
+
/* For FILE */
#include <stdio.h>
@@ -352,6 +387,11 @@
#ifdef HAVE_FSTATAT
# define gd_StatAt(d,...) fstatat(__VA_ARGS__)
#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#else
+struct stat;
+#endif
int gd_StatAt(const DIRFILE*, int, const char*, struct stat*, int);
#endif
@@ -954,11 +994,6 @@
off64_t _GD_SampIndSize(int, struct _gd_raw_file* file, gd_type_t data_type,
int swap);
-#ifdef _MSC_VER
-# define _gd_static_inline static
-#else
-# define _gd_static_inline static inline
-#endif
_gd_static_inline int entry_cmp(const void *a, const void *b)
{
return strcmp((*(gd_entry_t**)a)->field, (*(gd_entry_t**)b)->field);
Modified: trunk/getdata/src/sie.c
===================================================================
--- trunk/getdata/src/sie.c 2011-11-10 04:50:59 UTC (rev 621)
+++ trunk/getdata/src/sie.c 2011-11-10 04:56:10 UTC (rev 622)
@@ -340,13 +340,13 @@
}
p = p2;
}
- *cur_end = f->p + i - 1;
+ gd_put_unaligned64(f->p + i - 1, cur_end);
cur_end = (int64_t*)((char*)p + size * rin);
cur_datum = cur_end + 1;
memcpy(cur_datum, ((const char*)ptr) + i * dlen, dlen);
}
}
- *cur_end = f->p + nelem - 1;
+ gd_put_unaligned64(f->p + nelem - 1, cur_end);
rin++;
/* determine how many records we have to replace */
@@ -356,7 +356,7 @@
rout--;
}
- while (f->d[0] <= *cur_end) {
+ while (f->d[0] <= gd_get_unaligned64(cur_end)) {
++rout;
r = _GD_Advance(f, sizeof(int64_t) + GD_SIZE(data_type));
@@ -370,9 +370,10 @@
/* fix the endianness */
if (f->swap)
- for (i = 0; i < (size_t)rin; ++i)
- *((uint64_t*)(((char*)p) + size * i)) =
- gd_swap64(*((uint64_t*)(((char*)p) + size * i)));
+ for (i = 0; i < (size_t)rin; ++i) {
+ int64_t v = gd_get_unaligned64((int64_t*)(((char*)p) + size * i));
+ gd_put_unaligned64(gd_swap64(v), (int64_t*)(((char*)p) + size * i));
+ }
/* now, do some moving: first, move the trailing records, forward by
* (rin - rout) records */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|