Thread: [Getdata-commits] SF.net SVN: getdata:[444] trunk/getdata
Scientific Database Format
Brought to you by:
ketiltrout
From: <ket...@us...> - 2010-09-11 08:35:52
|
Revision: 444 http://getdata.svn.sourceforge.net/getdata/?rev=444&view=rev Author: ketiltrout Date: 2010-09-11 08:35:40 +0000 (Sat, 11 Sep 2010) Log Message: ----------- ANSI-C-ify. Also make work with a C++ compiler. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/cxx/bitentry.cpp trunk/getdata/bindings/cxx/constentry.cpp trunk/getdata/bindings/cxx/entry.cpp trunk/getdata/bindings/cxx/getdata/bitentry.h trunk/getdata/bindings/cxx/getdata/constentry.h trunk/getdata/bindings/cxx/getdata/entry.h trunk/getdata/bindings/cxx/getdata/lincomentry.h trunk/getdata/bindings/cxx/getdata/linterpentry.h trunk/getdata/bindings/cxx/getdata/phaseentry.h trunk/getdata/bindings/cxx/getdata/polynomentry.h trunk/getdata/bindings/cxx/getdata/rawentry.h trunk/getdata/bindings/cxx/getdata/recipentry.h trunk/getdata/bindings/cxx/getdata/sbitentry.h trunk/getdata/bindings/cxx/lincomentry.cpp trunk/getdata/bindings/cxx/linterpentry.cpp trunk/getdata/bindings/cxx/phaseentry.cpp trunk/getdata/bindings/cxx/polynomentry.cpp trunk/getdata/bindings/cxx/rawentry.cpp trunk/getdata/bindings/cxx/recipentry.cpp trunk/getdata/bindings/cxx/sbitentry.cpp trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/bindings/f77/fgetdata.h trunk/getdata/bindings/idl/getdata.c trunk/getdata/bindings/idl/test/Makefile.am trunk/getdata/bindings/python/pyentry.c trunk/getdata/bindings/python/pygetdata.c 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/common.c trunk/getdata/src/constant.c trunk/getdata/src/debug.c trunk/getdata/src/del.c trunk/getdata/src/encoding.c trunk/getdata/src/endian.c trunk/getdata/src/entry.c trunk/getdata/src/errors.c trunk/getdata/src/field_list.c trunk/getdata/src/flimits.c trunk/getdata/src/flush.c trunk/getdata/src/fragment.c trunk/getdata/src/getdata.c trunk/getdata/src/getdata.h.in trunk/getdata/src/globals.c trunk/getdata/src/include.c trunk/getdata/src/internal.h trunk/getdata/src/legacy.c trunk/getdata/src/lzma.c trunk/getdata/src/meta_list.c trunk/getdata/src/mod.c trunk/getdata/src/move.c trunk/getdata/src/name.c trunk/getdata/src/native.c trunk/getdata/src/nfields.c trunk/getdata/src/nframes.c trunk/getdata/src/nmeta.c trunk/getdata/src/open.c trunk/getdata/src/parse.c trunk/getdata/src/protect.c trunk/getdata/src/putdata.c trunk/getdata/src/slim.c trunk/getdata/src/spf.c trunk/getdata/src/string.c trunk/getdata/src/types.c trunk/getdata/test/add.c trunk/getdata/test/add_bit.c trunk/getdata/test/add_clincom.c trunk/getdata/test/add_code.c trunk/getdata/test/add_const.c trunk/getdata/test/add_cpolynom.c trunk/getdata/test/add_crecip.c trunk/getdata/test/add_crecip89.c trunk/getdata/test/add_duplicate.c trunk/getdata/test/add_format.c trunk/getdata/test/add_invalid.c trunk/getdata/test/add_lincom.c trunk/getdata/test/add_linterp.c trunk/getdata/test/add_phase.c trunk/getdata/test/add_polynom.c trunk/getdata/test/add_protect.c trunk/getdata/test/add_raw.c trunk/getdata/test/add_rdonly.c trunk/getdata/test/add_recip.c trunk/getdata/test/add_sbit.c trunk/getdata/test/add_scalar.c trunk/getdata/test/add_sort.c trunk/getdata/test/add_spec.c trunk/getdata/test/add_spec_meta.c trunk/getdata/test/add_type.c trunk/getdata/test/alter_cpolynom.c trunk/getdata/test/alter_crecip.c trunk/getdata/test/alter_crecip89.c trunk/getdata/test/alter_entry.c trunk/getdata/test/alter_entry_recode.c trunk/getdata/test/alter_entry_scalar2a.c trunk/getdata/test/alter_entry_scalar2n.c trunk/getdata/test/alter_entry_scalar3.c trunk/getdata/test/alter_entry_scalar4.c trunk/getdata/test/alter_linterp.c trunk/getdata/test/alter_polynom_coeff.c trunk/getdata/test/convert_complex128_complex64.c trunk/getdata/test/convert_complex128_float64.c trunk/getdata/test/convert_complex128_int64.c trunk/getdata/test/convert_complex128_uint64.c trunk/getdata/test/convert_complex64_complex128.c trunk/getdata/test/convert_complex64_float64.c trunk/getdata/test/convert_complex64_int64.c trunk/getdata/test/convert_complex64_uint64.c trunk/getdata/test/convert_float32_complex128.c trunk/getdata/test/convert_float32_complex64.c trunk/getdata/test/convert_float64_complex128.c trunk/getdata/test/convert_float64_complex64.c trunk/getdata/test/convert_int16_complex128.c trunk/getdata/test/convert_int16_complex64.c trunk/getdata/test/convert_int32_complex128.c trunk/getdata/test/convert_int32_complex64.c trunk/getdata/test/convert_int64_complex128.c trunk/getdata/test/convert_int64_complex64.c trunk/getdata/test/convert_int8_complex128.c trunk/getdata/test/convert_int8_complex64.c trunk/getdata/test/convert_uint16_complex128.c trunk/getdata/test/convert_uint16_complex64.c trunk/getdata/test/convert_uint32_complex128.c trunk/getdata/test/convert_uint32_complex64.c trunk/getdata/test/convert_uint64_complex128.c trunk/getdata/test/convert_uint64_complex64.c trunk/getdata/test/convert_uint8_complex128.c trunk/getdata/test/convert_uint8_complex64.c trunk/getdata/test/entry_bit.c trunk/getdata/test/entry_bit_scalar.c trunk/getdata/test/entry_lincom.c trunk/getdata/test/entry_lincom_scalar.c trunk/getdata/test/entry_linterp.c trunk/getdata/test/entry_phase.c trunk/getdata/test/entry_phase_scalar.c trunk/getdata/test/entry_polynom.c trunk/getdata/test/entry_polynom_scalar.c trunk/getdata/test/entry_raw.c trunk/getdata/test/entry_raw_scalar.c trunk/getdata/test/entry_scalar_repr.c trunk/getdata/test/flush_spec.c trunk/getdata/test/get_clincom.c trunk/getdata/test/get_complex128.c trunk/getdata/test/get_complex64.c trunk/getdata/test/get_const_complex.c trunk/getdata/test/get_const_repr.c trunk/getdata/test/get_cpolynom.c trunk/getdata/test/get_endian_complex128_arm.c trunk/getdata/test/get_endian_complex128_big.c trunk/getdata/test/get_endian_complex128_little.c trunk/getdata/test/get_endian_complex64_arm.c trunk/getdata/test/get_endian_complex64_big.c trunk/getdata/test/get_endian_complex64_little.c trunk/getdata/test/header_complex.c trunk/getdata/test/legacy_get.c trunk/getdata/test/legacy_get_put.c trunk/getdata/test/legacy_get_rofs.c trunk/getdata/test/legacy_nframes.c trunk/getdata/test/legacy_nonexistent.c trunk/getdata/test/legacy_put.c trunk/getdata/test/legacy_spf.c trunk/getdata/test/madd.c trunk/getdata/test/madd_bit.c trunk/getdata/test/madd_clincom.c trunk/getdata/test/madd_const.c trunk/getdata/test/madd_cpolynom.c trunk/getdata/test/madd_crecip.c trunk/getdata/test/madd_crecip89.c trunk/getdata/test/madd_lincom.c trunk/getdata/test/madd_linterp.c trunk/getdata/test/madd_phase.c trunk/getdata/test/madd_polynom.c trunk/getdata/test/madd_recip.c trunk/getdata/test/madd_sbit.c trunk/getdata/test/madd_spec.c trunk/getdata/test/nframes.c trunk/getdata/test/put_complex128.c trunk/getdata/test/put_complex64.c trunk/getdata/test/put_endian_complex128_arm.c trunk/getdata/test/put_endian_complex128_big.c trunk/getdata/test/put_endian_complex128_little.c trunk/getdata/test/put_endian_complex64_arm.c trunk/getdata/test/put_endian_complex64_big.c trunk/getdata/test/put_endian_complex64_little.c trunk/getdata/test/repr_a.c trunk/getdata/test/repr_float32.c trunk/getdata/test/repr_float64.c trunk/getdata/test/repr_i.c trunk/getdata/test/repr_int16.c trunk/getdata/test/repr_int32.c trunk/getdata/test/repr_int64.c trunk/getdata/test/repr_int8.c trunk/getdata/test/repr_m.c trunk/getdata/test/repr_r.c trunk/getdata/test/repr_real_a.c trunk/getdata/test/repr_real_i.c trunk/getdata/test/repr_real_m.c trunk/getdata/test/repr_real_r.c trunk/getdata/test/repr_uint16.c trunk/getdata/test/repr_uint32.c trunk/getdata/test/repr_uint64.c trunk/getdata/test/repr_uint8.c trunk/getdata/test/slim_nframes.c trunk/getdata/test/test.h trunk/getdata/util/dirfile2ascii.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/ChangeLog 2010-09-11 08:35:40 UTC (rev 444) @@ -1,3 +1,32 @@ +2010-09-11 D. V. Wiebe <ge...@ke...> svn:444 + * test/ src/ bindings/ util/: ANSI-C-ify. + * src/getdata.h.in: Define GD_NO_C99_API when the C99-compliant API has been + disabled at build time. + * src/getdata.h.in src/internal.h: ANSI C does not permit anonymous union + and structures, so name all the sub-bits of gd_entry_t and gd_private_entry. + + * src/getdata.h.in: Encompass everything in an extern "C" block + for C++ compilers. + + * src/: include gd_throw in definition of functions. + + * src/debug.c src/common.c src/Makefile.am: Move gd_col_count and + gd_debug_col to common.c to remove the need for GDLIB. + + * test/legacy_get_rofs.c test/legacy_get.c test/legacy_nonexistent.c + test/legacy_put.c: Fix skip test. + + * test/flush_spec.c: Skip the blank line. + + * test/slim_nframes.c: Add missing r. + + * bindings/idl/test/Makefile.am: Use DL_LIBRARY_PATH in TESTS_ENVIRONMENT. + + * configure.ac: Add --enable-ansi-c, which will disable Python and IDL. + A fail of AC_PROG_CC_C99 will also cause this to be asserted. + + * configure.ac: Fix lfs_transitional_api check. + 2010-08-10 D. V. Wiebe <ge...@ke...> svn:443 * src/common.c (_GD_BadInput): Check the propper entry for scalarness. Modified: trunk/getdata/bindings/cxx/bitentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/bitentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/bitentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -35,8 +35,8 @@ E.field = strdup(field_code); E.field_type = GD_BIT_ENTRY; E.in_fields[0] = strdup(in_field); - E.bitnum = bitnum; - E.numbits = numbits; + E.u.bit.bitnum = bitnum; + E.u.bit.numbits = numbits; E.fragment_index = fragment_index; } @@ -58,7 +58,7 @@ int BitEntry::SetFirstBit(gd_bit_t first_bit) { - E.bitnum = first_bit; + E.u.bit.bitnum = first_bit; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -68,7 +68,7 @@ int BitEntry::SetNumBits(gd_bit_t num_bits) { - E.numbits = num_bits; + E.u.bit.numbits = num_bits; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -98,7 +98,7 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) - r = gd_get_constant(D->D, first_bit, GD_INT16, &E.bitnum); + r = gd_get_constant(D->D, first_bit, GD_INT16, &E.u.bit.bitnum); } return r; @@ -118,7 +118,7 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) - r = gd_get_constant(D->D, num_bits, GD_INT16, &E.numbits); + r = gd_get_constant(D->D, num_bits, GD_INT16, &E.u.bit.numbits); } return r; Modified: trunk/getdata/bindings/cxx/constentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/constentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/constentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -33,13 +33,13 @@ { E.field = strdup(field_code); E.field_type = GD_CONST_ENTRY; - E.const_type = (gd_type_t)data_type; + E.u.cons.type = (gd_type_t)data_type; E.fragment_index = fragment_index; } int ConstEntry::SetType(DataType type) { - E.const_type = (gd_type_t)type; + E.u.cons.type = (gd_type_t)type; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); Modified: trunk/getdata/bindings/cxx/entry.cpp =================================================================== --- trunk/getdata/bindings/cxx/entry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/entry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -136,14 +136,14 @@ switch (E.field_type) { case GD_LINCOM_ENTRY: - if (index >= GD_MAX_LINCOM + E.n_fields || - (index >= E.n_fields && index < GD_MAX_LINCOM)) + if (index >= GD_MAX_LINCOM + E.u.lincom.n_fields || + (index >= E.u.lincom.n_fields && index < GD_MAX_LINCOM)) { return NULL; } break; case GD_POLYNOM_ENTRY: - if (index > E.poly_ord) + if (index > E.u.polynom.poly_ord) return NULL; break; case GD_BIT_ENTRY: Modified: trunk/getdata/bindings/cxx/getdata/bitentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/bitentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/bitentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -52,11 +52,11 @@ }; virtual gd_bit_t FirstBit() { - return E.bitnum; + return E.u.bit.bitnum; }; virtual gd_bit_t NumBits() { - return E.numbits; + return E.u.bit.numbits; }; int SetInput(const char* field); Modified: trunk/getdata/bindings/cxx/getdata/constentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/constentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/constentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -46,7 +46,7 @@ ConstEntry(const char* field_code, DataType type, int fragment_index = 0); - virtual DataType ConstType() { return (DataType)E.const_type; } + virtual DataType ConstType() { return (DataType)E.u.cons.type; } int SetType(DataType type); Modified: trunk/getdata/bindings/cxx/getdata/entry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/entry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/entry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -91,7 +91,7 @@ /* Specific data */ virtual const char *Input(int index = 0) { - return (CheckIndex(E.field_type, E.n_fields, index)) ? + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.in_fields[index] : NULL; }; @@ -104,88 +104,88 @@ /* RAW methods */ virtual gd_spf_t SamplesPerFrame() { - return (E.field_type == GD_RAW_ENTRY) ? E.spf : 0; + return (E.field_type == GD_RAW_ENTRY) ? E.u.raw.spf : 0; }; virtual DataType RawType() { - return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.data_type : Unknown; + return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.u.raw.type : Unknown; }; /* LINCOM methods */ virtual int NFields() { - return (E.field_type == GD_LINCOM_ENTRY) ? E.n_fields : 0; + return (E.field_type == GD_LINCOM_ENTRY) ? E.u.lincom.n_fields : 0; }; virtual double Scale(int index = 0) { return (E.field_type == GD_LINCOM_ENTRY && - CheckIndex(E.field_type, E.n_fields, index)) ? E.m[index] : 0; + CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.m[index] : 0; } virtual std::complex<double> CScale(int index = 0) { return (E.field_type == GD_LINCOM_ENTRY && - CheckIndex(E.field_type, E.n_fields, index)) - ? std::complex<double>(E.cm[index][0], E.cm[index][1]) : 0; + CheckIndex(E.field_type, E.u.lincom.n_fields, index)) + ? std::complex<double>(E.u.lincom.cm[index][0], E.u.lincom.cm[index][1]) : 0; } virtual double Offset(int index = 0) { return (E.field_type == GD_LINCOM_ENTRY && - CheckIndex(E.field_type, E.n_fields, index)) ? E.b[index] : 0; + CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.b[index] : 0; } virtual std::complex<double> COffset(int index = 0) { return (E.field_type == GD_LINCOM_ENTRY && - CheckIndex(E.field_type, E.n_fields, index)) - ? std::complex<double>(E.cb[index][0], E.cb[index][1]) : 0; + CheckIndex(E.field_type, E.u.lincom.n_fields, index)) + ? std::complex<double>(E.u.lincom.cb[index][0], E.u.lincom.cb[index][1]) : 0; } /* LINTERP methods */ virtual const char *Table() { - return (E.field_type == GD_LINTERP_ENTRY) ? E.table : NULL; + return (E.field_type == GD_LINTERP_ENTRY) ? E.u.linterp.table : NULL; }; /* (S)BIT methods */ virtual gd_bit_t FirstBit() { - return (E.field_type == GD_BIT_ENTRY) ? E.bitnum : -1; + return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.bitnum : -1; }; virtual gd_bit_t NumBits() { - return (E.field_type == GD_BIT_ENTRY) ? E.numbits : -1; + return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.numbits : -1; }; /* PHASE methods */ virtual gd_shift_t Shift() { - return (E.field_type == GD_PHASE_ENTRY) ? E.shift : 0; + return (E.field_type == GD_PHASE_ENTRY) ? E.u.phase.shift : 0; }; /* CONST methods */ virtual DataType ConstType() { - return (E.field_type == GD_CONST_ENTRY) ? (DataType)E.const_type : + return (E.field_type == GD_CONST_ENTRY) ? (DataType)E.u.cons.type : Unknown; }; /* POLYNOM methods */ virtual int PolyOrd() { - return (E.field_type == GD_POLYNOM_ENTRY) ? E.poly_ord : 0; + return (E.field_type == GD_POLYNOM_ENTRY) ? E.u.polynom.poly_ord : 0; }; virtual double Coefficient(int index = 0) { - return (E.field_type == GD_POLYNOM_ENTRY && index <= E.poly_ord) - ? E.a[index] : 0; + return (E.field_type == GD_POLYNOM_ENTRY && index <= E.u.polynom.poly_ord) + ? E.u.polynom.a[index] : 0; } virtual std::complex<double> CCoefficient(int index = 0) { - return (E.field_type == GD_POLYNOM_ENTRY && index <= E.poly_ord) - ? std::complex<double>(E.ca[index][0], E.ca[index][1]) : 0; + return (E.field_type == GD_POLYNOM_ENTRY && index <= E.u.polynom.poly_ord) + ? std::complex<double>(E.u.polynom.ca[index][0], E.u.polynom.ca[index][1]) : 0; } /* RECIP methods */ virtual double Dividend() { - return (E.field_type == GD_RECIP_ENTRY) ? E.dividend : 0; + return (E.field_type == GD_RECIP_ENTRY) ? E.u.recip.dividend : 0; }; virtual std::complex<double> CDividend() { return (E.field_type == GD_RECIP_ENTRY) ? - std::complex<double>(E.cdividend[0], E.cdividend[1]) : 0; + std::complex<double>(E.u.recip.cdividend[0], E.u.recip.cdividend[1]) : 0; }; void SetName(const char* name); Modified: trunk/getdata/bindings/cxx/getdata/lincomentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/lincomentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/lincomentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -52,7 +52,7 @@ int fragment_index = 0); virtual const char *Input(int index = 0) { - return (CheckIndex(E.field_type, E.n_fields, index)) ? + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.in_fields[index] : NULL; }; @@ -61,25 +61,25 @@ } virtual int NFields() { - return E.n_fields; + return E.u.lincom.n_fields; }; virtual double Scale(int index = 0) { - return (CheckIndex(E.field_type, E.n_fields, index)) ? E.m[index] : 0; + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.m[index] : 0; }; virtual std::complex<double> CScale(int index = 0) { - return (CheckIndex(E.field_type, E.n_fields, index)) - ? std::complex<double>(E.cm[index][0], E.cm[index][1]) : 0; + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) + ? std::complex<double>(E.u.lincom.cm[index][0], E.u.lincom.cm[index][1]) : 0; }; virtual double Offset(int index = 0) { - return (CheckIndex(E.field_type, E.n_fields, index)) ? E.b[index] : 0; + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.b[index] : 0; }; virtual std::complex<double> COffset(int index = 0) { - return (CheckIndex(E.field_type, E.n_fields, index)) - ? std::complex<double>(E.cb[index][0], E.cb[index][1]) : 0; + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) + ? std::complex<double>(E.u.lincom.cb[index][0], E.u.lincom.cb[index][1]) : 0; }; virtual const char *Scalar(int index = 0); Modified: trunk/getdata/bindings/cxx/getdata/linterpentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/linterpentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/linterpentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -52,7 +52,7 @@ }; virtual const char *Table() { - return E.table; + return E.u.linterp.table; }; int SetInput(const char* field); Modified: trunk/getdata/bindings/cxx/getdata/phaseentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/phaseentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/phaseentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -52,7 +52,7 @@ }; virtual gd_shift_t Shift() { - return E.shift; + return E.u.phase.shift; }; int SetInput(const char* field); Modified: trunk/getdata/bindings/cxx/getdata/polynomentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/polynomentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/polynomentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -59,16 +59,16 @@ } virtual int PolyOrd() { - return E.poly_ord; + return E.u.polynom.poly_ord; }; virtual double Coefficient(int index = 0) { - return (index <= E.poly_ord) ? E.a[index] : 0; + return (index <= E.u.polynom.poly_ord) ? E.u.polynom.a[index] : 0; }; virtual std::complex<double> CCoefficient(int index = 0) { - return (index <= E.poly_ord) - ? std::complex<double>(E.ca[index][0], E.ca[index][1]) : 0; + return (index <= E.u.polynom.poly_ord) + ? std::complex<double>(E.u.polynom.ca[index][0], E.u.polynom.ca[index][1]) : 0; }; virtual const char *Scalar(int index = 0); Modified: trunk/getdata/bindings/cxx/getdata/rawentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -48,11 +48,11 @@ int fragment_index = 0); virtual gd_spf_t SamplesPerFrame() { - return E.spf; + return E.u.raw.spf; }; virtual DataType RawType() { - return (DataType)E.data_type; + return (DataType)E.u.raw.type; }; const char* FileName(); Modified: trunk/getdata/bindings/cxx/getdata/recipentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/recipentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/recipentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -63,11 +63,11 @@ } virtual double Dividend() { - return E.dividend; + return E.u.recip.dividend; }; virtual std::complex<double> CDividend() { - return std::complex<double>(E.cdividend[0], E.cdividend[1]); + return std::complex<double>(E.u.recip.cdividend[0], E.u.recip.cdividend[1]); }; virtual int SetInput(const char* field); Modified: trunk/getdata/bindings/cxx/getdata/sbitentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/sbitentry.h 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/getdata/sbitentry.h 2010-09-11 08:35:40 UTC (rev 444) @@ -52,11 +52,11 @@ }; virtual gd_bit_t FirstBit() { - return E.bitnum; + return E.u.bit.bitnum; }; virtual gd_bit_t NumBits() { - return E.numbits; + return E.u.bit.numbits; }; int SetInput(const char* field); Modified: trunk/getdata/bindings/cxx/lincomentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/lincomentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/lincomentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -37,13 +37,13 @@ E.field = strdup(field_code); E.field_type = GD_LINCOM_ENTRY; - E.n_fields = n_fields; + E.u.lincom.n_fields = n_fields; E.fragment_index = fragment_index; E.comp_scal = 0; for (i = 0; i < n_fields; ++i) { E.in_fields[i] = strdup(in_fields[i]); - E.m[i] = m[i]; - E.b[i] = b[i]; + E.u.lincom.m[i] = m[i]; + E.u.lincom.b[i] = b[i]; } } @@ -55,15 +55,15 @@ E.field = strdup(field_code); E.field_type = GD_LINCOM_ENTRY; - E.n_fields = n_fields; + E.u.lincom.n_fields = n_fields; E.fragment_index = fragment_index; E.comp_scal = 1; for (i = 0; i < n_fields; ++i) { E.in_fields[i] = strdup(in_fields[i]); - E.cm[i][0] = cm[i].real(); - E.cm[i][1] = cm[i].imag(); - E.cb[i][0] = cb[i].real(); - E.cb[i][1] = cb[i].imag(); + E.u.lincom.cm[i][0] = cm[i].real(); + E.u.lincom.cm[i][1] = cm[i].imag(); + E.u.lincom.cb[i][0] = cb[i].real(); + E.u.lincom.cb[i][1] = cb[i].imag(); } } @@ -91,8 +91,8 @@ if (index < 0 || index >= GD_MAX_LINCOM) return -1; - E.cm[index][0] = E.m[index] = scale; - E.cm[index][1] = 0; + E.u.lincom.cm[index][0] = E.u.lincom.m[index] = scale; + E.u.lincom.cm[index][1] = 0; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -118,8 +118,8 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) { - r = gd_get_constant(D->D, scale, GD_COMPLEX128, E.cm + index); - E.m[index] = E.cm[index][0]; + r = gd_get_constant(D->D, scale, GD_COMPLEX128, E.u.lincom.cm + index); + E.u.lincom.m[index] = E.u.lincom.cm[index][0]; } } @@ -131,8 +131,8 @@ if (index < 0 || index >= GD_MAX_LINCOM) return -1; - E.m[index] = E.cm[index][0] = scale.real(); - E.cm[index][1] = scale.imag(); + E.u.lincom.m[index] = E.u.lincom.cm[index][0] = scale.real(); + E.u.lincom.cm[index][1] = scale.imag(); E.comp_scal = 1; if (D != NULL) @@ -146,8 +146,8 @@ if (index < 0 || index >= GD_MAX_LINCOM) return -1; - E.cb[index][0] = E.b[index] = offset; - E.cb[index][1] = 0; + E.u.lincom.cb[index][0] = E.u.lincom.b[index] = offset; + E.u.lincom.cb[index][1] = 0; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -173,8 +173,8 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) { - r = gd_get_constant(D->D, scale, GD_COMPLEX128, E.cb + index); - E.b[index] = E.cb[index][0]; + r = gd_get_constant(D->D, scale, GD_COMPLEX128, E.u.lincom.cb + index); + E.u.lincom.b[index] = E.u.lincom.cb[index][0]; } } @@ -186,8 +186,8 @@ if (index < 0 || index >= GD_MAX_LINCOM) return -1; - E.b[index] = E.cb[index][0] = offset.real(); - E.cb[index][1] = offset.imag(); + E.u.lincom.b[index] = E.u.lincom.cb[index][0] = offset.real(); + E.u.lincom.cb[index][1] = offset.imag(); E.comp_scal = 1; if (D != NULL) @@ -198,7 +198,7 @@ int LincomEntry::SetNFields(int nfields) { - int old_n = E.n_fields; + int old_n = E.u.lincom.n_fields; if (nfields < 1 || nfields > GD_MAX_LINCOM) return -1; @@ -209,11 +209,11 @@ for (i = old_n; i < nfields; ++i) { free(E.in_fields[i]); E.in_fields[i] = strdup("INDEX"); - E.m[i] = E.b[i] = 0; + E.u.lincom.m[i] = E.u.lincom.b[i] = 0; } } - E.n_fields = nfields; + E.u.lincom.n_fields = nfields; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -223,7 +223,7 @@ const char *LincomEntry::Scalar(int index) { - if (index < 0 || index >= E.n_fields) + if (index < 0 || index >= E.u.lincom.n_fields) return NULL; return E.scalar[index]; Modified: trunk/getdata/bindings/cxx/linterpentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/linterpentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/linterpentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -35,7 +35,7 @@ E.field = strdup(field_code); E.field_type = GD_LINTERP_ENTRY; E.in_fields[0] = strdup(in_field); - E.table = strdup(table); + E.u.linterp.table = strdup(table); E.fragment_index = fragment_index; } @@ -62,8 +62,8 @@ if (ptr == NULL) return 0; - free(E.table); - E.table = ptr; + free(E.u.linterp.table); + E.u.linterp.table = ptr; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, move_table); Modified: trunk/getdata/bindings/cxx/phaseentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/phaseentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/phaseentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -35,7 +35,7 @@ E.field = strdup(field_code); E.field_type = GD_PHASE_ENTRY; E.in_fields[0] = strdup(in_field); - E.shift = shift; + E.u.phase.shift = shift; E.fragment_index = fragment_index; } @@ -57,7 +57,7 @@ int PhaseEntry::SetShift(gd_shift_t shift) { - E.shift = shift; + E.u.phase.shift = shift; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -79,7 +79,7 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) - r = gd_get_constant(D->D, shift, GD_INT64, &E.shift); + r = gd_get_constant(D->D, shift, GD_INT64, &E.u.phase.shift); } return r; Modified: trunk/getdata/bindings/cxx/polynomentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/polynomentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/polynomentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -36,12 +36,12 @@ E.field = strdup(field_code); E.field_type = GD_POLYNOM_ENTRY; - E.poly_ord = poly_ord; + E.u.polynom.poly_ord = poly_ord; E.fragment_index = fragment_index; E.comp_scal = 0; E.in_fields[0] = strdup(in_field); for (i = 0; i <= poly_ord; ++i) - E.a[i] = a[i]; + E.u.polynom.a[i] = a[i]; } PolynomEntry::PolynomEntry(const char* field_code, int poly_ord, @@ -52,13 +52,13 @@ E.field = strdup(field_code); E.field_type = GD_POLYNOM_ENTRY; - E.poly_ord = poly_ord; + E.u.polynom.poly_ord = poly_ord; E.fragment_index = fragment_index; E.comp_scal = 1; E.in_fields[0] = strdup(in_field); for (i = 0; i <= poly_ord; ++i) { - E.ca[i][0] = ca[i].real(); - E.ca[i][1] = ca[i].imag(); + E.u.polynom.ca[i][0] = ca[i].real(); + E.u.polynom.ca[i][1] = ca[i].imag(); } } @@ -83,8 +83,8 @@ if (index < 0 || index > GD_MAX_POLYORD) return -1; - E.ca[index][0] = E.a[index] = coeff; - E.ca[index][1] = 0; + E.u.polynom.ca[index][0] = E.u.polynom.a[index] = coeff; + E.u.polynom.ca[index][1] = 0; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -110,8 +110,8 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) { - r = gd_get_constant(D->D, scale, GD_COMPLEX128, E.ca + index); - E.a[index] = E.ca[index][0]; + r = gd_get_constant(D->D, scale, GD_COMPLEX128, E.u.polynom.ca + index); + E.u.polynom.a[index] = E.u.polynom.ca[index][0]; } } @@ -123,8 +123,8 @@ if (index < 0 || index > GD_MAX_POLYORD) return -1; - E.a[index] = E.ca[index][0] = coeff.real(); - E.ca[index][1] = coeff.imag(); + E.u.polynom.a[index] = E.u.polynom.ca[index][0] = coeff.real(); + E.u.polynom.ca[index][1] = coeff.imag(); E.comp_scal = 1; if (D != NULL) @@ -135,7 +135,7 @@ int PolynomEntry::SetPolyOrd(int poly_ord) { - int old_n = E.poly_ord; + int old_n = E.u.polynom.poly_ord; if (poly_ord < 2 || poly_ord > GD_MAX_POLYORD) return -1; @@ -144,10 +144,10 @@ int i; for (i = old_n + 1; i <= poly_ord; ++i) - E.a[i] = 0; + E.u.polynom.a[i] = 0; } - E.poly_ord = poly_ord; + E.u.polynom.poly_ord = poly_ord; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -157,7 +157,7 @@ const char *PolynomEntry::Scalar(int index) { - if (index < 0 || index > E.poly_ord) + if (index < 0 || index > E.u.polynom.poly_ord) return NULL; return E.scalar[index]; Modified: trunk/getdata/bindings/cxx/rawentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/rawentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/rawentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -35,14 +35,14 @@ { E.field = strdup(field_code); E.field_type = GD_RAW_ENTRY; - E.spf = spf; - E.data_type = (gd_type_t)data_type; + E.u.raw.spf = spf; + E.u.raw.type = (gd_type_t)data_type; E.fragment_index = fragment_index; } int RawEntry::SetSamplesPerFrame(gd_spf_t spf, int recode) { - E.spf = spf; + E.u.raw.spf = spf; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, recode); @@ -64,7 +64,7 @@ r = gd_alter_entry(D->D, E.field, &E, recode); if (!r) - r = gd_get_constant(D->D, spf, GD_UINT16, &E.spf); + r = gd_get_constant(D->D, spf, GD_UINT16, &E.u.raw.spf); } return r; @@ -72,7 +72,7 @@ int RawEntry::SetType(DataType type, int recode) { - E.data_type = (gd_type_t)type; + E.u.raw.type = (gd_type_t)type; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, recode); Modified: trunk/getdata/bindings/cxx/recipentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/recipentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/recipentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -36,8 +36,8 @@ E.field_type = GD_RECIP_ENTRY; E.in_fields[0] = strdup(in_field1); E.scalar[0] = 0; - E.cdividend[0] = E.dividend = dividend; - E.cdividend[1] = 0; + E.u.recip.cdividend[0] = E.u.recip.dividend = dividend; + E.u.recip.cdividend[1] = 0; E.comp_scal = 0; E.fragment_index = fragment_index; } @@ -49,8 +49,8 @@ E.field_type = GD_RECIP_ENTRY; E.in_fields[0] = strdup(in_field1); E.scalar[0] = 0; - E.cdividend[0] = E.dividend = dividend.real(); - E.cdividend[1] = dividend.imag(); + E.u.recip.cdividend[0] = E.u.recip.dividend = dividend.real(); + E.u.recip.cdividend[1] = dividend.imag(); E.comp_scal = 1; E.fragment_index = fragment_index; } @@ -73,8 +73,8 @@ int RecipEntry::SetDividend(double dividend) { - E.cdividend[0] = E.dividend = dividend; - E.cdividend[1] = 0; + E.u.recip.cdividend[0] = E.u.recip.dividend = dividend; + E.u.recip.cdividend[1] = 0; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -97,8 +97,8 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) { - r = gd_get_constant(D->D, scale, GD_COMPLEX128, &E.cdividend); - E.dividend = E.cdividend[0]; + r = gd_get_constant(D->D, scale, GD_COMPLEX128, &E.u.recip.cdividend); + E.u.recip.dividend = E.u.recip.cdividend[0]; } } @@ -107,8 +107,8 @@ int RecipEntry::SetDividend(std::complex<double> dividend) { - E.dividend = E.cdividend[0] = dividend.real(); - E.cdividend[1] = dividend.imag(); + E.u.recip.dividend = E.u.recip.cdividend[0] = dividend.real(); + E.u.recip.cdividend[1] = dividend.imag(); E.comp_scal = 1; if (D != NULL) Modified: trunk/getdata/bindings/cxx/sbitentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/sbitentry.cpp 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/cxx/sbitentry.cpp 2010-09-11 08:35:40 UTC (rev 444) @@ -35,8 +35,8 @@ E.field = strdup(field_code); E.field_type = GD_BIT_ENTRY; E.in_fields[0] = strdup(in_field); - E.bitnum = bitnum; - E.numbits = numbits; + E.u.bit.bitnum = bitnum; + E.u.bit.numbits = numbits; E.fragment_index = fragment_index; } @@ -58,7 +58,7 @@ int SBitEntry::SetFirstBit(gd_bit_t first_bit) { - E.bitnum = first_bit; + E.u.bit.bitnum = first_bit; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -68,7 +68,7 @@ int SBitEntry::SetNumBits(gd_bit_t num_bits) { - E.numbits = num_bits; + E.u.bit.numbits = num_bits; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -98,7 +98,7 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) - r = gd_get_constant(D->D, first_bit, GD_INT16, &E.bitnum); + r = gd_get_constant(D->D, first_bit, GD_INT16, &E.u.bit.bitnum); } return r; @@ -118,7 +118,7 @@ r = gd_alter_entry(D->D, E.field, &E, 0); if (!r) - r = gd_get_constant(D->D, num_bits, GD_INT16, &E.numbits); + r = gd_get_constant(D->D, num_bits, GD_INT16, &E.u.bit.numbits); } return r; Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-08-11 00:59:43 UTC (rev 443) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-09-11 08:35:40 UTC (rev 444) @@ -170,7 +170,7 @@ void F77_FUNC(gdopen, GDOPEN) (int* dirfile, const char* dirfilename, const int* dirfilename_l, const int* flags) { - char* out = malloc(*dirfilename_l + 1); + char* out = (char *)malloc(*dirfilename_l + 1); *dirfile = _GDF_SetDirfile(gd_open(_GDF_CString(out, dirfilename, *dirfilename_l), *flags)); @@ -197,7 +197,7 @@ if (field_code_l == 0) gd_flush(_GDF_GetDirfile(*dirfile), NULL); else { - out = malloc(*field_code_l + 1); + out = (char *)malloc(*field_code_l + 1); gd_flush(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l)); free(out); @@ -211,7 +211,7 @@ const int* num_frames, const int* num_samples, const int* return_type, void* data_out) { - char* out = malloc(*field_code_l + 1); + 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); @@ -243,7 +243,7 @@ size_t len = 0; DIRFILE* D = _GDF_GetDirfile(*dirfile); - char* pa = malloc(*parent_l + 1); + char* pa = (char *)malloc(*parent_l + 1); _GDF_CString(pa, parent, *parent_l); unsigned int i, nfields = gd_nmfields(D, pa); @@ -288,7 +288,7 @@ const char** fl; DIRFILE* D = _GDF_GetDirfile(*dirfile); - char* pa = malloc(*parent_l + 1); + char* pa = (char *)malloc(*parent_l + 1); _GDF_CString(pa, parent, *parent_l); unsigned int nfields = gd_nmfields(D, pa); @@ -316,7 +316,7 @@ void F77_FUNC(gdgbof, GDGBOF) (int* bof, const int* dirfile, const char* field_code, const int* field_code_l) { - char *fc = malloc(*field_code_l + 1); + char *fc = (char *)malloc(*field_code_l + 1); *bof = gd_bof(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l)); free(fc); @@ -326,7 +326,7 @@ void F77_FUNC(gdgeof, GDGEOF) (int* eof, const int* dirfile, const char* field_code, const int* field_code_l) { - char *fc = malloc(*field_code_l + 1); + char *fc = (char *)malloc(*field_code_l + 1); *eof = gd_eof(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l)); free(fc); @@ -342,7 +342,7 @@ void F77_FUNC(gdgspf, GDGSPF) (int* spf, const int* dirfile, const char* field_code, const int* field_code_l) { - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); *spf = gd_spf(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l)); free(out); @@ -354,7 +354,7 @@ const int* first_sample, const int* num_frames, const int* num_samples, const int* data_type, const void* data_in) { - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); *n_wrote = gd_putdata(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), *first_frame, *first_sample, *num_frames, *num_samples, (gd_type_t)*data_type, data_in); @@ -391,7 +391,7 @@ { dtrace("%p, %i, %p, %i", type, *dirfile, field_code, *field_code_l); - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); *type = (int)gd_entry_type(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l)); @@ -408,15 +408,15 @@ dtrace("%p, %p, %p, %i, %p, %i", spf, dtype, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), &E) || E.field_type != GD_RAW_ENTRY) *spf = 0; else { - *spf = E.spf; - *dtype = E.data_type; + *spf = E.u.raw.spf; + *dtype = E.u.raw.type; *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -439,30 +439,30 @@ infield3, infield3_l, m3, b3, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), &E) || E.field_type != GD_LINCOM_ENTRY) *nfields = 0; else { - *nfields = E.n_fields; + *nfields = E.u.lincom.n_fields; *fragment_index = E.fragment_index; _GDF_FString(infield1, infield1_l, E.in_fields[0]); - *m1 = E.m[0]; - *b1 = E.b[0]; + *m1 = E.u.lincom.m[0]; + *b1 = E.u.lincom.b[0]; - if (E.n_fields > 1) { + if (E.u.lincom.n_fields > 1) { _GDF_FString(infield2, infield2_l, E.in_fields[1]); - *m2 = E.m[1]; - *b2 = E.b[1]; + *m2 = E.u.lincom.m[1]; + *b2 = E.u.lincom.b[1]; } - if (E.n_fields > 2) { + if (E.u.lincom.n_fields > 2) { _GDF_FString(infield3, infield3_l, E.in_fields[2]); - *m3 = E.m[2]; - *b3 = E.b[2]; + *m3 = E.u.lincom.m[2]; + *b3 = E.u.lincom.b[2]; } gd_free_entry_strings(&E); @@ -473,9 +473,9 @@ } void F77_FUNC(gdgecl, GDGECL) (int* nfields, - char* infield1, int* infield1_l, double complex* m1, double complex* b1, - char* infield2, int* infield2_l, double complex* m2, double complex* b2, - char* infield3, int* infield3_l, double complex* m3, double complex* b3, + char* infield1, int* infield1_l, GD_DCOMPLEXP(m1), GD_DCOMPLEXP(b1), + char* infield2, int* infield2_l, GD_DCOMPLEXP(m2), GD_DCOMPLEXP(b2), + char* infield3, int* infield3_l, GD_DCOMPLEXP(m3), GD_DCOMPLEXP(b3), int* fragment_index, const int* dirfile, const char* field_code, const int* field_code_l) { @@ -484,7 +484,7 @@ infield3, infield3_l, m3, b3, fragment_index, *dirfile, field_code, *field_code_l); - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, @@ -494,23 +494,23 @@ *nfields = 0; gd_free_entry_strings(&E); } else { - *nfields = E.n_fields; + *nfields = E.u.lincom.n_fields; *fragment_index = E.fragment_index; _GDF_FString(infield1, infield1_l, E.in_fields[0]); - *m1 = E.cm[0]; - *b1 = E.cb[0]; + _gd_c2cp(m1, E.u.lincom.cm[0]); + _gd_c2cp(b1, E.u.lincom.cb[0]); - if (E.n_fields > 1) { + if (E.u.lincom.n_fields > 1) { _GDF_FString(infield2, infield2_l, E.in_fields[1]); - *m2 = E.cm[1]; - *b2 = E.cb[1]; + _gd_c2cp(m2, E.u.lincom.cm[1]); + _gd_c2cp(b2, E.u.lincom.cb[1]); } - if (E.n_fields > 2) { + if (E.u.lincom.n_fields > 2) { _GDF_FString(infield3, infield3_l, E.in_fields[2]); - *m3 = E.cm[2]; - *b3 = E.cb[2]; + _gd_c2cp(m3, E.u.lincom.cm[2]); + _gd_c2cp(b3, E.u.lincom.cb[2]); } gd_free_entry_strings(&E); } @@ -530,30 +530,30 @@ infield, *infield_l, a0, a1, a2, a3, a4, a5, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), &E) || E.field_type != GD_POLYNOM_ENTRY) *poly_ord = 0; else { - *poly_ord = E.poly_ord; + *poly_ord = E.u.polynom.poly_ord; *fragment_index = E.fragment_index; _GDF_FString(infield, infield_l, E.in_fields[0]); - switch (E.poly_ord) { + switch (E.u.polynom.poly_ord) { case 5: - *a5 = E.a[5]; + *a5 = E.u.polynom.a[5]; case 4: - *a4 = E.a[4]; + *a4 = E.u.polynom.a[4]; case 3: - *a3 = E.a[3]; + *a3 = E.u.polynom.a[3]; case 2: - *a2 = E.a[2]; + *a2 = E.u.polynom.a[2]; case 1: - *a1 = E.a[1]; - *a0 = E.a[0]; + *a1 = E.u.polynom.a[1]; + *a0 = E.u.polynom.a[0]; } gd_free_entry_strings(&E); } @@ -563,8 +563,8 @@ } void F77_FUNC(gdgecp, GDGECP) (int* poly_ord, char* infield, int* infield_l, - double complex* a0, double complex* a1, double complex* a2, - double complex* a3, double complex* a4, double complex* a5, + GD_DCOMPLEXP(a0), GD_DCOMPLEXP(a1), GD_DCOMPLEXP(a2), + GD_DCOMPLEXP(a3), GD_DCOMPLEXP(a4), GD_DCOMPLEXP(a5), int* fragment_index, const int* dirfile, const char* field_code, const int* field_code_l) { @@ -572,30 +572,30 @@ infield, *infield_l, a0, a1, a2, a3, a4, a5, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), &E) || E.field_type != GD_POLYNOM_ENTRY) *poly_ord = 0; else { - *poly_ord = E.poly_ord; + *poly_ord = E.u.polynom.poly_ord; *fragment_index = E.fragment_index; _GDF_FString(infield, infield_l, E.in_fields[0]); - switch (E.poly_ord) { + switch (E.u.polynom.poly_ord) { case 5: - *a5 = E.ca[5]; + _gd_c2cp(a5, E.u.polynom.ca[5]); case 4: - *a4 = E.ca[4]; + _gd_c2cp(a4, E.u.polynom.ca[4]); case 3: - *a3 = E.ca[3]; + _gd_c2cp(a3, E.u.polynom.ca[3]); case 2: - *a2 = E.ca[2]; + _gd_c2cp(a2, E.u.polynom.ca[2]); case 1: - *a1 = E.ca[1]; - *a0 = E.ca[0]; + _gd_c2cp(a1, E.u.polynom.ca[1]); + _gd_c2cp(a0, E.u.polynom.ca[0]); } gd_free_entry_strings(&E); } @@ -613,14 +613,14 @@ dtrace("%p, %i, %p, %i, %p, %i, %p, %i", in_field, *in_field_l, table, *table_l, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), &E) || E.field_type != GD_LINTERP_ENTRY) *in_field_l = 0; else { - _GDF_FString(table, table_l, E.table); + _GDF_FString(table, table_l, E.u.linterp.table); _GDF_FString(in_field, in_field_l, E.in_fields[0]); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); @@ -638,7 +638,7 @@ dtrace("%p, %i, %p, %p, %p, %i, %p, %i", in_field, *in_field_l, bitnum, numbits, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -646,8 +646,8 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *bitnum = E.bitnum; - *numbits = E.numbits; + *bitnum = E.u.bit.bitnum; + *numbits = E.u.bit.numbits; *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -664,7 +664,7 @@ dtrace("%p, %i, %p, %p, %p, %i, %p, %i", in_field, *in_field_l, bitnum, numbits, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -672,8 +672,8 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *bitnum = E.bitnum; - *numbits = E.numbits; + *bitnum = E.u.bit.bitnum; + *numbits = E.u.bit.numbits; *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -691,7 +691,7 @@ in_field2, *in_field2_l, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -717,7 +717,7 @@ in_field2, *in_field2_l, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -743,7 +743,7 @@ dtrace("%p, %i, %p, %p, %i, %p, %i", in_field, *in_field_l, dividend, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -751,7 +751,7 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *dividend = E.dividend; + *dividend = E.u.recip.dividend; *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -762,13 +762,13 @@ } void F77_FUNC(gdgecr, GDGECR) (char* in_field, int* in_field_l, - complex double* cdividend, int* fragment_index, const int* dirfile, + GD_DCOMPLEXP(cdividend), int* fragment_index, const int* dirfile, const char* field_code, const int* field_code_l) { dtrace("%p, %i, %p, %p, %i, %p, %i", in_field, *in_field_l, cdividend, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -776,7 +776,7 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *cdividend = E.cdividend; + _gd_c2cp(cdividend, E.u.recip.cdividend); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -794,7 +794,7 @@ dtrace("%p, %i, %p, %p, %i, %p, %i", in_field, *in_field_l, shift, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, @@ -802,7 +802,7 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *shift = E.shift; + *shift = E.u.phase.shift; *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -818,14 +818,14 @@ dtrace("%p, %p, %i, %p, %i", data_type, fragment_index, *dirfile, field_code, *field_code_l); - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_entry_t E; if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), &E) || E.field_type != GD_CONST_ENTRY) *data_type = 0; else { - *data_type = E.const_type; + *data_type = E.u.cons.type; *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -838,7 +838,7 @@ void F77_FUNC(gdfrgi, GDFRGI) (int* fragment_index, const int* dirfile, const char* field_code, const int* field_code_l) { - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); *fragment_index = gd_fragment_index(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l)); @@ -851,7 +851,7 @@ const int* field_code_l, const int* data_type, const int* spf, const int* fragment_index) { - char* out = malloc(*field_code_l + 1); + char* out = (char *)malloc(*field_code_l + 1); gd_add_raw(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, *field_code_l), (gd_type_t)(*data_type), (gd_spf_t)*spf, *fragment_index); @@ -866,28 +866,28 @@ const double* b2, const char* in_field3, const int* in_field3_l, const double* m3, const double* b3, const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); char* in_fields[3] = {NULL, NULL, NULL}; double m[3] = {0, 0, 0}; double b[3] = {0, 0, 0}; int nf = *n_fields; if (nf > 0) { - in_fields[0] = malloc(*in_field1_l + 1); + in_fields[0] = (char *)malloc(*in_field1_l + 1); _GDF_CString(in_fields[0], in_field1, *in_field1_l); m[0] = *m1; b[0] = *b1; } if (nf > 1) { - in_fields[1] = malloc(*in_field2_l + 1); + in_fields[1] = (char *)malloc(*in_field2_l + 1); _GDF_CString(in_fields[1], in_field2, *in_field2_l); m[1] = *m2; b[1] = *b2; } if (nf > 2) { - in_fields[2] = malloc(*in_field3_l + 1); + in_fields[2] = (char *)malloc(*in_field3_l + 1); _GDF_CString(in_fields[2], in_field3, *in_field3_l); m[2] = *m3; b[2] = *b3; @@ -903,37 +903,42 @@ void F77_FUNC(gdadcl, GDADCL) (const int* dirfile, const char* field_code, const int* field_code_l, const int* n_fields, const char* in_field1, - const int* in_field1_l, const double complex* m1, const double complex* b1, - const char* in_field2, const int* in_field2_l, const double complex* m2, - const double complex* b2, const char* in_field3, const int* in_field3_l, - const double complex* m3, const double complex* b3, + const int* in_field1_l, const GD_DCOMPLEXP(m1), const GD_DCOMPLEXP(b1), + const char* in_field2, const int* in_field2_l, const GD_DCOMPLEXP(m2), + const GD_DCOMPLEXP(b2), const char* in_field3, const int* in_field3_l, + const GD_DCOMPLEXP(m3), const GD_DCOMPLEXP(b3), const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); char* in_fields[3] = {NULL, NULL, NULL}; +#ifdef GD_NO_C99_API + double cm[6] = {0, 0, 0, 0, 0, 0}; + double cb[6] = {0, 0, 0, 0, 0, 0}; +#else double complex cm[3] = {0, 0, 0}; double complex cb[3] = {0, 0, 0}; +#endif int nf = *n_fields; if (nf > 0) { - in_fields[0] = malloc(*in_field1_l + 1); + in_fields[0] = (char *)malloc(*in_field1_l + 1); _GDF_CString(in_fields[0], in_field1, *in_field1_l); - cm[0] = *m1; - cb[0] = *b1; + _gd_cp2ca(cm, 0, m1); + _gd_cp2ca(cb, 0, b1); } if (nf > 1) { - in_fields[1] = malloc(*in_field2_l + 1); + in_fields[1] = (char *)malloc(*in_field2_l + 1); _GDF_CString(in_fields[1], in_field2, *in_field2_l); - cm[1] = *m2; - cb[1] = *b2; + _gd_cp2ca(cm, 1, m2); + _gd_cp2ca(cb, 1, b2); } if (nf > 2) { - in_fields[2] = malloc(*in_field3_l + 1); + in_fields[2] = (char *)malloc(*in_field3_l + 1); _GDF_CString(in_fields[2], in_field3, *in_field3_l); - cm[2] = *m3; - cb[2] = *b3; + _gd_cp2ca(cm, 2, m3); + _gd_cp2ca(cb, 2, b3); } gd_add_clincom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, @@ -951,14 +956,14 @@ const double* a3, const double* a4, const double* a5, const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); char* inf = NULL; double a[6] = {0, 0, 0, 0, 0, 0}; int po = *poly_ord; if (po > 5) po = 5; - inf = malloc(*in_field_l + 1); + inf = (char *)malloc(*in_field_l + 1); _GDF_CString(inf, in_field, *in_field_l); switch (po) { @@ -983,33 +988,37 @@ void F77_FUNC(gdadcp, GDADCP) (const int* dirfile, const char* field_code, const int* field_code_l, const int* poly_ord, const char* in_field, - const int* in_field_l, const double complex* a0, const double complex* a1, - const double complex* a2, const double complex* a3, - const double complex* a4, const double complex* a5, + const int* in_field_l, const GD_DCOMPLEXP(a0), const GD_DCOMPLEXP(a1), + const GD_DCOMPLEXP(a2), const GD_DCOMPLEXP(a3), + const GD_DCOMPLEXP(a4), const GD_DCOMPLEXP(a5), const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); char* inf = NULL; +#ifdef GD_NO_C99_API + double ca[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#else double complex ca[6] = {0, 0, 0, 0, 0, 0}; +#endif int po = *poly_ord; if (po > 5) po = 5; - inf = malloc(*in_field_l + 1); + inf = (char *)malloc(*in_field_l + 1); _GDF_CString(inf, in_field, *in_field_l); switch (po) { case 5: - ca[5] = *a5; + _gd_cp2ca(ca, 5, a5); case 4: - ca[4] = *a4; + _gd_cp2ca(ca, 4, a4); case 3: - ca[3] = *a3; + _gd_cp2ca(ca, 3, a3); case 2: - ca[2] = *a2; + _gd_cp2ca(ca, 2, a2); case 1: - ca[1] = *a1; - ca[0] = *a0; + _gd_cp2ca(ca, 1, a1); + _gd_cp2ca(ca, 0, a0); } gd_add_cpolynom(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, @@ -1023,9 +1032,9 @@ const int* field_code_l, const char* in_field, const int* in_field_l, const char* table, const int* table_l, const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); - char* in = malloc(*in_field_l + 1); - char* tab = malloc(*table_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); + char* in = (char *)malloc(*in_field_l + 1); + char* tab = (char *)malloc(*table_l + 1); gd_add_linterp(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l), _GDF_CString(in, in_field, *in_field_l), @@ -1040,8 +1049,8 @@ const int* field_code_l, const char* in_field, const int* in_field_l, const int* bitnum, const int* numbits, const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); - char* in = malloc(*in_field_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); + char* in = (char *)malloc(*in_field_l + 1); gd_add_bit(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l), _GDF_CString(in, in_field, *in_field_l), @@ -1055,8 +1064,8 @@ const int* field_code_l, const char* in_field, const int* in_field_l, const int* bitnum, const int* numbits, const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); - char* in = malloc(*in_field_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); + char* in = (char *)malloc(*in_field_l + 1); gd_add_sbit(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l), _GDF_CString(in, in_field, *in_field_l), @@ -1070,9 +1079,9 @@ const int* field_code_l, const char* in_field1, const int* in_field1_l, const char* in_field2, const int* in_field2_l, const int* fragment_index) { - char* fc = malloc(*field_code_l + 1); - char* in1 = malloc(*in_field1_l + 1); - char* in2 = malloc(*in_field2_l + 1); + char* fc = (char *)malloc(*field_code_l + 1); + char* in1 = (char *)m... [truncated message content] |
From: <ket...@us...> - 2010-09-11 19:37:45
|
Revision: 445 http://getdata.svn.sourceforge.net/getdata/?rev=445&view=rev Author: ketiltrout Date: 2010-09-11 19:37:39 +0000 (Sat, 11 Sep 2010) Log Message: ----------- More mingw fixes. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/util/dirfile2ascii.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-09-11 08:35:40 UTC (rev 444) +++ trunk/getdata/ChangeLog 2010-09-11 19:37:39 UTC (rev 445) @@ -1,3 +1,10 @@ +2010-09-11 D. V. Wiebe <ge...@ke...> svn:445 + * bindings/f77/fgetdata.c (GDFNSS): Don't call the explicitly 64-bit + version of gd_framenum_subset. + + * util/dirfile2ascii.c: Unroll type_data initialisation some more. + + 2010-09-11 D. V. Wiebe <ge...@ke...> svn:444 * test/ src/ bindings/ util/: ANSI-C-ify. * src/getdata.h.in: Define GD_NO_C99_API when the C99-compliant API has been Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-09-11 08:35:40 UTC (rev 444) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-09-11 19:37:39 UTC (rev 445) @@ -2478,7 +2478,7 @@ *field_code_l, *value, *start, *end); char *fc = (char *)malloc(*field_code_l + 1); - *framenum = gd_framenum_subset64(_GDF_GetDirfile(*dirfile), + *framenum = gd_framenum_subset(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, *field_code_l), *value, *start, *end); free(fc); Modified: trunk/getdata/util/dirfile2ascii.c =================================================================== --- trunk/getdata/util/dirfile2ascii.c 2010-09-11 08:35:40 UTC (rev 444) +++ trunk/getdata/util/dirfile2ascii.c 2010-09-11 19:37:39 UTC (rev 445) @@ -181,19 +181,32 @@ int t; const char* f; } type_data[0x7f]; - type_data[(int)'a'] = { READ_AS_DOUBLE, "a" }; - type_data[(int)'A'] = { READ_AS_DOUBLE, "A" }; - type_data[(int)'e'] = { READ_AS_DOUBLE, "e" }; - type_data[(int)'E'] = { READ_AS_DOUBLE, "E" }; - type_data[(int)'f'] = { READ_AS_DOUBLE, "f" }; - type_data[(int)'F'] = { READ_AS_DOUBLE, "F" }; - type_data[(int)'g'] = { READ_AS_DOUBLE, "g" }; - type_data[(int)'G'] = { READ_AS_DOUBLE, "G" }; - type_data[(int)'i'] = { READ_AS_INT, PRIi64 }; - type_data[(int)'o'] = { READ_AS_UINT, PRIo64 }; - type_data[(int)'u'] = { READ_AS_UINT, PRIu64 }; - type_data[(int)'x'] = { READ_AS_UINT, PRIx64 }; - type_data[(int)'X'] = { READ_AS_UINT, PRIX64 }; + type_data[(int)'a'].t = READ_AS_DOUBLE; + type_data[(int)'a'].f = "a"; + type_data[(int)'A'].t = READ_AS_DOUBLE; + type_data[(int)'A'].f = "A"; + type_data[(int)'e'].t = READ_AS_DOUBLE; + type_data[(int)'e'].f = "e"; + type_data[(int)'E'].t = READ_AS_DOUBLE; + type_data[(int)'E'].f = "E"; + type_data[(int)'f'].t = READ_AS_DOUBLE; + type_data[(int)'f'].f = "f"; + type_data[(int)'F'].t = READ_AS_DOUBLE; + type_data[(int)'F'].f = "F"; + type_data[(int)'g'].t = READ_AS_DOUBLE; + type_data[(int)'g'].f = "g"; + type_data[(int)'G'].t = READ_AS_DOUBLE; + type_data[(int)'G'].f = "G"; + type_data[(int)'i'].t = READ_AS_INT; + type_data[(int)'i'].f = PRIi64; + type_data[(int)'o'].t = READ_AS_UINT; + type_data[(int)'o'].f = PRIo64; + type_data[(int)'u'].t = READ_AS_UINT; + type_data[(int)'u'].f = PRIu64; + type_data[(int)'x'].t = READ_AS_UINT; + type_data[(int)'x'].f = PRIx64; + type_data[(int)'X'].t = READ_AS_UINT; + type_data[(int)'X'].f = PRIX64; while ((c = getopt_long(argc, argv, "-f:n:d:x:X:g:G:e:E:a:A:F:i:o:p:s:bvqh?", longopts, &optind)) != -1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-09-15 00:14:56
|
Revision: 446 http://getdata.svn.sourceforge.net/getdata/?rev=446&view=rev Author: ketiltrout Date: 2010-09-15 00:14:49 +0000 (Wed, 15 Sep 2010) Log Message: ----------- As Ted points out, EOF isn't really a good member name. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/cxx/dirfile.cpp trunk/getdata/bindings/cxx/getdata/dirfile.h Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-09-11 19:37:39 UTC (rev 445) +++ trunk/getdata/ChangeLog 2010-09-15 00:14:49 UTC (rev 446) @@ -1,3 +1,6 @@ +2010-09-15 D. V. Wiebe <ge...@ke...> svn:446 + * bindings/cxx/dirfile.cpp (Dirfile::EoF Dirfile::BoF): Renamed. + 2010-09-11 D. V. Wiebe <ge...@ke...> svn:445 * bindings/f77/fgetdata.c (GDFNSS): Don't call the explicitly 64-bit version of gd_framenum_subset. Modified: trunk/getdata/bindings/cxx/dirfile.cpp =================================================================== --- trunk/getdata/bindings/cxx/dirfile.cpp 2010-09-11 19:37:39 UTC (rev 445) +++ trunk/getdata/bindings/cxx/dirfile.cpp 2010-09-15 00:14:49 UTC (rev 446) @@ -236,12 +236,12 @@ return gd_nframes(D); } -off_t Dirfile::EOF(const char *field_code) +off_t Dirfile::EoF(const char *field_code) { return gd_eof(D, field_code); } -off_t Dirfile::BOF(const char *field_code) +off_t Dirfile::BoF(const char *field_code) { return gd_bof(D, field_code); } Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-09-11 19:37:39 UTC (rev 445) +++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-09-15 00:14:49 UTC (rev 446) @@ -29,9 +29,7 @@ // C99 _Complex keyword #define GD_C89_API -extern "C" { #include <getdata.h> -} #include <getdata/fragment.h> #include <getdata/entry.h> @@ -87,7 +85,7 @@ int AlterSpec(const char* spec, int recode = 0); - off_t BOF(const char *field_code); + off_t BoF(const char *field_code); int Close(); @@ -99,7 +97,7 @@ GetData::Entry* Entry(const char *field_code); - off_t EOF(const char *field_code); + off_t EoF(const char *field_code); int Error(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-09-17 20:17:14
|
Revision: 447 http://getdata.svn.sourceforge.net/getdata/?rev=447&view=rev Author: ketiltrout Date: 2010-09-17 20:17:08 +0000 (Fri, 17 Sep 2010) Log Message: ----------- Remove hardcoded -Wall. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/cxx/Makefile.am trunk/getdata/bindings/cxx/test/Makefile.am trunk/getdata/bindings/cxx/test/big_test.cpp trunk/getdata/bindings/f77/Makefile.am trunk/getdata/bindings/f77/test/Makefile.am trunk/getdata/bindings/idl/Makefile.am trunk/getdata/bindings/python/Makefile.am trunk/getdata/configure.ac trunk/getdata/m4/compiler.m4 trunk/getdata/src/Makefile.am trunk/getdata/test/Makefile.am trunk/getdata/util/Makefile.am Property Changed: ---------------- trunk/getdata/ Property changes on: trunk/getdata ___________________________________________________________________ Modified: svn:ignore - Makefile Makefile.in aclocal.m4 autom4te.cache config.log config.guess config.status config.sub configure depcomp getdata-*.tar.gz getdata-*.tar.bz2 getdata-*.sig install-sh libtool ltmain.sh missing *.swp libltdl RELEASE_NOTES-* config.lt + Makefile Makefile.in aclocal.m4 autom4te.cache config.log config.guess config.status config.sub configure depcomp getdata-*.tar.gz getdata-*.tar.bz2 getdata-*.sig install-sh libtool ltmain.sh missing *.swp libltdl RELEASE_NOTES-* config.lt compile Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/ChangeLog 2010-09-17 20:17:08 UTC (rev 447) @@ -1,3 +1,14 @@ +2010-09-17 D. V. Wiebe <ge...@ke...> svn:447 + * test/Makefile.am src/Makefile.am bindings/python/Makefile.am + bindings/cxx/Makefile.am bindings/f77/test/Makefile.am + bindings/f77/Makefile.am bindings/idl/Makefile.am util/Makefile.am: Remove + hardcoded -Wall. + * m4/compiler.m4 (GD_PROG_CC_WALL GD_PROG_CXX_WALL GD_PROG_FC_WALL + GD_PROG_F77_WALL): Added. + * configure.ac: Check whether the compilers accept -Wall + + * bindings/cxx/big_test.cpp: Fix for renamed functions. + 2010-09-15 D. V. Wiebe <ge...@ke...> svn:446 * bindings/cxx/dirfile.cpp (Dirfile::EoF Dirfile::BoF): Renamed. @@ -7,7 +18,6 @@ * util/dirfile2ascii.c: Unroll type_data initialisation some more. - 2010-09-11 D. V. Wiebe <ge...@ke...> svn:444 * test/ src/ bindings/ util/: ANSI-C-ify. * src/getdata.h.in: Define GD_NO_C99_API when the C99-compliant API has been Modified: trunk/getdata/bindings/cxx/Makefile.am =================================================================== --- trunk/getdata/bindings/cxx/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/cxx/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -21,11 +21,15 @@ AUTOMAKE_OPTIONS = foreign getdata_includedir = ${includedir}/getdata +if CXX_WALL +WALL=-Wall +endif + if CXX_WEXTRA WEXTRA=-Wextra endif -INCLUDES = -Wall $(WEXTRA) -I$(top_srcdir)/src +INCLUDES = ${WALL} $(WEXTRA) -I$(top_srcdir)/src SUBDIRS=test Modified: trunk/getdata/bindings/cxx/test/Makefile.am =================================================================== --- trunk/getdata/bindings/cxx/test/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/cxx/test/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,11 +20,15 @@ # AUTOMAKE_OPTIONS = foreign +if CXX_WALL +WALL=-Wall +endif + if CXX_WEXTRA WEXTRA=-Wextra endif -INCLUDES = -Wall $(WEXTRA) -I$(srcdir)/.. -I$(top_srcdir)/src -D__TEST__=\"$@\" +INCLUDES = ${WALL} $(WEXTRA) -I$(srcdir)/.. -I$(top_srcdir)/src -D__TEST__=\"$@\" LDADD=../libgetdata++.la TESTS=big_test Modified: trunk/getdata/bindings/cxx/test/big_test.cpp =================================================================== --- trunk/getdata/bindings/cxx/test/big_test.cpp 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/cxx/test/big_test.cpp 2010-09-17 20:17:08 UTC (rev 447) @@ -1029,13 +1029,13 @@ CHECK_OK(101); CHECK_DOUBLE(101,dp,37.0375); - // 86: Dirfile::EOF check - n = d->EOF("lincom"); + // 86: Dirfile::EoF check + n = d->EoF("lincom"); CHECK_OK(86); CHECK_INT(86,n,344); - // 142: Dirfile::BOF check - n = d->BOF("lincom"); + // 142: Dirfile::BoF check + n = d->BoF("lincom"); CHECK_OK(142); CHECK_INT(142,n,264); Modified: trunk/getdata/bindings/f77/Makefile.am =================================================================== --- trunk/getdata/bindings/f77/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/f77/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -25,13 +25,20 @@ if FC_WEXTRA FC_WEXTRA=-Wextra +endif + +if FC_WALL FC_WALL=-Wall endif if CC_WEXTRA -C_WEXTRA=-Wextra +CC_WEXTRA=-Wextra endif +if CC_WALL +CC_WALL=-Wall +endif + if MAKE_F95BINDINGS F95_INC=getdata.mod F95_LIB=libf95getdata.la @@ -52,7 +59,7 @@ nodist_include_HEADERS=getdata.f $(F95_INC) lib_LTLIBRARIES=libfgetdata.la $(F95_LIB) -libfgetdata_la_CPPFLAGS = -Wall $(C_WEXTRA) +libfgetdata_la_CPPFLAGS = ${CC_WALL} $(CC_WEXTRA) libfgetdata_la_SOURCES = fgetdata.c fgetdata.h $(DEBUG_C) libfgetdata_la_LIBADD=../../src/libgetdata.la libfgetdata_la_LDFLAGS = -version-info @FGETDATA_VERSION@ Modified: trunk/getdata/bindings/f77/test/Makefile.am =================================================================== --- trunk/getdata/bindings/f77/test/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/f77/test/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,11 +20,11 @@ # AUTOMAKE_OPTIONS = foreign -if FC_WEXTRA +if FC_WALL FC_WALL=-Wall endif -if F77_WEXTRA +if F77_WALL F77_WALL=-Wall endif Modified: trunk/getdata/bindings/idl/Makefile.am =================================================================== --- trunk/getdata/bindings/idl/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/idl/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,6 +20,10 @@ # AUTOMAKE_OPTIONS = foreign +if CC_WALL +WALL=-Wall +endif + if GETDATA_DEBUG DEBUG_C = ../../src/debug.c endif @@ -30,7 +34,7 @@ idl_HEADERS = idl_getdata.dlm # idl makes heavy use of type punning, ergo -fno-strict-aliasing -AM_CFLAGS = -Wall $(IDL_CFLAGS) -fno-strict-aliasing +AM_CFLAGS = ${WALL} $(IDL_CFLAGS) -fno-strict-aliasing BUILT_SOURCES=sublist.c constants.c idl_getdata_la_LDFLAGS = -module -avoid-version -export-symbols-regex IDL_Load \ -precious-files-regex 'idl_getdata\.dlm' Modified: trunk/getdata/bindings/python/Makefile.am =================================================================== --- trunk/getdata/bindings/python/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/bindings/python/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,6 +20,10 @@ # AUTOMAKE_OPTIONS = foreign +if CC_WALL +WALL=-Wall +endif + if GETDATA_DEBUG DEBUG_C = ../../src/debug.c endif @@ -29,7 +33,7 @@ python_LTLIBRARIES = pygetdata.la BUILT_SOURCES = pyconstants.c -AM_CFLAGS = -Wall -fno-strict-aliasing +AM_CFLAGS = ${WALL} -fno-strict-aliasing AM_CPPFLAGS = $(CPPFLAGS) $(PYTHON_CPPFLAGS) $(NUMPY_CPPFLAGS) pygetdata_la_LDFLAGS = -module -avoid-version \ -export-symbols-regex initpygetdata Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/configure.ac 2010-09-17 20:17:08 UTC (rev 447) @@ -451,18 +451,22 @@ echo "*** Checking additional compiler characteristics" echo AC_C_INLINE +GD_PROG_CC_WALL GD_PROG_CC_WEXTRA if test "x$make_c++bindings" != "xno"; then + GD_PROG_CXX_WALL GD_PROG_CXX_WEXTRA fi if test "x$make_f77bindings" != "xno"; then + GD_PROG_F77_WALL GD_PROG_F77_WEXTRA GD_LANG_F77_COMPILER_INTEL fi if test "x$make_f95bindings" != "xno"; then + GD_PROG_FC_WALL GD_PROG_FC_WEXTRA GD_LANG_FC_COMPILER_INTEL fi @@ -777,6 +781,10 @@ dnl Automake conditionals AM_CONDITIONAL(GETDATA_DEBUG, [test "x$enable_debug" == "xyes"]) +AM_CONDITIONAL(CC_WALL, [test "x$gd_cv_prog_cc_wall" == "xyes"]) +AM_CONDITIONAL(CXX_WALL, [test "x$gd_cv_prog_cxx_wall" == "xyes"]) +AM_CONDITIONAL(F77_WALL, [test "x$gd_cv_prog_f77_wall" == "xyes"]) +AM_CONDITIONAL(FC_WALL, [test "x$gd_cv_prog_fc_wall" == "xyes"]) AM_CONDITIONAL(CC_WEXTRA, [test "x$gd_cv_prog_cc_wextra" == "xyes"]) AM_CONDITIONAL(CXX_WEXTRA, [test "x$gd_cv_prog_cxx_wextra" == "xyes"]) AM_CONDITIONAL(F77_WEXTRA, [test "x$gd_cv_prog_f77_wextra" == "xyes"]) Modified: trunk/getdata/m4/compiler.m4 =================================================================== --- trunk/getdata/m4/compiler.m4 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/m4/compiler.m4 2010-09-17 20:17:08 UTC (rev 447) @@ -114,6 +114,59 @@ AC_LANG_POP([Fortran 77])]) FCFLAGS=$gd_saved_FCFLAGS]) +dnl GD_PROG_CC_WALL +dnl ------------------------------------------------------------- +dnl Check whether the C compiler accepts -Wall +AC_DEFUN([GD_PROG_CC_WALL], +[gd_saved_CFLAGS=$CFLAGS +AC_CACHE_CHECK([whether $CC accepts -Wall], gd_cv_prog_cc_wall, +[CFLAGS="-Wall" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [gd_cv_prog_cc_wall=yes], +[gd_cv_prog_cc_wall=no])]) +CFLAGS=$gd_saved_CFLAGS]) + + +dnl GD_PROG_CXX_WALL +dnl ------------------------------------------------------------- +dnl Check whether the C++ compiler accepts -Wall +AC_DEFUN([GD_PROG_CXX_WALL], +[gd_saved_CXXFLAGS=$CXXFLAGS +AC_CACHE_CHECK([whether $CXX accepts -Wall], gd_cv_prog_cxx_wall, +[CXXFLAGS="-Wall" +AC_LANG_PUSH([C++]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [gd_cv_prog_cxx_wall=yes], +[gd_cv_prog_cxx_wall=no]) +AC_LANG_POP([C++])]) +CXXFLAGS=$gd_saved_CXXFLAGS]) + + +dnl GD_PROG_F77_WALL +dnl ------------------------------------------------------------- +dnl Check whether the Fotran-77 compiler accepts -Wall +AC_DEFUN([GD_PROG_F77_WALL], +[gd_saved_FFLAGS=$FFLAGS +AC_CACHE_CHECK([whether $F77 accepts -Wall], gd_cv_prog_f77_wall, +[FFLAGS="-Wall" +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [gd_cv_prog_f77_wall=yes], +[gd_cv_prog_f77_wall=no]) +AC_LANG_POP([Fortran 77])]) +FFLAGS=$gd_saved_FFLAGS]) + + +dnl GD_PROG_FC_WALL +dnl ------------------------------------------------------------- +dnl Check whether the free-form Fotran compiler accepts -Wall +AC_DEFUN([GD_PROG_FC_WALL], +[gd_saved_FCFLAGS=$FCFLAGS +AC_CACHE_CHECK([whether $FC accepts -Wall], gd_cv_prog_fc_wall, +[FCFLAGS="-Wall" +AC_LANG_PUSH([Fortran 77]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [gd_cv_prog_fc_wall=yes], +[gd_cv_prog_fc_wall=no]) +AC_LANG_POP([Fortran 77])]) +FCFLAGS=$gd_saved_FCFLAGS]) + dnl GD_C_FLOATORDERING dnl ----------------------------------------------------------- dnl Attempt to determine the ordering of double precision floats Modified: trunk/getdata/src/Makefile.am =================================================================== --- trunk/getdata/src/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/src/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,6 +20,10 @@ # AUTOMAKE_OPTIONS = foreign +if CC_WALL +WALL=-Wall +endif + if CC_WEXTRA WEXTRA=-Wextra endif @@ -86,7 +90,7 @@ endif pkgconfigdir = @libdir@/pkgconfig -AM_CFLAGS = -Wall ${WEXTRA} +AM_CFLAGS = ${WALL} ${WEXTRA} AM_CPPFLAGS = $(LTDLINCL) $(EXTERNAL_CPPFLAGS) BUILT_SOURCES = getdata.h Modified: trunk/getdata/test/Makefile.am =================================================================== --- trunk/getdata/test/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/test/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,6 +20,10 @@ # AUTOMAKE_OPTIONS = foreign +if CC_WALL +WALL=-Wall +endif + if CC_WEXTRA WEXTRA=-Wextra endif @@ -34,7 +38,7 @@ endif LDADD=../src/libgetdata.la -INCLUDES=-Wall $(WEXTRA) -I$(top_srcdir)/src -D__TEST__=\"$@\" +INCLUDES=${WALL} $(WEXTRA) -I$(top_srcdir)/src -D__TEST__=\"$@\" EXTRA_DIST=test.h Modified: trunk/getdata/util/Makefile.am =================================================================== --- trunk/getdata/util/Makefile.am 2010-09-15 00:14:49 UTC (rev 446) +++ trunk/getdata/util/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) @@ -20,12 +20,16 @@ # AUTOMAKE_OPTIONS = foreign +if CC_WALL +WALL=-Wall +endif + if CC_WEXTRA WEXTRA=-Wextra endif LDADD=../src/libgetdata.la -INCLUDES=-Wall $(WEXTRA) -I$(top_srcdir)/src +INCLUDES=${WALL} $(WEXTRA) -I$(top_srcdir)/src if MAKE_CHECKDIRFILE CHECKDIRFILE=checkdirfile dirfile2ascii This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-09-18 01:00:44
|
Revision: 448 http://getdata.svn.sourceforge.net/getdata/?rev=448&view=rev Author: ketiltrout Date: 2010-09-18 01:00:35 +0000 (Sat, 18 Sep 2010) Log Message: ----------- Added gd_invalid_dirfile(). Flag const member functions in C++ bindings. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/cxx/bitentry.cpp trunk/getdata/bindings/cxx/dirfile.cpp trunk/getdata/bindings/cxx/entry.cpp trunk/getdata/bindings/cxx/fragment.cpp trunk/getdata/bindings/cxx/getdata/bitentry.h trunk/getdata/bindings/cxx/getdata/constentry.h trunk/getdata/bindings/cxx/getdata/dirfile.h trunk/getdata/bindings/cxx/getdata/divideentry.h trunk/getdata/bindings/cxx/getdata/entry.h trunk/getdata/bindings/cxx/getdata/fragment.h trunk/getdata/bindings/cxx/getdata/indexentry.h trunk/getdata/bindings/cxx/getdata/lincomentry.h trunk/getdata/bindings/cxx/getdata/linterpentry.h trunk/getdata/bindings/cxx/getdata/multiplyentry.h trunk/getdata/bindings/cxx/getdata/phaseentry.h trunk/getdata/bindings/cxx/getdata/polynomentry.h trunk/getdata/bindings/cxx/getdata/rawentry.h trunk/getdata/bindings/cxx/getdata/recipentry.h trunk/getdata/bindings/cxx/getdata/sbitentry.h trunk/getdata/bindings/cxx/getdata/stringentry.h trunk/getdata/bindings/cxx/lincomentry.cpp trunk/getdata/bindings/cxx/polynomentry.cpp trunk/getdata/bindings/cxx/sbitentry.cpp trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/bindings/idl/getdata.c trunk/getdata/bindings/python/pydirfile.c trunk/getdata/configure.ac trunk/getdata/man/Makefile.am trunk/getdata/man/gd_parser_callback.3 trunk/getdata/src/getdata.h.in trunk/getdata/src/legacy.c trunk/getdata/src/open.c Added Paths: ----------- trunk/getdata/man/gd_invalid_dirfile.3 Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/ChangeLog 2010-09-18 01:00:35 UTC (rev 448) @@ -1,3 +1,18 @@ +2010-09-18 D. V. Wiebe <ge...@ke...> svn:448 + * bindings/python/pydirfile.c (gdpy_dirfile_close gdpy_dirfile_discard) + bindings/cxx/dirfile.cpp (Dirfile::Discard Dirfile::Close) + bindings/f77/fgetdata.c (_GDF_InitDirfiles) bindings/idl/getdata.c + (gdidl_init_dirfile): Call gd_invalid_dirfile() instead of using + GetData C internals. + * src/open.c (gd_invalid_dirfile): Added. + + * src/cxx/: Declare const member functions. + + * configure.ac: Fix mkdir check for C++ compilers masquerading as C + compilers. + + * src/legacy.c: Humanely initialise _GD_GlobalErrors when possible. + 2010-09-17 D. V. Wiebe <ge...@ke...> svn:447 * test/Makefile.am src/Makefile.am bindings/python/Makefile.am bindings/cxx/Makefile.am bindings/f77/test/Makefile.am Modified: trunk/getdata/bindings/cxx/bitentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/bitentry.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/bitentry.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -76,7 +76,7 @@ return 0; } -const char *BitEntry::Scalar(int index) +const char *BitEntry::Scalar(int index) const { if (index != 0 && index != 1) return NULL; Modified: trunk/getdata/bindings/cxx/dirfile.cpp =================================================================== --- trunk/getdata/bindings/cxx/dirfile.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/dirfile.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -53,31 +53,31 @@ gd_close(D); } -int Dirfile::Add(GetData::Entry &entry) +int Dirfile::Add(GetData::Entry &entry) const { int ret = gd_add(D, &entry.E); entry.SetDirfile(this); return ret; } -int Dirfile::AddSpec(const char *spec, int format_file) +int Dirfile::AddSpec(const char *spec, int format_file) const { return gd_add_spec(D, spec, format_file); } -int Dirfile::MAdd(GetData::Entry &entry, const char *parent) +int Dirfile::MAdd(GetData::Entry &entry, const char *parent) const { int ret = gd_madd(D, &entry.E, parent); entry.SetDirfile(this); return ret; } -int Dirfile::MAddSpec(const char *spec, const char *parent) +int Dirfile::MAddSpec(const char *spec, const char *parent) const { return gd_madd_spec(D, spec, parent); } -Entry *Dirfile::Entry(const char* field_code) +Entry *Dirfile::Entry(const char* field_code) const { GetData::EntryType type = (GetData::EntryType)gd_entry_type(D, field_code); @@ -115,17 +115,17 @@ return NULL; } -int Dirfile::Flush(const char* field_code) +int Dirfile::Flush(const char* field_code) const { return gd_flush(D, field_code); } -int Dirfile::MetaFlush() +int Dirfile::MetaFlush() const { return gd_metaflush(D); } -int Dirfile::Error() +int Dirfile::Error() const { return gd_error(D); } @@ -142,149 +142,151 @@ } int Dirfile::Include(const char* file, int format_file, unsigned long flags) + const { return gd_include(D, file, format_file, flags); } -unsigned int Dirfile::SamplesPerFrame(const char* field_code) +unsigned int Dirfile::SamplesPerFrame(const char* field_code) const { return gd_spf(D, field_code); } -unsigned int Dirfile::NFields() +unsigned int Dirfile::NFields() const { return gd_nfields(D); } -unsigned int Dirfile::NFieldsByType(EntryType type) +unsigned int Dirfile::NFieldsByType(EntryType type) const { return gd_nfields_by_type(D, (gd_entype_t)type); } -const char** Dirfile::FieldListByType(EntryType type) +const char** Dirfile::FieldListByType(EntryType type) const { return gd_field_list_by_type(D, (gd_entype_t)type); } -unsigned int Dirfile::NMFields(const char *parent) +unsigned int Dirfile::NMFields(const char *parent) const { return gd_nmfields(D, parent); } -unsigned int Dirfile::NMFieldsByType(const char *parent, EntryType type) +unsigned int Dirfile::NMFieldsByType(const char *parent, EntryType type) const { return gd_nmfields_by_type(D, parent, (gd_entype_t)type); } -const char** Dirfile::MFieldListByType(const char *parent, EntryType type) +const char** Dirfile::MFieldListByType(const char *parent, EntryType type) const { return gd_mfield_list_by_type(D, parent, (gd_entype_t)type); } -const void *Dirfile::Constants(DataType type) +const void *Dirfile::Constants(DataType type) const { return gd_constants(D, (gd_type_t)type); } -const char **Dirfile::Strings() +const char **Dirfile::Strings() const { return gd_strings(D); } -const void *Dirfile::MConstants(const char *parent, DataType type) +const void *Dirfile::MConstants(const char *parent, DataType type) const { return gd_mconstants(D, parent, (gd_type_t)type); } -const char **Dirfile::MStrings(const char *parent) +const char **Dirfile::MStrings(const char *parent) const { return gd_mstrings(D, parent); } -const char** Dirfile::FieldList() +const char** Dirfile::FieldList() const { return gd_field_list(D); } -const char** Dirfile::MFieldList(const char *parent) +const char** Dirfile::MFieldList(const char *parent) const { return gd_mfield_list(D, parent); } -unsigned int Dirfile::NVectors() +unsigned int Dirfile::NVectors() const { return gd_nvectors(D); } -const char** Dirfile::VectorList() +const char** Dirfile::VectorList() const { return gd_vector_list(D); } -unsigned int Dirfile::NMVectors(const char *parent) +unsigned int Dirfile::NMVectors(const char *parent) const { return gd_nmvectors(D, parent); } -const char** Dirfile::MVectorList(const char *parent) +const char** Dirfile::MVectorList(const char *parent) const { return gd_mvector_list(D, parent); } -off_t Dirfile::NFrames() +off_t Dirfile::NFrames() const { return gd_nframes(D); } -off_t Dirfile::EoF(const char *field_code) +off_t Dirfile::EoF(const char *field_code) const { return gd_eof(D, field_code); } -off_t Dirfile::BoF(const char *field_code) +off_t Dirfile::BoF(const char *field_code) const { return gd_bof(D, field_code); } size_t Dirfile::GetConstant(const char *field_code, DataType type, - void *data_out) + void *data_out) const { return gd_get_constant(D, field_code, (gd_type_t)type, data_out); } size_t Dirfile::GetData(const char* field_code, off_t first_frame, off_t first_sample, size_t num_frames, size_t num_samples, - DataType type, void* data_out) + DataType type, void* data_out) const { return gd_getdata(D, field_code, first_frame, first_sample, num_frames, num_samples, (gd_type_t)type, data_out); } size_t Dirfile::GetString(const char *field_code, size_t len, char* data_out) + const { return gd_get_string(D, field_code, len, data_out); } size_t Dirfile::PutConstant(const char *field_code, DataType type, - const void *data_in) + const void *data_in) const { return gd_put_constant(D, field_code, (gd_type_t)type, data_in); } size_t Dirfile::PutData(const char* field_code, off_t first_frame, off_t first_sample, size_t num_frames, size_t num_samples, - DataType type, const void* data_in) + DataType type, const void* data_in) const { return gd_putdata(D, field_code, first_frame, first_sample, num_frames, num_samples, (gd_type_t)type, data_in); } -size_t Dirfile::PutString(const char *field_code, const char* data_in) +size_t Dirfile::PutString(const char *field_code, const char* data_in) const { return gd_put_string(D, field_code, data_in); } -GetData::Fragment* Dirfile::Fragment(int index) +GetData::Fragment* Dirfile::Fragment(int index) const { if (index < 0 || index >= gd_nfragments(D)) return NULL; @@ -292,12 +294,12 @@ return new GetData::Fragment(this, index); } -int Dirfile::NFragments() +int Dirfile::NFragments() const { return gd_nfragments(D); } -const char* Dirfile::ReferenceFilename() +const char* Dirfile::ReferenceFilename() const { const char* ref = gd_reference(D, NULL); @@ -312,7 +314,7 @@ int ret = gd_discard(D); if (!ret) - D = NULL; + D = gd_invalid_dirfile(); return ret; } @@ -322,17 +324,17 @@ int ret = gd_close(D); if (!ret) - D = NULL; + D = gd_invalid_dirfile(); return ret; } -void Dirfile::SetCallback(gd_parser_callback_t sehandler, void* extra) +void Dirfile::SetCallback(gd_parser_callback_t sehandler, void* extra) const { gd_parser_callback(D, sehandler, extra); } -RawEntry* Dirfile::Reference(const char* field_code) +RawEntry* Dirfile::Reference(const char* field_code) const { const char* ref = gd_reference(D, field_code); @@ -342,48 +344,48 @@ return new RawEntry(this, ref); } -int Dirfile::AlterSpec(const char *line, int recode) +int Dirfile::AlterSpec(const char *line, int recode) const { return gd_alter_spec(D, line, recode); } -int Dirfile::MAlterSpec(const char* line, const char *parent, int recode) +int Dirfile::MAlterSpec(const char* line, const char *parent, int recode) const { return gd_malter_spec(D, line, parent, recode); } -int Dirfile::Delete(const char* field_code, int flags) +int Dirfile::Delete(const char* field_code, int flags) const { return gd_delete(D, field_code, flags); } -int Dirfile::UnInclude(int fragment_index, int del) +int Dirfile::UnInclude(int fragment_index, int del) const { return gd_uninclude(D, fragment_index, del); } -DataType Dirfile::NativeType(const char* field_code) +DataType Dirfile::NativeType(const char* field_code) const { return (DataType)gd_native_type(D, field_code); } -int Dirfile::Validate(const char* field_code) +int Dirfile::Validate(const char* field_code) const { return gd_validate(D, field_code); } double Dirfile::FrameNum(const char* field_code, double value, - off_t frame_start, off_t frame_end) + off_t frame_start, off_t frame_end) const { return gd_framenum_subset(D, field_code, value, frame_start, frame_end); } -int Dirfile::FragmentIndex(const char* field_code) +int Dirfile::FragmentIndex(const char* field_code) const { return gd_fragment_index(D, field_code); } -const char* Dirfile::Name() +const char* Dirfile::Name() const { return gd_dirfilename(D); } Modified: trunk/getdata/bindings/cxx/entry.cpp =================================================================== --- trunk/getdata/bindings/cxx/entry.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/entry.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -35,7 +35,7 @@ D = NULL; } -Entry::Entry(GetData::Dirfile *dirfile, const char* field_code) +Entry::Entry(const GetData::Dirfile *dirfile, const char* field_code) { D = dirfile; gd_entry(D->D, field_code, &E); @@ -114,7 +114,7 @@ return ret; } -void Entry::SetDirfile(GetData::Dirfile* dirfile) +void Entry::SetDirfile(const GetData::Dirfile* dirfile) { D = dirfile; } @@ -129,7 +129,7 @@ this->Move(fragment_index); } -const char *Entry::Scalar(int index) +const char *Entry::Scalar(int index) const { if (index < 0) return NULL; Modified: trunk/getdata/bindings/cxx/fragment.cpp =================================================================== --- trunk/getdata/bindings/cxx/fragment.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/fragment.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -29,7 +29,7 @@ using namespace GetData; -Fragment::Fragment(GetData::Dirfile *dirfile, int index) +Fragment::Fragment(const GetData::Dirfile *dirfile, int index) { D = dirfile; @@ -38,16 +38,16 @@ end = gd_endianness(D->D, index); off = gd_frameoffset(D->D, index); prot = gd_protection(D->D, index); - name = strdup(gd_fragmentname(D->D, index)); + name = gd_fragmentname(D->D, index); parent = (index == 0) ? -1 : gd_parent_fragment(D->D, index); } Fragment::~Fragment() { - free(name); + ; } -int Fragment::ReWrite() +int Fragment::ReWrite() const { return gd_rewrite_fragment(D->D, ind); } Modified: trunk/getdata/bindings/cxx/getdata/bitentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/bitentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/bitentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_BITENTRY_H #define GETDATA_BITENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,17 +37,11 @@ BitEntry(const char* field_code, const char* in_field, gd_bit_t bitnum, gd_bit_t numbits = 1, int fragment_index = 0); - virtual const char *Input() { - return E.in_fields[0]; - }; + virtual const char *Input() const { return E.in_fields[0]; }; - virtual gd_bit_t FirstBit() { - return E.u.bit.bitnum; - }; + virtual gd_bit_t FirstBit() const { return E.u.bit.bitnum; }; - virtual gd_bit_t NumBits() { - return E.u.bit.numbits; - }; + virtual gd_bit_t NumBits() const { return E.u.bit.numbits; }; int SetInput(const char* field); int SetFirstBit(gd_bit_t first_bit); @@ -65,10 +49,10 @@ int SetNumBits(gd_bit_t num_bits); int SetNumBits(const char* num_bits); - virtual const char *Scalar(int index = 0); + virtual const char *Scalar(int index = 0) const; private: - BitEntry(GetData::Dirfile *dirfile, const char* field_code) : + BitEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/constentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/constentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/constentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_CONSTENTRY_H #define GETDATA_CONSTENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -46,12 +36,12 @@ ConstEntry(const char* field_code, DataType type, int fragment_index = 0); - virtual DataType ConstType() { return (DataType)E.u.cons.type; } + virtual DataType ConstType() const { return (DataType)E.u.cons.type; } int SetType(DataType type); private: - ConstEntry(GetData::Dirfile *dirfile, const char* field_code) : + ConstEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-09-18 01:00:35 UTC (rev 448) @@ -79,116 +79,120 @@ ~Dirfile(); - int Add(GetData::Entry &entry); + int Add(GetData::Entry &entry) const; - int AddSpec(const char *spec, int fragment_index = 0); + int AddSpec(const char *spec, int fragment_index = 0) const; - int AlterSpec(const char* spec, int recode = 0); + int AlterSpec(const char* spec, int recode = 0) const; - off_t BoF(const char *field_code); + off_t BoF(const char *field_code) const; int Close(); - const void *Constants(DataType type = Float64); + const void *Constants(DataType type = Float64) const; - int Delete(const char* field_code, int flags = 0); + int Delete(const char* field_code, int flags = 0) const; int Discard(); - GetData::Entry* Entry(const char *field_code); + GetData::Entry* Entry(const char *field_code) const; - off_t EoF(const char *field_code); + off_t EoF(const char *field_code) const; - int Error(); + int Error() const; const char *ErrorString(size_t len = 4096); - const char **FieldList(); + const char **FieldList() const; - const char **FieldListByType(EntryType type); + const char **FieldListByType(EntryType type) const; - int Flush(const char *field_code = NULL); + int Flush(const char *field_code = NULL) const; - GetData::Fragment *Fragment(int index); + GetData::Fragment *Fragment(int index) const; - int FragmentIndex(const char* field_code); + int FragmentIndex(const char* field_code) const; double FrameNum(const char* field_code, double value, - off_t frame_start = 0, off_t frame_end = 0); + off_t frame_start = 0, off_t frame_end = 0) const; - size_t GetConstant(const char *field_code, DataType type, void *data_out); + size_t GetConstant(const char *field_code, DataType type, void *data_out) + const; size_t GetData(const char *field_code, off_t first_frame, off_t first_sample, size_t num_frames, size_t num_samples, - DataType type, void* data_out); + DataType type, void* data_out) const; - size_t GetString(const char *field_code, size_t len, char *data_out); + size_t GetString(const char *field_code, size_t len, char *data_out) + const; int Include(const char *file, int fragment_index = 0, - unsigned long flags = 0); + unsigned long flags = 0) const; - int MAdd(GetData::Entry &entry, const char *parent); + int MAdd(GetData::Entry &entry, const char *parent) const; - int MAddSpec(const char *spec, const char *parent); + int MAddSpec(const char *spec, const char *parent) const; - int MAlterSpec(const char *line, const char *parent, int recode = 0); + int MAlterSpec(const char *line, const char *parent, int recode = 0) + const; - const void *MConstants(const char *parent, DataType type = Float64); + const void *MConstants(const char *parent, DataType type = Float64) const; - int MetaFlush(); + int MetaFlush() const; - const char **MFieldList(const char *parent); + const char **MFieldList(const char *parent) const; - const char **MFieldListByType(const char *parent, EntryType type); + const char **MFieldListByType(const char *parent, EntryType type) const; - const char **MStrings(const char *parent); + const char **MStrings(const char *parent) const; - const char **MVectorList(const char *parent); + const char **MVectorList(const char *parent) const; - unsigned int NFields(); + unsigned int NFields() const; - unsigned int NFieldsByType(EntryType type); + unsigned int NFieldsByType(EntryType type) const; - unsigned int NMFields(const char *parent); + unsigned int NMFields(const char *parent) const; - unsigned int NMFieldsByType(const char *parent, EntryType type); + unsigned int NMFieldsByType(const char *parent, EntryType type) const; - unsigned int NMVectors(const char *parent); + unsigned int NMVectors(const char *parent) const; - const char* Name(); + const char* Name() const; - DataType NativeType(const char* field_code); + DataType NativeType(const char* field_code) const; - int NFragments(); + int NFragments() const; - off_t NFrames(); + off_t NFrames() const; - unsigned int NVectors(); + unsigned int NVectors() const; size_t PutConstant(const char *field_code, DataType type, - const void *data_in); + const void *data_in) const; size_t PutData(const char *field_code, off_t first_frame, off_t first_sample, size_t num_frames, size_t num_samples, - DataType type, const void* data_in); + DataType type, const void* data_in) const; - size_t PutString(const char *field_code, const char *data_in); + size_t PutString(const char *field_code, const char *data_in) const; - GetData::RawEntry *Reference(const char* field_code = NULL); + GetData::RawEntry *Reference(const char* field_code = NULL) const; - const char *ReferenceFilename(); + const char *ReferenceFilename() const; - unsigned int SamplesPerFrame(const char *field_code); + unsigned int SamplesPerFrame(const char *field_code) const; - void SetCallback(gd_parser_callback_t sehandler, void* extra = NULL); + void SetCallback(gd_parser_callback_t sehandler, void* extra = NULL) + const; - const char **Strings(); + const char **Strings() const; - int UnInclude(int fragment_index, int del = 0); + int UnInclude(int fragment_index, int del = 0) const; - int Validate(const char* field_code); + int Validate(const char* field_code) const; - const char **VectorList(); + const char **VectorList() const; private: DIRFILE* D; Modified: trunk/getdata/bindings/cxx/getdata/divideentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/divideentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/divideentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_DIVIDEENTRY_H #define GETDATA_DIVIDEENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,14 +37,14 @@ DivideEntry(const char* field_code, const char* in_field1, const char* in_field2, int fragment_index = 0); - virtual const char *Input(int index = 0) { + virtual const char *Input(int index = 0) const { return E.in_fields[(index == 0) ? 0 : 1]; }; int SetInput(const char* field, int index); private: - DivideEntry(GetData::Dirfile *dirfile, const char* field_code) : + DivideEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/entry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/entry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/entry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -75,117 +75,125 @@ virtual ~Entry(); /* Generic data */ - int Associated() { return (D != NULL); }; + int Associated() const { return (D != NULL); }; - const char *Name() { return E.field; }; + const char *Name() const { return E.field; }; - EntryType Type() { return (EntryType)E.field_type; }; + EntryType Type() const { return (EntryType)E.field_type; }; void Dissociate() { D = NULL; }; - int FragmentIndex() { return E.fragment_index; }; + int FragmentIndex() const { return E.fragment_index; }; int Move(int new_fragment, int move_data = 0); int Rename(const char* new_name, int move_data = 0); /* Specific data */ - virtual const char *Input(int index = 0) { + virtual const char *Input(int index = 0) const { return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.in_fields[index] : NULL; }; - virtual int ComplexScalars() { + virtual int ComplexScalars() const { return (E.field_type == GD_LINCOM_ENTRY || E.field_type == GD_POLYNOM_ENTRY) ? E.comp_scal : 0; } - virtual const char *Scalar(int index = 0); + virtual const char *Scalar(int index = 0) const; /* RAW methods */ - virtual gd_spf_t SamplesPerFrame() { + virtual gd_spf_t SamplesPerFrame() const { return (E.field_type == GD_RAW_ENTRY) ? E.u.raw.spf : 0; }; - virtual DataType RawType() { - return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.u.raw.type : Unknown; + virtual DataType RawType() const { + return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.u.raw.type : + Unknown; }; /* LINCOM methods */ - virtual int NFields() { + virtual int NFields() const { return (E.field_type == GD_LINCOM_ENTRY) ? E.u.lincom.n_fields : 0; }; - virtual double Scale(int index = 0) { + virtual double Scale(int index = 0) const { return (E.field_type == GD_LINCOM_ENTRY && - CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.m[index] : 0; + CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? + E.u.lincom.m[index] : 0; } - virtual std::complex<double> CScale(int index = 0) { + virtual std::complex<double> CScale(int index = 0) const { return (E.field_type == GD_LINCOM_ENTRY && CheckIndex(E.field_type, E.u.lincom.n_fields, index)) - ? std::complex<double>(E.u.lincom.cm[index][0], E.u.lincom.cm[index][1]) : 0; + ? std::complex<double>(E.u.lincom.cm[index][0], + E.u.lincom.cm[index][1]) : 0; } - virtual double Offset(int index = 0) { + virtual double Offset(int index = 0) const { return (E.field_type == GD_LINCOM_ENTRY && - CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.b[index] : 0; + CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? + E.u.lincom.b[index] : 0; } - virtual std::complex<double> COffset(int index = 0) { + virtual std::complex<double> COffset(int index = 0) const { return (E.field_type == GD_LINCOM_ENTRY && CheckIndex(E.field_type, E.u.lincom.n_fields, index)) - ? std::complex<double>(E.u.lincom.cb[index][0], E.u.lincom.cb[index][1]) : 0; + ? std::complex<double>(E.u.lincom.cb[index][0], + E.u.lincom.cb[index][1]) : 0; } /* LINTERP methods */ - virtual const char *Table() { + virtual const char *Table() const { return (E.field_type == GD_LINTERP_ENTRY) ? E.u.linterp.table : NULL; }; /* (S)BIT methods */ - virtual gd_bit_t FirstBit() { + virtual gd_bit_t FirstBit() const { return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.bitnum : -1; }; - virtual gd_bit_t NumBits() { + virtual gd_bit_t NumBits() const { return (E.field_type == GD_BIT_ENTRY) ? E.u.bit.numbits : -1; }; /* PHASE methods */ - virtual gd_shift_t Shift() { + virtual gd_shift_t Shift() const { return (E.field_type == GD_PHASE_ENTRY) ? E.u.phase.shift : 0; }; /* CONST methods */ - virtual DataType ConstType() { + virtual DataType ConstType() const { return (E.field_type == GD_CONST_ENTRY) ? (DataType)E.u.cons.type : Unknown; }; /* POLYNOM methods */ - virtual int PolyOrd() { + virtual int PolyOrd() const { return (E.field_type == GD_POLYNOM_ENTRY) ? E.u.polynom.poly_ord : 0; }; - virtual double Coefficient(int index = 0) { - return (E.field_type == GD_POLYNOM_ENTRY && index <= E.u.polynom.poly_ord) - ? E.u.polynom.a[index] : 0; + virtual double Coefficient(int index = 0) const { + return (E.field_type == GD_POLYNOM_ENTRY && index <= + E.u.polynom.poly_ord) ? E.u.polynom.a[index] : 0; } - virtual std::complex<double> CCoefficient(int index = 0) { - return (E.field_type == GD_POLYNOM_ENTRY && index <= E.u.polynom.poly_ord) - ? std::complex<double>(E.u.polynom.ca[index][0], E.u.polynom.ca[index][1]) : 0; + virtual std::complex<double> CCoefficient(int index = 0) const { + return (E.field_type == GD_POLYNOM_ENTRY && index <= + E.u.polynom.poly_ord) ? + std::complex<double>(E.u.polynom.ca[index][0], + E.u.polynom.ca[index][1]) : 0; } /* RECIP methods */ - virtual double Dividend() { + virtual double Dividend() const { return (E.field_type == GD_RECIP_ENTRY) ? E.u.recip.dividend : 0; }; - virtual std::complex<double> CDividend() { + virtual std::complex<double> CDividend() const { return (E.field_type == GD_RECIP_ENTRY) ? - std::complex<double>(E.u.recip.cdividend[0], E.u.recip.cdividend[1]) : 0; + std::complex<double>(E.u.recip.cdividend[0], E.u.recip.cdividend[1]) : + 0; }; void SetName(const char* name); @@ -193,14 +201,14 @@ void SetFragmentIndex(int fragment_index); protected: - Entry(Dirfile *dirfile, const char* field_code); + Entry(const Dirfile *dirfile, const char* field_code); static int CheckIndex(gd_entype_t field_type, int n_fields, int index); - void SetDirfile(GetData::Dirfile* dirfile); + void SetDirfile(const GetData::Dirfile* dirfile); gd_entry_t E; - Dirfile* D; + const Dirfile* D; }; } Modified: trunk/getdata/bindings/cxx/getdata/fragment.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/fragment.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/fragment.h 2010-09-18 01:00:35 UTC (rev 448) @@ -52,21 +52,21 @@ public: virtual ~Fragment(); - EncodingScheme Encoding() { return enc; }; + EncodingScheme Encoding() const { return enc; }; - unsigned long Endianness() { return end; }; + unsigned long Endianness() const { return end; }; - off_t FrameOffset() { return (off_t)off; }; + off_t FrameOffset() const { return (off_t)off; }; - int Index() { return ind; } + int Index() const { return ind; } - const char* Name() { return name; } + const char* Name() const { return name; } - int Parent() { return parent; } + int Parent() const { return parent; } - int Protection() { return prot; } + int Protection() const { return prot; } - int ReWrite(); + int ReWrite() const; int SetEncoding(EncodingScheme encoding, int recode = 0); @@ -77,15 +77,15 @@ int SetProtection(int protection_level); protected: - Fragment(Dirfile *dirfile, int index); + Fragment(const Dirfile *dirfile, int index); - Dirfile* D; + const Dirfile *D; EncodingScheme enc; unsigned long end; int ind; int prot; off_t off; - char* name; + const char* name; int parent; }; } Modified: trunk/getdata/bindings/cxx/getdata/indexentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/indexentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/indexentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_INDEXENTRY_H #define GETDATA_INDEXENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -42,7 +32,7 @@ friend class Dirfile; private: - IndexEntry(GetData::Dirfile *dirfile, const char* field_code) : + IndexEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/lincomentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/lincomentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/lincomentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_LINCOMENTRY_H #define GETDATA_LINCOMENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -51,38 +41,38 @@ std::complex<double>* cm, std::complex<double>* cb, int fragment_index = 0); - virtual const char *Input(int index = 0) { + virtual const char *Input(int index = 0) const { return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.in_fields[index] : NULL; }; - virtual int ComplexScalars() { - return E.comp_scal; - } + virtual int ComplexScalars() const { return E.comp_scal; } - virtual int NFields() { - return E.u.lincom.n_fields; - }; + virtual int NFields() const { return E.u.lincom.n_fields; }; - virtual double Scale(int index = 0) { - return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.m[index] : 0; + virtual double Scale(int index = 0) const { + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? + E.u.lincom.m[index] : 0; }; - virtual std::complex<double> CScale(int index = 0) { + virtual std::complex<double> CScale(int index = 0) const { return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) - ? std::complex<double>(E.u.lincom.cm[index][0], E.u.lincom.cm[index][1]) : 0; + ? std::complex<double>(E.u.lincom.cm[index][0], + E.u.lincom.cm[index][1]) : 0; }; - virtual double Offset(int index = 0) { - return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? E.u.lincom.b[index] : 0; + virtual double Offset(int index = 0) const { + return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) ? + E.u.lincom.b[index] : 0; }; - virtual std::complex<double> COffset(int index = 0) { + virtual std::complex<double> COffset(int index = 0) const { return (CheckIndex(E.field_type, E.u.lincom.n_fields, index)) - ? std::complex<double>(E.u.lincom.cb[index][0], E.u.lincom.cb[index][1]) : 0; + ? std::complex<double>(E.u.lincom.cb[index][0], + E.u.lincom.cb[index][1]) : 0; }; - virtual const char *Scalar(int index = 0); + virtual const char *Scalar(int index = 0) const; int SetNFields(int nfields); int SetInput(const char* field, int index = 0); @@ -94,7 +84,7 @@ int SetOffset(std::complex<double> offset, int index = 0); private: - LincomEntry(GetData::Dirfile *dirfile, const char* field_code) : + LincomEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/linterpentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/linterpentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/linterpentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_LINTERPENTRY_H #define GETDATA_LINTERPENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,19 +37,15 @@ LinterpEntry(const char* field_code, const char* in_field, const char* table, int fragment_index = 0); - virtual const char *Input() { - return E.in_fields[0]; - }; + virtual const char *Input() const { return E.in_fields[0]; }; - virtual const char *Table() { - return E.u.linterp.table; - }; + virtual const char *Table() const { return E.u.linterp.table; }; int SetInput(const char* field); int SetTable(const char* table, int move_table = 0); private: - LinterpEntry(GetData::Dirfile *dirfile, const char* field_code) : + LinterpEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/multiplyentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/multiplyentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/multiplyentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_MULTIPLYENTRY_H #define GETDATA_MULTIPLYENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,14 +37,14 @@ MultiplyEntry(const char* field_code, const char* in_field1, const char* in_field2, int fragment_index = 0); - virtual const char *Input(int index = 0) { + virtual const char *Input(int index = 0) const { return E.in_fields[(index == 0) ? 0 : 1]; }; int SetInput(const char* field, int index); private: - MultiplyEntry(GetData::Dirfile *dirfile, const char* field_code) : + MultiplyEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/phaseentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/phaseentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/phaseentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_PHASEENTRY_H #define GETDATA_PHASEENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,24 +37,18 @@ PhaseEntry(const char* field_code, const char* in_field, gd_shift_t shift, int fragment_index = 0); - virtual const char *Input() { - return E.in_fields[0]; - }; + virtual const char *Input() const { return E.in_fields[0]; }; - virtual gd_shift_t Shift() { - return E.u.phase.shift; - }; + virtual gd_shift_t Shift() const { return E.u.phase.shift; }; int SetInput(const char* field); int SetShift(gd_shift_t shift); int SetShift(const char* shift); - const char *Scalar() { - return E.scalar[0]; - }; + const char *Scalar() const { return E.scalar[0]; }; private: - PhaseEntry(GetData::Dirfile *dirfile, const char* field_code) : + PhaseEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/polynomentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/polynomentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/polynomentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_POLYNOMENTRY_H #define GETDATA_POLYNOMENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -50,28 +40,23 @@ PolynomEntry(const char* field_code, int poly_ord, const char* in_field, std::complex<double>* ca, int fragment_index = 0); - virtual const char *Input() { - return E.in_fields[0]; - }; + virtual const char *Input() const { return E.in_fields[0]; }; - virtual int ComplexScalars() { - return E.comp_scal; - } + virtual int ComplexScalars() const { return E.comp_scal; } - virtual int PolyOrd() { - return E.u.polynom.poly_ord; - }; + virtual int PolyOrd() const { return E.u.polynom.poly_ord; }; - virtual double Coefficient(int index = 0) { + virtual double Coefficient(int index = 0) const { return (index <= E.u.polynom.poly_ord) ? E.u.polynom.a[index] : 0; }; - virtual std::complex<double> CCoefficient(int index = 0) { + virtual std::complex<double> CCoefficient(int index = 0) const { return (index <= E.u.polynom.poly_ord) - ? std::complex<double>(E.u.polynom.ca[index][0], E.u.polynom.ca[index][1]) : 0; + ? std::complex<double>(E.u.polynom.ca[index][0], + E.u.polynom.ca[index][1]) : 0; }; - virtual const char *Scalar(int index = 0); + virtual const char *Scalar(int index = 0) const; int SetPolyOrd(int poly_ord); int SetInput(const char* field); @@ -80,7 +65,7 @@ int SetCoefficient(std::complex<double> coeff, int index = 0); private: - PolynomEntry(GetData::Dirfile *dirfile, const char* field_code) : + PolynomEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/rawentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_RAWENTRY_H #define GETDATA_RAWENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,25 +37,19 @@ RawEntry(const char* field_code, DataType data_type, gd_spf_t spf, int fragment_index = 0); - virtual gd_spf_t SamplesPerFrame() { - return E.u.raw.spf; - }; + virtual gd_spf_t SamplesPerFrame() const { return E.u.raw.spf; }; - virtual DataType RawType() { - return (DataType)E.u.raw.type; - }; + virtual DataType RawType() const { return (DataType)E.u.raw.type; }; const char* FileName(); int SetSamplesPerFrame(gd_spf_t spf, int recode = 0); int SetSamplesPerFrame(const char *spf, int recode = 0); int SetType(DataType type, int recode = 0); - virtual const char *Scalar() { - return E.scalar[0]; - }; + virtual const char *Scalar() const { return E.scalar[0]; }; private: - RawEntry(GetData::Dirfile *dirfile, const char* field_code) : + RawEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/recipentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/recipentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/recipentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_RECIPENTRY_H #define GETDATA_RECIPENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -50,24 +40,17 @@ RecipEntry(const char* field_code, const char* in_field, std::complex<double> cdividend, int fragment_index = 0); - virtual const char *Input() { - return E.in_fields[0]; - }; + virtual const char *Input() const { return E.in_fields[0]; }; - virtual const char *Scalar() { - return E.scalar[0]; - } + virtual const char *Scalar() const { return E.scalar[0]; } - virtual int ComplexScalars() { - return E.comp_scal; - } + virtual int ComplexScalars() const { return E.comp_scal; } - virtual double Dividend() { - return E.u.recip.dividend; - }; + virtual double Dividend() const { return E.u.recip.dividend; }; - virtual std::complex<double> CDividend() { - return std::complex<double>(E.u.recip.cdividend[0], E.u.recip.cdividend[1]); + virtual std::complex<double> CDividend() const { + return std::complex<double>(E.u.recip.cdividend[0], + E.u.recip.cdividend[1]); }; virtual int SetInput(const char* field); @@ -76,7 +59,7 @@ virtual int SetDividend(std::complex<double> coeff); private: - RecipEntry(GetData::Dirfile *dirfile, const char* field_code) : + RecipEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/sbitentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/sbitentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/sbitentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_SBITENTRY_H #define GETDATA_SBITENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,17 +37,11 @@ SBitEntry(const char* field_code, const char* in_field, gd_bit_t bitnum, gd_bit_t numbits = 1, int fragment_index = 0); - virtual const char *Input() { - return E.in_fields[0]; - }; + virtual const char *Input() const { return E.in_fields[0]; }; - virtual gd_bit_t FirstBit() { - return E.u.bit.bitnum; - }; + virtual gd_bit_t FirstBit() const { return E.u.bit.bitnum; }; - virtual gd_bit_t NumBits() { - return E.u.bit.numbits; - }; + virtual gd_bit_t NumBits() const { return E.u.bit.numbits; }; int SetInput(const char* field); int SetFirstBit(gd_bit_t first_bit); @@ -65,10 +49,10 @@ int SetNumBits(gd_bit_t num_bits); int SetNumBits(const char* num_bits); - virtual const char *Scalar(int index = 0); + virtual const char *Scalar(int index = 0) const; private: - SBitEntry(GetData::Dirfile *dirfile, const char* field_code) : + SBitEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/getdata/stringentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/stringentry.h 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/getdata/stringentry.h 2010-09-18 01:00:35 UTC (rev 448) @@ -22,16 +22,6 @@ #ifndef GETDATA_STRINGENTRY_H #define GETDATA_STRINGENTRY_H -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -#define GD_NO_LEGACY_API -#define GD_C89_API - -extern "C" { -#include <getdata.h> -} #include <getdata/entry.h> namespace GetData { @@ -47,7 +37,7 @@ StringEntry(const char* field_code, int fragment_index = 0); private: - StringEntry(GetData::Dirfile *dirfile, const char* field_code) : + StringEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; }; } Modified: trunk/getdata/bindings/cxx/lincomentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/lincomentry.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/lincomentry.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -221,7 +221,7 @@ return 0; } -const char *LincomEntry::Scalar(int index) +const char *LincomEntry::Scalar(int index) const { if (index < 0 || index >= E.u.lincom.n_fields) return NULL; Modified: trunk/getdata/bindings/cxx/polynomentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/polynomentry.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/polynomentry.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -155,7 +155,7 @@ return 0; } -const char *PolynomEntry::Scalar(int index) +const char *PolynomEntry::Scalar(int index) const { if (index < 0 || index > E.u.polynom.poly_ord) return NULL; Modified: trunk/getdata/bindings/cxx/sbitentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/sbitentry.cpp 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/cxx/sbitentry.cpp 2010-09-18 01:00:35 UTC (rev 448) @@ -76,7 +76,7 @@ return 0; } -const char *SBitEntry::Scalar(int index) +const char *SBitEntry::Scalar(int index) const { if (index != 0 && index != 1) return NULL; Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-09-18 01:00:35 UTC (rev 448) @@ -42,9 +42,7 @@ /* we keep entry zero as a generic, invalid dirfile to return if * dirfile lookup fails */ - f77dirfiles[0] = (DIRFILE*)malloc(sizeof(DIRFILE)); - memset(f77dirfiles[0], 0, sizeof(DIRFILE)); - f77dirfiles[0]->flags = GD_INVALID; + f77dirfiles[0] = gd_invalid_dirfile(); f77dirfiles_initialised = 1; dreturnvoid(); Modified: trunk/getdata/bindings/idl/getdata.c =================================================================== --- trunk/getdata/bindings/idl/getdata.c 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/idl/getdata.c 2010-09-18 01:00:35 UTC (rev 448) @@ -90,9 +90,7 @@ /* we keep entry zero as a generic, invalid dirfile to return if * dirfile lookup fails */ - idldirfiles[0] = (DIRFILE*)malloc(sizeof(DIRFILE)); - memset(idldirfiles[0], 0, sizeof(DIRFILE)); - idldirfiles[0]->flags = GD_INVALID; + idldirfiles[0] = gd_invalid_dirfile(); idldirfiles_initialised = 1; dreturnvoid(); Modified: trunk/getdata/bindings/python/pydirfile.c =================================================================== --- trunk/getdata/bindings/python/pydirfile.c 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/bindings/python/pydirfile.c 2010-09-18 01:00:35 UTC (rev 448) @@ -296,13 +296,7 @@ PYGD_CHECK_ERROR(self->D, NULL); - /* Here we replace D with an empty, invalid dirfile object. The following - * uses getdata internals, but this could be done just as simply (but with - * more overhead) using the public API by calling gd_open("", 0) - */ - self->D = malloc(sizeof(struct _GD_DIRFILE)); - memset(self->D, 0, sizeof(struct _GD_DIRFILE)); - self->D->flags = GD_INVALID; + self->D = gd_invalid_dirfile(); Py_INCREF(Py_None); dreturn("%p", Py_None); @@ -342,13 +336,8 @@ PYGD_CHECK_ERROR(self->D, NULL); - /* Here we replace D with an empty, invalid dirfile object. The following - * uses getdata internals, but this could be done just as simply (but with - * more overhead) using the public API by calling gd_open("", 0) - */ - self->D = malloc(sizeof(struct _GD_DIRFILE)); - memset(self->D, 0, sizeof(struct _GD_DIRFILE)); - self->D->flags = GD_INVALID; + /* Here we replace D with an empty, invalid dirfile object. */ + self->D = gd_invalid_dirfile(); Py_INCREF(Py_None); dreturn("%p", Py_None); Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/configure.ac 2010-09-18 01:00:35 UTC (rev 448) @@ -539,6 +539,12 @@ 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 Modified: trunk/getdata/man/Makefile.am =================================================================== --- trunk/getdata/man/Makefile.am 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/man/Makefile.am 2010-09-18 01:00:35 UTC (rev 448) @@ -37,9 +37,9 @@ 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_madd_bit.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_invalid_dirfile.3 gd_madd_bit.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 \ Added: trunk/getdata/man/gd_invalid_dirfile.3 =================================================================== --- trunk/getdata/man/gd_invalid_dirfile.3 (rev 0) +++ trunk/getdata/man/gd_invalid_dirfile.3 2010-09-18 01:00:35 UTC (rev 448) @@ -0,0 +1,71 @@ +.\" gd_invalid_dirfile.3. The gd_invalid_dirfile man page. +.\" +.\" (C) 2010 D. V. Wiebe +.\" +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.\" +.\" This file is part of the GetData project. +.\" +.\" Permission is granted to copy, distribute and/or modify this document +.\" under the terms of the GNU Free Documentation License, Version 1.2 or +.\" any later version published by the Free Software Foundation; with no +.\" Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +.\" Texts. A copy of the license is included in the `COPYING.DOC' file +.\" as part of this distribution. +.\" +.TH gd_invalid_dirfile 3 "17 September 2010" "Version 0.7.0" "GETDATA" +.SH NAME +gd_invalid_dirfile \(em obtain an pointer to an invalid DIRFILE object +.SH SYNOPSIS +.B #include <getdata.h> +.HP +.nh +.ad l +.BI "DIRFILE* gd_invalid_dirfile(void); +.hy +.ad n +.SH DESCRIPTION +The +.BR gd_invalid_dirfile () +returns a pointer to a newly allocated, invalid DIRFILE object. Like any +other DIRFILE object, the invalid DIRFILE object should be deallocated by +calling +.BR gd_close (3) +or +.BR gd_discard (3) +when it is no longer needed. + +The DIRFILE object reutrned may be passed to any other GetData function which +requires one, but doing so will inevitably result in that function failing +with the +.B GD_BAD_DIRFILE +error. + +A similar effect can be achieved by making an invalid +.BR gd_open (3) +call, such as: +.HP +.in +2n +.nf +.fam C +.BR gd_open( """""" ,\~ 0 ); +.fam +.fi +.in +.PP +which also returns a pointer to an invalid DIRFILE object. The difference +is that an invalid DIRFILE created in this way has a non-zero Dirfile +error (obtainable with +.BR gd_error (3)), +while the dirfile error of the invalid DIRFILE returned by +.BR gd_invalid_dirfile (3) +is zero (indicating success). + +.SH RETURN VALUE +This function always returns a pointer to a newly allocated, invalid DIRFILE +object. + +.SH SEE ALSO +.BR gd_close (3), +.BR gd_discard (3), +.BR gd_open (3) Modified: trunk/getdata/man/gd_parser_callback.3 =================================================================== --- trunk/getdata/man/gd_parser_callback.3 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/man/gd_parser_callback.3 2010-09-18 01:00:35 UTC (rev 448) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH gd_parser_callback 3 "21 July 2010" "Version 0.7.0" "GETDATA" +.TH gd_parser_callback 3 "17 September 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_parser_callback \(em set the syntax error callback handler for a dirfile .SH SYNOPSIS @@ -28,7 +28,7 @@ .SH DESCRIPTION The .BR gd_parser_callback () -updates the syntax error callback function of the DIRFILE object +function updates the syntax error callback function of the DIRFILE object .I dirfile to be .IR sehandler , Modified: trunk/getdata/src/getdata.h.in =================================================================== --- trunk/getdata/src/getdata.h.in 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/src/getdata.h.in 2010-09-18 01:00:35 UTC (rev 448) @@ -513,6 +513,8 @@ extern const char *gd_fragmentname(DIRFILE *dirfile, int index) gd_nothrow gd_nonnull ((1)); +DIRFILE* gd_invalid_dirfile(void) gd_nothrow; + extern int gd_madd(DIRFILE *dirfile, const gd_entry_t *entry, const char *parent) gd_nothrow gd_nonnull ((1,2,3)); Modified: trunk/getdata/src/legacy.c =================================================================== --- trunk/getdata/src/legacy.c 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/src/legacy.c 2010-09-18 01:00:35 UTC (rev 448) @@ -36,7 +36,16 @@ static char _GD_GlobalErrorString[GD_MAX_LINE_LENGTH]; static char _GD_GlobalErrorFile[GD_MAX_LINE_LENGTH]; static DIRFILE _GD_GlobalErrors = { +#ifndef GD_NO_C99_API + .error = 0, + .suberror = 0, + .error_string = _GD_GlobalErrorString, + .error_file = _GD_GlobalErrorFile, + .error_line = 0, + .flags = GD_INVALID, +#else 0, 0, _GD_GlobalErrorString, _GD_GlobalErrorFile, 0, GD_INVALID +#endif }; /* old error strings */ @@ -81,7 +90,7 @@ static struct FormatType Format; /* _GD_CopyGlobalError: Copy the last error message to the global error buffer. - */ +*/ static int _GD_CopyGlobalError(DIRFILE* D) { dtrace("%p", D); @@ -96,7 +105,7 @@ } /* legacy wrapper for gd_error_string() - */ +*/ char *GetDataErrorString(char* buffer, size_t buflen) gd_nothrow { return gd_error_string(&_GD_GlobalErrors, buffer, buflen); @@ -176,7 +185,7 @@ } R->field = E->field; - + switch(E->u.raw.type) { case GD_UINT8: R->type = 'c'; @@ -356,7 +365,7 @@ dreturn("%p", NULL); return NULL; } - + memset(&Format, sizeof(Format), 0); /* fill the structure -- like everything about the legacy API, this is Modified: trunk/getdata/src/open.c =================================================================== --- trunk/getdata/src/open.c 2010-09-17 20:17:08 UTC (rev 447) +++ trunk/getdata/src/open.c 2010-09-18 01:00:35 UTC (rev 448) @@ -199,6 +199,20 @@ dreturnvoid(); } +DIRFILE* gd_invalid_dirfile(void) gd_nothrow +{ + DIRFILE *D; + + dtracevoid(); + + D = (DIRFILE *)malloc(sizeof(DIRFILE)); + memset(D, 0, sizeof(DIRFILE)); + D->flags = GD_INVALID; + + dreturn("%p", D); + return D; +} + /* dirfile_cbopen: open (or, perhaps, create) and parse the specified dirfile */ DIRFILE* gd_cbopen(const char* filedir, unsigned long flags, This was sent by the SourceForge.net collaborative development platform, the wo... [truncated message content] |
From: <ket...@us...> - 2010-10-15 19:23:05
|
Revision: 450 http://getdata.svn.sourceforge.net/getdata/?rev=450&view=rev Author: ketiltrout Date: 2010-10-15 19:22:58 +0000 (Fri, 15 Oct 2010) Log Message: ----------- configure documentation Modified Paths: -------------- trunk/getdata/configure.ac trunk/getdata/m4/encoding.m4 Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-14 07:23:31 UTC (rev 449) +++ trunk/getdata/configure.ac 2010-10-15 19:22:58 UTC (rev 450) @@ -486,7 +486,8 @@ [gd_msvcrt=no]) AC_MSG_RESULT([$gd_msvcrt]) - +dnl 64-bit stat() requires MSVCRT 6.1 or later. This may prohibit using +dnl GetData on Windows95. Oh no! if test "$gd_msvcrt" = "yes"; then AC_DEFINE([__MSVCRT_VERSION__], [0x601], [ If compiling aginst the MSVCRT, define to 0x601 ]) Modified: trunk/getdata/m4/encoding.m4 =================================================================== --- trunk/getdata/m4/encoding.m4 2010-10-14 07:23:31 UTC (rev 449) +++ trunk/getdata/m4/encoding.m4 2010-10-15 19:22:58 UTC (rev 450) @@ -38,15 +38,16 @@ m4_divert_once([HELP_WITH], AS_HELP_STRING([--without-lib$2], [disable encodings supported by lib$2, even if the library is present])) +echo +echo "*** Configuring $1 support" +echo + if test "x$no_extern" = "xyes"; then use_$1="no"; fi if test "x$use_$1" = "xyes"; then dnl search for library - echo - echo "*** Configuring $1 support" - echo saved_ldflags=$LDFLAGS saved_libs=$LIBS if test "x$[]$1_prefix" != "x"; then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-16 02:25:39
|
Revision: 452 http://getdata.svn.sourceforge.net/getdata/?rev=452&view=rev Author: ketiltrout Date: 2010-10-16 02:25:29 +0000 (Sat, 16 Oct 2010) Log Message: ----------- Enough with those ANSI-C-mandated silly named structs, except, of course, in ANSI C mode. Back to the anonymous goodness of previous versions. Admittedly, this isn't even C99-compatible, but it is allowed by C1X, so we'll stick with it until someone whom we're unable to placate with ANSI C mode complains. (It's allowed in C++, and seems to have appeared in the MS C header files, and, thence, GCC support.) Also fixed the autotools "make dist" bug reported by Ted. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/cxx/constentry.cpp trunk/getdata/bindings/cxx/getdata/constentry.h trunk/getdata/bindings/cxx/getdata/entry.h trunk/getdata/bindings/cxx/getdata/rawentry.h trunk/getdata/bindings/cxx/rawentry.cpp trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/bindings/idl/getdata.c trunk/getdata/bindings/python/pyentry.c trunk/getdata/configure.ac trunk/getdata/src/add.c trunk/getdata/src/common.c trunk/getdata/src/constant.c trunk/getdata/src/del.c trunk/getdata/src/encoding.c trunk/getdata/src/endian.c trunk/getdata/src/entry.c trunk/getdata/src/field_list.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/internal.h trunk/getdata/src/legacy.c trunk/getdata/src/meta_list.c trunk/getdata/src/mod.c trunk/getdata/src/move.c trunk/getdata/src/name.c trunk/getdata/src/native.c trunk/getdata/src/nframes.c trunk/getdata/src/parse.c trunk/getdata/src/putdata.c trunk/getdata/src/spf.c trunk/getdata/test/add.c trunk/getdata/test/add_bit.c trunk/getdata/test/add_clincom.c trunk/getdata/test/add_code.c trunk/getdata/test/add_const.c trunk/getdata/test/add_cpolynom.c trunk/getdata/test/add_duplicate.c trunk/getdata/test/add_format.c trunk/getdata/test/add_invalid.c trunk/getdata/test/add_lincom.c trunk/getdata/test/add_linterp.c trunk/getdata/test/add_phase.c trunk/getdata/test/add_polynom.c trunk/getdata/test/add_protect.c trunk/getdata/test/add_raw.c trunk/getdata/test/add_rdonly.c trunk/getdata/test/add_sbit.c trunk/getdata/test/add_scalar.c trunk/getdata/test/add_sort.c trunk/getdata/test/add_spec.c trunk/getdata/test/add_spec_meta.c trunk/getdata/test/add_type.c trunk/getdata/test/alter_entry.c trunk/getdata/test/alter_entry_recode.c trunk/getdata/test/alter_entry_scalar2a.c trunk/getdata/test/alter_entry_scalar2n.c trunk/getdata/test/alter_entry_scalar3.c trunk/getdata/test/alter_entry_scalar4.c trunk/getdata/test/alter_linterp.c trunk/getdata/test/alter_polynom_coeff.c trunk/getdata/test/entry_bit.c trunk/getdata/test/entry_bit_scalar.c trunk/getdata/test/entry_lincom.c trunk/getdata/test/entry_lincom_scalar.c trunk/getdata/test/entry_linterp.c trunk/getdata/test/entry_phase.c trunk/getdata/test/entry_phase_scalar.c trunk/getdata/test/entry_polynom.c trunk/getdata/test/entry_polynom_scalar.c trunk/getdata/test/entry_raw.c trunk/getdata/test/entry_raw_scalar.c trunk/getdata/test/entry_scalar_repr.c trunk/getdata/test/header_complex.c trunk/getdata/test/madd.c trunk/getdata/test/madd_bit.c trunk/getdata/test/madd_clincom.c trunk/getdata/test/madd_const.c trunk/getdata/test/madd_cpolynom.c trunk/getdata/test/madd_lincom.c trunk/getdata/test/madd_linterp.c trunk/getdata/test/madd_phase.c trunk/getdata/test/madd_polynom.c trunk/getdata/test/madd_sbit.c trunk/getdata/test/madd_spec.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/ChangeLog 2010-10-16 02:25:29 UTC (rev 452) @@ -1,3 +1,11 @@ +2010-10-16 D. V. Wiebe <ge...@ke...> svn:452 + * src/getdata.h.in: Keep anonymous structs and unions in C99-mode. + * src/internal.h: Helper macros for C99/C89 differences. + * test/ src/ bindings/: Update for changes. + + * configure.ac: Generate Makefiles even for bindings we're not using (so we + can still run maintainer tasks on them.) + 2010-09-18 D. V. Wiebe <ge...@ke...> svn:448 * bindings/python/pydirfile.c (gdpy_dirfile_close gdpy_dirfile_discard) bindings/cxx/dirfile.cpp (Dirfile::Discard Dirfile::Close) @@ -6,7 +14,7 @@ GetData C internals. * src/open.c (gd_invalid_dirfile): Added. - * src/cxx/: Declare const member functions. + * bindings/cxx/: Declare const member functions. * configure.ac: Fix mkdir check for C++ compilers masquerading as C compilers. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/NEWS 2010-10-16 02:25:29 UTC (rev 452) @@ -1,4 +1,4 @@ -New in version 0.7.0a1: +New in version 0.7.0a2: * Plus ça change, plus c'est la même chose. Modified: trunk/getdata/bindings/cxx/constentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/constentry.cpp 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/cxx/constentry.cpp 2010-10-16 02:25:29 UTC (rev 452) @@ -33,13 +33,13 @@ { E.field = strdup(field_code); E.field_type = GD_CONST_ENTRY; - E.u.cons.type = (gd_type_t)data_type; + E.u.cons.const_type = (gd_type_t)data_type; E.fragment_index = fragment_index; } int ConstEntry::SetType(DataType type) { - E.u.cons.type = (gd_type_t)type; + E.u.cons.const_type = (gd_type_t)type; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); Modified: trunk/getdata/bindings/cxx/getdata/constentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/constentry.h 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/cxx/getdata/constentry.h 2010-10-16 02:25:29 UTC (rev 452) @@ -36,7 +36,7 @@ ConstEntry(const char* field_code, DataType type, int fragment_index = 0); - virtual DataType ConstType() const { return (DataType)E.u.cons.type; } + virtual DataType ConstType() const { return (DataType)E.u.cons.const_type; } int SetType(DataType type); Modified: trunk/getdata/bindings/cxx/getdata/entry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/entry.h 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/cxx/getdata/entry.h 2010-10-16 02:25:29 UTC (rev 452) @@ -108,7 +108,7 @@ }; virtual DataType RawType() const { - return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.u.raw.type : + return (E.field_type == GD_RAW_ENTRY) ? (DataType)E.u.raw.data_type : Unknown; }; @@ -164,7 +164,7 @@ /* CONST methods */ virtual DataType ConstType() const { - return (E.field_type == GD_CONST_ENTRY) ? (DataType)E.u.cons.type : + return (E.field_type == GD_CONST_ENTRY) ? (DataType)E.u.cons.const_type : Unknown; }; Modified: trunk/getdata/bindings/cxx/getdata/rawentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-10-16 02:25:29 UTC (rev 452) @@ -39,7 +39,7 @@ virtual gd_spf_t SamplesPerFrame() const { return E.u.raw.spf; }; - virtual DataType RawType() const { return (DataType)E.u.raw.type; }; + virtual DataType RawType() const { return (DataType)E.u.raw.data_type; }; const char* FileName(); int SetSamplesPerFrame(gd_spf_t spf, int recode = 0); Modified: trunk/getdata/bindings/cxx/rawentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/rawentry.cpp 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/cxx/rawentry.cpp 2010-10-16 02:25:29 UTC (rev 452) @@ -36,7 +36,7 @@ E.field = strdup(field_code); E.field_type = GD_RAW_ENTRY; E.u.raw.spf = spf; - E.u.raw.type = (gd_type_t)data_type; + E.u.raw.data_type = (gd_type_t)data_type; E.fragment_index = fragment_index; } @@ -72,7 +72,7 @@ int RawEntry::SetType(DataType type, int recode) { - E.u.raw.type = (gd_type_t)type; + E.u.raw.data_type = (gd_type_t)type; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, recode); Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-10-16 02:25:29 UTC (rev 452) @@ -413,8 +413,8 @@ *field_code_l), &E) || E.field_type != GD_RAW_ENTRY) *spf = 0; else { - *spf = E.u.raw.spf; - *dtype = E.u.raw.type; + *spf = E.EN(raw,spf); + *dtype = E.EN(raw,data_type); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -444,23 +444,23 @@ *field_code_l), &E) || E.field_type != GD_LINCOM_ENTRY) *nfields = 0; else { - *nfields = E.u.lincom.n_fields; + *nfields = E.EN(lincom,n_fields); *fragment_index = E.fragment_index; _GDF_FString(infield1, infield1_l, E.in_fields[0]); - *m1 = E.u.lincom.m[0]; - *b1 = E.u.lincom.b[0]; + *m1 = E.EN(lincom,m)[0]; + *b1 = E.EN(lincom,b)[0]; - if (E.u.lincom.n_fields > 1) { + if (E.EN(lincom,n_fields) > 1) { _GDF_FString(infield2, infield2_l, E.in_fields[1]); - *m2 = E.u.lincom.m[1]; - *b2 = E.u.lincom.b[1]; + *m2 = E.EN(lincom,m)[1]; + *b2 = E.EN(lincom,b)[1]; } - if (E.u.lincom.n_fields > 2) { + if (E.EN(lincom,n_fields) > 2) { _GDF_FString(infield3, infield3_l, E.in_fields[2]); - *m3 = E.u.lincom.m[2]; - *b3 = E.u.lincom.b[2]; + *m3 = E.EN(lincom,m)[2]; + *b3 = E.EN(lincom,b)[2]; } gd_free_entry_strings(&E); @@ -492,23 +492,23 @@ *nfields = 0; gd_free_entry_strings(&E); } else { - *nfields = E.u.lincom.n_fields; + *nfields = E.EN(lincom,n_fields); *fragment_index = E.fragment_index; _GDF_FString(infield1, infield1_l, E.in_fields[0]); - _gd_c2cp(m1, E.u.lincom.cm[0]); - _gd_c2cp(b1, E.u.lincom.cb[0]); + _gd_c2cp(m1, E.EN(lincom,cm)[0]); + _gd_c2cp(b1, E.EN(lincom,cb)[0]); - if (E.u.lincom.n_fields > 1) { + if (E.EN(lincom,n_fields) > 1) { _GDF_FString(infield2, infield2_l, E.in_fields[1]); - _gd_c2cp(m2, E.u.lincom.cm[1]); - _gd_c2cp(b2, E.u.lincom.cb[1]); + _gd_c2cp(m2, E.EN(lincom,cm)[1]); + _gd_c2cp(b2, E.EN(lincom,cb)[1]); } - if (E.u.lincom.n_fields > 2) { + if (E.EN(lincom,n_fields) > 2) { _GDF_FString(infield3, infield3_l, E.in_fields[2]); - _gd_c2cp(m3, E.u.lincom.cm[2]); - _gd_c2cp(b3, E.u.lincom.cb[2]); + _gd_c2cp(m3, E.EN(lincom,cm)[2]); + _gd_c2cp(b3, E.EN(lincom,cb)[2]); } gd_free_entry_strings(&E); } @@ -535,23 +535,23 @@ *field_code_l), &E) || E.field_type != GD_POLYNOM_ENTRY) *poly_ord = 0; else { - *poly_ord = E.u.polynom.poly_ord; + *poly_ord = E.EN(polynom,poly_ord); *fragment_index = E.fragment_index; _GDF_FString(infield, infield_l, E.in_fields[0]); - switch (E.u.polynom.poly_ord) { + switch (E.EN(polynom,poly_ord)) { case 5: - *a5 = E.u.polynom.a[5]; + *a5 = E.EN(polynom,a)[5]; case 4: - *a4 = E.u.polynom.a[4]; + *a4 = E.EN(polynom,a)[4]; case 3: - *a3 = E.u.polynom.a[3]; + *a3 = E.EN(polynom,a)[3]; case 2: - *a2 = E.u.polynom.a[2]; + *a2 = E.EN(polynom,a)[2]; case 1: - *a1 = E.u.polynom.a[1]; - *a0 = E.u.polynom.a[0]; + *a1 = E.EN(polynom,a)[1]; + *a0 = E.EN(polynom,a)[0]; } gd_free_entry_strings(&E); } @@ -577,23 +577,23 @@ *field_code_l), &E) || E.field_type != GD_POLYNOM_ENTRY) *poly_ord = 0; else { - *poly_ord = E.u.polynom.poly_ord; + *poly_ord = E.EN(polynom,poly_ord); *fragment_index = E.fragment_index; _GDF_FString(infield, infield_l, E.in_fields[0]); - switch (E.u.polynom.poly_ord) { + switch (E.EN(polynom,poly_ord)) { case 5: - _gd_c2cp(a5, E.u.polynom.ca[5]); + _gd_c2cp(a5, E.EN(polynom,ca)[5]); case 4: - _gd_c2cp(a4, E.u.polynom.ca[4]); + _gd_c2cp(a4, E.EN(polynom,ca)[4]); case 3: - _gd_c2cp(a3, E.u.polynom.ca[3]); + _gd_c2cp(a3, E.EN(polynom,ca)[3]); case 2: - _gd_c2cp(a2, E.u.polynom.ca[2]); + _gd_c2cp(a2, E.EN(polynom,ca)[2]); case 1: - _gd_c2cp(a1, E.u.polynom.ca[1]); - _gd_c2cp(a0, E.u.polynom.ca[0]); + _gd_c2cp(a1, E.EN(polynom,ca)[1]); + _gd_c2cp(a0, E.EN(polynom,ca)[0]); } gd_free_entry_strings(&E); } @@ -618,7 +618,7 @@ *field_code_l), &E) || E.field_type != GD_LINTERP_ENTRY) *in_field_l = 0; else { - _GDF_FString(table, table_l, E.u.linterp.table); + _GDF_FString(table, table_l, E.EN(linterp,table)); _GDF_FString(in_field, in_field_l, E.in_fields[0]); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); @@ -644,8 +644,8 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *bitnum = E.u.bit.bitnum; - *numbits = E.u.bit.numbits; + *bitnum = E.EN(bit,bitnum); + *numbits = E.EN(bit,numbits); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -670,8 +670,8 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *bitnum = E.u.bit.bitnum; - *numbits = E.u.bit.numbits; + *bitnum = E.EN(bit,bitnum); + *numbits = E.EN(bit,numbits); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -749,7 +749,7 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *dividend = E.u.recip.dividend; + *dividend = E.EN(recip,dividend); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -774,7 +774,7 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - _gd_c2cp(cdividend, E.u.recip.cdividend); + _gd_c2cp(cdividend, E.EN(recip,cdividend)); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -800,7 +800,7 @@ *in_field_l = 0; else { _GDF_FString(in_field, in_field_l, E.in_fields[0]); - *shift = E.u.phase.shift; + *shift = E.EN(phase,shift); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -823,7 +823,7 @@ *field_code_l), &E) || E.field_type != GD_CONST_ENTRY) *data_type = 0; else { - *data_type = E.u.cons.type; + *data_type = E.EN(cons,const_type); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -2513,14 +2513,14 @@ ok = 0; break; case GD_LINCOM_ENTRY: - if (*index > GD_MAX_LINCOM + E.u.lincom.n_fields || - (*index > E.u.lincom.n_fields && *index <= GD_MAX_LINCOM)) + if (*index > GD_MAX_LINCOM + E.EN(lincom,n_fields) || + (*index > E.EN(lincom,n_fields) && *index <= GD_MAX_LINCOM)) { ok = 0; } break; case GD_POLYNOM_ENTRY: - if (*index > E.u.polynom.poly_ord + 1) + if (*index > E.EN(polynom,poly_ord) + 1) ok = 0; break; case GD_BIT_ENTRY: @@ -2578,14 +2578,14 @@ ok = 0; break; case GD_LINCOM_ENTRY: - if (*index > GD_MAX_LINCOM + E.u.lincom.n_fields || - (*index > E.u.lincom.n_fields && *index <= GD_MAX_LINCOM)) + if (*index > GD_MAX_LINCOM + E.EN(lincom,n_fields) || + (*index > E.EN(lincom,n_fields) && *index <= GD_MAX_LINCOM)) { ok = 0; } break; case GD_POLYNOM_ENTRY: - if (*index > E.u.polynom.poly_ord + 1) + if (*index > E.EN(polynom,poly_ord) + 1) ok = 0; break; case GD_BIT_ENTRY: Modified: trunk/getdata/bindings/idl/getdata.c =================================================================== --- trunk/getdata/bindings/idl/getdata.c 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/idl/getdata.c 2010-10-16 02:25:29 UTC (rev 452) @@ -421,18 +421,18 @@ { case GD_RAW_ENTRY: *(IDL_UINT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "SPF", - IDL_MSG_LONGJMP, NULL)) = E->u.raw.spf; + IDL_MSG_LONGJMP, NULL)) = E->spf; *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "DATA_TYPE", - IDL_MSG_LONGJMP, NULL)) = E->u.raw.type; + IDL_MSG_LONGJMP, NULL)) = E->data_type; IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "SCALAR", IDL_MSG_LONGJMP, NULL)), E->scalar[0]); break; case GD_LINCOM_ENTRY: *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, - "N_FIELDS", IDL_MSG_LONGJMP, NULL)) = E->u.lincom.n_fields; + "N_FIELDS", IDL_MSG_LONGJMP, NULL)) = E->n_fields; *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "COMP_SCAL", IDL_MSG_LONGJMP, NULL)) = E->comp_scal; - for (i = 0; i < E->u.lincom.n_fields; ++i) { + for (i = 0; i < E->n_fields; ++i) { IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "IN_FIELDS", IDL_MSG_LONGJMP, NULL)) + i, E->in_fields[i]); @@ -447,29 +447,29 @@ if (E->comp_scal) { gdidl_c99_to_dcmp((IDL_DCOMPLEX*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "CM", IDL_MSG_LONGJMP, - NULL)), E->u.lincom.cm, E->u.lincom.n_fields); + NULL)), E->cm, E->n_fields); gdidl_c99_to_dcmp((IDL_DCOMPLEX*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "CB", IDL_MSG_LONGJMP, - NULL)), E->u.lincom.cb, E->u.lincom.n_fields); + NULL)), E->cb, E->n_fields); } else { memcpy(data + IDL_StructTagInfoByName(gdidl_entry_def, "M", - IDL_MSG_LONGJMP, NULL), E->u.lincom.m, E->u.lincom.n_fields * + IDL_MSG_LONGJMP, NULL), E->m, E->n_fields * sizeof(double)); memcpy(data + IDL_StructTagInfoByName(gdidl_entry_def, "B", - IDL_MSG_LONGJMP, NULL), E->u.lincom.b, E->u.lincom.n_fields * + IDL_MSG_LONGJMP, NULL), E->b, E->n_fields * sizeof(double)); } break; case GD_LINTERP_ENTRY: IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, - "TABLE", IDL_MSG_LONGJMP, NULL)), E->u.linterp.table); + "TABLE", IDL_MSG_LONGJMP, NULL)), E->table); break; case GD_BIT_ENTRY: case GD_SBIT_ENTRY: *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "BITNUM", - IDL_MSG_LONGJMP, NULL)) = E->u.bit.bitnum; + IDL_MSG_LONGJMP, NULL)) = E->bitnum; *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "NUMBITS", - IDL_MSG_LONGJMP, NULL)) = E->u.bit.numbits; + IDL_MSG_LONGJMP, NULL)) = E->numbits; IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "SCALAR", IDL_MSG_LONGJMP, NULL)), E->scalar[0]); IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, @@ -489,14 +489,14 @@ if (E->comp_scal) gdidl_c99_to_dcmp((IDL_DCOMPLEX*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "CDIVIDEND", - IDL_MSG_LONGJMP, NULL)), &E->u.recip.cdividend, 1); + IDL_MSG_LONGJMP, NULL)), &E->cdividend, 1); else *(double*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "DIVIDEND", - IDL_MSG_LONGJMP, NULL)) = E->u.recip.dividend; + IDL_MSG_LONGJMP, NULL)) = E->dividend; break; case GD_PHASE_ENTRY: *(IDL_LONG*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "SHIFT", - IDL_MSG_LONGJMP, NULL)) = E->u.phase.shift; + IDL_MSG_LONGJMP, NULL)) = E->shift; IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "SCALAR", IDL_MSG_LONGJMP, NULL)), E->scalar[0]); break; @@ -504,9 +504,9 @@ *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "COMP_SCAL", IDL_MSG_LONGJMP, NULL)) = E->comp_scal; *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, - "POLY_ORD", IDL_MSG_LONGJMP, NULL)) = E->u.polynom.poly_ord; + "POLY_ORD", IDL_MSG_LONGJMP, NULL)) = E->poly_ord; - for (i = 0; i <= E->u.polynom.poly_ord; ++i) + for (i = 0; i <= E->poly_ord; ++i) IDL_StrStore((IDL_STRING*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "SCALAR", IDL_MSG_LONGJMP, NULL)) + i, E->scalar[i]); @@ -514,15 +514,15 @@ if (E->comp_scal) gdidl_c99_to_dcmp((IDL_DCOMPLEX*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "CA", IDL_MSG_LONGJMP, - NULL)), E->u.polynom.ca, E->u.polynom.poly_ord + 1); + NULL)), E->ca, E->poly_ord + 1); else memcpy(data + IDL_StructTagInfoByName(gdidl_entry_def, "A", - IDL_MSG_LONGJMP, NULL), E->u.polynom.a, - (E->u.polynom.poly_ord + 1) * sizeof(double)); + IDL_MSG_LONGJMP, NULL), E->a, + (E->poly_ord + 1) * sizeof(double)); break; case GD_CONST_ENTRY: *(IDL_INT*)(data + IDL_StructTagInfoByName(gdidl_entry_def, "DATA_TYPE", - IDL_MSG_LONGJMP, NULL)) = E->u.cons.type; + IDL_MSG_LONGJMP, NULL)) = E->const_type; break; case GD_NO_ENTRY: case GD_INDEX_ENTRY: @@ -595,16 +595,16 @@ if (o != -1) { if (d->type != IDL_TYP_UINT) idl_abort("GD_ENTRY element INDEX must be of type UINT"); - E->u.raw.spf = *(uint16_t*)(data + o); + E->spf = *(uint16_t*)(data + o); } o = IDL_StructTagInfoByName(v->value.s.sdef, "DATA_TYPE", action, &d); if (o != -1) { if (d->type != IDL_TYP_INT) idl_abort("GD_ENTRY element DATA_TYPE must be of type INT"); - E->u.raw.type = *(int16_t*)(data + o); + E->data_type = *(int16_t*)(data + o); } else - E->u.raw.type = GD_NULL; + E->data_type = GD_NULL; copy_scalar[0] = 1; @@ -614,7 +614,7 @@ if (o != -1) { if (d->type != IDL_TYP_INT) idl_abort("GD_ENTRY element N_FIELDS must be of type INT"); - n = E->u.lincom.n_fields = *(int16_t*)(data + o); + n = E->n_fields = *(int16_t*)(data + o); } o = IDL_StructTagInfoByName(v->value.s.sdef, "COMP_SCAL", action, &d); @@ -652,7 +652,7 @@ n = GD_MAX_LINCOM; } if (d->type == IDL_TYP_DCOMPLEX) - gdidl_dcmp_to_c99(E->u.lincom.cm, (IDL_DCOMPLEX*)data + o, n); + gdidl_dcmp_to_c99(E->cm, (IDL_DCOMPLEX*)data + o, n); else idl_abort("GD_ENTRY element CM must be of type DCOMPLEX"); } @@ -666,9 +666,9 @@ n = GD_MAX_LINCOM; } if (d->type == IDL_TYP_DOUBLE) { - memcpy(E->u.lincom.m, data + o, n * sizeof(double)); + memcpy(E->m, data + o, n * sizeof(double)); for (i = 0; i < n; ++i) - E->u.lincom.cm[i] = E->u.lincom.m[i]; + E->cm[i] = E->m[i]; } else idl_abort("GD_ENTRY element M must be of type DOUBLE"); } @@ -684,8 +684,8 @@ n = GD_MAX_LINCOM; } if (d->type == IDL_TYP_DCOMPLEX) - gdidl_dcmp_to_c99(E->u.lincom.cb, (IDL_DCOMPLEX*)data + o, - E->u.lincom.n_fields); + gdidl_dcmp_to_c99(E->cb, (IDL_DCOMPLEX*)data + o, + E->n_fields); else idl_abort("GD_ENTRY element CB must be of type DCOMPLEX"); } @@ -699,10 +699,10 @@ n = GD_MAX_LINCOM; } if (d->type == IDL_TYP_DOUBLE) { - memcpy(E->u.lincom.b, data + o, E->u.lincom.n_fields * + memcpy(E->b, data + o, E->n_fields * sizeof(double)); - for (i = 0; i < E->u.lincom.n_fields; ++i) - E->u.lincom.cb[i] = E->u.lincom.b[i]; + for (i = 0; i < E->n_fields; ++i) + E->cb[i] = E->b[i]; } else idl_abort("GD_ENTRY element B must be of type DOUBLE"); } @@ -721,15 +721,15 @@ if (o != -1) { if (d->type != IDL_TYP_INT) idl_abort("GD_ENTRY element BITNUM must be of type INT"); - E->u.bit.bitnum = *(int16_t*)(data + o); + E->bitnum = *(int16_t*)(data + o); } else - E->u.bit.bitnum = -1; + E->bitnum = -1; o = IDL_StructTagInfoByName(v->value.s.sdef, "NUMBITS", action, &d); if (o != -1) { if (d->type != IDL_TYP_INT) idl_abort("GD_ENTRY element NUMBITS must be of type INT"); - E->u.bit.numbits = *(int16_t*)(data + o); + E->numbits = *(int16_t*)(data + o); } copy_scalar[0] = copy_scalar[1] = 1; @@ -754,7 +754,7 @@ o = IDL_StructTagInfoByName(v->value.s.sdef, "CDIVIDEND", action, &d); if (o != -1) { if (d->type == IDL_TYP_DCOMPLEX) - gdidl_dcmp_to_c99(&E->u.recip.cdividend, (IDL_DCOMPLEX*)data + o, + gdidl_dcmp_to_c99(&E->cdividend, (IDL_DCOMPLEX*)data + o, 1); else idl_abort("GD_ENTRY element CDIVIDEND must be of type DCOMPLEX"); @@ -763,7 +763,7 @@ o = IDL_StructTagInfoByName(v->value.s.sdef, "DIVIDEND", action, &d); if (o != -1) { if (d->type == IDL_TYP_DOUBLE) - E->u.recip.dividend = *(double*)(data + o); + E->dividend = *(double*)(data + o); else idl_abort("GD_ENTRY element DIVIDEND must be of type DOUBLE"); } @@ -775,7 +775,7 @@ &d); if (d->type != IDL_TYP_LONG) idl_abort("GD_ENTRY element SHIFT must be of type LONG"); - E->u.phase.shift = *(int16_t*)(data + o); + E->shift = *(int16_t*)(data + o); copy_scalar[0] = 1; break; case GD_POLYNOM_ENTRY: @@ -783,8 +783,8 @@ if (o != -1) { if (d->type != IDL_TYP_INT) idl_abort("GD_ENTRY element POLY_ORD must be of type INT"); - E->u.polynom.poly_ord = *(int16_t*)(data + o); - n = E->u.polynom.poly_ord + 1; + E->poly_ord = *(int16_t*)(data + o); + n = E->poly_ord + 1; } for (i = 0 ; i < n; ++i) @@ -807,7 +807,7 @@ n = GD_MAX_POLYORD; } if (d->type == IDL_TYP_DCOMPLEX) - gdidl_dcmp_to_c99(E->u.polynom.ca, (IDL_DCOMPLEX*)data + o, n); + gdidl_dcmp_to_c99(E->ca, (IDL_DCOMPLEX*)data + o, n); else idl_abort("GD_ENTRY element CA must be of type DCOMPLEX"); } @@ -821,7 +821,7 @@ n = GD_MAX_POLYORD; } if (d->type == IDL_TYP_DOUBLE) - memcpy(E->u.polynom.a, data + o, n * sizeof(double)); + memcpy(E->a, data + o, n * sizeof(double)); else idl_abort("GD_ENTRY element A must be of type DOUBLE"); } @@ -832,9 +832,9 @@ if (o != -1) { if (d->type != IDL_TYP_INT) idl_abort("GD_ENTRY element DATA_TYPE must be of type INT"); - E->u.cons.type = *(int16_t*)(data + o); + E->const_type = *(int16_t*)(data + o); } else - E->u.cons.type = GD_NULL; + E->const_type = GD_NULL; break; case GD_NO_ENTRY: case GD_INDEX_ENTRY: Modified: trunk/getdata/bindings/python/pyentry.c =================================================================== --- trunk/getdata/bindings/python/pyentry.c 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/bindings/python/pyentry.c 2010-10-16 02:25:29 UTC (rev 452) @@ -167,13 +167,13 @@ switch (E->field_type) { case GD_RAW_ENTRY: - E->u.raw.type = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0)); - if (GDPY_INVALID_TYPE(E->u.raw.type)) + E->data_type = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0)); + if (GDPY_INVALID_TYPE(E->data_type)) PyErr_SetString(PyExc_ValueError, "'pygetdata.entry' invalid data type"); gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_UINT16, - &E->scalar[0], &E->u.raw.spf); + &E->scalar[0], &E->spf); break; case GD_LINCOM_ENTRY: parm1 = PyTuple_GetItem(tuple, 0); @@ -188,7 +188,7 @@ return; } - count = E->u.lincom.n_fields = PyTuple_Size(parm1); + count = E->n_fields = PyTuple_Size(parm1); if (count > GD_MAX_LINCOM) count = GD_MAX_LINCOM; @@ -210,14 +210,14 @@ obj = PyTuple_GetItem(parm2, i); if (PyComplex_Check(obj)) { E->comp_scal = 1; - E->u.lincom.cm[i] = gdpy_as_complex(obj); + E->cm[i] = gdpy_as_complex(obj); } else if (E->comp_scal) gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, &E->scalar[i], - &E->u.lincom.cm[i]); + &E->cm[i]); else { gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[i], - &E->u.lincom.m[i]); - E->u.lincom.cm[i] = E->u.lincom.m[i]; + &E->m[i]); + E->cm[i] = E->m[i]; } if (PyErr_Occurred()) { @@ -228,14 +228,14 @@ obj = PyTuple_GetItem(parm3, i); if (PyComplex_Check(obj)) { E->comp_scal = 1; - E->u.lincom.cb[i] = gdpy_as_complex(obj); + E->cb[i] = gdpy_as_complex(obj); } else if (E->comp_scal) gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, - &E->scalar[i + GD_MAX_LINCOM], &E->u.lincom.cb[i]); + &E->scalar[i + GD_MAX_LINCOM], &E->cb[i]); else { gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, - &E->scalar[i + GD_MAX_LINCOM], &E->u.lincom.b[i]); - E->u.lincom.cb[i] = E->u.lincom.b[i]; + &E->scalar[i + GD_MAX_LINCOM], &E->b[i]); + E->cb[i] = E->b[i]; } if (PyErr_Occurred()) { @@ -252,7 +252,7 @@ return; } - E->u.linterp.table = gdpy_dup_pystring(PyTuple_GetItem(tuple, 1)); + E->table = gdpy_dup_pystring(PyTuple_GetItem(tuple, 1)); if (PyErr_Occurred()) { dreturnvoid(); @@ -269,12 +269,12 @@ } gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_INT16, - &E->scalar[0], &E->u.bit.bitnum); + &E->scalar[0], &E->bitnum); if (size > 2) gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 2), GD_INT16, - &E->scalar[1], &E->u.bit.numbits); + &E->scalar[1], &E->numbits); else { - E->u.bit.numbits = 1; + E->numbits = 1; E->scalar[1] = NULL; } break; @@ -305,14 +305,14 @@ obj = PyTuple_GetItem(tuple, 1); if (PyComplex_Check(obj)) { E->comp_scal = 1; - E->u.recip.cdividend = gdpy_as_complex(obj); + E->cdividend = gdpy_as_complex(obj); } else if (E->comp_scal) gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, &E->scalar[0], - &E->u.recip.cdividend); + &E->cdividend); else { gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[0], - &E->u.recip.dividend); - E->u.recip.cdividend = E->u.recip.dividend; + &E->dividend); + E->cdividend = E->dividend; } if (PyErr_Occurred()) { @@ -329,7 +329,7 @@ } gdpy_set_scalar_from_pyobj(PyTuple_GetItem(tuple, 1), GD_INT64, - &E->scalar[0], &E->u.phase.shift); + &E->scalar[0], &E->shift); break; case GD_POLYNOM_ENTRY: parm2 = PyTuple_GetItem(tuple, 1); @@ -340,7 +340,7 @@ return; } - E->u.polynom.poly_ord = count = PyTuple_Size(parm2) - 1; + E->poly_ord = count = PyTuple_Size(parm2) - 1; if (count > GD_MAX_POLYORD) count = GD_MAX_POLYORD; @@ -355,15 +355,15 @@ obj = PyTuple_GetItem(parm2, i); if (PyComplex_Check(obj)) { E->comp_scal = 1; - E->u.polynom.ca[i] = gdpy_as_complex(obj); + E->ca[i] = gdpy_as_complex(obj); E->scalar[i] = NULL; } else if (E->comp_scal) gdpy_set_scalar_from_pyobj(obj, GD_COMPLEX128, &E->scalar[i], - &E->u.polynom.ca[i]); + &E->ca[i]); else { gdpy_set_scalar_from_pyobj(obj, GD_FLOAT64, &E->scalar[i], - &E->u.polynom.a[i]); - E->u.polynom.ca[i] = E->u.polynom.a[i]; + &E->a[i]); + E->ca[i] = E->a[i]; } if (PyErr_Occurred()) { @@ -373,8 +373,8 @@ } break; case GD_CONST_ENTRY: - E->u.cons.type = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0)); - if (GDPY_INVALID_TYPE(E->u.cons.type)) + E->const_type = (gd_type_t)PyInt_AsLong(PyTuple_GetItem(tuple, 0)); + if (GDPY_INVALID_TYPE(E->const_type)) PyErr_SetString(PyExc_ValueError, "'pygetdata.entry' invalid data type"); case GD_NO_ENTRY: @@ -653,8 +653,8 @@ switch (self->E->field_type) { case GD_LINCOM_ENTRY: - tuple = PyTuple_New(self->E->u.lincom.n_fields); - for (i = 0; i < self->E->u.lincom.n_fields; ++i) + tuple = PyTuple_New(self->E->n_fields); + for (i = 0; i < self->E->n_fields; ++i) PyTuple_SetItem(tuple, i, PyString_FromString(self->E->in_fields[i])); break; case GD_LINTERP_ENTRY: @@ -703,14 +703,14 @@ return -1; } - if (PyTuple_Size(value) < self->E->u.lincom.n_fields) { + if (PyTuple_Size(value) < self->E->n_fields) { PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' " "not enough items in tuple for in_fields"); dreturn("%i", -1); return -1; } - for (i = 0; i < self->E->u.lincom.n_fields; ++i) + for (i = 0; i < self->E->n_fields; ++i) s[i] = gdpy_dup_pystring(PyTuple_GetItem(value, i)); if (PyErr_Occurred()) { @@ -718,7 +718,7 @@ return -1; } - for (i = 0; i < self->E->u.lincom.n_fields; ++i) { + for (i = 0; i < self->E->n_fields; ++i) { free(self->E->in_fields[i]); self->E->in_fields[i] = s[i]; } @@ -804,9 +804,9 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_RAW_ENTRY) - t = self->E->u.raw.type; + t = self->E->data_type; else if (self->E->field_type == GD_CONST_ENTRY) - t = self->E->u.cons.type; + t = self->E->const_type; else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " "attribute 'data_type_name' not available for entry type %s", @@ -831,9 +831,9 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_RAW_ENTRY) - obj = PyInt_FromLong(self->E->u.raw.type); + obj = PyInt_FromLong(self->E->data_type); else if (self->E->field_type == GD_CONST_ENTRY) - obj = PyInt_FromLong(self->E->u.cons.type); + obj = PyInt_FromLong(self->E->const_type); else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " "attribute 'data_type' not available for entry type %s", @@ -873,9 +873,9 @@ } if (self->E->field_type == GD_RAW_ENTRY) - self->E->u.raw.type = (gd_type_t)t; + self->E->data_type = (gd_type_t)t; else - self->E->u.cons.type = (gd_type_t)t; + self->E->const_type = (gd_type_t)t; dreturn("%i", 0); return 0; @@ -889,7 +889,7 @@ if (self->E->field_type == GD_RAW_ENTRY) { if (self->E->scalar[0] == NULL) - obj = PyInt_FromLong(self->E->u.raw.spf); + obj = PyInt_FromLong(self->E->spf); else obj = PyString_FromString(self->E->scalar[0]); } else @@ -927,7 +927,7 @@ free(self->E->scalar[0]); self->E->scalar[0] = scalar; - self->E->u.raw.spf = spf; + self->E->spf = spf; dreturn("%i", 0); return 0; @@ -940,7 +940,7 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_LINCOM_ENTRY) { - obj = PyInt_FromLong(self->E->u.lincom.n_fields); + obj = PyInt_FromLong(self->E->n_fields); } else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " "attribute 'n_fields' not available for entry type %s", @@ -976,16 +976,16 @@ } /* free extra terms */ - for (i = n; i < self->E->u.lincom.n_fields; ++i) + for (i = n; i < self->E->n_fields; ++i) free(self->E->in_fields[i]); /* initialise new terms */ - for (i = self->E->u.lincom.n_fields; i < n; ++i) { + for (i = self->E->n_fields; i < n; ++i) { self->E->in_fields[i] = strdup(""); - self->E->u.lincom.m[i] = self->E->u.lincom.b[i] = 0; + self->E->m[i] = self->E->b[i] = 0; } - self->E->u.lincom.n_fields = n; + self->E->n_fields = n; dreturn("%i", 0); return 0; @@ -999,11 +999,11 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_LINCOM_ENTRY) { - obj = PyTuple_New(self->E->u.lincom.n_fields); - for (i = 0; i < self->E->u.lincom.n_fields; ++i) + obj = PyTuple_New(self->E->n_fields); + for (i = 0; i < self->E->n_fields; ++i) PyTuple_SetItem(obj, i, (self->E->scalar[i] == NULL) ? - (self->E->comp_scal) ? gdpy_from_complex(self->E->u.lincom.cm[i]) : - PyFloat_FromDouble(self->E->u.lincom.m[i]) : + (self->E->comp_scal) ? gdpy_from_complex(self->E->cm[i]) : + PyFloat_FromDouble(self->E->m[i]) : PyString_FromString(self->E->scalar[i])); } else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " @@ -1040,14 +1040,14 @@ return -1; } - if (PyTuple_Size(value) < self->E->u.lincom.n_fields) { + if (PyTuple_Size(value) < self->E->n_fields) { PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' " "not enough items in tuple for attribute 'm'"); dreturn("%i", -1); return -1; } - for (i = 0; i < self->E->u.lincom.n_fields; ++i) { + for (i = 0; i < self->E->n_fields; ++i) { PyObject *obj = PyTuple_GetItem(value, i); if (PyComplex_Check(obj)) { comp_scal = 1; @@ -1069,11 +1069,11 @@ return -1; } - for (i = 0; i < self->E->u.lincom.n_fields; ++i) { - if (cimag(self->E->u.lincom.cb[i])) + for (i = 0; i < self->E->n_fields; ++i) { + if (cimag(self->E->cb[i])) comp_scal = 1; - self->E->u.lincom.cm[i] = cm[i]; - self->E->u.lincom.m[i] = m[i]; + self->E->cm[i] = cm[i]; + self->E->m[i] = m[i]; free(self->E->scalar[i]); self->E->scalar[i] = scalar[i]; } @@ -1091,11 +1091,11 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_LINCOM_ENTRY) { - obj = PyTuple_New(self->E->u.lincom.n_fields); - for (i = 0; i < self->E->u.lincom.n_fields; ++i) + obj = PyTuple_New(self->E->n_fields); + for (i = 0; i < self->E->n_fields; ++i) PyTuple_SetItem(obj, i, (self->E->scalar[i + GD_MAX_LINCOM] == NULL) ? - (self->E->comp_scal) ? gdpy_from_complex(self->E->u.lincom.cb[i]) : - PyFloat_FromDouble(self->E->u.lincom.b[i]) : + (self->E->comp_scal) ? gdpy_from_complex(self->E->cb[i]) : + PyFloat_FromDouble(self->E->b[i]) : PyString_FromString(self->E->scalar[i + GD_MAX_LINCOM])); } else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " @@ -1132,14 +1132,14 @@ return -1; } - if (PyTuple_Size(value) < self->E->u.lincom.n_fields) { + if (PyTuple_Size(value) < self->E->n_fields) { PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' " "not enough items in tuple for attribute 'b'"); dreturn("%i", -1); return -1; } - for (i = 0; i < self->E->u.lincom.n_fields; ++i) { + for (i = 0; i < self->E->n_fields; ++i) { PyObject *obj = PyTuple_GetItem(value, i); if (PyComplex_Check(obj)) { comp_scal = 1; @@ -1161,11 +1161,11 @@ return -1; } - for (i = 0; i < self->E->u.lincom.n_fields; ++i) { - if (cimag(self->E->u.lincom.cm[i])) + for (i = 0; i < self->E->n_fields; ++i) { + if (cimag(self->E->cm[i])) comp_scal = 1; - self->E->u.lincom.cb[i] = cb[i]; - self->E->u.lincom.b[i] = b[i]; + self->E->cb[i] = cb[i]; + self->E->b[i] = b[i]; free(self->E->scalar[i + GD_MAX_LINCOM]); self->E->scalar[i + GD_MAX_LINCOM] = scalar[i]; } @@ -1181,7 +1181,7 @@ PyObject* obj = NULL; if (self->E->field_type == GD_LINTERP_ENTRY) - obj = PyString_FromString(self->E->u.linterp.table); + obj = PyString_FromString(self->E->table); else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " "attribute 'table' not available for entry type %s", @@ -1228,7 +1228,7 @@ self->E->field_type == GD_SBIT_ENTRY) { if (self->E->scalar[0] == NULL) - obj = PyInt_FromLong(self->E->u.bit.bitnum); + obj = PyInt_FromLong(self->E->bitnum); else obj = PyString_FromString(self->E->scalar[0]); } else @@ -1264,7 +1264,7 @@ return -1; } - self->E->u.bit.bitnum = (gd_bit_t)bitnum; + self->E->bitnum = (gd_bit_t)bitnum; free(self->E->scalar[0]); self->E->scalar[0] = scalar; @@ -1282,7 +1282,7 @@ self->E->field_type == GD_SBIT_ENTRY) { if (self->E->scalar[1] == NULL) - obj = PyInt_FromLong(self->E->u.bit.numbits); + obj = PyInt_FromLong(self->E->numbits); else obj = PyString_FromString(self->E->scalar[1]); } else @@ -1319,7 +1319,7 @@ return -1; } - self->E->u.bit.numbits = (gd_bit_t)numbits; + self->E->numbits = (gd_bit_t)numbits; free(self->E->scalar[1]); self->E->scalar[1] = scalar; @@ -1338,9 +1338,9 @@ if (self->E->scalar[0]) obj = PyString_FromString(self->E->scalar[0]); else if (self->E->comp_scal) - obj = gdpy_from_complex(self->E->u.recip.cdividend); + obj = gdpy_from_complex(self->E->cdividend); else - obj = PyFloat_FromDouble(self->E->u.recip.dividend); + obj = PyFloat_FromDouble(self->E->dividend); } else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " "attribute 'dividend' not available for entry type %s", @@ -1385,8 +1385,8 @@ } self->E->comp_scal = comp_scal; - self->E->u.recip.cdividend = cdividend; - self->E->u.recip.dividend = dividend; + self->E->cdividend = cdividend; + self->E->dividend = dividend; free(self->E->scalar[0]); self->E->scalar[0] = scalar; @@ -1402,7 +1402,7 @@ if (self->E->field_type == GD_PHASE_ENTRY) { if (self->E->scalar[0] == NULL) - obj = PyLong_FromLongLong((PY_LONG_LONG)self->E->u.phase.shift); + obj = PyLong_FromLongLong((PY_LONG_LONG)self->E->shift); else obj = PyString_FromString(self->E->scalar[0]); } else @@ -1437,7 +1437,7 @@ return -1; } - self->E->u.phase.shift = shift; + self->E->shift = shift; free(self->E->scalar[0]); self->E->scalar[0] = scalar; @@ -1453,11 +1453,11 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_POLYNOM_ENTRY) { - obj = PyTuple_New(self->E->u.polynom.poly_ord + 1); - for (i = 0; i <= self->E->u.polynom.poly_ord; ++i) + obj = PyTuple_New(self->E->poly_ord + 1); + for (i = 0; i <= self->E->poly_ord; ++i) PyTuple_SetItem(obj, i, (self->E->scalar[i] == NULL) ? - (self->E->comp_scal) ? gdpy_from_complex(self->E->u.polynom.ca[i]) : - PyFloat_FromDouble(self->E->u.polynom.a[i]) : + (self->E->comp_scal) ? gdpy_from_complex(self->E->ca[i]) : + PyFloat_FromDouble(self->E->a[i]) : PyString_FromString(self->E->scalar[i])); } else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " @@ -1494,14 +1494,14 @@ return -1; } - if (PyTuple_Size(value) < self->E->u.polynom.poly_ord + 1) { + if (PyTuple_Size(value) < self->E->poly_ord + 1) { PyErr_SetString(PyExc_TypeError, "'pygetdata.entry' " "not enough items in tuple for attribute 'a'"); dreturn("%i", -1); return -1; } - for (i = 0; i <= self->E->u.polynom.poly_ord; ++i) { + for (i = 0; i <= self->E->poly_ord; ++i) { PyObject *obj = PyTuple_GetItem(value, i); if (PyComplex_Check(obj)) { comp_scal = 1; @@ -1520,9 +1520,9 @@ return -1; } - for (i = 0; i <= self->E->u.polynom.poly_ord; ++i) { - self->E->u.polynom.a[i] = a[i]; - self->E->u.polynom.ca[i] = ca[i]; + for (i = 0; i <= self->E->poly_ord; ++i) { + self->E->a[i] = a[i]; + self->E->ca[i] = ca[i]; free(self->E->scalar[i]); self->E->scalar[i] = scalar[i]; } @@ -1539,7 +1539,7 @@ dtrace("%p, %p", self, closure); if (self->E->field_type == GD_POLYNOM_ENTRY) - obj = PyInt_FromLong(self->E->u.polynom.poly_ord); + obj = PyInt_FromLong(self->E->poly_ord); else PyErr_Format(PyExc_AttributeError, "'pygetdata.entry' " "attribute 'poly_ord' not available for entry type %s", @@ -1574,7 +1574,7 @@ return -1; } - self->E->u.polynom.poly_ord = n; + self->E->poly_ord = n; dreturn("%i", 0); return 0; @@ -1596,14 +1596,14 @@ tuple = Py_BuildValue("()"); break; case GD_CONST_ENTRY: - tuple = Py_BuildValue("(i)", self->E->u.cons.type); + tuple = Py_BuildValue("(i)", self->E->const_type); break; case GD_RAW_ENTRY: - tuple = Py_BuildValue("(iI)", self->E->u.raw.type, self->E->u.raw.spf); + tuple = Py_BuildValue("(iI)", self->E->data_type, self->E->spf); break; case GD_LINTERP_ENTRY: tuple = Py_BuildValue("(ss)", self->E->in_fields[0], - self->E->u.linterp.table); + self->E->table); break; case GD_MULTIPLY_ENTRY: case GD_DIVIDE_ENTRY: @@ -1613,73 +1613,73 @@ case GD_RECIP_ENTRY: if (self->E->comp_scal) tuple = Py_BuildValue("(sO)", self->E->in_fields[0], - gdpy_from_complex(self->E->u.recip.cdividend)); + gdpy_from_complex(self->E->cdividend)); else tuple = Py_BuildValue("(sd)", self->E->in_fields[0], - self->E->u.recip.dividend); + self->E->dividend); break; case GD_PHASE_ENTRY: tuple = Py_BuildValue("(si)", self->E->in_fields[0], - self->E->u.phase.shift); + self->E->shift); break; case GD_POLYNOM_ENTRY: - a = PyTuple_New(self->E->u.polynom.poly_ord + 1); + a = PyTuple_New(self->E->poly_ord + 1); if (self->E->comp_scal) - for (i = 0; i <= self->E->u.polynom.poly_ord; ++i) - PyTuple_SetItem(a, i, gdpy_from_complex(self->E->u.polynom.ca[i])); + for (i = 0; i <= self->E->poly_ord; ++i) + PyTuple_SetItem(a, i, gdpy_from_complex(self->E->ca[i])); else - for (i = 0; i <= self->E->u.polynom.poly_ord; ++i) - PyTuple_SetItem(a, i, PyFloat_FromDouble(self->E->u.polynom.a[i])); + for (i = 0; i <= self->E->poly_ord; ++i) + PyTuple_SetItem(a, i, PyFloat_FromDouble(self->E->a[i])); tuple = Py_BuildValue("(sO)", self->E->in_fields[0], a); break; case GD_LINCOM_ENTRY: - switch (self->E->u.lincom.n_fields) { + switch (self->E->n_fields) { case 1: if (self->E->comp_scal) tuple = Py_BuildValue("((s)(O)(O))", self->E->in_fields[0], - gdpy_from_complex(self->E->u.lincom.cm[0]), - gdpy_from_complex(self->E->u.lincom.cb[0])); + gdpy_from_complex(self->E->cm[0]), + gdpy_from_complex(self->E->cb[0])); else tuple = Py_BuildValue("((s)(d)(d))", self->E->in_fields[0], - self->E->u.lincom.m[0], self->E->u.lincom.b[0]); + self->E->m[0], self->E->b[0]); break; case 2: if (self->E->comp_scal) tuple = Py_BuildValue("((ss)(OO)(OO))", self->E->in_fields[0], self->E->in_fields[1], - gdpy_from_complex(self->E->u.lincom.cm[0]), - gdpy_from_complex(self->E->u.lincom.cm[1]), - gdpy_from_complex(self->E->u.lincom.cb[0]), - gdpy_from_complex(self->E->u.lincom.cb[1])); + gdpy_from_complex(self->E->cm[0]), + gdpy_from_complex(self->E->cm[1]), + gdpy_from_complex(self->E->cb[0]), + gdpy_from_complex(self->E->cb[1])); else tuple = Py_BuildValue("((ss)(dd)(dd))", self->E->in_fields[0], - self->E->in_fields[1], self->E->u.lincom.m[0], - self->E->u.lincom.m[1], self->E->u.lincom.b[0], - self->E->u.lincom.b[1]); + self->E->in_fields[1], self->E->m[0], + self->E->m[1], self->E->b[0], + self->E->b[1]); break; case 3: if (self->E->comp_scal) tuple = Py_BuildValue("((sss)(OOO)(OOO))", self->E->in_fields[0], self->E->in_fields[1], self->E->in_fields[2], - gdpy_from_complex(self->E->u.lincom.cm[0]), - gdpy_from_complex(self->E->u.lincom.cm[1]), - gdpy_from_complex(self->E->u.lincom.cm[2]), - gdpy_from_complex(self->E->u.lincom.cb[0]), - gdpy_from_complex(self->E->u.lincom.cb[1]), - gdpy_from_complex(self->E->u.lincom.cb[2])); + gdpy_from_complex(self->E->cm[0]), + gdpy_from_complex(self->E->cm[1]), + gdpy_from_complex(self->E->cm[2]), + gdpy_from_complex(self->E->cb[0]), + gdpy_from_complex(self->E->cb[1]), + gdpy_from_complex(self->E->cb[2])); else tuple = Py_BuildValue("((sss)(ddd)(ddd))", self->E->in_fields[0], self->E->in_fields[1], self->E->in_fields[2], - self->E->u.lincom.m[0], self->E->u.lincom.m[1], - self->E->u.lincom.m[2], self->E->u.lincom.b[0], - self->E->u.lincom.b[1], self->E->u.lincom.b[2]); + self->E->m[0], self->E->m[1], + self->E->m[2], self->E->b[0], + self->E->b[1], self->E->b[2]); break; } break; case GD_BIT_ENTRY: case GD_SBIT_ENTRY: tuple = Py_BuildValue("(sii)", self->E->in_fields[0], - self->E->u.bit.bitnum, self->E->u.bit.numbits); + self->E->bitnum, self->E->numbits); break; } Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/configure.ac 2010-10-16 02:25:29 UTC (rev 452) @@ -22,7 +22,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 7) m4_define(getdata_revision, 0) -m4_define(getdata_extra, [a1]) +m4_define(getdata_extra, [a2]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/getdata/src/add.c =================================================================== --- trunk/getdata/src/add.c 2010-10-16 01:41:34 UTC (rev 451) +++ trunk/getdata/src/add.c 2010-10-16 02:25:29 UTC (rev 452) @@ -184,35 +184,40 @@ return -1; } - E->u.raw.type = entry->u.raw.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->EN(raw,data_type) = entry->EN(raw,data_type); + E->e->EN(raw,file)[0].fp = E->e->EN(raw,file)[1].fp = -1; + E->e->EN(raw,file)[0].encoding = GD_ENC_UNKNOWN; - if ((E->e->u.raw.filebase = (char *)malloc(FILENAME_MAX)) == NULL) { + if ((E->e->EN(raw,filebase) = (char *)malloc(FILENAME_MAX)) == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); break; } if (D->fragment[E->fragment_index].sname) - snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s/%s", D->name, + snprintf(E->e->EN(raw,filebase), FILENAME_MAX, "%s/%s/%s", D->name, D->fragment[E->fragment_index].sname, E->field); else - snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s", D->name, + snprintf(E->e->EN(raw,filebase), FILENAME_MAX, "%s/%s", D->name, E->field); - if ((E->u.raw.spf = entry->u.raw.spf) == 0) + if ((E->EN(raw,spf) = entry->EN(raw,spf)) == 0) _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_SPF, NULL, - entry->u.raw.spf, NULL); - else if (E->u.raw.type & 0x40 || (E->e->u.raw.size = - GD_SIZE(E->u.raw.type)) == 0) - _GD_SetError(D, GD_E_BAD_TYPE, entry->u.raw.type, NULL, 0, NULL); + entry->EN(raw,spf), NULL); + else if (E->EN(raw,data_type) & 0x40 || (E->e->EN(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)) + else if (_GD_SetEncodedName(D, E->e->EN(raw,file), E->e->EN(raw,filebase), + 0)) + { ; /* error already set */ - else if ((*_gd_ef[E->e->u.raw.file[0].encoding].touch)(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) { + } else if ((*_gd_ef[E->e->EN(raw,file)[0].encoding].touch)(E->e->EN(raw, + file))) + { + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + NULL); + } 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) @@ -221,38 +226,38 @@ copy_scalar[0] = 1; break; case GD_LINCOM_ENTRY: - E->u.lincom.n_fields = entry->u.lincom.n_fields; + E->EN(lincom,n_fields) = entry->EN(lincom,n_fields); - if (E->u.lincom.n_fields < 1 || E->u.lincom.n_fields > GD_MAX_LINCOM) + if (E->EN(lincom,n_fields) < 1 || E->EN(lincom,n_fields) > GD_MAX_LINCOM) _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NFIELDS, NULL, - E->u.lincom.n_fields, NULL); + E->EN(lincom,n_fields), NULL); else { if (entry->comp_scal) { int cs = 0; - memcpy(E->u.lincom.cm, entry->u.lincom.cm, sizeof(double) * 2 * - E->u.lincom.n_fields); - memcpy(E->u.lincom.cb, entry->u.lincom.cb, sizeof(double) * 2 * - E->u.lincom.n_fields); - for (i = 0; i < E->u.lincom.n_fields; ++i) { - E->u.lincom.m[i] = creal(E->u.lincom.cm[i]); - E->u.lincom.b[i] = creal(E->u.lincom.cb[i]); - if (cimag(E->u.lincom.cm[i]) || cimag(E->u.lincom.cb[i])) + memcpy(E->EN(lincom,cm), entry->EN(lincom,cm), sizeof(double) * 2 * + E->EN(lincom,n_fields)); + memcpy(E->EN(lincom,cb), entry->EN(lincom,cb), sizeof(double) * 2 * + E->EN(lincom,n_fields)); + for (i = 0; i < E->EN(lincom,n_fields); ++i) { + E->EN(lincom,m)[i] = creal(E->EN(lincom,cm)[i]); + E->EN(lincom,b)[i] = creal(E->EN(lincom,cb)[i]); + if (cimag(E->EN(lincom,cm)[i]) || cimag(E->EN(lincom,cb)[i])) cs = 1; } E->comp_scal = cs; } else { - memcpy(E->u.lincom.m, entry->u.lincom.m, sizeof(double) * - E->u.lincom.n_fields); - memcpy(E->u.lincom.b, entry->u.lincom.b, sizeof(double) * - E->u.lincom.n_fields); - for (i = 0; i < E->u.lincom.n_fields; ++i) { - _gd_r2c(E->u.lincom.cm[i], E->u.lincom.m[i]); - _gd_r2c(E->u.lincom.cb[i], E->u.lincom.b[i]); + memcpy(E->EN(lincom,m), entry->EN(lincom,m), sizeof(double) * + E->EN(lincom,n_fields)); + memcpy(E->EN(lincom,b), entry->EN(lincom,b), sizeof(double) * + E->EN(lincom,n_fields)); + for (i = 0; i < E->EN(lincom,n_fields); ++i) { + _gd_r2c(E->EN(lincom,cm)[i], E->EN(lincom,m)[i]); + _gd_r2c(E->EN(lincom,cb)[i], E->EN(lincom,b)[i]); } E->comp_scal = 0; } - for (i = 0; i < E->u.lincom.n_fields; ++i) { + for (i = 0; i < E->EN(lincom,n_fields); ++i) { if ((E->in_fields[i] = strdup(entry->in_fields[i])) == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); copy_scalar[i] = copy_scalar[i + GD_MAX_LINCOM] = 1; @@ -260,12 +265,15 @@ } break; case GD_LINTERP_ENTRY: - E->e->u.linterp.table_len = -1; + E->e->EN(linterp,table_len) = -1; if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); - else if ((E->u.linterp.table = strdup(entry->u.linterp.table)) == NULL) + else if ((E->EN(linterp,table) = strdup(entry->EN(linterp,table))) + == NULL) + { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); + } break; case GD_MULTIPLY_ENTRY: case GD_DIVIDE_ENTRY: @@ -280,73 +288,76 @@ copy_scalar[0] = 1; if (entry->comp_scal) { - _gd_c2c(E->u.recip.cdividend, entry->u.recip.cdividend); - E->u.recip.dividend = creal(E->u.recip.cdividend); - E->comp_scal = (cimag(E->u.recip.cdividend) == 0) ? 0 : 1; + _gd_c2c(E->EN(recip,cdividend), entry->EN(recip,cdividend)); + E->EN(recip,dividend) = creal(E->EN(recip,cdividend)); + E->comp_scal = (cimag(E->EN(recip,cdividend)) == 0) ? 0 : 1; } else { - E->u.recip.dividend = entry->u.recip.dividend; - _gd_r2c(E->u.recip.cdividend, E->u.recip.dividend); + E->EN(recip,dividend) = entry->EN(recip,dividend); + _gd_r2c(E->EN(recip,cdividend), E->EN(recip,dividend)); E->comp_scal = 0; } break; case GD_BIT_ENTRY: case GD_SBIT_ENTRY: - E->u.bit.numbits = entry->u.bit.numbits; - E->u.bit.bitnum = entry->u.bit.bitnum; + E->EN(bit,numbits) = entry->EN(bit,numbits); + E->EN(bit,bitnum) = entry->EN(bit,bitnum); if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); - else if (E->u.bit.numbits < 1) + else if (E->EN(bit,numbits) < 1) _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_NUMBITS, NULL, - entry->u.bit.numbits, NULL); - else if (E->u.bit.bitnum < 0) + 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, - entry->u.bit.bitnum, NULL); - else if (E->u.bit.bitnum + E->u.bit.numbits - 1 > 63) + 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, - E->u.bit.bitnum + E->u.bit.numbits - 1, NULL); + E->EN(bit,bitnum) + E->EN(bit,numbits) - 1, NULL); copy_scalar[0] = copy_scalar[1] = 1; break; case GD_PHASE_ENTRY: - E->u.phase.shift = entry->u.phase.shift; + E->EN(phase,shift) = entry->EN(phase,shift); if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); copy_scalar[0] = 1; break; case GD_CONST_ENTRY: - E->u.cons.type = entry->u.cons.type; + E->EN(cons,const_type) = entry->EN(cons,const_type); - if (E->u.cons.type & 0x40 || GD_SIZE(E->u.cons.type) == 0) - _GD_SetError(D, GD_E_BAD_TYPE, E->u.cons.type, NULL, 0, NULL); + if (E->EN(cons,const_type) & 0x40 || GD_SIZE(E->EN(cons,const_type)) == 0) + _GD_SetError(D, GD_E_BAD_TYPE, E->... [truncated message content] |
From: <ket...@us...> - 2010-10-16 03:14:06
|
Revision: 453 http://getdata.svn.sourceforge.net/getdata/?rev=453&view=rev Author: ketiltrout Date: 2010-10-16 03:14:00 +0000 (Sat, 16 Oct 2010) Log Message: ----------- Somehow the "make dist" bug fix escaped. We recaptured it. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/configure.ac Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-16 02:25:29 UTC (rev 452) +++ trunk/getdata/ChangeLog 2010-10-16 03:14:00 UTC (rev 453) @@ -1,3 +1,7 @@ +2010-10-16 D. V. Wiebe <ge...@ke...> svn:453 + * configure.ac: Generate Makefiles even for bindings we're not using (so we + can still run maintainer tasks on them.) + 2010-10-16 D. V. Wiebe <ge...@ke...> svn:452 * src/getdata.h.in: Keep anonymous structs and unions in C99-mode. * src/internal.h: Helper macros for C99/C89 differences. @@ -3,7 +7,4 @@ * test/ src/ bindings/: Update for changes. - * configure.ac: Generate Makefiles even for bindings we're not using (so we - can still run maintainer tasks on them.) - 2010-09-18 D. V. Wiebe <ge...@ke...> svn:448 * bindings/python/pydirfile.c (gdpy_dirfile_close gdpy_dirfile_discard) Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-16 02:25:29 UTC (rev 452) +++ trunk/getdata/configure.ac 2010-10-16 03:14:00 UTC (rev 453) @@ -758,23 +758,15 @@ echo AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([bindings/Makefile]) -if test "x$make_cxxbindings" = "xyes"; then - AC_CONFIG_FILES([bindings/cxx/Makefile]) - AC_CONFIG_FILES([bindings/cxx/test/Makefile]) -fi -if test "x$make_f77bindings" = "xyes"; then - AC_CONFIG_FILES([bindings/f77/Makefile]) - AC_CONFIG_FILES([bindings/f77/test/Makefile]) -fi -if test "x$make_idlbindings" = "xyes"; then - AC_CONFIG_FILES([bindings/idl/Makefile]) - AC_CONFIG_FILES([bindings/idl/makedlm.sh]) - AC_CONFIG_FILES([bindings/idl/test/Makefile]) -fi -if test "x$make_pybindings" = "xyes"; then - AC_CONFIG_FILES([bindings/python/Makefile]) - AC_CONFIG_FILES([bindings/python/test/Makefile]) -fi +AC_CONFIG_FILES([bindings/cxx/Makefile]) +AC_CONFIG_FILES([bindings/cxx/test/Makefile]) +AC_CONFIG_FILES([bindings/f77/Makefile]) +AC_CONFIG_FILES([bindings/f77/test/Makefile]) +AC_CONFIG_FILES([bindings/idl/Makefile]) +AC_CONFIG_FILES([bindings/idl/makedlm.sh]) +AC_CONFIG_FILES([bindings/idl/test/Makefile]) +AC_CONFIG_FILES([bindings/python/Makefile]) +AC_CONFIG_FILES([bindings/python/test/Makefile]) AC_CONFIG_FILES([doc/Makefile]) AC_CONFIG_FILES([man/Makefile]) AC_CONFIG_FILES([man/gd_alter_encoding.3]) @@ -888,13 +880,13 @@ echo echo " Supported internal encodings:${ENCODINGS_BUILT}" if test "x${use_modules}" != "xno"; then -echo " Supported external encodings:${ENCODINGS_MODS}" + echo " Supported external encodings:${ENCODINGS_MODS}" fi echo " Unsupported encodings: ${ENCODINGS_LEFT}" echo echo " Bindings built: ${BINDINGS_BUILT}" echo " Bindings not built: ${BINDINGS_LEFT}" if test "x$make_pybindings" != "xno"; then -echo " NumPy support in Python: ${have_numpy}" + echo " NumPy support in Python: ${have_numpy}" fi echo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-16 03:46:41
|
Revision: 454 http://getdata.svn.sourceforge.net/getdata/?rev=454&view=rev Author: ketiltrout Date: 2010-10-16 03:46:35 +0000 (Sat, 16 Oct 2010) Log Message: ----------- Test suite fixes. Modified Paths: -------------- trunk/getdata/src/internal.h trunk/getdata/src/mod.c trunk/getdata/test/add_crecip.c trunk/getdata/test/add_crecip89.c trunk/getdata/test/add_recip.c trunk/getdata/test/alter_crecip89.c trunk/getdata/test/madd_crecip.c trunk/getdata/test/madd_crecip89.c trunk/getdata/test/madd_recip.c Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/src/internal.h 2010-10-16 03:46:35 UTC (rev 454) @@ -723,7 +723,7 @@ # define gd_nothrow #endif -#if GD_NO_C99_API +#ifdef GD_C89_API # define EN(t,v) u.t.v # define ES(v) u.v #else Modified: trunk/getdata/src/mod.c =================================================================== --- trunk/getdata/src/mod.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/src/mod.c 2010-10-16 03:46:35 UTC (rev 454) @@ -699,7 +699,7 @@ break; case GD_CONST_ENTRY: - Q.EN(cons,const_type) = (N->EN(cons,const_type) == GD_NULL) + Q.EN(cons,const_type) = (N->EN(cons,const_type) == GD_NULL) ? E->EN(cons,const_type) : N->EN(cons,const_type); if (Q.EN(cons,const_type) & 0x40 || GD_SIZE(Q.EN(cons,const_type)) == 0) { Modified: trunk/getdata/test/add_crecip.c =================================================================== --- trunk/getdata/test/add_crecip.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/add_crecip.c 2010-10-16 03:46:35 UTC (rev 454) @@ -33,7 +33,7 @@ CHECKI(e.field_type, GD_RECIP_ENTRY); CHECKS(e.in_fields[0], "in"); CHECKI(e.comp_scal, 1); - CHECKC(e.u.recip.cdividend, cdividend); + CHECKC(e.EN(recip,cdividend), cdividend); CHECKI(e.fragment_index, 0); gd_free_entry_strings(&e); Modified: trunk/getdata/test/add_crecip89.c =================================================================== --- trunk/getdata/test/add_crecip89.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/add_crecip89.c 2010-10-16 03:46:35 UTC (rev 454) @@ -30,8 +30,8 @@ CHECKI(e.field_type, GD_RECIP_ENTRY); CHECKS(e.in_fields[0], "in"); CHECKI(e.comp_scal, 1); - CHECKF(e.u.recip.cdividend[0], dividend[0]); - CHECKF(e.u.recip.cdividend[1], dividend[1]); + CHECKF(e.EN(recip,cdividend)[0], dividend[0]); + CHECKF(e.EN(recip,cdividend)[1], dividend[1]); CHECKI(e.fragment_index, 0); gd_free_entry_strings(&e); Modified: trunk/getdata/test/add_recip.c =================================================================== --- trunk/getdata/test/add_recip.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/add_recip.c 2010-10-16 03:46:35 UTC (rev 454) @@ -28,7 +28,7 @@ CHECKI(e.field_type, GD_RECIP_ENTRY); CHECKS(e.in_fields[0], "in"); CHECKI(e.comp_scal, 0); - CHECKF(e.u.recip.dividend, 33.3); + CHECKF(e.EN(recip,dividend), 33.3); CHECKI(e.fragment_index, 0); gd_free_entry_strings(&e); Modified: trunk/getdata/test/alter_crecip89.c =================================================================== --- trunk/getdata/test/alter_crecip89.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/alter_crecip89.c 2010-10-16 03:46:35 UTC (rev 454) @@ -51,8 +51,8 @@ CHECKI(error,0); CHECKI(n,0); CHECKI(ret,0); - CHECKF(E.u.recip.cdividend[0], div[0]); - CHECKF(E.u.recip.cdividend[1], div[1]); + CHECKF(E.EN(recip,cdividend)[0], div[0]); + CHECKF(E.EN(recip,cdividend)[1], div[1]); CHECKS(E.in_fields[0], "phase"); return r; Modified: trunk/getdata/test/madd_crecip.c =================================================================== --- trunk/getdata/test/madd_crecip.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/madd_crecip.c 2010-10-16 03:46:35 UTC (rev 454) @@ -33,7 +33,7 @@ if (!r) { CHECKI(e.field_type, GD_RECIP_ENTRY); CHECKS(e.in_fields[0], "in1"); - CHECKC(e.u.recip.cdividend, v); + CHECKC(e.EN(recip,cdividend), v); CHECKI(e.comp_scal, 1); CHECKI(e.fragment_index, 0); gd_free_entry_strings(&e); Modified: trunk/getdata/test/madd_crecip89.c =================================================================== --- trunk/getdata/test/madd_crecip89.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/madd_crecip89.c 2010-10-16 03:46:35 UTC (rev 454) @@ -30,8 +30,8 @@ if (!r) { CHECKI(e.field_type, GD_RECIP_ENTRY); CHECKS(e.in_fields[0], "in1"); - CHECKF(e.u.recip.cdividend[0], div[0]); - CHECKF(e.u.recip.cdividend[1], div[1]); + CHECKF(e.EN(recip,cdividend)[0], div[0]); + CHECKF(e.EN(recip,cdividend)[1], div[1]); CHECKI(e.comp_scal, 1); CHECKI(e.fragment_index, 0); gd_free_entry_strings(&e); Modified: trunk/getdata/test/madd_recip.c =================================================================== --- trunk/getdata/test/madd_recip.c 2010-10-16 03:14:00 UTC (rev 453) +++ trunk/getdata/test/madd_recip.c 2010-10-16 03:46:35 UTC (rev 454) @@ -28,7 +28,7 @@ if (!r) { CHECKI(e.field_type, GD_RECIP_ENTRY); CHECKS(e.in_fields[0], "in1"); - CHECKF(e.u.recip.dividend, 3.2); + CHECKF(e.EN(recip,dividend), 3.2); CHECKI(e.comp_scal, 0); CHECKI(e.fragment_index, 0); gd_free_entry_strings(&e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-17 09:02:23
|
Revision: 455 http://getdata.svn.sourceforge.net/getdata/?rev=455&view=rev Author: ketiltrout Date: 2010-10-17 09:02:13 +0000 (Sun, 17 Oct 2010) Log Message: ----------- 0.7.0rc1: update NEWS; Bump interface numbers; removed --disable-checkdirfile. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/python/pyentry.c trunk/getdata/configure.ac trunk/getdata/man/gd_dirfile_standards.3 trunk/getdata/src/getdata.h.in trunk/getdata/util/Makefile.am Property Changed: ---------------- trunk/getdata/NEWS Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/ChangeLog 2010-10-17 09:02:13 UTC (rev 455) @@ -1,3 +1,11 @@ +2010-10-17 D. V. Wiebe <ge...@ke...> svn:455 + GetData-0.7.0rc1: + + * configure.ac: update library interface numbers. Removed + --disable-checkdirfile. + + * MEWS: Update. + 2010-10-16 D. V. Wiebe <ge...@ke...> svn:453 * configure.ac: Generate Makefiles even for bindings we're not using (so we can still run maintainer tasks on them.) Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/NEWS 2010-10-17 09:02:13 UTC (rev 455) @@ -1,9 +1,168 @@ -New in version 0.7.0a2: +New in version 0.7.0rc1: - * Plus ça change, plus c'est la même chose. + Dirfile Changes + * Dirfile Standards Version 8 has been released. It adds two new field types: + DIVIDE, which computes X/Y for vectors X and Y, and RECIP, which computes + A/X for vector X and scalar A. A few other changes are listed below. + * Slashes on reserved words are now mandatory, allowing fields with reserved + words as names. + * The long deprecated single character data type codes have been removed. + * Just to be clear: these removed features are still supported by GetData, + since it can handle older Standards Versions as well. + * The /ENDIAN directive now takes an optional second parameter. The only + allowed value for this second token is "arm", which indicates that double + precision floating point data (including double precision complex data) are + stored in the ARM middle-endian format. + + Library Changes + + * GetData, including its bindings, is now supported under MacOS X, Cygwin, and + Win32 using MinGW. In the case of MinGW, this includes linking against the + Microsoft C Runtime, which isn't POSIX compliant. Users should excercise + caution when writing to dirfiles in this case. + * GetData can now be used on ARM processors. As a side-effect, GetData can + now read and write the middle-ended floating point format used by older ARM + processors (on any processor). + * Some changes have been made to the parser. It now operates in one of two + modes: pedantic mode, which adheres strictly to one particular Dirfile + Standards Version, and permissive mode (the default) which is more + lenient, as the old parser was. Encountering a /VERSION directive will + switch the parser from permissive to pedantic mode unless told not to (see + GD_PERMISSIVE below), and will change the particular Standards Version to + which pedantic mode is adhering. + * As a result of the previous change, the Standards compliance of the parser + in strict mode has been greatly increased. This affects allowed characters + in field names, and field name lengths. The existance or lack thereof of + the implicit FILEFRAM field (an alias for INDEX) is also affected. + * Since Standards Versions 4 and earlier were never codified, we've made some + assumptions as to their behaviour in certain undocumented situtations. Most + noticably, they still prohibit ASCII control codes (bytes < 0x20) and '/' + in field names. + * Every Dirfile object now complies to a particular Standards Version, which + affects functions such as gd_add_spec(). The Version will start out as the + value of the last /VERSION directive encountered by the parser, or else the + latest compliant Standards Version. It can be changed (see below). + * When writing metadata to disk, fragments will be written according to the + current Standards Version of the dirfile object, rather than always using + the latest version, as before. + * The C library now sports an "ANSI C" mode, which allows compilation of + GetData without a C99-compliant compiler. Some functionality may be lost, + most prominently, but unsurprisingly, the default (C99) API. + * LINTERP tables are no longer required to be sorted. The library will + sort them, if needed. As a side-effect of this, tables are no longer read + twice when loading, leading to potential speed-up. + * BUG FIX: The library wasn't properly checking that the second and higher + input fields in LINCOM and MULTIPLY fields were, in fact, vectors, leading + to possible segfaults. + * BUG FIX: A memory leak associated with modifying LINCOM metadata has been + fixed. + * BUG FIX: Using a complex valued vector as the second input field in a + MULTIPLY wouldn't result in the field being internally flagged as complex, + leading to loss of the imaginary part in certain situtaitons. + * BUG FIX: Trying to write to a LINTERP which isn't monotonic now results in + error. Previously, this was allowed, with arbitrary data stored to disk. + + API Changes + + * Due to namespace conflicts with the MacOS X System Library (which contains + the C Standard Library), a wholesale renaming of public symbols has been + performed. All public functions, and data types now begin with 'gd_'. All + public preprocessor macros now begin with 'GD_'. Symbol renaming has + occurred in the following manner: + - functions which started with 'put' simply prefix 'gd_' to their name. So + put_constant() becomes gd_put_constant(). + - functions which started with 'get' replace 'get' with 'gd', except those + functions with a corresponding 'put' function, these simply prefix 'gd_'. + So, get_constants() becomes gd_constants(), but get_constant() becomes + gd_get_constant(). + - functions which started with 'dirfile' replace 'dirfile' with 'gd', + except for dirfilename(), which becomes gd_dirfilename(). So, + dirfile_alter_encoding() become gd_alter_encoding(). + - macros which started with 'GETDATA_' now start with 'GD_'. Those that + started with 'NO_GETDATA_' now start with 'GD_NO_'. So GETDATA_LEGACY_API + becomes GD_LEGACY_API and NO_GETDATA_LEGACY_API becomes GD_NO_LEGACY_API. + * The above renaming rules result in one gd_ namespace clash. As a result, + get_reference() has been removed completely. Calls will have to be + changed to use gd_reference(), formerly dirfile_reference(). + * To ease transition to the new namespace, defining GD_FUNCTION_ALIASES before + including getdata.h will create a bunch of preprocessor macros which map the + old names to the new. + * The meaning of the GD_PEDANTIC flag to gd_[cb]open() has changed. It now + forces the parser to start off in pedantic mode (see above), following the + latest Standards Version, rather than the default permissive mode. This is + a subtle change, and in most cases the effects of GD_PEDANTIC will be the + same as they were before. + * A new dirfile flag, GD_PERMISSIVE, has been added. Passing this to + gd_[cb]open() will prohibit the parser from switching into pedantic mode + when it encounters a /VERSION directive. This flag is needed to read + dirfiles which claim to adhere to the Standards via a /VERSION directive, + but contain invalid syntax nonetheless. + * The current Standards Version of an open dirfile can be set or queried by + calling the new function gd_dirfile_standards(). NB: this only affects the + open dirfile, not the metadata stored on disk. + * A new function, gd_rewrite_fragment() will force GetData to write the + specified fragment to disk, even if no metadata in the fragment has changed. + * Two new functions, gd_bof() and gd_eof() can be used to find the sample + number of the beginning- or end-of-field for a given field. Notably, these + can be used to calculate the amount of raw data on disk for a given field. + * The new gd_invalid_dirfile() function will return a newly created, invalid + dirfile. Primarily useful to callers as a "null dirfile" placeholder. + * GD_E_OPEN_INCLUDE has been renamed to GD_E_OPEN_FRAGMENT, but the former + symbol remains as an alias. + * Where gd_flush() and gd_metaflush() in the past raised GD_E_OPEN_INCLUDE + on I/O error, they now raise the new GD_FLUSH. + * All functions now raise GD_E_DIMENSION when encountering a scalar field + when expecting a vector. In the past, the error value returned was + different for different functions. + * getdata.h now wraps itself in an extern "C" block if included by a C++ + compiler. + * BUG FIX: gd_metaflush() now fails and raises GD_E_ACCMODE if called on a + read-only dirfile + + Bindings + + * C++: Const member functions are now flagged as such. + * F95: For consistency sake, the Fortran 95 bindings have undergone the same + renaming as the C bindings. All functions are now preceded by 'fgd_'. + * IDL: The IDL bindings have also followed suit in the great renaming. The + exception to this is GETDATA_CONSTANTS(), which is not renamed. + * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. + * Python BUG FIX: A non-litteral phase shift is now properly reported. + + Miscellaneous + + * The --disable-checkdirfile option has been removed from ./configure. It + is now always installed. + * A utility, dirfile2ascii, is now installed alongside checkdirfile. This + utility converts all or part of a dirfile into ASCII text. dirfile2ascii + was written by Matthew Truch. + * The thoroughness of the checks done by checkdirfile have increased. It now + reports format syntax errors, Dirfile Standards compliance, problems with + field definitions (such as missing input fields), and the size of the + dirfile. + |==============================================================================| +New in version 0.6.3: + + Bindings + + * A memory leak has been plugged in the Python bindings manifesting in calls + to dirfile.getdata() returning a NumPy array. In previous versions, the + memory used by the returned array to hold the data was not reclaimed by GC. + +|==============================================================================| + +New in version 0.6.2: + + Library Changes + + * Attempting to get the number of frames from an ASCII file no longer fails + the second time. + +|==============================================================================| + New in version 0.6.1: API Changes Property changes on: trunk/getdata/NEWS ___________________________________________________________________ Added: svn:mergeinfo + /branches/getdata-0.4/NEWS:217-227 /branches/getdata-0.6/NEWS:369-391 /branches/getdata-arm/NEWS:355-413 /branches/getdata-osx/NEWS:400-402 Modified: trunk/getdata/bindings/python/pyentry.c =================================================================== --- trunk/getdata/bindings/python/pyentry.c 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/bindings/python/pyentry.c 2010-10-17 09:02:13 UTC (rev 455) @@ -1904,10 +1904,6 @@ " 'in_field': a string containing the input field code.\n"\ " 'shift: a number or CONST field code specifying the number of\n"\ " samples to shift the data.\n\n"\ -" PHASE: (in_field, shift)\n"\ -" 'in_field': a string containing the input field code.\n"\ -" 'shift': a number or CONST field code specifying the number of\n"\ -" samples to shift the data.\n\n"\ " POLYNOM: (in_field, a)\n"\ " 'in_field': a string containing the input field code.\n"\ " 'a': a tuple of the co-efficients of the polynomial. The\n"\ Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/configure.ac 2010-10-17 09:02:13 UTC (rev 455) @@ -22,7 +22,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 7) m4_define(getdata_revision, 0) -m4_define(getdata_extra, [a2]) +m4_define(getdata_extra, [rc1]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) @@ -43,20 +43,20 @@ [C compiler command on the build system (only needed if cross-compiling)]) dnl libgetdata current interface version -AC_SUBST(GETDATA_IFACE_VERSION, [3]) +AC_SUBST(GETDATA_IFACE_VERSION, [4]) dnl libgetdata current interface implementation revision AC_SUBST(GETDATA_IMPL_REVISION, [0]) dnl libgetdata interface age (current interface - oldest supported interface) -AC_SUBST(GETDATA_IFACE_AGE, [1]) +AC_SUBST(GETDATA_IFACE_AGE, [0]) dnl libgetdata++ interface version info -AC_SUBST(GETDATAXX_VERSION, [1:0:0]) +AC_SUBST(GETDATAXX_VERSION, [2:0:1]) dnl libfgetdata interface version info -AC_SUBST(FGETDATA_VERSION, [1:0:0]) +AC_SUBST(FGETDATA_VERSION, [2:0:1]) dnl libf95getdata interface version info -AC_SUBST(F95GETDATA_VERSION, [1:0:0]) +AC_SUBST(F95GETDATA_VERSION, [2:0:0]) AC_CONFIG_SRCDIR([src/getdata.c]) AC_CONFIG_HEADER([src/config.h]) @@ -134,18 +134,6 @@ AC_MSG_CHECKING([whether to build in ANSI C compliance mode]) AC_MSG_RESULT([$disable_c99]) -dnl checkdirfile -AC_ARG_ENABLE(checkdirfile, AS_HELP_STRING([--disable-checkdirfile], - [don't build or install the checkdirfile utility]), - [ - case "${enableval}" in - no) make_checkdirfile="don't build" ;; - *) make_checkdirfile="build" ;; - esac - ], [ make_checkdirfile="build" ]) -AC_MSG_CHECKING([whether to compile and install checkdirfile]) -AC_MSG_RESULT([$make_checkdirfile]) - dnl bindings, globally make_cxxbindings="yes" make_f77bindings="yes" @@ -793,7 +781,6 @@ AM_CONDITIONAL(INTEL_FC_COMPILER, [test "x$gd_cv_fc_compiler_intel" == "xyes"]) AM_CONDITIONAL(LFS_TRANSITIONAL_API, [test "x$gd_cv_type_off64_t" = "xyes"]) AM_CONDITIONAL(INCLUDE_LEGACY_API, [test "x$include_legacy_api" != "xno"]) -AM_CONDITIONAL(MAKE_CHECKDIRFILE, [test "x$make_checkdirfile" = "xbuild"]) AM_CONDITIONAL(MAKE_CXXBINDINGS, [test "x$make_cxxbindings" = "xyes"]) AM_CONDITIONAL(MAKE_F77BINDINGS, [test "x$make_f77bindings" != "xno"]) AM_CONDITIONAL(MAKE_F95BINDINGS, [test "x$make_f95bindings" = "xyes"]) @@ -868,7 +855,6 @@ echo echo "Configuration summary: " -echo " checkdirfile utility: ${make_checkdirfile}" echo " ANSI C compatibility mode: ${disable_c99}" echo " LFS transitional API: ${lfs_transitional_api}" echo " Legacy API: ${include_legacy_api}" Modified: trunk/getdata/man/gd_dirfile_standards.3 =================================================================== --- trunk/getdata/man/gd_dirfile_standards.3 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/man/gd_dirfile_standards.3 2010-10-17 09:02:13 UTC (rev 455) @@ -67,7 +67,7 @@ Specifies the current Standards Version should be set to the latest version to which the loaded dirfile conforms. .P -If the loaded dirfile cannot conform to the specified +If the loaded dirfile does not conform to the specified .IR version , this function fails, and the current Standards Version is unchanged. If the loaded dirfile conforms to no known Standards Version, this function will fail Modified: trunk/getdata/src/getdata.h.in =================================================================== --- trunk/getdata/src/getdata.h.in 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/src/getdata.h.in 2010-10-17 09:02:13 UTC (rev 455) @@ -873,6 +873,7 @@ /* function aliases */ #ifdef GD_FUNCTION_ALIASES +# warning "Using deprecated function aliases." # define dirfile_add gd_add # define dirfile_add_bit gd_add_bit # define dirfile_add_clincom gd_add_clincom Modified: trunk/getdata/util/Makefile.am =================================================================== --- trunk/getdata/util/Makefile.am 2010-10-16 03:46:35 UTC (rev 454) +++ trunk/getdata/util/Makefile.am 2010-10-17 09:02:13 UTC (rev 455) @@ -31,11 +31,7 @@ LDADD=../src/libgetdata.la INCLUDES=${WALL} $(WEXTRA) -I$(top_srcdir)/src -if MAKE_CHECKDIRFILE -CHECKDIRFILE=checkdirfile dirfile2ascii -endif - -bin_PROGRAMS=$(CHECKDIRFILE) +bin_PROGRAMS=checkdirfile dirfile2ascii checkdirfile_SOURCES=checkdirfile.c dirfile2ascii_SOURCES=dirfile2ascii.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-18 22:31:46
|
Revision: 456 http://getdata.svn.sourceforge.net/getdata/?rev=456&view=rev Author: ketiltrout Date: 2010-10-18 22:31:37 +0000 (Mon, 18 Oct 2010) Log Message: ----------- 0.7.0rc2: fix types in dlopen code. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/configure.ac trunk/getdata/src/encoding.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-17 09:02:13 UTC (rev 455) +++ trunk/getdata/ChangeLog 2010-10-18 22:31:37 UTC (rev 456) @@ -1,3 +1,9 @@ +2010-10-18 D. V. Wiebe <ge...@ke...> svn:455 + GetData-0.7.0rc2: + + * encoding.c (_GD_ResolveSymbol _GD_MissingFramework): Fix types for + USE_MODULES. + 2010-10-17 D. V. Wiebe <ge...@ke...> svn:455 GetData-0.7.0rc1: Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-17 09:02:13 UTC (rev 455) +++ trunk/getdata/NEWS 2010-10-18 22:31:37 UTC (rev 456) @@ -1,4 +1,4 @@ -New in version 0.7.0rc1: +New in version 0.7.0rc2: Dirfile Changes Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-17 09:02:13 UTC (rev 455) +++ trunk/getdata/configure.ac 2010-10-18 22:31:37 UTC (rev 456) @@ -22,7 +22,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 7) m4_define(getdata_revision, 0) -m4_define(getdata_extra, [rc1]) +m4_define(getdata_extra, [rc2]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/getdata/src/encoding.c =================================================================== --- trunk/getdata/src/encoding.c 2010-10-17 09:02:13 UTC (rev 455) +++ trunk/getdata/src/encoding.c 2010-10-18 22:31:37 UTC (rev 456) @@ -176,7 +176,7 @@ encoding == GD_TEXT_ENCODED || encoding == GD_LZMA_ENCODED)) #ifdef USE_MODULES -static void* _GD_ResolveSymbol(lt__handle* lib, struct encoding_t* enc, +static void* _GD_ResolveSymbol(lt_dlhandle lib, struct encoding_t* enc, const char* name) { void* func; @@ -225,35 +225,39 @@ /* Try to resolve the symbols */ if (_gd_ef[encoding].provides & GD_EF_OPEN) - _gd_ef[encoding].open = (int (*)(_gd_raw_file*, int, + _gd_ef[encoding].open = (int (*)(struct _gd_raw_file*, int, int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Open"); if (_gd_ef[encoding].provides & GD_EF_CLOSE) - _gd_ef[encoding].close = (int (*)(_gd_raw_file*))_GD_ResolveSymbol(lib, - _gd_ef + encoding, "Close"); + _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 (*)(_gd_raw_file*))_GD_ResolveSymbol(lib, - _gd_ef + encoding, "Touch"); + _gd_ef[encoding].touch = (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 (*)(_gd_raw_file*, off64_t, gd_type_t, - int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Seek"); + _gd_ef[encoding].seek = (off64_t (*)(struct _gd_raw_file*, off64_t, + gd_type_t, int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Seek"); if (_gd_ef[encoding].provides & GD_EF_READ) - _gd_ef[encoding].read = (ssize_t (*)(_gd_raw_file*, void*, gd_type_t, - size_t))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Read"); + _gd_ef[encoding].read = (ssize_t (*)(struct _gd_raw_file*, void*, + gd_type_t, size_t))_GD_ResolveSymbol(lib, _gd_ef + encoding, + "Read"); if (_gd_ef[encoding].provides & GD_EF_SIZE) - _gd_ef[encoding].size = (off64_t (*)(_gd_raw_file*, + _gd_ef[encoding].size = (off64_t (*)(struct _gd_raw_file*, gd_type_t))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Size"); if (_gd_ef[encoding].provides & GD_EF_WRITE) - _gd_ef[encoding].write = (ssize_t (*)(_gd_raw_file*, const void*, + _gd_ef[encoding].write = (ssize_t (*)(struct _gd_raw_file*, const void*, gd_type_t, size_t))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Write"); if (_gd_ef[encoding].provides & GD_EF_SYNC) - _gd_ef[encoding].sync = (int (*)(_gd_raw_file*))_GD_ResolveSymbol(lib, - _gd_ef + encoding, "Sync"); + _gd_ef[encoding].sync = + (int (*)(struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding, + "Sync"); if (_gd_ef[encoding].provides & GD_EF_UNLINK) - _gd_ef[encoding].unlink = (int (*)(_gd_raw_file*))_GD_ResolveSymbol(lib, - _gd_ef + encoding, "Unlink"); + _gd_ef[encoding].unlink = + (int (*)(struct _gd_raw_file*))_GD_ResolveSymbol(lib, _gd_ef + encoding, + "Unlink"); if (_gd_ef[encoding].provides & GD_EF_TEMP) - _gd_ef[encoding].temp = (int (*)(_gd_raw_file*, + _gd_ef[encoding].temp = (int (*)(struct _gd_raw_file*, int))_GD_ResolveSymbol(lib, _gd_ef + encoding, "Temp"); /* we tried our best, don't bother trying again */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-19 02:37:36
|
Revision: 457 http://getdata.svn.sourceforge.net/getdata/?rev=457&view=rev Author: ketiltrout Date: 2010-10-19 02:37:29 +0000 (Tue, 19 Oct 2010) Log Message: ----------- Fix memory leak in Legacy API. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/src/legacy.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-18 22:31:37 UTC (rev 456) +++ trunk/getdata/ChangeLog 2010-10-19 02:37:29 UTC (rev 457) @@ -1,4 +1,8 @@ -2010-10-18 D. V. Wiebe <ge...@ke...> svn:455 +2010-10-19 D. V. Wiebe <ge...@ke...> svn:457 + * legacy.c (_GD_GetDirfile): On error, set *error_code (now passed as a + parameter), copy the error, discard the bad dirfile, and return NULL. + +2010-10-18 D. V. Wiebe <ge...@ke...> svn:456 GetData-0.7.0rc2: * encoding.c (_GD_ResolveSymbol _GD_MissingFramework): Fix types for Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-18 22:31:37 UTC (rev 456) +++ trunk/getdata/NEWS 2010-10-19 02:37:29 UTC (rev 457) @@ -120,6 +120,14 @@ * BUG FIX: gd_metaflush() now fails and raises GD_E_ACCMODE if called on a read-only dirfile + Legacy API Changes + + * In the legacy format struct, DIVIDE fields are listed as MULTIPLYs and RECIP + fields are listed as LINCOMs, with the dividend stored in m[0]. + * BUG FIX: In previous versions, attempting to access an invalid dirfile + (anything that would cause gd_open to fail) resulted in leaked memory. This + leak has been plugged. + Bindings * C++: Const member functions are now flagged as such. Modified: trunk/getdata/src/legacy.c =================================================================== --- trunk/getdata/src/legacy.c 2010-10-18 22:31:37 UTC (rev 456) +++ trunk/getdata/src/legacy.c 2010-10-19 02:37:29 UTC (rev 457) @@ -114,7 +114,7 @@ /* _GD_GetDirfile: Locate the legacy DIRFILE given the filespec. This started * life as GetFormat... */ -static DIRFILE* _GD_GetDirfile(const char *filename_in, int mode) +static DIRFILE* _GD_GetDirfile(const char *filename_in, int mode, int *error_code) { unsigned int i_dirfile; void *ptr; @@ -134,7 +134,7 @@ if ((mode & GD_RDWR) && (_GD_Dirfiles.D[i_dirfile]->flags & GD_ACCMODE) == GD_RDONLY) { /* close it */ - gd_close(_GD_Dirfiles.D[i_dirfile]); + gd_discard(_GD_Dirfiles.D[i_dirfile]); /* copy the last dirfile in the list over top of this one and decrement * the counter -- next realloc will do nothing */ @@ -150,29 +150,28 @@ /* if we get here, the file has not yet been read */ /* Allocate the memory, then fill. If we have an error, */ /* we will have to free the memory... */ - _GD_Dirfiles.n++; - ptr = realloc(_GD_Dirfiles.D, _GD_Dirfiles.n * sizeof(DIRFILE*)); + ptr = realloc(_GD_Dirfiles.D, (_GD_Dirfiles.n + 1) * sizeof(DIRFILE*)); if (ptr == NULL) { - /* There's been a problem trying to create a new dirfile object, even an - * invalid one. So, return the only one we're guaranteed to have... */ - _GD_GlobalErrors.error = GD_E_ALLOC; - dreturn("%p", &_GD_GlobalErrors); - return &_GD_GlobalErrors; + *error_code = _GD_GlobalErrors.error = GD_E_ALLOC; + dreturn("%p", NULL); + return NULL; } _GD_Dirfiles.D = (DIRFILE **)ptr; /* Open a dirfile */ - _GD_Dirfiles.D[_GD_Dirfiles.n - 1] = gd_open(filedir, mode); + _GD_Dirfiles.D[_GD_Dirfiles.n] = gd_open(filedir, mode); - /* Error encountered -- the dirfile will shortly be deleted */ - if (_GD_Dirfiles.D[_GD_Dirfiles.n - 1]->error != GD_E_OK) { - dreturn("%p", _GD_Dirfiles.D[_GD_Dirfiles.n - 1]); - return _GD_Dirfiles.D[--_GD_Dirfiles.n]; + /* Error encountered -- clean up */ + if (_GD_Dirfiles.D[_GD_Dirfiles.n]->error != GD_E_OK) { + *error_code = _GD_CopyGlobalError(_GD_Dirfiles.D[_GD_Dirfiles.n]); + gd_discard(_GD_Dirfiles.D[_GD_Dirfiles.n]); + dreturn("%p", NULL); + return NULL; } - dreturn("%p", _GD_Dirfiles.D[_GD_Dirfiles.n - 1]); - return _GD_Dirfiles.D[_GD_Dirfiles.n - 1]; + dreturn("%p", _GD_Dirfiles.D[_GD_Dirfiles.n]); + return _GD_Dirfiles.D[_GD_Dirfiles.n++]; } static void CopyRawEntry(struct RawEntryType* R, gd_entry_t* E) @@ -349,8 +348,6 @@ { dtrace("\"%s\", %p", filedir, error_code); - DIRFILE *D = _GD_GetDirfile(filedir, GD_RDONLY); - unsigned int i; int nraw = 0; @@ -360,8 +357,9 @@ int nbit = 0; int nphase = 0; - if (D->error) { - *error_code = _GD_CopyGlobalError(D); + DIRFILE *D = _GD_GetDirfile(filedir, GD_RDONLY, error_code); + + if (!D) { dreturn("%p", NULL); return NULL; } @@ -490,10 +488,9 @@ first_frame, first_samp, num_frames, num_samp, return_type, data_out, error_code); - D = _GD_GetDirfile(filename, GD_RDONLY); + D = _GD_GetDirfile(filename, GD_RDONLY, error_code); - if (D->error) { - *error_code = _GD_CopyGlobalError(D); + if (!D) { dreturn("%i", 0); return 0; } @@ -519,10 +516,9 @@ dtrace("\"%s\", %p, <unused>", filename, error_code); - D = _GD_GetDirfile(filename, GD_RDONLY); + D = _GD_GetDirfile(filename, GD_RDONLY, error_code); - if (D->error) { - *error_code = _GD_CopyGlobalError(D); + if (!D) { dreturn("%i", 0); return 0; } @@ -543,10 +539,9 @@ dtrace("\"%s\", \"%s\", %p", filename, field_code, error_code); - D = _GD_GetDirfile(filename, GD_RDONLY); + D = _GD_GetDirfile(filename, GD_RDONLY, error_code); - if (D->error) { - *error_code = _GD_CopyGlobalError(D); + if (!D) { dreturn("%i", 0); return 0; } @@ -571,10 +566,9 @@ first_frame, first_samp, num_frames, num_samp, data_type, data_in, error_code); - D = _GD_GetDirfile(filename, GD_RDWR | GD_UNENCODED); + D = _GD_GetDirfile(filename, GD_RDWR | GD_UNENCODED, error_code); - if (D->error) { - *error_code = _GD_CopyGlobalError(D); + if (!D) { dreturn("%i", 0); return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-20 01:03:35
|
Revision: 459 http://getdata.svn.sourceforge.net/getdata/?rev=459&view=rev Author: ketiltrout Date: 2010-10-20 01:03:29 +0000 (Wed, 20 Oct 2010) Log Message: ----------- Big-endian fixes. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/man/gd_cbopen.3 trunk/getdata/man/gd_close.3 trunk/getdata/man/gd_invalid_dirfile.3 trunk/getdata/src/flush.c trunk/getdata/src/getdata.c trunk/getdata/src/putdata.c trunk/getdata/test/version_5.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/ChangeLog 2010-10-20 01:03:29 UTC (rev 459) @@ -1,3 +1,11 @@ +2010-10-20 D. V. Wiebe <ge...@ke...> svn:459 + * test/version_5.c: Fix for WORDS_BIGENDIAN. + + * src/getdata.c (_GD_DoRaw) src/putdata.c (_GD_DoRawOut): Fix + _GD_FixEndianness test. + + * src/flush.c (_GD_FindVersion): Native byte sex is assumed in early versions. + 2010-10-19 D. V. Wiebe <ge...@ke...> svn:457 * legacy.c (_GD_GetDirfile): On error, set *error_code (now passed as a parameter), copy the error, discard the bad dirfile, and return NULL. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/NEWS 2010-10-20 01:03:29 UTC (rev 459) @@ -38,8 +38,10 @@ * Since Standards Versions 4 and earlier were never codified, we've made some assumptions as to their behaviour in certain undocumented situtations. Most noticably, they still prohibit ASCII control codes (bytes < 0x20) and '/' - in field names. - * Every Dirfile object now complies to a particular Standards Version, which + in field names. We also assume these dirfiles have native byte sex, even + though some early Standards Version implied only little-ended data was + acceptable. + * Every Dirfile object now records its current Standards Version, which affects functions such as gd_add_spec(). The Version will start out as the value of the last /VERSION directive encountered by the parser, or else the latest compliant Standards Version. It can be changed (see below). @@ -60,8 +62,9 @@ * BUG FIX: Using a complex valued vector as the second input field in a MULTIPLY wouldn't result in the field being internally flagged as complex, leading to loss of the imaginary part in certain situtaitons. - * BUG FIX: Trying to write to a LINTERP which isn't monotonic now results in - error. Previously, this was allowed, with arbitrary data stored to disk. + * BUG FIX: Trying to write to a LINTERP via a table which isn't monotonic now + results in error. Previously, this was allowed, with arbitrary data stored + to disk. API Changes Modified: trunk/getdata/man/gd_cbopen.3 =================================================================== --- trunk/getdata/man/gd_cbopen.3 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/man/gd_cbopen.3 2010-10-20 01:03:29 UTC (rev 459) @@ -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 "15 October 2010" "Version 0.7.0" "GETDATA" +.TH gd_cbopen 3 "20 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_cbopen, gd_open \(em open or create a dirfile .SH SYNOPSIS @@ -285,7 +285,7 @@ The latest Dirfile Standards Version which this release of GetData understands is provided in the preprocessor macro .B GD_DIRFILE_STANDARDS_VERSION -defined in getdata.h. GetData is able to open and parse any Dirfile which +defined in getdata.h. GetData is able to open and parse any dirfile which conforms to this Standards Version, or to any earlier Version. The .BR dirfile-format (5) manual page lists the changes between Standards Versions. @@ -306,7 +306,7 @@ mode. .I Permissive -mode is provided primarily to allow GetData to be used on Dirfiles which +mode is provided primarily to allow GetData to be used on dirfiles which conform to no single Standard, but which were accepted by the GetData parser in previous versions. It is notably lax regarding reserved field names, and field name characters, the mixing of old and new data type specifiers, and @@ -611,8 +611,27 @@ .BR gd_error_string (3). When finished with it, a caller should de-allocate the DIRFILE object by calling .BR gd_close (3), +or +.BR gd_discard (3), even if the open failed. .SH BUGS +When working with dirfiles conforming to Standards Versions 4 and earlier +(before the introduction of the +.B ENDIAN +directive), GetData assumes the dirfile has native byte sex, even though, +officially, these early Standards stipulated data to be little-endian. This is +necessary since, in the absense of an explicit +.B /VERSION +directive, it is often impossible to determine the intended Standards Version of +a dirfile, and the current behaviour is to assume native byte sex for modern +dirfiles lacking +.BR /ENDIAN . +To read an old, little-ended dirfile on a big-ended platform, an +.B /ENDIAN +directive should be added to the format specification, or else +.B GD_LITTLE_ENDIAN +should be specified by the caller. + GetData's parser assumes it is running on an ASCII-compatible platform. Format specification parsing will fail gloriously on an EBCDIC platform. .SH SEE ALSO @@ -621,6 +640,7 @@ .BR dirfile-format (5), .BR gd_close (3), .BR gd_dirfile_standards (3), +.BR gd_discard (3), .BR gd_error (3), .BR gd_error_string (3), .BR gd_getdata (3), Modified: trunk/getdata/man/gd_close.3 =================================================================== --- trunk/getdata/man/gd_close.3 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/man/gd_close.3 2010-10-20 01:03:29 UTC (rev 459) @@ -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 "15 October 2010" "Version 0.7.0" "GETDATA" +.TH gd_close 3 "20 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_close, gd_discard \(em close a dirfile and free associated memory. .SH SYNOPSIS @@ -57,9 +57,10 @@ behave identically. One of these functions should be called on all pointers returned by -.BR gd_cbopen (3) +.BR gd_cbopen (3), +.BR gd_open (3), and -.BR gd_open (3), +.BR gd_invalid_dirfile (3), even if the call to those function failed. After .BR gd_close () or @@ -73,7 +74,7 @@ object. See .BR gd_dirfile_standards (3) to change or report the current Standards Version. If the dirfile metadata -conforms to no known Standards Version, a Standards non-compliant fragment will +conforms to no known Standards Version, Standards non-compliant metadata will be written. .SH RETURN VALUE .BR gd_close () @@ -107,4 +108,5 @@ .BR gd_error (3), .BR gd_error_string (3), .BR gd_flush (3), +.BR gd_invalid_dirfile (3), .BR gd_open (3) Modified: trunk/getdata/man/gd_invalid_dirfile.3 =================================================================== --- trunk/getdata/man/gd_invalid_dirfile.3 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/man/gd_invalid_dirfile.3 2010-10-20 01:03:29 UTC (rev 459) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH gd_invalid_dirfile 3 "15 October 2010" "Version 0.7.0" "GETDATA" +.TH gd_invalid_dirfile 3 "20 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_invalid_dirfile \(em obtain an pointer to an invalid DIRFILE object .SH SYNOPSIS @@ -54,7 +54,7 @@ .in .PP which also returns a pointer to an invalid DIRFILE object. The difference -is that an invalid DIRFILE created in this way has a non-zero Dirfile +is that an invalid DIRFILE created in this way has a non-zero dirfile error (obtainable with .BR gd_error (3)), while the dirfile error of the invalid DIRFILE returned by @@ -68,4 +68,5 @@ .SH SEE ALSO .BR gd_close (3), .BR gd_discard (3), +.BR gd_error (3), .BR gd_open (3) Modified: trunk/getdata/src/flush.c =================================================================== --- trunk/getdata/src/flush.c 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/src/flush.c 2010-10-20 01:03:29 UTC (rev 459) @@ -714,7 +714,13 @@ for (i = 0; D->av && i < (unsigned int)D->n_fragment; ++i) { if (D->fragment[i].frame_offset > 0) D->av &= GD_VERS_GE_1; - else if (D->fragment[i].byte_sex != GD_LITTLE_ENDIAN) + else if (D->fragment[i].byte_sex != +#ifdef WORDS_BIGENDIAN + GD_BIG_ENDIAN +#else + GD_LITTLE_ENDIAN +#endif + ) D->av &= GD_VERS_GE_5; else if ((D->fragment[i].encoding != GD_UNENCODED && D->fragment[i].encoding != GD_AUTO_ENCODED) || Modified: trunk/getdata/src/getdata.c =================================================================== --- trunk/getdata/src/getdata.c 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/src/getdata.c 2010-10-20 01:03:29 UTC (rev 459) @@ -341,7 +341,7 @@ E->EN(raw,data_type) & GD_COMPLEX, samples_read); } - if (D->fragment[E->fragment_index].byte_sex == + if (D->fragment[E->fragment_index].byte_sex & #ifdef WORDS_BIGENDIAN GD_LITTLE_ENDIAN #else Modified: trunk/getdata/src/putdata.c =================================================================== --- trunk/getdata/src/putdata.c 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/src/putdata.c 2010-10-20 01:03:29 UTC (rev 459) @@ -87,7 +87,7 @@ ns); } - if (D->fragment[E->fragment_index].byte_sex == + if (D->fragment[E->fragment_index].byte_sex & #ifdef WORDS_BIGENDIAN GD_LITTLE_ENDIAN #else Modified: trunk/getdata/test/version_5.c =================================================================== --- trunk/getdata/test/version_5.c 2010-10-19 20:39:45 UTC (rev 458) +++ trunk/getdata/test/version_5.c 2010-10-20 01:03:29 UTC (rev 459) @@ -17,7 +17,11 @@ const char* data = __TEST__ "dirfile/a.r"; const char* format_data = "/VERSION 5\n" +#ifdef WORDS_BIGENDIAN + "/ENDIAN little\n" +#else "/ENDIAN big\n" +#endif "a.r RAW UINT8 8\n" "ENCODING PHASE a.r 0\n"; uint16_t c[8]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-21 02:37:05
|
Revision: 460 http://getdata.svn.sourceforge.net/getdata/?rev=460&view=rev Author: ketiltrout Date: 2010-10-21 02:36:58 +0000 (Thu, 21 Oct 2010) Log Message: ----------- Middle-ended ARM fixes (including the introduction of GD_NOT_ARM_ENDIAN). Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/cxx/test/big_test.cpp trunk/getdata/bindings/f77/test/big_test.f trunk/getdata/bindings/f77/test/big_test95.f90 trunk/getdata/bindings/idl/test/big_test.pro trunk/getdata/bindings/make_parameters.c trunk/getdata/bindings/python/test/big_test.py trunk/getdata/man/dirfile-format.5 trunk/getdata/man/gd_alter_endianness.3.in trunk/getdata/man/gd_cbopen.3 trunk/getdata/man/gd_endianness.3 trunk/getdata/src/endian.c trunk/getdata/src/errors.c trunk/getdata/src/flush.c trunk/getdata/src/getdata.c trunk/getdata/src/getdata.h.in trunk/getdata/src/internal.h trunk/getdata/src/move.c trunk/getdata/src/open.c trunk/getdata/src/parse.c trunk/getdata/src/putdata.c trunk/getdata/test/endian_get.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/ChangeLog 2010-10-21 02:36:58 UTC (rev 460) @@ -1,3 +1,26 @@ +2010-10-21 D. V. Wiebe <ge...@ke...> svn:460 + * test/endian_get.c: Test ARM endianness. + * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp + bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90 + bindings/idl/test/big_test.pro: Fix test 79 on middle-ended platforms. + + * src/getdata.h.in: Added GD_NOT_ARM_ENDIAN and conditionally figure out + whether it or GD_ARM_ENDIAN should be zero. + * bindings/make_parameters.c: Added GD_NOT_ARM_ENDIAN. + * src/internal.h: compute GD_ARM_FLAG. + * src/endian.c (_GD_ByteSwapFragment) src/open.c (gd_cbopen) src/getdata.c + (_GD_DoRaw) src/flush.c (_GD_FlushFragment) src/putdata.c (_GD_DoRawOut) + src/parse.c (_GD_ParseDirective): Fix handling of ARM flag. + * src/move.c (_GD_MogrifyFile): Only apply the ARM fix to double precision + data. Also fixed the count in byte swapping calls. + + * src/flush.c (_GD_FindVersion): Fix logic for ARM endianness. Fix ordering + of fragment metadata tests. + + * src/flush.c (_GD_FindVersion) src/errors.c: Better script for + GD_E_BAD_VERSION. Differentiate between a non-conformant dirfile and an + invalid version number. + 2010-10-20 D. V. Wiebe <ge...@ke...> svn:459 * test/version_5.c: Fix for WORDS_BIGENDIAN. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/NEWS 2010-10-21 02:36:58 UTC (rev 460) @@ -113,6 +113,11 @@ dirfile. Primarily useful to callers as a "null dirfile" placeholder. * GD_E_OPEN_INCLUDE has been renamed to GD_E_OPEN_FRAGMENT, but the former symbol remains as an alias. + * Two new bitflags to gd_cbopen and gd_open: GD_ARM_ENDIAN and + GD_NOT_ARM_ENDIAN allow specifying the default ordering of double precision + data. These flags may also be used with gd_alter_endianness() and will be + returned by gd_endianness(). On all platforms except for middle-endian + ARMs, GD_NOT_ARM_ENDIAN equals zero and may be omitted. * Where gd_flush() and gd_metaflush() in the past raised GD_E_OPEN_INCLUDE on I/O error, they now raise the new GD_FLUSH. * All functions now raise GD_E_DIMENSION when encountering a scalar field Modified: trunk/getdata/bindings/cxx/test/big_test.cpp =================================================================== --- trunk/getdata/bindings/cxx/test/big_test.cpp 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/bindings/cxx/test/big_test.cpp 2010-10-21 02:36:58 UTC (rev 460) @@ -896,7 +896,7 @@ CHECK_INT(78,frag->Encoding(),RawEncoding); // 79: Fragment::Endianness check - CHECK_INT(79,frag->Endianness(),GD_LITTLE_ENDIAN); + CHECK_INT(79,frag->Endianness(),GD_LITTLE_ENDIAN | GD_NOT_ARM_ENDIAN); // 80: Dirfile::Name check str = d->Name(); Modified: trunk/getdata/bindings/f77/test/big_test.f =================================================================== --- trunk/getdata/bindings/f77/test/big_test.f 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/bindings/f77/test/big_test.f 2010-10-21 02:36:58 UTC (rev 460) @@ -2601,7 +2601,7 @@ WRITE(*, 2001) 79, e ENDIF - IF (n .NE. GD_LE) THEN + IF (n .NE. (GD_LE + GD_NA)) THEN ne = ne + 1 WRITE(*, 2002) 79, n ENDIF Modified: trunk/getdata/bindings/f77/test/big_test95.f90 =================================================================== --- trunk/getdata/bindings/f77/test/big_test95.f90 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/bindings/f77/test/big_test95.f90 2010-10-21 02:36:58 UTC (rev 460) @@ -3314,7 +3314,7 @@ write(*, 2001) 79, e end if - if (n .ne. GD_LITTLE_ENDIAN) then + if (n .ne. (GD_LITTLE_ENDIAN + GD_NOT_ARM_ENDIAN)) then ne = ne + 1 write(*, 2002) 79, n end if Modified: trunk/getdata/bindings/idl/test/big_test.pro =================================================================== --- trunk/getdata/bindings/idl/test/big_test.pro 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/bindings/idl/test/big_test.pro 2010-10-21 02:36:58 UTC (rev 460) @@ -792,7 +792,7 @@ ; 79: gd_endianness n = gd_endianness(d, fragment=0) nume += check_ok(79, d) -nume += check_simple(79, n, !GD.LITTLE_ENDIAN) +nume += check_simple(79, n, (!GD.LITTLE_ENDIAN + !GD.NOT_ARM_ENDIAN)) ; 80: dirfilename n = gd_dirfilename(d) Modified: trunk/getdata/bindings/make_parameters.c =================================================================== --- trunk/getdata/bindings/make_parameters.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/bindings/make_parameters.c 2010-10-21 02:36:58 UTC (rev 460) @@ -88,6 +88,7 @@ CONSTANT(IGNORE_REFS, "GD_IR", 1), CONSTANT(PRETTY_PRINT, "GD_PP", 1), CONSTANT(ARM_ENDIAN, "GD_AE", 1), + CONSTANT(NOT_ARM_ENDIAN, "GD_NA", 1), CONSTANT(PERMISSIVE, "GD_PM", 1), CONSTANT(AUTO_ENCODED, "GD_EA", 1), Modified: trunk/getdata/bindings/python/test/big_test.py =================================================================== --- trunk/getdata/bindings/python/test/big_test.py 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/bindings/python/test/big_test.py 2010-10-21 02:36:58 UTC (rev 460) @@ -990,7 +990,8 @@ # 79: endianness check try: - CheckSimple(79,f.endianness,pygetdata.LITTLE_ENDIAN) + CheckSimple(79,f.endianness,pygetdata.LITTLE_ENDIAN | + pygetdata.NOT_ARM_ENDIAN) except: CheckOK(79) Modified: trunk/getdata/man/dirfile-format.5 =================================================================== --- trunk/getdata/man/dirfile-format.5 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/man/dirfile-format.5 2010-10-21 02:36:58 UTC (rev 460) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH dirfile\-format 5 "15 October 2010" "Standards Version 8" "DATA FORMATS" +.TH dirfile\-format 5 "21 October 2010" "Standards Version 8" "DATA FORMATS" .SH NAME dirfile\-format \(em the dirfile database format specification file .SH DESCRIPTION @@ -943,7 +943,7 @@ This document describes Version 8 of the Dirfile Standards. -Version 8 of the Standards (August 2010) added the +Version 8 of the Standards (October 2010) added the .B DIVIDE and .B RECIP Modified: trunk/getdata/man/gd_alter_endianness.3.in =================================================================== --- trunk/getdata/man/gd_alter_endianness.3.in 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/man/gd_alter_endianness.3.in 2010-10-21 02:36:58 UTC (rev 460) @@ -15,7 +15,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH gd_alter_endianness 3 "20 July 2010" "Version 0.7.0" "GETDATA" +.TH gd_alter_endianness 3 "21 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_alter_endianness \(em modify the byte sex of fields in a dirfile .SH SYNOPSIS @@ -23,7 +23,7 @@ .HP .nh .ad l -.BI "int gd_alter_endianness(DIRFILE *" dirfile ", unsigned int" +.BI "int gd_alter_endianness(DIRFILE *" dirfile ", unsigned long" .IB byte_sex ", int " fragment_index ", int " recode ); .hy .ad n @@ -65,6 +65,8 @@ Furthermore, any of these may be bitwise or'd with .B GD_ARM_ENDIAN +or +.B GD_NOT_ARM_ENDIAN indicating that the floating point data are stored in the ARM middle-endian format. .P Modified: trunk/getdata/man/gd_cbopen.3 =================================================================== --- trunk/getdata/man/gd_cbopen.3 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/man/gd_cbopen.3 2010-10-21 02:36:58 UTC (rev 460) @@ -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 "20 October 2010" "Version 0.7.0" "GETDATA" +.TH gd_cbopen 3 "21 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_cbopen, gd_open \(em open or create a dirfile .SH SYNOPSIS @@ -68,27 +68,49 @@ .BR GD_RDWR (read-write), and may also contain zero or more of the following flags, bitwise-or'd together: +.P +.B GD_ARM_ENDIAN +.PD 0 .TP -.B GD_ARM_ENDIAN -Specifies that double precision floating point raw data on disk is stored in the -middle-endian format used by older ARM processors. +.PD +.B GD_NOT_ARM_ENDIAN +Specifies that double precision floating point raw data on disk is, or is not, +stored in the middle-endian format used by older ARM processors. -This flag is only honoured if no -.B ENDIAN -directive occurs in the dirfile format specification, unless +These flag are only set the default endianness, and will be overridden when an +.B /ENDIAN +directive specifies the byte sex of +.B RAW +fields, unless .B GD_FORCE_ENDIAN is also specified. + +On every platform, one of these flags +.RB ( GD_NOT_ARM_ENDIAN +on all but middle-ended ARM systems) +indicates the native behaviour of the platform. That symbol will equal zero, +and may be omitted. +.P +.B GD_BIG_ENDIAN +.PD 0 .TP -.B GD_BIG_ENDIAN -Specifies that raw data on disk is stored as big-endian data (most significant -byte first). Specifying this flag along with the contradictory -.BR GD_LITTLE_ENDIAN -will cause the library to assume that the endianness of the data is opposite to -that of the native architecture. +.PD +.B GD_LITTLE_ENDIAN +Specifies the default byte sex of raw data stored on disk to be either +big-endian (most significant byte first) or little-endian (least significant +byte first). Omitting both flags indicates the default should be the native +endianness of the platform. -This flag is only honoured if no -.B ENDIAN -directive occurs in the dirfile format specification, unless +Unlike the ARM endianness flags above, neither of these symbols is ever zero. +Specifying both these flags together will cause the library to assume that the +endianness of the data is opposite to that of the native architecture, whatever +that might be. + +These flag are only set the default endianness, and will be overridden when an +.B /ENDIAN +directive specifies the byte sex of +.B RAW +fields, unless .B GD_FORCE_ENDIAN is also specified. .TP @@ -126,7 +148,7 @@ .TP .B GD_FORCE_ENCODING Specifies that -.B ENCODING +.B /ENCODING directives (see .BR dirfile-format (5)) found in the dirfile format specification should be ignored. The encoding scheme @@ -136,15 +158,15 @@ .TP .B GD_FORCE_ENDIAN Specifies that -.B ENDIAN +.B /ENDIAN directives (see .BR dirfile-format (5)) -found in the dirfile format specification should be ignored. When specified -with one or more of -.BR GD_ARM_ENDIAN ,\~ GD_BIG_ENDIAN " or " GD_LITTLE_ENDIAN , -the specified endianness will be assumed. If this flag is specified with -none of those flags, the dirfile will be assumed to have the endianness of -the native architecture. +found in the dirfile format specification should be ignored. All raw data will +be assumed to have the byte sex indicated through the presence or absense of the +.BR GD_ARM_ENDIAN ,\~ GD_BIG_ENDIAN ,\~ GD_LITTLE_ENDIAN , +and +.B GD_NOT_ARM_ENDIAN +flags. .TP .B GD_IGNORE_DUPS If the dirfile format metadata specifies more than one field with the same name, @@ -161,19 +183,6 @@ .B GD_E_FORMAT_DUPLICATE suberrors itself with an appropriate callback function. .TP -.B GD_LITTLE_ENDIAN -Specifies that raw data on disk is stored as little-endian data (least -significant byte first). Specifying this flag along with the contradictory -.BR GD_BIG_ENDIAN -will cause the library to assume that the endianness of the data is opposite to -that of the native architecture. - -This flag is only honoured if no -.B ENDIAN -directive occurs in the dirfile format specification, unless -.B GD_FORCE_ENDIAN -is also specified. -.TP .B GD_PEDANTIC Reject dirfiles which don't conform to the Dirfile Standards. See the .B Standards Compliance @@ -443,7 +452,7 @@ .TP .B GD_E_FORMAT_ENDIAN The byte sex specified by an -.B ENDIAN +.B /ENDIAN directive was unrecognised. .TP .B GD_E_FORMAT_LITERAL Modified: trunk/getdata/man/gd_endianness.3 =================================================================== --- trunk/getdata/man/gd_endianness.3 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/man/gd_endianness.3 2010-10-21 02:36:58 UTC (rev 460) @@ -49,11 +49,13 @@ .BR gd_endianness () returns the byte sex of the specified fragment, which will be either .BR GD_BIG_ENDIAN " or " GD_LITTLE_ENDIAN , -possibly bitwise-or'd with -.BR GD_ARM_ENDIAN , -if floating point data in this fragment are stored in the old ARM middle-endian -format. On error, it returns zero and sets the dirfile error to a non-zero -error value. Possible error values are: +bitwise-or'd with either +.B GD_ARM_ENDIAN +or +.BR GD_NOT_ARM_ENDIAN , +indicating whether double-precision floating point data in this fragment are +stored in the old ARM middle-endian format. 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_BAD_DIRFILE The supplied dirfile was invalid. Modified: trunk/getdata/src/endian.c =================================================================== --- trunk/getdata/src/endian.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/endian.c 2010-10-21 02:36:58 UTC (rev 460) @@ -39,7 +39,7 @@ #else (byte_sex & GD_BIG_ENDIAN) ? GD_BIG_ENDIAN : GD_LITTLE_ENDIAN #endif - ) | (byte_sex & GD_ARM_ENDIAN); + ) | (byte_sex & GD_ARM_FLAG); /* check protection */ if (D->fragment[fragment].protection & GD_PROTECT_FORMAT) { Modified: trunk/getdata/src/errors.c =================================================================== --- trunk/getdata/src/errors.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/errors.c 2010-10-21 02:36:58 UTC (rev 460) @@ -177,7 +177,10 @@ { GD_E_BAD_REPR, GD_E_REPR_PUT, "Unable to write to field reprentation: .{4}", 0 }, /* GD_E_BAD_VERSION 3 = version */ - { GD_E_BAD_VERSION, 0, "Bad version specified: {3}", 0 }, + { GD_E_BAD_VERSION, GD_E_VERS_NONE, + "Dirfile conforms to no Standards Version", 0 }, + { GD_E_BAD_VERSION, GD_E_VERS_MISSING, + "Dirfile does not conform to Standards Version {3}", 0 }, /* GD_E_FLUSH: 3 = suberror, 4 = filename */ { GD_E_FLUSH, GD_E_FLUSH_MKTMP, "I/O error creating temporary file: ", 1 }, { GD_E_FLUSH, GD_E_FLUSH_OPEN, "I/O error opening temporary file: ", 1 }, Modified: trunk/getdata/src/flush.c =================================================================== --- trunk/getdata/src/flush.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/flush.c 2010-10-21 02:36:58 UTC (rev 460) @@ -479,7 +479,8 @@ fprintf(stream, "/ENDIAN %s%s\n", (D->fragment[i].byte_sex & GD_LITTLE_ENDIAN) ? "little" : "big", ((permissive || D->standards >= 8) && - D->fragment[i].byte_sex & GD_ARM_ENDIAN) ? " arm" : ""); + (D->fragment[i].byte_sex & GD_ARM_FLAG) == GD_ARM_ENDIAN) ? " arm" : + ""); if (permissive || D->standards >= 6) { if (D->fragment[i].protection == GD_PROTECT_NONE) @@ -712,20 +713,30 @@ D->av &= GD_VERS_GE_3; for (i = 0; D->av && i < (unsigned int)D->n_fragment; ++i) { - if (D->fragment[i].frame_offset > 0) - D->av &= GD_VERS_GE_1; - else if (D->fragment[i].byte_sex != -#ifdef WORDS_BIGENDIAN - GD_BIG_ENDIAN + /* on an arm-endian platform, the arm flag is set by /ENDIAN directives + * missing an "arm" token, but it's absense might mean either an "arm" + * token was present, or else there was no /ENDIAN directive at all */ + if (D->fragment[i].byte_sex & GD_ARM_FLAG) +#if ARM_ENDIAN_DOUBLES + D->av &= GD_VERS_GE_5; #else + D->av &= GD_VERS_GE_8; + else +#endif + if ((D->fragment[i].encoding != GD_UNENCODED && + D->fragment[i].encoding != GD_AUTO_ENCODED) || + D->fragment[i].protection) + D->av &= GD_VERS_GE_6; + else if (D->fragment[i].byte_sex & +#if WORDS_BIGENDIAN GD_LITTLE_ENDIAN +#else + GD_BIG_ENDIAN #endif ) D->av &= GD_VERS_GE_5; - else if ((D->fragment[i].encoding != GD_UNENCODED && - D->fragment[i].encoding != GD_AUTO_ENCODED) || - D->fragment[i].protection) - D->av &= GD_VERS_GE_6; + else if (D->fragment[i].frame_offset > 0) + D->av &= GD_VERS_GE_1; } for (i = 0; D->av && i < D->n_entries; ++i) { @@ -884,7 +895,8 @@ if (vers < 0 || vers > GD_DIRFILE_STANDARDS_VERSION || ~D->av & (1ULL << vers)) { - _GD_SetError(D, GD_E_BAD_VERSION, 0, NULL, vers, NULL); + _GD_SetError(D, GD_E_BAD_VERSION, (D->av == 0) ? GD_E_VERS_NONE : + GD_E_VERS_MISSING, NULL, vers, NULL); dreturn("%i", -1); return -1; } Modified: trunk/getdata/src/getdata.c =================================================================== --- trunk/getdata/src/getdata.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/getdata.c 2010-10-21 02:36:58 UTC (rev 460) @@ -332,10 +332,7 @@ /* convert to/from middle-ended doubles */ if ((E->EN(raw,data_type) == GD_FLOAT64 || E->EN(raw,data_type) == GD_COMPLEX128) && -#ifdef ARM_ENDIAN_DOUBLES - ~ -#endif - D->fragment[E->fragment_index].byte_sex & GD_ARM_ENDIAN) + D->fragment[E->fragment_index].byte_sex & GD_ARM_FLAG) { _GD_ArmEndianise((uint64_t *)(databuffer + n_read * E->e->EN(raw,size)), E->EN(raw,data_type) & GD_COMPLEX, samples_read); Modified: trunk/getdata/src/getdata.h.in =================================================================== --- trunk/getdata/src/getdata.h.in 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/getdata.h.in 2010-10-21 02:36:58 UTC (rev 460) @@ -355,7 +355,15 @@ #define GD_IGNORE_REFS 0x00000800 /* ignore REFERENCE directives -- dirfile_include only */ #define GD_PRETTY_PRINT 0x00001000 /* make a nicer looking format file */ -#define GD_ARM_ENDIAN 0x00002000 /* ARM-endian doubles */ + +#if (defined __arm__ && !(defined __VFP_FP__ || defined __MAVERICK__)) +# define GD_ARM_ENDIAN 0x00000000 /* ARM-endian doubles */ +# define GD_NOT_ARM_ENDIAN 0x00002000 /* "normal"-endian doubles */ +#else +# define GD_ARM_ENDIAN 0x00002000 /* ARM-endian doubles */ +# define GD_NOT_ARM_ENDIAN 0x00000000 /* "normal"-endian doubles */ +#endif + #define GD_PERMISSIVE 0x00004000 /* be permissive */ #define GD_ENCODING 0x0F000000 /* mask */ Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/internal.h 2010-10-21 02:36:58 UTC (rev 460) @@ -101,6 +101,8 @@ # include <io.h> #endif +#define GD_ARM_FLAG (GD_ARM_ENDIAN | GD_NOT_ARM_ENDIAN) + /* Type conventions: * * - samples per frame is always gd_spf_t (aka uin16_t) @@ -334,6 +336,9 @@ #define GD_E_FLUSH_OPEN 2 #define GD_E_FLUSH_RENAME 3 +#define GD_E_VERS_NONE 1 +#define GD_E_VERS_MISSING 2 + struct _gd_raw_file { char* name; int fp; Modified: trunk/getdata/src/move.c =================================================================== --- trunk/getdata/src/move.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/move.c 2010-10-21 02:36:58 UTC (rev 460) @@ -99,8 +99,10 @@ enc_in = _gd_ef + E->e->EN(raw,file)[0].encoding; /* Need to do the ARM thing? */ - arm_endianise = ((byte_sex & GD_ARM_ENDIAN) && enc_out->ecor) ^ - ((D->fragment[E->fragment_index].byte_sex & GD_ARM_ENDIAN) && enc_in->ecor); + arm_endianise = (((byte_sex & GD_ARM_FLAG) && enc_out->ecor) ^ + ((D->fragment[E->fragment_index].byte_sex & GD_ARM_FLAG) && enc_in->ecor)) + && (E->EN(raw,data_type) == GD_FLOAT64 || + E->EN(raw,data_type) == GD_COMPLEX128); /* Normalise endiannesses */ #ifdef WORDS_BIGENDIAN @@ -216,14 +218,14 @@ /* fix army-ness, if required */ if (arm_endianise) _GD_ArmEndianise((uint64_t *)buffer, E->EN(raw,data_type) & GD_COMPLEX, - ns); + nread); /* swap endianness, if required */ if (byte_sex) { if (E->EN(raw,data_type) & GD_COMPLEX) - _GD_FixEndianness((char *)buffer, E->e->EN(raw,size) / 2, ns * 2); + _GD_FixEndianness((char *)buffer, E->e->EN(raw,size) / 2, nread * 2); else - _GD_FixEndianness((char *)buffer, E->e->EN(raw,size), ns); + _GD_FixEndianness((char *)buffer, E->e->EN(raw,size), nread); } nwrote = (*enc_out->write)(E->e->EN(raw,file) + 1, buffer, Modified: trunk/getdata/src/open.c =================================================================== --- trunk/getdata/src/open.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/open.c 2010-10-21 02:36:58 UTC (rev 460) @@ -311,7 +311,7 @@ #else (D->flags & GD_BIG_ENDIAN) ? GD_BIG_ENDIAN : GD_LITTLE_ENDIAN #endif - ) | (D->flags & GD_ARM_ENDIAN); + ) | (D->flags & GD_ARM_FLAG); D->fragment[0].ref_name = NULL; D->fragment[0].frame_offset = 0; D->fragment[0].protection = GD_PROTECT_NONE; Modified: trunk/getdata/src/parse.c =================================================================== --- trunk/getdata/src/parse.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/parse.c 2010-10-21 02:36:58 UTC (rev 460) @@ -1515,13 +1515,19 @@ else _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN, D->fragment[me].cname, linenum, NULL); - if (n_cols > 2) { - if (strcmp(in_cols[2], "arm") == 0) - D->fragment[me].byte_sex |= GD_ARM_ENDIAN; - else + if (n_cols > 2 && (!pedantic || *standards >= 8)) { + if (strcmp(in_cols[2], "arm") == 0) { +#if ! ARM_ENDIAN_DOUBLES + D->fragment[me].byte_sex |= GD_ARM_FLAG; +#endif + } else _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN, D->fragment[me].cname, linenum, NULL); } +#if ARM_ENDIAN_DOUBLES + else + D->fragment[me].byte_sex |= GD_ARM_FLAG; +#endif } } else if (strcmp(ptr, "FRAMEOFFSET") == 0 && (!pedantic || *standards >= 1)) D->fragment[me].frame_offset = strtoll(in_cols[1], NULL, 10); Modified: trunk/getdata/src/putdata.c =================================================================== --- trunk/getdata/src/putdata.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/src/putdata.c 2010-10-21 02:36:58 UTC (rev 460) @@ -78,10 +78,7 @@ /* convert to/from middle-ended doubles */ if ((E->EN(raw,data_type) == GD_FLOAT64 || E->EN(raw,data_type) == GD_COMPLEX128) && -#ifdef ARM_ENDIAN_DOUBLES - ~ -#endif - D->fragment[E->fragment_index].byte_sex & GD_ARM_ENDIAN) + D->fragment[E->fragment_index].byte_sex & GD_ARM_FLAG) { _GD_ArmEndianise((uint64_t*)databuffer, E->EN(raw,data_type) & GD_COMPLEX, ns); Modified: trunk/getdata/test/endian_get.c =================================================================== --- trunk/getdata/test/endian_get.c 2010-10-20 01:03:29 UTC (rev 459) +++ trunk/getdata/test/endian_get.c 2010-10-21 02:36:58 UTC (rev 460) @@ -16,8 +16,12 @@ const char* filedir = __TEST__ "dirfile"; const char* format = __TEST__ "dirfile/format"; const char* format1 = __TEST__ "dirfile/format1"; + const char* format2 = __TEST__ "dirfile/format2"; + const char* format3 = __TEST__ "dirfile/format3"; const char* format_data = "ENDIAN little\nINCLUDE format1\n"; - const char* format_data1 = "ENDIAN big\n"; + const char* format_data1 = "ENDIAN big\nINCLUDE format2\n"; + const char* format_data2 = "ENDIAN big arm\nINCLUDE format3\n"; + const char* format_data3 = "ENDIAN little arm\n"; int fd, r = 0; mkdir(filedir, 0777); @@ -30,20 +34,34 @@ write(fd, format_data1, strlen(format_data1)); close(fd); + fd = open(format2, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data2, strlen(format_data2)); + close(fd); + + fd = open(format3, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data3, strlen(format_data3)); + close(fd); + DIRFILE* D = gd_open(filedir, GD_RDONLY | GD_VERBOSE); unsigned long n = gd_endianness(D, 0); unsigned long m = gd_endianness(D, 1); + unsigned long l = gd_endianness(D, 2); + unsigned long k = gd_endianness(D, 3); int error = gd_error(D); gd_close(D); unlink(format); unlink(format1); + unlink(format2); + unlink(format3); rmdir(filedir); CHECKI(error, 0); - CHECKX(n, GD_LITTLE_ENDIAN); - CHECKX(m, GD_BIG_ENDIAN); + CHECKX(n, GD_LITTLE_ENDIAN | GD_NOT_ARM_ENDIAN); + CHECKX(m, GD_BIG_ENDIAN | GD_NOT_ARM_ENDIAN); + CHECKX(l, GD_BIG_ENDIAN | GD_ARM_ENDIAN); + CHECKX(k, GD_LITTLE_ENDIAN | GD_ARM_ENDIAN); return r; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-22 02:27:23
|
Revision: 461 http://getdata.svn.sourceforge.net/getdata/?rev=461&view=rev Author: ketiltrout Date: 2010-10-22 02:27:13 +0000 (Fri, 22 Oct 2010) Log Message: ----------- Add gd_invalid_dirfile() and gd_dirfile_standards() bindings. Fix segfault in pygetdata. Update doc/* Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/cxx/dirfile.cpp trunk/getdata/bindings/cxx/getdata/dirfile.h trunk/getdata/bindings/cxx/test/big_test.cpp trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/bindings/f77/fgetdata.h trunk/getdata/bindings/f77/getdata.f.in trunk/getdata/bindings/f77/getdata.f90.in trunk/getdata/bindings/f77/test/big_test.f trunk/getdata/bindings/f77/test/big_test95.f90 trunk/getdata/bindings/idl/getdata.c trunk/getdata/bindings/idl/test/big_test.pro trunk/getdata/bindings/make_parameters.c trunk/getdata/bindings/python/pydirfile.c trunk/getdata/bindings/python/pyfragment.c trunk/getdata/bindings/python/pygetdata.c trunk/getdata/bindings/python/test/big_test.py trunk/getdata/doc/README.cxx trunk/getdata/doc/README.f77 trunk/getdata/doc/README.f95 trunk/getdata/doc/README.idl trunk/getdata/doc/list.tests trunk/getdata/doc/unclean_database_recovery.txt Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/ChangeLog 2010-10-22 02:27:13 UTC (rev 461) @@ -1,3 +1,32 @@ +2010-10-21 D. V. Wiebe <ge...@ke...> svn:461 + * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp + bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90 + bindings/idl/test/big_test.pro: Added tests 156 and 157. + + * bindings/python/pydirfile.c (gdpy_dirfile_init): Allow name=None to create + an invalid dirfile. + + * bindings/python/pydirfile.c (gdpy_dirfile_close gdpy_dirfile_discard): + Don't check dirfile error on success. + * bindings/python/pygetdata.c: Add missing exceptions. + + * bindings/python/pydirfile.c bindings/python/pyfragment.c: Update docs. + + * bindings/make_parameters.c: GD_ARM_ENDIAN and GD_NOT_ARM_ENDIAN are type 2 + constants. Exclude unnecessary constants in Python and IDL. GD_VERSION_* + added. + + * bindings/cxx/dirfile.cpp (Dirfile::Dirfile): Create the invalid dirfile + using gd_invalid_dirfile(). + + * bindings/python/pydirfile.c (gdpy_dirfile_getstandards + gdpy_dirfile_setstandards) bindings/f77/fgetdata.c (GDINVD GDSTDV) + bindings/f77/getdata.f90.in (fgd_invalid_dirfile fgd_dirfile_standards) + bindings/idl/getdata.c (gdidl_invalid_dirfile gdidl_dirfile_standards) + bindings/cxx/dirfile.cpp (Dirfile::Standards): Added. + + * bindings/idl/getdata.c: Fix for GD_NOT_ARM_ENDIAN. + 2010-10-21 D. V. Wiebe <ge...@ke...> svn:460 * test/endian_get.c: Test ARM endianness. * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/NEWS 2010-10-22 02:27:13 UTC (rev 461) @@ -138,13 +138,18 @@ Bindings + * Bindings for the functionality introduced into 0.7.0 have been added. * C++: Const member functions are now flagged as such. * F95: For consistency sake, the Fortran 95 bindings have undergone the same renaming as the C bindings. All functions are now preceded by 'fgd_'. * IDL: The IDL bindings have also followed suit in the great renaming. The exception to this is GETDATA_CONSTANTS(), which is not renamed. + * IDL: Various constants defined in getdata.h but not used by the IDL bindings + have been removed from the structure returned by GETDATA_CONSTANTS(). * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. - * Python BUG FIX: A non-litteral phase shift is now properly reported. + * Python BUG FIX: A non-literal phase shift is now properly reported. + * Python BUG FIX: Calling Dirfile.discard() or Dirfile.close() no longer + results in a segfault. Miscellaneous Modified: trunk/getdata/bindings/cxx/dirfile.cpp =================================================================== --- trunk/getdata/bindings/cxx/dirfile.cpp 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/cxx/dirfile.cpp 2010-10-22 02:27:13 UTC (rev 461) @@ -28,7 +28,7 @@ Dirfile::Dirfile() { - D = gd_open("", 0); + D = gd_invalid_dirfile(); error_string = NULL; } @@ -389,3 +389,8 @@ { return gd_dirfilename(D); } + +int Dirfile::Standards(int version) const +{ + return gd_dirfile_standards(D, version); +} Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-10-22 02:27:13 UTC (rev 461) @@ -186,6 +186,8 @@ void SetCallback(gd_parser_callback_t sehandler, void* extra = NULL) const; + int Standards(int version = GD_VERSION_CURRENT) const; + const char **Strings() const; int UnInclude(int fragment_index, int del = 0) const; Modified: trunk/getdata/bindings/cxx/test/big_test.cpp =================================================================== --- trunk/getdata/bindings/cxx/test/big_test.cpp 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/cxx/test/big_test.cpp 2010-10-22 02:27:13 UTC (rev 461) @@ -47,11 +47,13 @@ using namespace std; using namespace GetData; -#define CHECK_ERROR(t,g) \ +#define CHECK_ERRORb(d,t,g) \ e = d->Error(); if (e != (g)) { ne++; cerr << "e[" << t << "] = " << e << endl; } -#define CHECK_ERROR2(t,n,g) \ +#define CHECK_ERROR2b(d,t,n,g) \ e = d->Error(); if (e != (g)) { \ ne++; cerr << "e[" << t << ", " << n << "] = " << e << endl; } +#define CHECK_ERROR(t,g) CHECK_ERRORb(d,t,g) +#define CHECK_ERROR2(t,n,g) CHECK_ERROR2b(d,t,n,g) #define CHECK_OK(t) CHECK_ERROR(t,GD_E_OK) #define CHECK_OK2(t,n) CHECK_ERROR2(t,n,GD_E_OK) @@ -1135,9 +1137,23 @@ // 155: Fragment::ReWrite check frag->ReWrite(); CHECK_OK(155); + + // 156: Invalid Dirfile check + Dirfile *id = new Dirfile(); + CHECK_ERROR2b(id,156,1,GD_E_OK); + id->NFragments(); + CHECK_ERROR2b(id,156,2,GD_E_BAD_DIRFILE); + delete id; + // 157: Dirfile::Standards check + n = d->Standards(); + CHECK_OK2(157,1); + CHECK_INT(157,n,8); + d->Standards(0); + CHECK_ERROR2(157,2,GD_E_BAD_VERSION); + // =================================================================== d->Discard(); delete d; Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-10-22 02:27:13 UTC (rev 461) @@ -202,7 +202,7 @@ } } -/* getdata wrapper */ +/* gd_getdata wrapper */ void F77_FUNC(gdgetd, GDGETD) (int* n_read, const int* dirfile, const char* field_code, const int* field_code_l, const int* first_frame, const int* first_sample, @@ -346,7 +346,7 @@ free(out); } -/* putdata wrapper */ +/* gd_putdata wrapper */ void F77_FUNC(gdputd, GDPUTD) (int* n_wrote, const int* dirfile, const char* field_code, const int* field_code_l, const int* first_frame, const int* first_sample, const int* num_frames, const int* num_samples, @@ -2614,3 +2614,23 @@ dreturnvoid(); } + +/* gd_invalid_dirfile wrapper */ +void F77_FUNC(gdinvd, GDINVD) (int *dirfile) +{ + dtrace("%p", dirfile); + + *dirfile = _GDF_SetDirfile(gd_invalid_dirfile()); + + dreturn("%i", *dirfile); +} + +/* gd_dirfile_standards wrapper */ +void F77_FUNC(gdstdv, GDSTDV) (int *vers, const int *dirfile) +{ + dtrace("%p, %i", vers, *dirfile); + + *vers = gd_dirfile_standards(_GDF_GetDirfile(*dirfile), *vers); + + dreturn("%i", *vers); +} Modified: trunk/getdata/bindings/f77/fgetdata.h =================================================================== --- trunk/getdata/bindings/f77/fgetdata.h 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/f77/fgetdata.h 2010-10-22 02:27:13 UTC (rev 461) @@ -344,8 +344,6 @@ void F77_FUNC(gdrefe, GDREFE) (char* name, int* name_l, const int* dirfile, const char* field_code, const int *field_code_l); -void F77_FUNC(gdgref, GDGREF) (char *name, int* name_l, const int* dirfile); - void F77_FUNC(gdaenc, GDAENC) (const int* dirfile, const int* encoding, const int* fragment, const int* recode); @@ -459,3 +457,7 @@ void F77_FUNC(gdadsb, GDADSB) (const int* dirfile, const char* field_code, const int* field_code_l, const char* in_field, const int* in_field_l, const int* bitnum, const int* numbits, const int* fragment_index); + +void F77_FUNC(gdinvd, GDINVD) (int *dirfile); + +void F77_FUNC(gdstdv, GDSTDV) (int *vers, const int *dirfile); Modified: trunk/getdata/bindings/f77/getdata.f.in =================================================================== --- trunk/getdata/bindings/f77/getdata.f.in 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/f77/getdata.f.in 2010-10-22 02:27:13 UTC (rev 461) @@ -181,6 +181,8 @@ EXTERNAL GDGTST C Corresponding to gd_include(3) EXTERNAL GDINCL +C Corresponding to gd_invalid_dirfile(3) + EXTERNAL GDINVD C Corresponding to gd_madd_bit(3) EXTERNAL GDMDBT C Corresponding to complex valued gd_madd_clincom(3) @@ -263,6 +265,8 @@ EXTERNAL GDRFRG C Corresponding to gd_raw_filename(3) EXTERNAL GDRWFN +C Corresponding to gd_dirfile_standards(3) + EXTERNAL GDSTDV 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 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/f77/getdata.f90.in 2010-10-22 02:27:13 UTC (rev 461) @@ -1387,9 +1387,9 @@ end subroutine function fgd_fragmentname (dirfile, ind) - character (len=GD_FIELD_LEN) :: fgd_fragmentname + character (len=GD_MAX_LINE_LENGTH) :: fgd_fragmentname integer, intent(in) :: dirfile, ind - integer :: l = GD_FIELD_LEN + integer :: l = GD_MAX_LINE_LENGTH call gdfrgn(fgd_fragmentname, l, dirfile, ind) end function @@ -1791,4 +1791,19 @@ call gdname(dirfilename, l, dirfile, fragment_index) end subroutine +function fgd_invalid_dirfile () + integer :: fgd_invalid_dirfile + + call gdinvd(fgd_invalid_dirfile) +end function + +function fgd_dirfile_standards (dirfile, version) + integer :: fgd_dirfile_standards + integer, intent(in) :: dirfile, version + + fgd_dirfile_standards = version + + call gdstdv(fgd_dirfile_standards, dirfile) +end function + end module Modified: trunk/getdata/bindings/f77/test/big_test.f =================================================================== --- trunk/getdata/bindings/f77/test/big_test.f 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/f77/test/big_test.f 2010-10-22 02:27:13 UTC (rev 461) @@ -3560,15 +3560,56 @@ IF (e .NE. GD_EOK) THEN ne = ne + 1 - WRITE(*, 2001), 154, e + WRITE(*, 2001), 155, e ENDIF +C 156: GDINVD check + CALL GDINVD(m) + CALL GDEROR(e, m) + IF (e .NE. GD_EOK) THEN + ne = ne + 1 + WRITE(*, 2006), 156, 1, e + ENDIF + CALL GDNFRG(n, m) + CALL GDEROR(e, m) + IF (e .NE. GD_EBD) THEN + ne = ne + 1 + WRITE(*, 2006), 156, 2, e + ENDIF + CALL GDCLOS(m) +C 157: GDSTDV check + n = GDSV_C + CALL GDSTDV(n, d) + CALL GDEROR(e, d) + IF (e .NE. GD_EOK) THEN + ne = ne + 1 + WRITE(*, 2006), 157, 1, e + ENDIF + + IF (n .NE. 8) THEN + ne = ne + 1 + WRITE(*, 2002), 157, n + ENDIF + + n = 0 + CALL GDSTDV(n, d) + CALL GDEROR(e, d) + + IF (e .NE. GD_EVR) THEN + ne = ne + 1 + WRITE(*, 2006), 157, 2, e + ENDIF + + + + + C =============================================================== C Cleanup CALL GDDSCD(d) Modified: trunk/getdata/bindings/f77/test/big_test95.f90 =================================================================== --- trunk/getdata/bindings/f77/test/big_test95.f90 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/f77/test/big_test95.f90 2010-10-22 02:27:13 UTC (rev 461) @@ -4184,7 +4184,50 @@ write(*, 2001), 155, e end if +! 156: fgd_invalid_dirfile check + m = fgd_invalid_dirfile() + e = fgd_error(m) + if (e .ne. GD_E_OK) then + ne = ne + 1 + write(*, 2006), 156, 1, e + end if + + n = fgd_nfragments(m) + e = fgd_error(m) + + if (e .ne. GD_E_BAD_DIRFILE) then + ne = ne + 1 + write(*, 2006), 156, 2, e + end if + + call fgd_close(m) + +! 157: fgd_dirfile_standards + n = fgd_dirfile_standards(d, GD_VERSION_CURRENT) + e = fgd_error(d) + + if (e .ne. GD_E_OK) then + ne = ne + 1 + write(*, 2006), 157, 1, e + end if + + if (n .ne. 8) then + ne = ne + 1 + write(*, 2002), 157, n + end if + + n = fgd_dirfile_standards(d, 0) + e = fgd_error(d) + + if (e .ne. GD_E_BAD_VERSION) then + ne = ne + 1 + write(*, 2006), 156, 2, e + end if + + + + !================================================================ call fgd_discard(d) Modified: trunk/getdata/bindings/idl/getdata.c =================================================================== --- trunk/getdata/bindings/idl/getdata.c 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/idl/getdata.c 2010-10-22 02:27:13 UTC (rev 461) @@ -918,9 +918,9 @@ return r; } -/* @@DLM: P gdidl_gd_add GD_ADD 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_add GD_MADD 2 2 KEYWORDS */ -void gdidl_gd_add(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add GD_ADD 2 2 KEYWORDS */ +/* @@DLM: P gdidl_add GD_MADD 2 2 KEYWORDS */ +void gdidl_add(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -964,9 +964,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_bit GD_ADD_BIT 3 3 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_bit GD_MADD_BIT 3 3 KEYWORDS */ -void gdidl_gd_add_bit(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_bit GD_ADD_BIT 3 3 KEYWORDS */ +/* @@DLM: P gdidl_add_bit GD_MADD_BIT 3 3 KEYWORDS */ +void gdidl_add_bit(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1017,9 +1017,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_const GD_ADD_CONST 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_const GD_MADD_CONST 2 2 KEYWORDS */ -void gdidl_gd_add_const(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_const GD_ADD_CONST 2 2 KEYWORDS */ +/* @@DLM: P gdidl_add_const GD_MADD_CONST 2 2 KEYWORDS */ +void gdidl_add_const(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1094,11 +1094,11 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_lincom GD_ADD_LINCOM 5 11 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_lincom GD_ADD_CLINCOM 5 11 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_lincom GD_MADD_CLINCOM 5 11 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_lincom GD_MADD_LINCOM 5 11 KEYWORDS */ -void gdidl_gd_add_lincom(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_lincom GD_ADD_LINCOM 5 11 KEYWORDS */ +/* @@DLM: P gdidl_add_lincom GD_ADD_CLINCOM 5 11 KEYWORDS */ +/* @@DLM: P gdidl_add_lincom GD_MADD_CLINCOM 5 11 KEYWORDS */ +/* @@DLM: P gdidl_add_lincom GD_MADD_LINCOM 5 11 KEYWORDS */ +void gdidl_add_lincom(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1177,9 +1177,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_linterp GD_ADD_LINTERP 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_linterp GD_MADD_LINTERP 4 4 KEYWORDS */ -void gdidl_gd_add_linterp(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_linterp GD_ADD_LINTERP 4 4 KEYWORDS */ +/* @@DLM: P gdidl_add_linterp GD_MADD_LINTERP 4 4 KEYWORDS */ +void gdidl_add_linterp(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1225,9 +1225,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_multiply GD_ADD_MULTIPLY 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_multiply GD_MADD_MULTIPLY 4 4 KEYWORDS */ -void gdidl_gd_add_multiply(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_multiply GD_ADD_MULTIPLY 4 4 KEYWORDS */ +/* @@DLM: P gdidl_add_multiply GD_MADD_MULTIPLY 4 4 KEYWORDS */ +void gdidl_add_multiply(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1273,9 +1273,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_divide GD_ADD_DIVIDE 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_divide GD_MADD_DIVIDE 4 4 KEYWORDS */ -void gdidl_gd_add_divide(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_divide GD_ADD_DIVIDE 4 4 KEYWORDS */ +/* @@DLM: P gdidl_add_divide GD_MADD_DIVIDE 4 4 KEYWORDS */ +void gdidl_add_divide(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1321,21 +1321,23 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_recip GD_ADD_RECIP 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_recip GD_ADD_CRECIP 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_recip GD_MADD_RECIP 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_recip GD_MADD_CRECIP 4 4 KEYWORDS */ -void gdidl_gd_add_recip(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_recip GD_ADD_RECIP 3 3 KEYWORDS */ +/* @@DLM: P gdidl_add_recip GD_ADD_CRECIP 3 3 KEYWORDS */ +/* @@DLM: P gdidl_add_recip GD_MADD_RECIP 3 3 KEYWORDS */ +/* @@DLM: P gdidl_add_recip GD_MADD_CRECIP 3 3 KEYWORDS */ +void gdidl_add_recip(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); int comp_scal = 0; double complex cdividend = 0; - double dividend = 0; + double dividend = 1; typedef struct { IDL_KW_RESULT_FIRST_FIELD; GDIDL_KW_RESULT_ERROR; + IDL_VPTR dividend; + int dividend_x; int fragment_index; IDL_STRING parent; int parent_x; @@ -1344,9 +1346,12 @@ GDIDL_KW_INIT_ERROR; kw.fragment_index = 0; - kw.parent_x = 0; + kw.parent_x = kw.dividend_x = 0; + kw.dividend = NULL; static IDL_KW_PAR kw_pars[] = { + { "DIVIDEND", 0, 1, IDL_KW_VIN, IDL_KW_OFFSETOF(dividend_x), + IDL_KW_OFFSETOF(dividend) }, GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "FRAGMENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(fragment_index) }, @@ -1361,11 +1366,15 @@ const char* field_code = IDL_VarGetString(argv[1]); const char* in_field1 = IDL_VarGetString(argv[2]); - if (argv[3]->type == IDL_TYP_DCOMPLEX || argv[3]->type == IDL_TYP_COMPLEX) { - comp_scal = 1; - cdividend = gdidl_dcomplexScalar(argv[3]); - } else - dividend = IDL_DoubleScalar(argv[3]); + if (kw.dividend_x) { + if (kw.dividend->type == IDL_TYP_DCOMPLEX || + kw.dividend->type == IDL_TYP_COMPLEX) + { + comp_scal = 1; + cdividend = gdidl_dcomplexScalar(kw.dividend); + } else + dividend = IDL_DoubleScalar(kw.dividend); + } if (kw.parent_x) { const char* parent = IDL_STRING_STR(&kw.parent); @@ -1385,9 +1394,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_phase GD_ADD_PHASE 4 4 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_phase GD_MADD_PHASE 4 4 KEYWORDS */ -void gdidl_gd_add_phase(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_phase GD_ADD_PHASE 4 4 KEYWORDS */ +/* @@DLM: P gdidl_add_phase GD_MADD_PHASE 4 4 KEYWORDS */ +void gdidl_add_phase(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1433,11 +1442,11 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_polynom GD_ADD_POLYNOM 4 9 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_polynom GD_ADD_CPOLYNOM 4 8 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_polynom GD_MADD_CPOLYNOM 4 9 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_polynom GD_MADD_POLYNOM 4 9 KEYWORDS */ -void gdidl_gd_add_polynom(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_polynom GD_ADD_POLYNOM 4 9 KEYWORDS */ +/* @@DLM: P gdidl_add_polynom GD_ADD_CPOLYNOM 4 8 KEYWORDS */ +/* @@DLM: P gdidl_add_polynom GD_MADD_CPOLYNOM 4 9 KEYWORDS */ +/* @@DLM: P gdidl_add_polynom GD_MADD_POLYNOM 4 9 KEYWORDS */ +void gdidl_add_polynom(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1565,8 +1574,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_raw GD_ADD_RAW 3 3 KEYWORDS */ -void gdidl_gd_add_raw(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_raw GD_ADD_RAW 3 3 KEYWORDS */ +void gdidl_add_raw(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1604,9 +1613,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_sbit GD_ADD_SBIT 3 3 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_sbit GD_MADD_SBIT 3 3 KEYWORDS */ -void gdidl_gd_add_sbit(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_sbit GD_ADD_SBIT 3 3 KEYWORDS */ +/* @@DLM: P gdidl_add_sbit GD_MADD_SBIT 3 3 KEYWORDS */ +void gdidl_add_sbit(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1657,9 +1666,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_spec GD_ADD_SPEC 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_spec GD_MADD_SPEC 2 2 KEYWORDS */ -void gdidl_gd_add_spec(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_spec GD_ADD_SPEC 2 2 KEYWORDS */ +/* @@DLM: P gdidl_add_spec GD_MADD_SPEC 2 2 KEYWORDS */ +void gdidl_add_spec(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1703,9 +1712,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_add_string GD_ADD_STRING 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_add_string GD_MADD_STRING 2 2 KEYWORDS */ -void gdidl_gd_add_string(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_add_string GD_ADD_STRING 2 2 KEYWORDS */ +/* @@DLM: P gdidl_add_string GD_MADD_STRING 2 2 KEYWORDS */ +void gdidl_add_string(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1759,8 +1768,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_bit GD_ALTER_BIT 2 2 KEYWORDS */ -void gdidl_gd_alter_bit(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_bit GD_ALTER_BIT 2 2 KEYWORDS */ +void gdidl_alter_bit(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1814,8 +1823,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_const GD_ALTER_CONST 2 2 KEYWORDS */ -void gdidl_gd_alter_const(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_const GD_ALTER_CONST 2 2 KEYWORDS */ +void gdidl_alter_const(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1850,8 +1859,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_encoding GD_ALTER_ENCODING 2 2 KEYWORDS */ -void gdidl_gd_alter_encoding(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_encoding GD_ALTER_ENCODING 2 2 KEYWORDS */ +void gdidl_alter_encoding(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1894,8 +1903,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_endianness GD_ALTER_ENDIANNESS 1 1 KEYWORDS */ -void gdidl_gd_alter_endianness(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_endianness GD_ALTER_ENDIANNESS 1 1 KEYWORDS */ +void gdidl_alter_endianness(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1907,6 +1916,7 @@ int fragment_index; int fragment_index_x; int little_end; + int not_arm_end; int recode; } KW_RESULT; KW_RESULT kw; @@ -1925,6 +1935,7 @@ { "FRAGMENT", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(fragment_index_x), IDL_KW_OFFSETOF(fragment_index) }, { "LITTLE_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(little_end) }, + { "NOT_ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(not_arm_end) }, { "RECODE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(recode) }, }; @@ -1936,8 +1947,8 @@ DIRFILE* D = gdidl_get_dirfile(IDL_LongScalar(argv[0])); gd_alter_endianness(D, (kw.big_end ? GD_BIG_ENDIAN : 0) | - (kw.little_end ? GD_LITTLE_ENDIAN : 0) | (kw.arm_end ? GD_ARM_ENDIAN : 0), - kw.fragment_index, kw.recode); + (kw.little_end ? GD_LITTLE_ENDIAN : 0) | (kw.arm_end ? GD_ARM_ENDIAN : 0) + | (kw.not_arm_end ? GD_NOT_ARM_ENDIAN : 0), kw.fragment_index, kw.recode); GDIDL_SET_ERROR(D); @@ -1946,8 +1957,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_entry GD_ALTER_ENTRY 3 3 KEYWORDS */ -void gdidl_gd_alter_entry(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_entry GD_ALTER_ENTRY 3 3 KEYWORDS */ +void gdidl_alter_entry(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -1985,8 +1996,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_frameoffset GD_ALTER_FRAMEOFFSET 2 2 KEYWORDS */ -void gdidl_gd_alter_frameoffset(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_frameoffset GD_ALTER_FRAMEOFFSET 2 2 KEYWORDS */ +void gdidl_alter_frameoffset(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2029,9 +2040,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_lincom GD_ALTER_LINCOM 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_alter_lincom GD_ALTER_CLINCOM 2 2 KEYWORDS */ -void gdidl_gd_alter_lincom(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_lincom GD_ALTER_LINCOM 2 2 KEYWORDS */ +/* @@DLM: P gdidl_alter_lincom GD_ALTER_CLINCOM 2 2 KEYWORDS */ +void gdidl_alter_lincom(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2165,8 +2176,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_linterp GD_ALTER_LINTERP 2 2 KEYWORDS */ -void gdidl_gd_alter_linterp(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_linterp GD_ALTER_LINTERP 2 2 KEYWORDS */ +void gdidl_alter_linterp(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2219,8 +2230,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_multiply GD_ALTER_MULTIPLY 2 2 KEYWORDS */ -void gdidl_gd_alter_multiply(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_multiply GD_ALTER_MULTIPLY 2 2 KEYWORDS */ +void gdidl_alter_multiply(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2270,8 +2281,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_divide GD_ALTER_DIVIDE 2 2 KEYWORDS */ -void gdidl_gd_alter_divide(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_divide GD_ALTER_DIVIDE 2 2 KEYWORDS */ +void gdidl_alter_divide(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2321,9 +2332,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_recip GD_ALTER_RECIP 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_alter_recip GD_ALTER_CRECIP 2 2 KEYWORDS */ -void gdidl_gd_alter_recip(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_recip GD_ALTER_RECIP 2 2 KEYWORDS */ +/* @@DLM: P gdidl_alter_recip GD_ALTER_CRECIP 2 2 KEYWORDS */ +void gdidl_alter_recip(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2385,8 +2396,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_phase GD_ALTER_PHASE 2 2 KEYWORDS */ -void gdidl_gd_alter_phase(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_phase GD_ALTER_PHASE 2 2 KEYWORDS */ +void gdidl_alter_phase(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2430,9 +2441,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_polynom GD_ALTER_POLYNOM 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_alter_polynom GD_ALTER_CPOLYNOM 2 2 KEYWORDS */ -void gdidl_gd_alter_polynom(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_polynom GD_ALTER_POLYNOM 2 2 KEYWORDS */ +/* @@DLM: P gdidl_alter_polynom GD_ALTER_CPOLYNOM 2 2 KEYWORDS */ +void gdidl_alter_polynom(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2515,8 +2526,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_raw GD_ALTER_RAW 2 2 KEYWORDS */ -void gdidl_gd_alter_raw(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_raw GD_ALTER_RAW 2 2 KEYWORDS */ +void gdidl_alter_raw(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2558,8 +2569,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_sbit GD_ALTER_SBIT 2 2 KEYWORDS */ -void gdidl_gd_alter_sbit(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_sbit GD_ALTER_SBIT 2 2 KEYWORDS */ +void gdidl_alter_sbit(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2612,9 +2623,9 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_alter_spec GD_ALTER_SPEC 2 2 KEYWORDS */ -/* @@DLM: P gdidl_gd_alter_spec GD_MALTER_SPEC 2 2 KEYWORDS */ -void gdidl_gd_alter_spec(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_spec GD_ALTER_SPEC 2 2 KEYWORDS */ +/* @@DLM: P gdidl_alter_spec GD_MALTER_SPEC 2 2 KEYWORDS */ +void gdidl_alter_spec(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2658,8 +2669,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_close GD_CLOSE 1 1 KEYWORDS */ -void gdidl_gd_close(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_close GD_CLOSE 1 1 KEYWORDS */ +void gdidl_close(int argc, IDL_VPTR argv[], char *argk) { int ret = 0; DIRFILE* D = NULL; @@ -2715,8 +2726,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_delete GD_DELETE 2 2 KEYWORDS */ -void gdidl_gd_delete(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_delete GD_DELETE 2 2 KEYWORDS */ +void gdidl_delete(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2755,8 +2766,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_flush GD_FLUSH 1 1 KEYWORDS */ -void gdidl_gd_flush(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_flush GD_FLUSH 1 1 KEYWORDS */ +void gdidl_flush(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2797,8 +2808,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_include GD_INCLUDE 2 2 KEYWORDS */ -void gdidl_gd_include(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_include GD_INCLUDE 2 2 KEYWORDS */ +void gdidl_include(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2814,6 +2825,7 @@ int ignore_dups; int ignore_refs; int little_end; + int not_arm_end; int pedantic; int permissive; int trunc; @@ -2826,7 +2838,7 @@ KW_RESULT kw; kw.big_end = kw.creat = kw.excl = kw.force_enc = kw.force_end = kw.ignore_dups = kw.ignore_refs = kw.little_end = kw.pedantic = kw.trunc = - kw.enc_x = kw.index_x = kw.fragment_index = 0; + kw.enc_x = kw.index_x = kw.fragment_index = kw.arm_end = kw.not_arm_end = 0; GDIDL_KW_INIT_ERROR; static IDL_KW_PAR kw_pars[] = { @@ -2847,6 +2859,7 @@ { "IGNORE_DUPS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ignore_dups) }, { "IGNORE_REFS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ignore_dups) }, { "LITTLE_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(little_end) }, + { "NOT_ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(not_arm_end) }, { "PEDANTIC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pedantic) }, { "PERMISSIVE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(permissive) }, { "TRUNC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(trunc) }, @@ -2869,6 +2882,7 @@ | (kw.ignore_dups ? GD_IGNORE_DUPS : 0) | (kw.ignore_refs ? GD_IGNORE_REFS : 0) | (kw.little_end ? GD_LITTLE_ENDIAN : 0) + | (kw.not_arm_end ? GD_NOT_ARM_ENDIAN : 0) | (kw.pedantic ? GD_PEDANTIC : 0) | (kw.permissive ? GD_PERMISSIVE : 0) | (kw.trunc ? GD_TRUNC : 0); @@ -2890,8 +2904,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_metaflush GD_METAFLUSH 1 1 KEYWORDS */ -void gdidl_gd_metaflush(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_metaflush GD_METAFLUSH 1 1 KEYWORDS */ +void gdidl_metaflush(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2908,8 +2922,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_rewrite_fragment GD_REWRITE_FRAGMENT 1 1 KEYWORDS */ -void gdidl_gd_rewrite_fragment(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_rewrite_fragment GD_REWRITE_FRAGMENT 1 1 KEYWORDS */ +void gdidl_rewrite_fragment(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2948,8 +2962,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_move GD_MOVE 3 3 KEYWORDS */ -void gdidl_gd_move(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_move GD_MOVE 3 3 KEYWORDS */ +void gdidl_move(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -2983,8 +2997,8 @@ dreturnvoid(); } -/* @@DLM: F gdidl_gd_open GD_OPEN 1 1 KEYWORDS */ -IDL_VPTR gdidl_gd_open(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: F gdidl_open GD_OPEN 1 1 KEYWORDS */ +IDL_VPTR gdidl_open(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3002,6 +3016,7 @@ int force_end; int ignore_dups; int little_end; + int not_arm_end; int pedantic; int permissive; int trunc; @@ -3012,12 +3027,12 @@ KW_RESULT kw; kw.rdwr = kw.big_end = kw.creat = kw.excl = kw.force_enc = kw.force_end = kw.ignore_dups = kw.little_end = kw.pedantic = kw.trunc = kw.verbose = - kw.enc_x = 0; + kw.enc_x = kw.arm_end = kw.not_arm_end = 0; GDIDL_KW_INIT_ERROR; static IDL_KW_PAR kw_pars[] = { IDL_KW_FAST_SCAN, - { "ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(big_end) }, + { "ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(arm_end) }, { "BIG_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(big_end) }, { "CREAT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(creat) }, { "ENCODING", 0, 1, IDL_KW_VIN, IDL_KW_OFFSETOF(enc_x), @@ -3029,7 +3044,9 @@ { "FORCE_ENDIANNESS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(force_end) }, { "IGNORE_DUPS", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(ignore_dups) }, { "LITTLE_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(little_end) }, + { "NOT_ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(not_arm_end) }, { "PEDANTIC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(pedantic) }, + { "PERMISSIVE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(permissive) }, { "RDWR", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(rdwr) }, { "TRUNC", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(trunc) }, { "VERBOSE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(verbose) }, @@ -3047,6 +3064,7 @@ | (kw.force_end ? GD_FORCE_ENDIAN : 0) | (kw.ignore_dups ? GD_IGNORE_DUPS : 0) | (kw.little_end ? GD_LITTLE_ENDIAN : 0) + | (kw.not_arm_end ? GD_NOT_ARM_ENDIAN : 0) | (kw.pedantic ? GD_PEDANTIC : 0) | (kw.permissive ? GD_PERMISSIVE : 0) | (kw.trunc ? GD_TRUNC : 0) | (kw.verbose ? GD_VERBOSE : 0); @@ -3064,8 +3082,8 @@ return r; } -/* @@DLM: P gdidl_gd_alter_protection GD_ALTER_PROTECTION 2 2 KEYWORDS */ -void gdidl_gd_alter_protection(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_alter_protection GD_ALTER_PROTECTION 2 2 KEYWORDS */ +void gdidl_alter_protection(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3105,8 +3123,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_reference GD_REFERENCE 2 2 KEYWORDS */ -void gdidl_gd_reference(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_reference GD_REFERENCE 2 2 KEYWORDS */ +void gdidl_reference(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3124,8 +3142,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_rename GD_RENAME 3 3 KEYWORDS */ -void gdidl_gd_rename(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_rename GD_RENAME 3 3 KEYWORDS */ +void gdidl_rename(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3160,8 +3178,8 @@ dreturnvoid(); } -/* @@DLM: P gdidl_gd_uninclude GD_UNINCLUDE 2 2 KEYWORDS */ -void gdidl_gd_uninclude(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: P gdidl_uninclude GD_UNINCLUDE 2 2 KEYWORDS */ +void gdidl_uninclude(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3194,8 +3212,8 @@ dreturnvoid(); } -/* @@DLM: F gdidl_gd_validate GD_VALIDATE 2 2 KEYWORDS */ -IDL_VPTR gdidl_gd_validate(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: F gdidl_validate GD_VALIDATE 2 2 KEYWORDS */ +IDL_VPTR gdidl_validate(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3546,8 +3564,8 @@ return r; } -/* @@DLM: F gdidl_gd_error GD_ERROR 1 1 */ -IDL_VPTR gdidl_gd_error(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: F gdidl_error GD_ERROR 1 1 */ +IDL_VPTR gdidl_error(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -3558,8 +3576,8 @@ return r; } -/* @@DLM: F gdidl_gd_error_string GD_ERROR_STRING 1 1 */ -IDL_VPTR gdidl_gd_error_string(int argc, IDL_VPTR argv[], char *argk) +/* @@DLM: F gdidl_error_string GD_ERROR_STRING 1 1 */ +IDL_VPTR gdidl_error_string(int argc, IDL_VPTR argv[], char *argk) { dtraceidl(); @@ -4309,6 +4327,64 @@ dreturnvoid(); } +/* @@DLM: F gdidl_invalid_dirfile GD_INVALID_DIRFILE 0 0 */ +IDL_VPTR gdidl_invalid_dirfile(int argc, IDL_VPTR argv[], char *argk) +{ + dtraceidl(); + + IDL_VPTR r = IDL_GettmpInt(gdidl_set_dirfile(gd_invalid_dirfile())); + dreturn("%p", r); + return r; +} + +/* @@DLM: F gdidl_dirfile_standards GD_DIRFILE_STANDARDS 1 2 KEYWORDS */ +IDL_VPTR gdidl_dirfile_standards(int argc, IDL_VPTR argv[], char *argk) +{ + dtraceidl(); + + typedef struct { + IDL_KW_RESULT_FIRST_FIELD; + GDIDL_KW_RESULT_ERROR; + int earliest; + int current; + int latest; + } KW_RESULT; + KW_RESULT kw; + int vers = 16384; + + kw.earliest = kw.current = kw.latest = 0; + GDIDL_KW_INIT_ERROR; + + static IDL_KW_PAR kw_pars[] = { + { "CURRENT", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(current) }, + { "EARLIEST", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(earliest) }, + GDIDL_KW_PAR_ERROR, + GDIDL_KW_PAR_ESTRING, + { "LATEST", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(latest) }, + }; + + argc = IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); + + DIRFILE *D = gdidl_get_dirfile(IDL_LongScalar(argv[0])); + + if (argc > 1) + vers = IDL_LongScalar(argv[1]); + + vers = gd_dirfile_standards(D, (vers != 16384) ? vers : + kw.current ? GD_VERSION_CURRENT : kw.latest ? GD_VERSION_LATEST : + kw.earliest ? GD_VERSION_EARLIEST : 16384); + + GDIDL_SET_ERROR(D); + + IDL_KW_FREE; + + IDL_VPTR r = IDL_GettmpInt(vers); + dreturn("%p", r); + return r; +} + + + /**** Module initialisation ****/ /* These are defined in the automatically generated sublist.c */ Modified: trunk/getdata/bindings/idl/test/big_test.pro =================================================================== --- trunk/getdata/bindings/idl/test/big_test.pro 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/idl/test/big_test.pro 2010-10-22 02:27:13 UTC (rev 461) @@ -967,7 +967,7 @@ nume += check_simple2(146, 4, n.in_fields, [ "in2", "in3" ]) ; 148: gd_add_recip -gd_add_recip, d, "new16", "in2", COMPLEX(33.3, 44.4) +gd_add_recip, d, "new16", "in2", dividend=COMPLEX(33.3, 44.4) nume += check_ok2(148, 1, d) n = gd_entry(d, "new16") @@ -1007,8 +1007,28 @@ gd_rewrite_fragment, d, fragment=0 nume += check_ok(155, d) +; 156: gd_invalid_dirfile +m = gd_invalid_dirfile() +nume += check_ok2(156, 1, m) +n = gd_nfragments(m) +nume += check_error2(156, 2, m, !GD.E_BAD_DIRFILE) +gd_close, m +; 157: gd_dirfile_standards +n = gd_dirfile_standards(d, /CURRENT) +nume += check_ok2(157, 1, d) +nume += check_simple(157, n, 8) +n = gd_dirfile_standards(d, 0) +nume += check_error2(157, 2, d, !GD.E_BAD_VERSION) + + + + +; =============================================================== +; Cleanup +gd_close, d, /DISCARD + spawn, "rm -rf " + filedir if (nume gt 0) then print, "nume=", nume Modified: trunk/getdata/bindings/make_parameters.c =================================================================== --- trunk/getdata/bindings/make_parameters.c 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/make_parameters.c 2010-10-22 02:27:13 UTC (rev 461) @@ -87,8 +87,8 @@ CONSTANT(IGNORE_DUPS, "GD_ID", 1), CONSTANT(IGNORE_REFS, "GD_IR", 1), CONSTANT(PRETTY_PRINT, "GD_PP", 1), - CONSTANT(ARM_ENDIAN, "GD_AE", 1), - CONSTANT(NOT_ARM_ENDIAN, "GD_NA", 1), + CONSTANT(ARM_ENDIAN, "GD_AE", 2), + CONSTANT(NOT_ARM_ENDIAN, "GD_NA", 2), CONSTANT(PERMISSIVE, "GD_PM", 1), CONSTANT(AUTO_ENCODED, "GD_EA", 1), @@ -163,8 +163,12 @@ CONSTANT(E_FORMAT_PROTECT, "GDF_PR", 8), CONSTANT(E_FORMAT_LITERAL, "GDF_LT", 8), - CONSTANT(MAX_LINE_LENGTH, "GD_MLL", 9), - CONSTANT(ALL_FRAGMENTS, "GD_ALL", 10), + CONSTANT(VERSION_CURRENT, "GDSV_C", 9), + 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), { NULL } }; @@ -251,10 +255,17 @@ parameter(constant_list[j].lname, constant_list[j].fname, constant_list[j].value, i); + printf("\\\n%c Special version codes\\\n", c); + + for (j = 0; constant_list[j].lname != NULL; ++j) + if (constant_list[j].type == 9 || constant_list[j].type == 10) + 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 >= 9 && constant_list[j].type <= 11) + if (constant_list[j].type == 11) parameter(constant_list[j].lname, constant_list[j].fname, constant_list[j].value, i); @@ -274,7 +285,8 @@ "const struct gdpy_constant_t gdpy_constant_list[] = {\n"); for (i = 0; constant_list[i].lname != NULL; ++i) - printf("{\"%s\", %s}, ", constant_list[i].sname, constant_list[i].lname); + if (constant_list[i].type != 9) + printf("{\"%s\", %s}, ", constant_list[i].sname, constant_list[i].lname); /* Python numerical type aliases */ printf( @@ -300,9 +312,12 @@ ); for (i = 0; constant_list[i].lname != NULL; ++i) - if (constant_list[i].type != 1) - printf("{ \"%s\", 0, (void*)IDL_TYP_%s }, ", constant_list[i].sname, - (constant_list[i].type == 2) ? "LONG" : "INT"); + if ((constant_list[i].type != 1) && (constant_list[i].type != 5) && + (constant_list[i].type != 7) && (constant_list[i].type != 8)) + { + printf("{ \"%s\", 0, (void*)IDL_TYP_%s }, ", constant_list[i].sname, + (constant_list[i].type == 2) ? "LONG" : "INT"); + } printf("{ NULL }};\n"); @@ -317,10 +332,13 @@ "\n"); for (n = i = 0; constant_list[i].lname != NULL; ++i) - if (constant_list[i].type != 1) + if ((constant_list[i].type != 1) && (constant_list[i].type != 5) && + (constant_list[i].type != 7) && (constant_list[i].type != 8)) + { printf("*(IDL_%s*)(data + IDL_StructTagInfoByIndex(gdidl_const_def, %i, " "IDL_MSG_LONGJMP, NULL)) = %li;\n", (constant_list[i].type == 2) ? "LONG" : "INT", n++, constant_list[i].value); + } printf("return r; }\n"); } Modified: trunk/getdata/bindings/python/pydirfile.c =================================================================== --- trunk/getdata/bindings/python/pydirfile.c 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/python/pydirfile.c 2010-10-22 02:27:13 UTC (rev 461) @@ -149,17 +149,33 @@ PyObject* pycallback = NULL; PyObject* pycallback_data = Py_None; char *keywords[] = {"name", "flags", "callback", "extra", NULL}; - const char* name = NULL; + PyObject* name = NULL; unsigned long flags = GD_RDWR; if (!PyArg_ParseTupleAndKeywords(args, keys, - "s|kOO:pygetdata.dirfile.__init__", keywords, &name, &flags, + "|OkOO:pygetdata.dirfile.__init__", keywords, &name, &flags, &pycallback, &pycallback_data)) { dreturn("%i", -1); return -1; } + /* An invalid dirfile was requested */ + if (name == NULL || name == Py_None) { + self->D = gd_invalid_dirfile(); + + PYGD_CHECK_ERROR(self->D, -1); + + dreturn("%i", 0); + return 0; + } + + if (!PyString_Check(name)) { + PyErr_SetString(PyExc_TypeError, "name must be a string or None"); + dreturn("%i", -1); + return -1; + } + if (pycallback && pycallback != Py_None && !PyCallable_Check(pycallback)) { PyErr_SetString(PyExc_TypeError, "callback function must be callable"); dreturn("%i", -1); @@ -174,7 +190,7 @@ self->callback_data = pycallback_data; self->callback_exception = 0; - self->D = gd_cbopen(name, (unsigned int)flags, + self->D = gd_cbopen(PyString_AsString(name), (unsigned int)flags, (pycallback == NULL) ? NULL : gdpy_callback_func, self); if (self->callback_exception) { @@ -292,10 +308,9 @@ { dtrace("%p", self); - gd_close(self->D); + if (gd_close(self->D)) + PYGD_CHECK_ERROR(self->D, NULL); - PYGD_CHECK_ERROR(self->D, NULL); - self->D = gd_invalid_dirfile(); Py_INCREF(Py_None); @@ -332,10 +347,10 @@ { dtrace("%p", self); - gd_discard(self->D); + if (gd_discard(self->D)) { + PYGD_CHECK_ERROR(self->D, NULL); + } - PYGD_CHECK_ERROR(self->D, NULL); - /* Here we replace D with an empty, invalid dirfile object. */ self->D = gd_invalid_dirfile(); @@ -1676,6 +1691,41 @@ return Py_None; } +static PyObject* gdpy_dirfile_getstandards(struct gdpy_dirfile_t* self, + void* closure) +{ + dtrace("%p, %p", self, closure); + + int vers = gd_dirfile_standards(self->D, GD_VERSION_CURRENT); + + PYGD_CHECK_ERROR(self->D, NULL); + + PyObject* pyobj = PyInt_FromLong(vers); + + dreturn("%p", pyobj); + return pyobj; +} + +static int gdpy_dirfile_setstandards(struct gdpy_dirfile_t* self, + PyObject *value, void *closure) +{ + dtrace("%p, %p, %p", self, value, closure); + + int vers = (int)PyInt_AsLong(value); + + if (PyErr_Occurred()) { + dreturn("%i", -1); + return -1; + } + + gd_dirfile_standards(self->D, vers); + + PYGD_CHECK_ERROR(self->D, -1); + + dreturn("%i", 0); + return 0; +} + static PyGetSetDef gdpy_dirfile_getset[] = { { "error", (getter)gdpy_dirfile_geterror, NULL, "The numerical error code encountered by the last call to the GetData\n" @@ -1702,6 +1752,14 @@ "The reference field for the dirfile, which may be modified. See\n" "gd_reference(3).", NULL }, + { "standards", (getter)gdpy_dirfile_getstandards, + (setter)gdpy_dirfile_setstandards, + "The current Standards Version of the loaded dirfile. Setting this\n" + "to pygetdata.VERSION_EARLIEST or pygetdata.VERSION_LATEST has the\n" + "same effect as passing the corresponding C API symbols to\n" + /* -----------------------------------------------------------------| */ + "gd_dirfile_standards(3), q.v.", + NULL }, { NULL } }; @@ -1977,7 +2035,6 @@ { "vector_list", (PyCFunction)gdpy_dirfile_getvectorlist, METH_NOARGS, "vector_list()\n\n" "Retrieve a list of all vector type fields (that is: BIT, DIVIDE,\n" - /* -----------------------------------------------------------------| */ "INDEX, LINCOM, LINTERP, MULTIPLY, PHASE, POLYNOM, RAW, RECIP, and\n" "SBIT metafields) defined in the database. See gd_vector_list(3)." }, @@ -2095,12 +2152,15 @@ }; #define DIRFILE_DOC \ - "dirfile(dirfilename [, flags [, sehandler [, extra ]])\n\n" \ -"Returns a dirfile object representing the dirfile specified by\n" \ -"'dirfilename'. The dirfile is opened by a call to gd_cbopen(3).\n"\ -"See that manual page for full details on arguments. If present 'flags'\n"\ -"should be a bitwise or'd collection of gd_cbopen flags. If it is\n"\ -"omitted, the default, pygetdata.RDRW, is used.\n\n" \ + "dirfile([name [, flags [, sehandler [, extra ]]])\n\n" \ +"If 'name' is omitted or None, returns an invalid dirfile, as if\n" \ +"gd_invalid_dirfile(3) were called. Othwerwise, if 'name' is a string,\n" \ +"returns a dirfile object representing the dirfile specified by 'name'.\n" \ +/* ---------------------------------------------------------------------| */\ +"The dirfile is opened by a call to gd_cbopen(3). See that manual page\n" \ +"for full details on arguments. If present, 'flags' should be a bitwise\n" \ +"or'd collection of gd_cbopen flags. If it is omitted, the default,\n" \ +"pygetdata.RDRW, is used.\n\n" \ "If a callback handler is desired, 'sehandler' should be a callable\n"\ "object (ie. a function) which accepts two objects. The first object is\n"\ "a dictionary with keys: 'suberror', 'line', 'linenum', and 'filename',\n"\ Modified: trunk/getdata/bindings/python/pyfragment.c =================================================================== --- trunk/getdata/bindings/python/pyfragment.c 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/python/pyfragment.c 2010-10-22 02:27:13 UTC (rev 461) @@ -285,9 +285,9 @@ NULL }, { "endianness", (getter)gdpy_fragment_getendianness, NULL, "The byte sex of this fragment. This will be either\n" - "pygetdata.BIG_ENDIAN or pygetdata.LITTLE_ENDIAN, possibly bitwise\n" - "or'd with pygetdata.ARM_ENDIAN. To change this value, use the\n" - "alter_endianness method.", + "pygetdata.BIG_ENDIAN or pygetdata.LITTLE_ENDIAN, bitwise or'd with\n" + "pygetdata.ARM_ENDIAN or pygetdata.NOT_ARM_ENDIAN. To change this\n" + "value, use the alter_endianness method.", NULL }, { "frameoffset", (getter)gdpy_fragment_getoffset, NULL, "The frame offset of this fragment. To change this value, use the\n" @@ -334,10 +334,11 @@ "Change the byte sex of this fragment. The 'endianness' parameter\n" "should be pygetdata.LITTLE_ENDIAN, pygetdata.BIG_ENDIAN, or some\n" "combination of these two as described in the gd_alter_endianness\n" - "manual page, and possibly bitwise or'd with pygetdata.ARM_ENDIAN.\n" - "If 'recode' is given, and is non-zero, the RAW files affected by\n" - "this change will be converted to the byte sex. See\n" - "gd_alter_endianness(3)." + /* -----------------------------------------------------------------| */ + "manual page, and possibly bitwise or'd with pygetdata.ARM_ENDIAN or\n" + "pygetdata.NOT_ARM_ENDIAN. If 'recode' is given, and is non-zero,\n" + "the RAW files affected by this change will be converted to the byte\n" + "sex. See gd_alter_endianness(3)." }, {"alter_frameoffset", (PyCFunction)gdpy_fragment_setoffset, METH_VARARGS | METH_KEYWORDS, @@ -350,7 +351,6 @@ }, {"rewrite", (PyCFunction)gdpy_fragment_rewrite, METH_NOARGS, "rewrite()\n\n" - /* -----------------------------------------------------------------| */ "Force re-writing of this fragment on disc, regardless of whether\n" "it has been modified or not. See gd_rewrite_fragment(3)." }, Modified: trunk/getdata/bindings/python/pygetdata.c =================================================================== --- trunk/getdata/bindings/python/pygetdata.c 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/python/pygetdata.c 2010-10-22 02:27:13 UTC (rev 461) @@ -30,7 +30,7 @@ "BadCode", "BadType", "RawIO", - "OpenInclude", + "OpenFragment", "InternalError", "Alloc", "Range", @@ -54,7 +54,9 @@ "BadProtection", "UncleanDatabase", "Domain", - "BadRepr" + "BadRepr", + "BadVersion", + "Flush" }; PyObject *gdpy_exceptions[GD_N_ERROR_CODES]; @@ -604,7 +606,6 @@ sprintf(name, "pygetdata.%sError", gdpy_exception_list[i]); gdpy_exceptions[i] = PyErr_NewException(name, GdPy_DirfileError, NULL); Py_INCREF(gdpy_exceptions[i]); - sprintf(name, "%sError", gdpy_exception_list[i]); - PyModule_AddObject(mod, name, gdpy_exceptions[i]); + PyModule_AddObject(mod, name + 10, gdpy_exceptions[i]); } } Modified: trunk/getdata/bindings/python/test/big_test.py =================================================================== --- trunk/getdata/bindings/python/test/big_test.py 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/bindings/python/test/big_test.py 2010-10-22 02:27:13 UTC (rev 461) @@ -1287,8 +1287,36 @@ except: CheckOK(155) +# 156: invalid dirfile check +try: + m = pygetdata.dirfile(None); +except: + CheckOK2(156,1) +try: + n = m.nfragments() +except: + CheckException2(156,2,pygetdata.BadDirfileError) +try: + m.discard(); +except: + pass; + +# 157: standards version +try: + n = d.standards; +except: + CheckOK2(157,1); +CheckSimple(157,n,8) + +try: + d.standards = 0; +except: + CheckException2(157,2,pygetdata.BadVersionError) + + + # the following causes the d object to silently fault on delete, since it # can't flush itself anymore. The moral of the story: always explicity # call d.close() if you care about your dirfile. (Fortunately we don't.) Modified: trunk/getdata/doc/README.cxx =================================================================== --- trunk/getdata/doc/README.cxx 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/doc/README.cxx 2010-10-22 02:27:13 UTC (rev 461) @@ -58,13 +58,23 @@ the buffer. The string written to the buffer will be at most len characters long, up to a maximum of 4096 characters. +* off_t BoF(const char *field_code) + + This method will call gd_bof(3) and return the location of the + beginning-of-field marker of the specified field. + * GetData::Entry *Dirfile::Entry(const char *field_code) This method will return a pointer to a newly allocated object of the appropriate Entry Child class, cast as a plain GetData::Entry, created after - calling gd_get_entry(3) with the supplied field_code. See below for a + calling gd_entry(3) with the supplied field_code. See below for a description of the Entry classes. +* off_t EoF(const char *field_code) + + This method will call gd_eof(3) and return the location of the end-of-field + marker of the specified field. + * GetData::Fragment *Dirfile::Fragment(int index) This method will return a pointer to a newly allocated GetData::Fragment @@ -72,13 +82,13 @@ * int Dirfile::FragmentIndex(const char *field_code) - This method will call gd_get_fragment_index(3) and return the index number of + This method will call gd_fragment_index(3) and return the index number of the fragment defining the specified field. * double Dirfile::FrameNum(const char *field_code, double value, off_t frame_start = 0, off_t frame_end = 0) - This method will call gd_get_framenum_subset(3) to perform a reverse look-up + This method will call gd_framenum_subset(3) to perform a reverse look-up on the specified field. If frame_start or frame_end are omitted, the start or end of the field will be used as the limit. @@ -104,6 +114,11 @@ This method will call gd_parser_callback(3) to change or remove the parser callback function. +* int Dirfile::Standards(int version = GD_VERSION_CURRENT) + + This method will call gd_dirfile_standards(3) to set or report the current + Standards Version of the loaded dirfile. + * int Dirfile::UnInclude(int fragment_index, int del = 0) This method will call gd_uninclude(3) to remove the indicated fragment from @@ -170,7 +185,8 @@ NoEntryType, BitEntryType, ConstEntryType, DivideEntryType, IndexEntryType, LincomEntryType, LinterpEntryType, MultiplyEntryType, PhaseEntryType, - RawEntryType, RecipEntryType, StringEntryType + PolynomEntryType, RawEntryType, RecipEntryType, SBitEntryType, + StringEntryType which are aliases for the gd_entype_t values GD_NO_ENTRY, GD_RAW_ENTRY, &c. Note that the arguments to AddSpec are opposite of the corresponding function @@ -185,7 +201,7 @@ constructor, but may be created by calling Dirfile::Fragment. Note: The Fragment class caches the format file index for the associated -fragment. As a result, if Dirfile::UnInclude is called, these indicies will +fragment. As a result, if Dirfile::UnInclude is called, these indices will be incorrect, and all pre-existing Fragment objects should be destroyed. * GetData::EncodingScheme Fragment::Encoding() @@ -223,7 +239,7 @@ created by using one of the constructors will not be associated. Changing the value of one of the data members of an associated entry object will -result in a call to the C API to update the corresponding entry in the dirifle. +result in a call to the C API to update the corresponding entry in the dirfile. Changing the value of one of the data members of an unassociated entry has no such side effect. @@ -239,16 +255,17 @@ * void Entry::Dissociate() - Dissociates this entry object. If the object is already dissocated, this - function does nothign. + Dissociates this entry object. If the object is already dissociated, this + function does nothing. * EntryType Entry::Type() This will return the field type of the Entry's field. This will be one of: - NoEntryType, BitEntryType, ConstEntryType, DivideEntryType, LincomEntryType, - LinterpEntryType, MultiplyEntryType, PhaseEntryType, PolynomEntryType, - RawEntryType, RecipEntry, SBitEntryType, StringEntryType + NoEntryType, BitEntryType, ConstEntryType, DivideEntryType, IndexEntryType, + LincomEntryType, LinterpEntryType, MultiplyEntryType, PhaseEntryType, + PolynomEntryType, RawEntryType, RecipEntryType, SBitEntryType, + StringEntryType * int Entry::SetFragmentIndex(int fragment_index) * int Entry::Move(int new_fragment, int move_data = 0) @@ -328,7 +345,7 @@ * const char *RawEntry::FileName() - This calls gd_get_raw_filename(3) and returns the pathname of the binary file + This calls gd_raw_filename(3) and returns the pathname of the binary file associated with the RAW field. * virtual unsigned int RawEntry::SamplesPerFrame() Modified: trunk/getdata/doc/README.f77 =================================================================== --- trunk/getdata/doc/README.f77 2010-10-21 02:36:58 UTC (rev 460) +++ trunk/getdata/doc/README.f77 2010-10-22 02:27:13 UTC (rev 461) @@ -1,4 +1,4 @@ -Fgd_gd_ORTRAN 77 BINDINGS FOR GETDATA +FORTRAN 77 BINDINGS FOR GETDATA =============================== This README describes the Fortran 77 bindings for the GetData library. These @@ -90,6 +90,14 @@ potentially could cause the callback subroutine to be called is GDINCL. Use GDCLBK to change the callback function before calling GDINCL, if required. +* GDINVD(dirfile_unit) + + Output: + INTEGER dirfile_unit + + This wraps gd_invalid_dirfile(3), and returns the unit number of a + newly-created, invalid dirfile. + * GDCLOS(dirfile_unit) Input: @@ -241,7 +249,7 @@ REAL*8 value CHARACTER*<field_code_len> field_code - This subroutine wraps gd_get_framenum(3), and performs a reverse look-up on a + This subroutine wraps gd_framenum(3), and performs a reverse look-up on a field. * GDFNSS(framenum, dirfile_unit, field_code, field_code_len, value, field_start, @@ -254,7 +262,7 @@ REAL*8 value CHARACTER*<field_code_len> field_code - This subroutine wraps gd_get_framenum_subset(3), and performs a reverse + This subroutine wraps gd_framenum_subset(3), and performs a reverse look-up on a field. @@ -268,7 +276,7 @@ Input: INTEGER dirfile_unit - This wraps gd_get_nfields(3). It takes the dirfile unit number as input and + This wraps gd_nfields(3). It takes the dirfile unit number as input and returns the number of fields in the dirfile in nfields. * GDNFDT(nfields, dirfile_unit, type) @@ -278,7 +286,7 @@ Input: INTEGER dirfile_unit, type - This wraps gd_get_nfields_by_type(3). It takes the dirfile unit number, and + This wraps gd_nfields_by_type(3). It takes the dirfile unit number, and type specifier as input and returns the number of fields of the specified type in the dirfile in nfields. @@ -289,15 +297,15 @@ Input: INTEGER dirfile_unit - This wraps gd_get_nvectors(3). It takes the dirfile unit number as input and + This wraps gd_nvectors(3). It takes the dirfile unit number as input and returns the number of vector fields in the dirfile in nfields. * GDNMFD(nfields, dirfile, parent, parent_l) * GDNMFT(nfields, dirfile, parent, parent_l, type) * GDNMVE(nvectors, dirfile, parent, parent_l) - These subroutine wrap gd_get_nmfields(3), gd_get_nmfields_by_type(3), and - gd_get_nmvectors(3). They behave analogously to GDNFLD, GDNFDT, and GDNVEC. + These subroutine wrap gd_nmfields(3), gd_nmfields_by_type(3), and + gd_nmvectors(3). They behave analogously to GDNFLD, GDNFDT, and GDNVEC. * GDFDNX(field_max, dirfile_unit) @@ -333,7 +341,7 @@ Input: INTEGER dirfile_unit, field_num - This subroutine is the replacement for gd_get_field_list(3). It returns in + This subroutine is the replacement for gd_field_list(3). It returns in name a Fortran 77 string containing the fie... [truncated message content] |
From: <ket...@us...> - 2010-10-22 17:41:48
|
Revision: 462 http://getdata.svn.sourceforge.net/getdata/?rev=462&view=rev Author: ketiltrout Date: 2010-10-22 17:41:41 +0000 (Fri, 22 Oct 2010) Log Message: ----------- Fix private libs in getdata.pc. Update README. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/README trunk/getdata/configure.ac trunk/getdata/m4/encoding.m4 trunk/getdata/src/getdata.pc.in Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-22 02:27:13 UTC (rev 461) +++ trunk/getdata/ChangeLog 2010-10-22 17:41:41 UTC (rev 462) @@ -1,4 +1,8 @@ -2010-10-21 D. V. Wiebe <ge...@ke...> svn:461 +2010-10-22 D. V. Wiebe <ge...@ke...> svn:462 + * configure.ac m4/encoding.m4: Compute PRIVATE_LIBS + * src/getdata.pc: Correct private libs. + +2010-10-22 D. V. Wiebe <ge...@ke...> svn:461 * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90 bindings/idl/test/big_test.pro: Added tests 156 and 157. Modified: trunk/getdata/README =================================================================== --- trunk/getdata/README 2010-10-22 02:27:13 UTC (rev 461) +++ trunk/getdata/README 2010-10-22 17:41:41 UTC (rev 462) @@ -48,7 +48,9 @@ This package provides: * the Dirfile Standards documents (three Unix manual pages) * the C GetData library (libgetdata) including Unix manual pages - * The handy checkdirfile utility, included also as an example + * Several utitilities, which also serve as examples of use: + - checkdirfile, which checks the metadata of a dirfile for problems + - dirfile2ascii, which can convert all or part of a dirfile to ASCII text * several bindings to the library from other languages: - C++ (libgetdata++) - Fortran 77 (libfgetdata) @@ -64,105 +66,36 @@ file called `NEWS'. -DIRFILE STANDARDS VERSION 7 +DIRFILE STANDARDS VERSION 8 =========================== -The 0.6.0 release of the GetData Library (October 2009), was released in +The 0.7.0 release of the GetData Library (October 2010), was released in conjunction with a new version of the Dirfile Standards, known as Standards -Version 7. +Version 8. -Standards Version 7 introduces the following: - * Support for single and double precision floating-point complex data. - This includes the support for complex literals in the format file, as well - as operators ("representations") to compute norms of complex data. - * Two new field types: SBIT, a (two's complement) signed bitfield; and - POLYNOM, a polynomial function of a given input field. - * The number of fields parameter for LINCOM is now optional. +Standards Version 8 introduces the following: + * Two new field types: DIVIDE, the quotient of two input vector fields, + and RECIP, the reciprocal of a vector field. + * Support for middle-endian ARM double-precision floating point data. + * Furthermore, several deprecated features have been removed. The old single + character type names are no longer accepted, and directives now require an + initial forward slash. (NB: these features are only removed from Standards + Version 8; GetData, which understands all Standards Versions, still can work + with these features.) -This is the first update to the Dirfile Standards since Standards Version 6 -(October 2008). +This is the first update to the Dirfile Standards since Standards Version 7 +(October 2009). A full history of the Dirfile Standards can be found in the +dirfile-format(5) man page. -Standards Version 6 introduced the following: - * Support for two scalar types: CONST (numerical) and STRING (a character - string) - * The ability to attach subdata to fields using the META directive. - * Support for different "encodings", which change how binary data is stored - on disk. - * Significantly more permissive and explicit rules on allowed characters in - format file tokens. - * Removal of "FILEFRAM" as an alias for the implicit "INDEX" field. It is - encouraged that made use of FILEFRAM be updated to use INDEX instead. - However, a work-around is to add: - FILEFRAM LINCOM 1 INDEX 1 0 - - to the dirfile's format file to recreate the old behaviour. - * The ability to flag portions of the dirfile as protected. - -Standards Version 6 follows closely on the heels of Standards Version 5, -released in August of 2006 with GetData 0.3.0. - -Standards Version 5 introduced the following: - * Three new supported data type: 8-bit signed integers, and 64-bit signed - and unsigned integers - * A new, uniform way of referring to data types. Previous versions of the - Standards used the single character data specifiers: c, u, s, U, S, i, f, - and d. The new standard defines the specifiers UINT8, INT8, UINT16, INT16, - UINT32, INT32, UINT64, INT64, FLOAT32, and FLOAT64. (FLOAT is also accepted - as an alias for FLOAT32 and DOUBLE for FLOAT64.) Accordingly, a RAW field - declaration, which in previous versions of the Dirfile Standards would - have been: - - field RAW u 20 - - would be preferred by Standards Version 5 to be: - - field RAW UINT16 20 - - For backwards compatibility, the single character specifiers are still - fully acceptable in format file declarations, although no single character - specifiers exist for the new data types. - * Unlimited field name lengths. Previous versions of the Standards limited - fields to 50 characters or less. Field name length is still effectively - limited by the maximum length of a filename and the maximum length of a - format file line, either of which will typically effectively limit field - names to a few thousand characters. - * Forbidding the implicit fields INDEX and FILEFRAM to be defined in the - format file. Previous Standards Versions allowed fields with these names to - be defined, but old GetData implementations would never let you access them, - returning the implicit frame-count field instead. - * 64-bit BIT fields. Previous Standards Versions limited BITs to 32-bits. - The size of any particular BIT field is still limited by the underlying RAW - type on which it depends. - * The ENDIAN directive for format files, which can be used to specify the - byte-sex of the underlying raw data. Previous Standards Versions indicated - that the byte-sex of raw data in a dirfile was always little-endian, but - old GetData implementations assumed data was native endian, by never doing - endianness conversion. Dirfile Standards Version 5 adopts the behaviour - of GetData rather than that of previous Standards Versions: dirfiles lacking - an ENDIAN directive will be assumed to have native endianness. Facilities - exist in the new GetData API to override this behaviour. - * The VERSION directive for format files, which specifies the Standards - Version to which the dirfile conforms. The Standards indicate that this - directive is optional, and should not be needed to properly parse a format - file conforming to Standards Version 5 or any earlier version. It is used - by GetData to ease forward-compatibility: if GetData encounters a Dirfile - conforming to a newer Standards Version than it is prepared to parse, - GetData will silently ignore any lines it doesn't understand. This allows - GetData to make a best-effort attempt at reading Standards newer than it - knows. - -A full history of the Dirfile Standards can be found in the dirfile-format(5) -man page. - - BUILDING THE LIBRARY ==================== This package may be configured and built using the GNU autotools. Generic installation instructions are provided in the file called `INSTALL'. A brief summary follows. A C99-compliant compiler is required to build (but not -to use) the package. +to use) the package, although a compatible library with reduced functionality +can be built with any ANSI C compiler. Most users should be able to build the package by simply executing: @@ -189,6 +122,24 @@ will display a brief help message summarising available options. +PREREQUISITES +============= + +The only library required to build GetData is the C Standard Library. Several +other external will be used if found by ./configure to provide support for +various data encodings (typically compression schemes). These are: + +- the slim compression library by Joseph Fowler; +- the zlib library by Jean-loup Gailly and Mark Adler; +- the bzip2 compression library by Julian Seward; and, +- the lzma library, part of the XZ Utils suite by Lasse Collin, Ville Koskinen, + and Igor Pavlov. + +If these libraries are not found by configure, GetData will lack support for +the associated encoding scheme and fail gracefully if encountering dirfiles so +encoded. + + USING THE LIBRARY ================= @@ -199,15 +150,13 @@ encodings supported by the library, e.g. using `-lgetdata -lm <other-libraries>'. -The `checkdirfile' program is provided as an example of library use in the -`util' subdirectory of the package. This program will be installed in -${prefix}/bin, unless disabled by passing `--disable-checkdirfile' to -./configure. +The various small programs in the `util' subdirectory of the package provide +examples of use. -This utility was designed to report syntax error in the format file(s) of the -large, complex dirfiles used in the analysis of the BLAST experiment data. -This utility will report all syntax errors it find in the supplied dirfile, -plus any problems in the metadata itself. +The checkdirfile utility was designed to report syntax errors in the format +file(s) of the large, complex dirfiles used in the analysis of the BLAST +experiment data. This utility will report all syntax errors it find in the +supplied dirfile, plus any problems in the metadata itself. Bindings exist for using the GetData library in languages other than C. If language bindings exist for your particular library, a README.<language> file @@ -223,18 +172,19 @@ ============= Starting with GetData 0.5.0, encoding schemes which rely on optional external -libraries (slim, gzip, bzip2) may be built as stand-alone library modules which -will be dynamically loaded, as needed, at runtime by the core GetData library. -This architecture is provided to permit packaging the core GetData library -separately from the parts of the library requiring the optional external +libraries (slim, gzip, bzip2, &c.) may be built as stand-alone library modules +which will be dynamically loaded, as needed, at runtime by the core GetData +library. This architecture is provided to permit packaging the core GetData +library separately from the parts of the library requiring the optional external libraries without having to give up the functionality these extra libraries provide. To enable this behaviour, pass `--enable-modules' to ./configure. The modules are dynamically loaded via GNU libtool's portable dlopen wrapper library, libltdl. The libltdl library permits dynamic loading of modules on at -least Solaris, Linux, BSD, HP-UX, Win16, Win32, BeOS, Darwin, Mac OS X. The +least Solaris, Linux, BSD, HP-UX, Win16, Win32, BeOS, Darwin, MacOS X. The libltdl library is no longer distributed with GetData. It can usually be found -as part of the GNU libtool package, on any modern system. +as part of the GNU libtool package on any modern GNU system, or else obtained +for free from the GNU Project. GetData will fail gracefully if a library module is not found or cannot be opened at runtime. In this case, the call which triggered the attempt to load @@ -251,17 +201,23 @@ The GetData header file, `getdata.h', installed in ${prefix}/include, declares the new API. It also includes `getdata_legacy.h' (also installed) which declares the legacy API. The legacy header should never be included directly. -Defining the preprocessor symbol `NO_GETDATA_LEGACY_API' before including -getdata.h will prevent the legacy API from being declared. In cases when the -legacy API is declared, getdata.h will define the symbol GETDATA_LEGACY_API, -which can be used by callers to determine whether the legacy API is present at -compile time. +Defining the preprocessor symbol `GD_NO_LEGACY_API' before including getdata.h +will prevent the legacy API from being declared. In cases when the legacy API +is declared, getdata.h will define the symbol GD_LEGACY_API, which can be used +by callers to determine whether the legacy API is present at compile time. If the legacy API is not built (as a result of passing `--disable-legacy-api' to ./configure), getdata_legacy.h will not be installed, and the legacy API will never be declared. +The default GetData API makes use of C99 features. An ANSI C API is also +available and can be used by defining GD_C89_API before including getdata.h. If +GetData was built without a C99-compliant compiler, the C99 API will be missing. +In this case, the ANSI C API will be enabled by default (as if GD_C89_API were +always defined) and, furthermore, getdata.h will define the symbol GD_NO_C99_API +to indicate this. + LARGEFILE SUPPORT ================= @@ -297,62 +253,6 @@ these macros. -THE API CHANGE -============== - -Users of older versions of GetData will notice a fairly substantial change in -the API starting with version 0.3.0 as compared with older version. Older -versions of this library (hereafter referred to as the "legacy API") suffered -from thread safety issues, and lacked LFS (large file) support. - -The new API separates the opening of a Dirfile from reading or writing to it. -Where in the old API one would use: - - int n_read = GetData("dirfile", "field", 1, 0, 1, 0, 'S', data, &error_code); - -the corresponding new API would have: - - DIRFILE* D = gd_open("dirfile", GD_RDONLY); - size_t n_read = gd_getdata(D, "field", 1, 0, 1, 0, GD_INT32, data); - -Here, D is a pointer to a DIRFILE object. This object is modelled after -the FILE object of the C Library's stdio interface. - -Where the old API was passed an integer pointer to store the error code, this is -now accessed via the DIRFILE object directly: D->error, which is of type int. -This is the only public member of the DIRFILE object. As a side-effect of this -change, the descriptive error string which can be generated by the library is -now local to a particular instance of a particular dirfile, rather than being -global across the library. - -Once a DIRFILE object has been created by a call to gd_open, all subsequent -operations on the dirfile operate on this object. Once the program is finished -with the dirfile, the object can be destroyed, and all open file handles closed, -with the call: - - gd_close(D); - -Partially in order to fully support large files (>2 GB) as defined by the LFS, -a consistent data type structure is used in the new API: - - * database offsets and database sizes are of type `off_t' - * object sizes and counts of items read are of type `size_t' - * samples-per-frame are of type `unsigned int' - * data type specifiers are of type `gd_type_t', which is defined in getdata.h. - Any time this type is specified, one of the following symbols, also defined - in getdata.h, should be used: GD_NULL, GD_UINT8, GD_INT8, GD_UINT16, - GD_INT16, GD_UINT32, GD_INT32, GD_UINT64, GD_INT64, GD_FLOAT32, GD_FLOAT64, - or GD_UNKNOWN. Using a legacy API single character type specifier for this - type will result in the library error GD_E_BAD_TYPE. - -The legacy API continues to use `int' for offsets, sizes, and counts, which -prevents it from supporting large files. - -The new API is fully documented in the included man pages. A translation -example from the legacy API to the new API is present as an Appendix at the end -of this document. - - AUTHOR ====== @@ -363,121 +263,3 @@ have been maintained by D. V. Wiebe <dv...@ke...>. A full list of contributors is given in the file called `AUTHORS'. - - -APPENDIX: API TRANSLATION EXAMPLE -================================== - -The following example programs demonstrate how to convert from the legacy to -the new API: - - /* Legacy API */ - #include <getdata.h> - #include <stdlib.h> - #include <stdio.h> - - int main(void) - { - const char* gd_name = "/var/dirfile"; /* dirfile name */ - const char* field_name = "datafield"; /* field code */ - char error_buffer[1024]; - int first_frame = 1000; - int error_code; - - /* Get size of the database -- third argument is ignored */ - int nf = GetNFrames(gd_name, &error_code, NULL); - if (error_code) { - printf("GetData error: %s\n", GetDataErrorString(error_buffer, 1024)); - exit(1); - } - - /* Get samples-per-frame */ - int spf = GetSamplesPerFrame(gd_name, field_name, &error_code); - if (error_code) { - printf("GetData error: %s\n", GetDataErrorString(error_buffer, 1024)); - exit(1); - } - - /* Allocate a buffer */ - double* data_buffer = malloc(sizeof(double) * spf * (nf - first_frame)); - - /* Retrieve all but the first 1000 frames */ - int n_read = GetData(gd_name, field_name, first_frame, 0, - nf - first_frame, 0, 'd', data_buffer, &error_code); - if (error_code) { - printf("GetData error: %s\n", GetDataErrorString(error_buffer, 1024)); - exit(1); - } - - /* Clean up */ - free(data_buffer); - - return 0; - } - - /* New API -- same header file */ - #include <getdata.h> - #include <stdlib.h> - #include <stdio.h> - - int main(void) - { - const char* gd_name = "/var/dirfile"; /* dirfile name */ - const char* field_name = "datafield"; /* field code */ - char error_buffer[1024]; - off_t first_frame = 1000; /* off_t is for dirfile offsets and lengths */ - - /* Open the dirfile */ - DIRFILE* dirfile = gd_open(gd_name, GD_RDONLY); - if (gd_error(dirfile)) { - /* gd_open() returns a pointer to a newly allocated DIRFILE - object even if the open failed. This DIRFILE object should still - be freed by calling gd_close() after checking the error state */ - - printf("GetData error: %s\n", - gd_error_string(dirfile, error_buffer, 1024)); - gd_close(dirfile); - exit(1); - } - - /* Get size of the database */ - off_t nf = gd_get_nframes(dirfile); /* again off_t */ - if (gd_error(dirfile)) { - printf("GetData error: %s\n", - gd_error_string(dirfile, error_buffer, 1024)); - gd_close(dirfile); - exit(1); - } - - /* Get samples-per-frame */ - unsigned int spf = gd_get_spf(dirfile, field_name); - if (gd_error(dirfile)) { - printf("GetData error: %s\n", - gd_error_string(dirfile, error_buffer, 1024)); - gd_close(dirfile); - exit(1); - } - - /* Allocate a buffer */ - double* data_buffer = malloc(sizeof(double) * spf * (nf - first_frame)); - - /* Retrieve all but the first 1000 frames -- size_t is for counts of - objects read */ - size_t n_read = gd_getdata(dirfile, field_name, first_frame, 0, - nf - first_frame, 0, GD_FLOAT64, data_buffer); - if (gd_error(dirfile)) { - printf("GetData error: %s\n", - gd_error_string(dirfile, error_buffer, 1024)); - gd_close(dirfile); - exit(1); - } - - /* Clean up */ - free(data_buffer); - - /* not strictly necessary at the end of the program for a dirfile opened - read-only */ - gd_close(dirfile); - - return 0; - } Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-22 02:27:13 UTC (rev 461) +++ trunk/getdata/configure.ac 2010-10-22 17:41:41 UTC (rev 462) @@ -66,6 +66,7 @@ BINDINGS_LEFT= ENCODINGS_BUILT=" raw ascii" ENCODINGS_LEFT= +PRIVATE_LIBS= echo "*** Checking GetData configuration" echo @@ -727,6 +728,11 @@ GD_CHECK_ENCODING([gzip],[z],[gzopen],[zlib.h],[gzip],[gunzip],[]) GD_CHECK_ENCODING([lzma],[lzma],[lzma_auto_decoder],[lzma.h],[xz],[],[]) +if test ! -z "${LIBS}"; then + PRIVATE_LIBS="${LIBS} ${PRIVATE_LIBS}" +fi +AC_SUBST([PRIVATE_LIBS]) + dnl Calculate absolute docdir cat <<EOF > conftest.sh prefix=$prefix Modified: trunk/getdata/m4/encoding.m4 =================================================================== --- trunk/getdata/m4/encoding.m4 2010-10-22 02:27:13 UTC (rev 461) +++ trunk/getdata/m4/encoding.m4 2010-10-22 17:41:41 UTC (rev 462) @@ -109,12 +109,17 @@ AM_CONDITIONAL(AS_TR_CPP([TEST_$1]), [test "x$path_$5" != "xnot found" -a "x$path_$6" != "xnot found"]) -dnl add to summary +dnl add to summary and private lib list if test "x$use_$1" != "xno"; then if test "x$use_modules" != "xno"; then ENCODINGS_MODS="${ENCODINGS_MODS} $1"; else ENCODINGS_BUILT="${ENCODINGS_BUILT} $1"; + if test -z "$PRIVATE_LIBS"; then + PRIVATE_LIBS="[$]AS_TR_CPP([$1_LDFLAGS])" + else + PRIVATE_LIBS="$PRIVATE_LIBS [$]AS_TR_CPP([$1_LDFLAGS])" + fi fi else ENCODINGS_LEFT="${ENCODINGS_LEFT} $1"; Modified: trunk/getdata/src/getdata.pc.in =================================================================== --- trunk/getdata/src/getdata.pc.in 2010-10-22 02:27:13 UTC (rev 461) +++ trunk/getdata/src/getdata.pc.in 2010-10-22 17:41:41 UTC (rev 462) @@ -9,5 +9,5 @@ Version: @PACKAGE_VERSION@ URL: http://getdata.sourceforge.net/ Libs: -L${libdir} -lgetdata -Libs.private: @LIBS@ +Libs.private: @PRIVATE_LIBS@ Cflags: -I${includedir} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-22 22:22:54
|
Revision: 464 http://getdata.svn.sourceforge.net/getdata/?rev=464&view=rev Author: ketiltrout Date: 2010-10-22 22:22:47 +0000 (Fri, 22 Oct 2010) Log Message: ----------- 0.7.0rc3: fix lutcmp; don't let gd_include muck about with dirfile flags. Also some stuff to try to stop ICC from whining quite so much. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/f77/fgetdata.h trunk/getdata/configure.ac trunk/getdata/doc/README.f77 trunk/getdata/src/bzip.c trunk/getdata/src/common.c trunk/getdata/src/errors.c trunk/getdata/src/flush.c trunk/getdata/src/getdata.h.in trunk/getdata/src/internal.h trunk/getdata/src/parse.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/ChangeLog 2010-10-22 22:22:47 UTC (rev 464) @@ -1,3 +1,12 @@ +2010-10-22 D. V. Wiebe <ge...@ke...> svn:463 + GetData-0.7.0rc3: + + * src/parse.c (_GD_ParseDirective): Update passed flags, not D->flags after + /INCLUDE. + + * src/common.c (lutcmp): Don't rely on typecasting to retain the -0+ + distiction. + 2010-10-22 D. V. Wiebe <ge...@ke...> svn:462 * configure.ac m4/encoding.m4: Compute PRIVATE_LIBS * src/getdata.pc: Correct private libs. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/NEWS 2010-10-22 22:22:47 UTC (rev 464) @@ -1,4 +1,4 @@ -New in version 0.7.0rc2: +New in version 0.7.0rc3: Dirfile Changes @@ -88,6 +88,8 @@ * The above renaming rules result in one gd_ namespace clash. As a result, get_reference() has been removed completely. Calls will have to be changed to use gd_reference(), formerly dirfile_reference(). + * Furthermore, the function dirfile_protect() is now gd_alter_protection() to + match the naming of other fragment metadata altering functions. * To ease transition to the new namespace, defining GD_FUNCTION_ALIASES before including getdata.h will create a bunch of preprocessor macros which map the old names to the new. @@ -139,9 +141,12 @@ Bindings * Bindings for the functionality introduced into 0.7.0 have been added. + * F77: GDPROT has been renamed GDAPRT to mirror the renaming of + gd_alter_protection(). + * F95: For consistency sake, the Fortran 95 bindings have undergone the same + renaming so they have the same name as their C counterparts. All functions + are now preceded by 'fgd_'. * C++: Const member functions are now flagged as such. - * F95: For consistency sake, the Fortran 95 bindings have undergone the same - renaming as the C bindings. All functions are now preceded by 'fgd_'. * IDL: The IDL bindings have also followed suit in the great renaming. The exception to this is GETDATA_CONSTANTS(), which is not renamed. * IDL: Various constants defined in getdata.h but not used by the IDL bindings Modified: trunk/getdata/bindings/f77/fgetdata.h =================================================================== --- trunk/getdata/bindings/f77/fgetdata.h 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/bindings/f77/fgetdata.h 2010-10-22 22:22:47 UTC (rev 464) @@ -461,3 +461,64 @@ void F77_FUNC(gdinvd, GDINVD) (int *dirfile); void F77_FUNC(gdstdv, GDSTDV) (int *vers, const int *dirfile); + +void F77_FUNC(gdgbof, GDGBOF) (int* bof, const int* dirfile, + const char* field_code, const int* field_code_l); + +void F77_FUNC(gdgeof, GDGEOF) (int* eof, const int* dirfile, + const char* field_code, const int* field_code_l); + +void F77_FUNC(gdgedv, GDGEDV) (char* in_field1, int* in_field1_l, + char* in_field2, int* in_field2_l, int* fragment_index, const int* dirfile, + const char* field_code, const int* field_code_l); + +void F77_FUNC(gdgerc, GDGERC) (char* in_field, int* in_field_l, + double* dividend, int* fragment_index, const int* dirfile, + const char* field_code, const int* field_code_l); + +void F77_FUNC(gdgecr, GDGECR) (char* in_field, int* in_field_l, + GD_DCOMPLEXP(cdividend), int* fragment_index, const int* dirfile, + const char* field_code, const int* field_code_l); + +void F77_FUNC(gdaddv, GDADDV) (const int* dirfile, const char* field_code, + const int* field_code_l, const char* in_field1, const int* in_field1_l, + const char* in_field2, const int* in_field2_l, const int* fragment_index); + +void F77_FUNC(gdadrc, GDADRC) (const int* dirfile, const char* field_code, + const int* field_code_l, const char* in_field, const int* in_field_l, + const double* dividend, const int* fragment_index); + +void F77_FUNC(gdadcr, GDADCR) (const int* dirfile, const char* field_code, + const int* field_code_l, const char* in_field, const int* in_field_l, + const GD_DCOMPLEXP(cdividend), const int* fragment_index); + +void F77_FUNC(gdmddv, GDMDDV) (const int* dirfile, const char* parent, + const int* parent_l, const char* field_code, const int* field_code_l, + const char* in_field1, const int* in_field1_l, const char* in_field2, + const int* in_field2_l); + +void F77_FUNC(gdrfrg, GDRFRG) (const int* dirfile, const int* fragment); + +void F77_FUNC(gdmdrc, GDMDRC) (const int* dirfile, const char* parent, + const int* parent_l, const char* field_code, const int* field_code_l, + const char* in_field, const int* in_field_l, const double* dividend); + +void F77_FUNC(gdmdcr, GDMDCR) (const int* dirfile, const char* parent, + const int* parent_l, const char* field_code, const int* field_code_l, + const char* in_field, const int* in_field_l, + const GD_DCOMPLEXP(cdividend)); + +void F77_FUNC(gdaldv, GDALDV) (const int* dirfile, const char* field_code, + const int* field_code_l, const char* in_field1, const int* in_field1_l, + const char* in_field2, const int* in_field2_l); + +void F77_FUNC(gdalrc, GDALRC) (const int* dirfile, const char* field_code, + const int* field_code_l, const char* in_field1, const int* in_field1_l, + const double* dividend); + +void F77_FUNC(gdalcr, GDALCR) (const int* dirfile, const char* field_code, + const int* field_code_l, const char* in_field1, const int* in_field1_l, + const GD_DCOMPLEXP(cdividend)); + +void F77_FUNC(gdaprt, GDAPRT) (const int* dirfile, const int* protection_level, + const int* fragment); Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/configure.ac 2010-10-22 22:22:47 UTC (rev 464) @@ -22,7 +22,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 7) m4_define(getdata_revision, 0) -m4_define(getdata_extra, [rc2]) +m4_define(getdata_extra, [rc3]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/getdata/doc/README.f77 =================================================================== --- trunk/getdata/doc/README.f77 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/doc/README.f77 2010-10-22 22:22:47 UTC (rev 464) @@ -608,7 +608,7 @@ level of the specified fragment, which will be one of the symbols listed below. -* GDPROT(dirfile_unit, protection_level, fragment) +* GDAPRT(dirfile_unit, protection_level, fragment) Input: INTEGER dirfile_unit, protection_level, fragment @@ -1627,7 +1627,7 @@ GDD_DR GD_DEL_DEREF GDD_FO GD_DEL_FORCE -Protection levels (returned by GDGPRT and required by GDPROT): +Protection levels (returned by GDGPRT and required by GDAPRT): F77 symbol C symbol Notes ---------- ----------------- -------------------------------------- Modified: trunk/getdata/src/bzip.c =================================================================== --- trunk/getdata/src/bzip.c 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/bzip.c 2010-10-22 22:22:47 UTC (rev 464) @@ -96,11 +96,9 @@ int _GD_Bzip2Open(struct _gd_raw_file* file, int mode __gd_unused, int creat __gd_unused) { - struct gd_bzdata *ptr; - dtrace("%p, <unused>, <unused>", file); - file->edata = ptr = _GD_Bzip2DoOpen(file); + file->edata = _GD_Bzip2DoOpen(file); if (file->edata == NULL) { dreturn("%i", 1); Modified: trunk/getdata/src/common.c =================================================================== --- trunk/getdata/src/common.c 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/common.c 2010-10-22 22:22:47 UTC (rev 464) @@ -213,9 +213,10 @@ } /* LUT comparison function for qsort */ -int lutcmp(const void* a, const void* b) +static int lutcmp(const void* a, const void* b) { - return ((struct _gd_lut *)a)->x - ((struct _gd_lut *)b)->x; + double dx = ((struct _gd_lut *)a)->x - ((struct _gd_lut *)b)->x; + return (dx < 0) ? -1 : (dx > 0) ? 1 : 0; } /* _GD_ReadLinterpFile: Read in the linterp data for this field Modified: trunk/getdata/src/errors.c =================================================================== --- trunk/getdata/src/errors.c 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/errors.c 2010-10-22 22:22:47 UTC (rev 464) @@ -276,7 +276,7 @@ *op = '\0'; if (op < bufend - 1 && error_string[s].adderr) { -#if STRERROR_R_CHAR_P +#ifdef STRERROR_R_CHAR_P char *ptr = strerror_r((error_string[s].adderr == 2) ? D->suberror : D->error_line, op, bufend - op); if (ptr != op) Modified: trunk/getdata/src/flush.c =================================================================== --- trunk/getdata/src/flush.c 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/flush.c 2010-10-22 22:22:47 UTC (rev 464) @@ -717,7 +717,7 @@ * missing an "arm" token, but it's absense might mean either an "arm" * token was present, or else there was no /ENDIAN directive at all */ if (D->fragment[i].byte_sex & GD_ARM_FLAG) -#if ARM_ENDIAN_DOUBLES +#ifdef ARM_ENDIAN_DOUBLES D->av &= GD_VERS_GE_5; #else D->av &= GD_VERS_GE_8; @@ -728,7 +728,7 @@ D->fragment[i].protection) D->av &= GD_VERS_GE_6; else if (D->fragment[i].byte_sex & -#if WORDS_BIGENDIAN +#ifdef WORDS_BIGENDIAN GD_LITTLE_ENDIAN #else GD_BIG_ENDIAN Modified: trunk/getdata/src/getdata.h.in =================================================================== --- trunk/getdata/src/getdata.h.in 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/getdata.h.in 2010-10-22 22:22:47 UTC (rev 464) @@ -61,7 +61,7 @@ /* If this symbol is defined here, the C99-API is not present in the library */ #undef GD_NO_C99_API -#if GD_NO_C99_API && ! defined(GD_C89_API) +#if defined(GD_NO_C99_API) && ! defined(GD_C89_API) # define GD_C89_API #endif @@ -297,7 +297,7 @@ struct { /* RECIP */ double dividend; GD_DCOMPLEXM(cdividend); - } GD_ANON(recip);; + } GD_ANON(recip); #ifdef GD_C89_API struct { /* LINTERP */ char *table; Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/internal.h 2010-10-22 22:22:47 UTC (rev 464) @@ -200,7 +200,7 @@ #define lseek64 (off64_t)_lseeki64 #endif -#if MKDIR_NO_MODE +#ifdef MKDIR_NO_MODE #ifdef HAVE__MKDIR #define mkdir(f,m) _mkdir(f) #else @@ -711,7 +711,7 @@ typedef union { unsigned char b[8]; double d; } nan_t; #ifdef ARM_ENDIAN_DOUBLES static const nan_t NaN_Bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } }; -#elif FLOATS_BIGENDIAN +#elif defined(FLOATS_BIGENDIAN) static const nan_t NaN_Bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } }; #else static const nan_t NaN_Bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }; Modified: trunk/getdata/src/parse.c =================================================================== --- trunk/getdata/src/parse.c 2010-10-22 17:42:27 UTC (rev 463) +++ trunk/getdata/src/parse.c 2010-10-22 22:22:47 UTC (rev 464) @@ -144,8 +144,8 @@ *(double *)data = d; *((double *)data + 1) = i; } else if (type == GD_COMPLEX64) { - *(float *)data = d; - *((float *)data + 1) = i; + *(float *)data = (float)d; + *((float *)data + 1) = (float)i; } else if (type == GD_FLOAT64) *(double *)data = d; else if (type == GD_FLOAT32) @@ -1517,14 +1517,14 @@ D->fragment[me].cname, linenum, NULL); if (n_cols > 2 && (!pedantic || *standards >= 8)) { if (strcmp(in_cols[2], "arm") == 0) { -#if ! ARM_ENDIAN_DOUBLES +#if ! defined(ARM_ENDIAN_DOUBLES) D->fragment[me].byte_sex |= GD_ARM_FLAG; #endif } else _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_ENDIAN, D->fragment[me].cname, linenum, NULL); } -#if ARM_ENDIAN_DOUBLES +#ifdef ARM_ENDIAN_DOUBLES else D->fragment[me].byte_sex |= GD_ARM_FLAG; #endif @@ -1532,13 +1532,13 @@ } else if (strcmp(ptr, "FRAMEOFFSET") == 0 && (!pedantic || *standards >= 1)) D->fragment[me].frame_offset = strtoll(in_cols[1], NULL, 10); else if (strcmp(ptr, "INCLUDE") == 0 && (!pedantic || *standards >= 3)) { - unsigned long flags = D->fragment[me].encoding | D->fragment[me].byte_sex | - (D->flags & (GD_PEDANTIC | GD_PERMISSIVE | GD_FORCE_ENDIAN | + unsigned long subflags = D->fragment[me].encoding | D->fragment[me].byte_sex + | (*flags & (GD_PEDANTIC | GD_PERMISSIVE | GD_FORCE_ENDIAN | GD_FORCE_ENCODING | GD_IGNORE_DUPS | GD_IGNORE_REFS)); int frag = _GD_Include(D, in_cols[1], D->fragment[me].cname, linenum, - ref_name, me, standards, &flags); - if ((pedantic = flags & GD_PEDANTIC)) - D->flags |= GD_PEDANTIC; + ref_name, me, standards, &subflags); + if ((pedantic = subflags & GD_PEDANTIC)) + *flags |= GD_PEDANTIC; D->fragment[me].vers |= D->fragment[frag].vers; } else if (strcmp(ptr, "META") == 0 && (!pedantic || *standards >= 6)) { const gd_entry_t* P = _GD_FindField(D, in_cols[1], D->entry, D->n_entries, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-28 03:02:10
|
Revision: 468 http://getdata.svn.sourceforge.net/getdata/?rev=468&view=rev Author: ketiltrout Date: 2010-10-28 03:02:03 +0000 (Thu, 28 Oct 2010) Log Message: ----------- Fix POLYNOM counting bug in legacy API. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/src/legacy.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-27 20:38:05 UTC (rev 467) +++ trunk/getdata/ChangeLog 2010-10-28 03:02:03 UTC (rev 468) @@ -1,3 +1,6 @@ +2010-10-28 D. V. Wiebe <ge...@ke...> svn:468 + * src/legacy.c (GetFormat): Fix counting of POLYNOM fields. + 2010-10-22 D. V. Wiebe <ge...@ke...> svn:463 GetData-0.7.0rc3: Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-27 20:38:05 UTC (rev 467) +++ trunk/getdata/NEWS 2010-10-28 03:02:03 UTC (rev 468) @@ -137,6 +137,8 @@ * BUG FIX: In previous versions, attempting to access an invalid dirfile (anything that would cause gd_open to fail) resulted in leaked memory. This leak has been plugged. + * BUG FIX: A segfault involving the reporting of POLYNOM fields has been fixed + in GetFormat(). Bindings Modified: trunk/getdata/src/legacy.c =================================================================== --- trunk/getdata/src/legacy.c 2010-10-27 20:38:05 UTC (rev 467) +++ trunk/getdata/src/legacy.c 2010-10-28 03:02:03 UTC (rev 468) @@ -380,11 +380,11 @@ Format.n_raw++; break; case GD_LINCOM_ENTRY: + case GD_POLYNOM_ENTRY: case GD_RECIP_ENTRY: Format.n_lincom++; break; case GD_LINTERP_ENTRY: - case GD_POLYNOM_ENTRY: Format.n_linterp++; break; case GD_BIT_ENTRY: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-05 22:20:48
|
Revision: 469 http://getdata.svn.sourceforge.net/getdata/?rev=469&view=rev Author: ketiltrout Date: 2010-11-05 22:20:38 +0000 (Fri, 05 Nov 2010) Log Message: ----------- Add CARRAY. Also removed 4096 byte limit on format lines and various crutches involving GD_MAX_LINE_LENGTH. Some random bugfixes. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/cxx/Makefile.am trunk/getdata/bindings/cxx/bitentry.cpp trunk/getdata/bindings/cxx/dirfile.cpp trunk/getdata/bindings/cxx/entry.cpp trunk/getdata/bindings/cxx/getdata/bitentry.h trunk/getdata/bindings/cxx/getdata/dirfile.h trunk/getdata/bindings/cxx/getdata/entry.h trunk/getdata/bindings/cxx/getdata/lincomentry.h trunk/getdata/bindings/cxx/getdata/phaseentry.h trunk/getdata/bindings/cxx/getdata/polynomentry.h trunk/getdata/bindings/cxx/getdata/rawentry.h trunk/getdata/bindings/cxx/getdata/recipentry.h trunk/getdata/bindings/cxx/getdata/sbitentry.h trunk/getdata/bindings/cxx/lincomentry.cpp trunk/getdata/bindings/cxx/phaseentry.cpp trunk/getdata/bindings/cxx/polynomentry.cpp trunk/getdata/bindings/cxx/rawentry.cpp trunk/getdata/bindings/cxx/recipentry.cpp trunk/getdata/bindings/cxx/sbitentry.cpp trunk/getdata/bindings/cxx/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/python/pydirfile.c trunk/getdata/bindings/python/pyentry.c trunk/getdata/bindings/python/test/big_test.py trunk/getdata/configure.ac trunk/getdata/doc/README.cxx trunk/getdata/doc/README.f77 trunk/getdata/doc/README.f95 trunk/getdata/doc/README.idl trunk/getdata/doc/list.tests trunk/getdata/man/Makefile.am trunk/getdata/man/dirfile-format.5 trunk/getdata/man/gd_add.3 trunk/getdata/man/gd_add_bit.3 trunk/getdata/man/gd_add_spec.3 trunk/getdata/man/gd_alter_bit.3 trunk/getdata/man/gd_alter_entry.3 trunk/getdata/man/gd_alter_spec.3 trunk/getdata/man/gd_cbopen.3 trunk/getdata/man/gd_delete.3 trunk/getdata/man/gd_entry.3 trunk/getdata/man/gd_entry_type.3 trunk/getdata/man/gd_error_string.3 trunk/getdata/man/gd_field_list_by_type.3 trunk/getdata/man/gd_get_constant.3 trunk/getdata/man/gd_getdata.3 trunk/getdata/man/gd_include.3 trunk/getdata/man/gd_madd_bit.3 trunk/getdata/man/gd_mconstants.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_nmfields_by_type.3 trunk/getdata/man/gd_put_constant.3 trunk/getdata/man/gd_putdata.3 trunk/getdata/man/gd_validate.3 trunk/getdata/src/add.c trunk/getdata/src/ascii.c trunk/getdata/src/close.c trunk/getdata/src/common.c trunk/getdata/src/compat.c trunk/getdata/src/constant.c trunk/getdata/src/del.c trunk/getdata/src/entry.c trunk/getdata/src/errors.c trunk/getdata/src/field_list.c trunk/getdata/src/flimits.c trunk/getdata/src/flush.c trunk/getdata/src/getdata.c trunk/getdata/src/getdata.h.in trunk/getdata/src/include.c trunk/getdata/src/internal.h trunk/getdata/src/legacy.c trunk/getdata/src/meta_list.c trunk/getdata/src/mod.c trunk/getdata/src/name.c trunk/getdata/src/native.c trunk/getdata/src/nfields.c trunk/getdata/src/nmeta.c trunk/getdata/src/parse.c trunk/getdata/src/putdata.c trunk/getdata/src/spf.c trunk/getdata/test/Makefile.am trunk/getdata/test/cvlist.c trunk/getdata/test/cvlist_invalid.c trunk/getdata/test/cvlist_meta.c trunk/getdata/test/cvlist_meta_invalid.c trunk/getdata/test/fragment_index.c trunk/getdata/test/get_char.c trunk/getdata/test/madd.c trunk/getdata/test/nvectors.c trunk/getdata/test/parse_const.c trunk/getdata/test/put_char.c Added Paths: ----------- trunk/getdata/bindings/cxx/carrayentry.cpp trunk/getdata/bindings/cxx/getdata/carrayentry.h trunk/getdata/man/gd_carray_len.3 trunk/getdata/man/gd_carrays.3 trunk/getdata/man/gd_get_carray_slice.3 trunk/getdata/man/gd_mcarrays.3 trunk/getdata/man/gd_put_carray_slice.3 trunk/getdata/test/add_carray.c trunk/getdata/test/alter_carray_len.c trunk/getdata/test/alter_carray_type.c trunk/getdata/test/cvlist_array.c trunk/getdata/test/cvlist_array_meta.c trunk/getdata/test/del_carray.c trunk/getdata/test/del_carray_deref.c trunk/getdata/test/get_carray.c trunk/getdata/test/get_carray_len.c trunk/getdata/test/get_carray_slice.c trunk/getdata/test/madd_carray.c trunk/getdata/test/nmeta_vectors_del.c trunk/getdata/test/parse_carray.c trunk/getdata/test/parse_carray_long.c trunk/getdata/test/put_carray.c trunk/getdata/test/put_carray_slice.c Property Changed: ---------------- trunk/getdata/test/ Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/ChangeLog 2010-11-05 22:20:38 UTC (rev 469) @@ -1,3 +1,128 @@ +2010-10-28 D. V. Wiebe <ge...@ke...> svn:469 + * bindings/python/test/big_test.py bindings/cxx/test/big_test.cpp + bindings/f77/test/big_test.f bindings/f77/test/big_test95.f90 + bindings/idl/test/big_test.pro: Added tests 158 through 181. + + * test/put_carray_slice.c test/cvlist_array_meta.c test/del_carray.c + test/get_carray_slice.c test/cvlist_array.c test/del_carray_deref.c + test/nmeta_vectors_del.c test/get_carray.c test/parse_carray.c + test/madd_carray.c test/add_carray.c test/put_carray.c test/get_carray_len.c + test/parse_carray_long.c test/alter_carray_len.c test/alter_carray_type.c: + Added. + + * test/madd.c: Remove gd_get_constant call. + + * test/parse_const.c: Actually test what is advertised. + + * bindings/python/pydirfile.c (gdpy_dirfile_getcarray gdpy_dirfile_carraylen + gdpy_dirfile_carrays gdpy_dirfile_mcarrays gdpy_dirfile_putcarray) + bindings/python/pyentry.c (gdpy_entry_getarraylen gdpy_entry_setarraylen): + Added. + * bindings/python/pyentry.c (gdpy_set_entry_from_tuple + gdpy_set_entry_from_dict gdpy_entry_getinfields gdpy_entry_getdatatypename + gdpy_entry_getdatatype): Update for CARRAY. + + * bindings/cxx/bitentry.cpp (BitEntry::ScalarIndex) bindings/cxx/entry.cpp + (scalar_ok Entry::ScalarIndex Entry::SetScalar) bindings/cxx/lincomentry.cpp + (LincomEntry::ScalarIndex) bindings/cxx/dirfile.cpp (Dirfile::Carrays + Dirfile::CarrayLen Dirfile::MCarrays Dirfile::GetCarray Dirfile::PutCarray) + bindings/cxx/polynomentry.cpp (PolynomEntry::ScalarIndex) + bindings/cxx/sbitentry.cpp (SBitEntry::ScalarIndex) + bindings/cxx/getdata/rawentry.h (ScalarIndex) + bindings/cxx/getdata/recipentry.h (ScalarIndex): Added. + * bindings/cxx/bitentry.cpp (BitEntry::SetFirstBit BitEntry::SetNumBits) + bindings/cxx/lincomentry.cpp (LincomEntry::SetScale LincomEntry::SetOffset) + bindings/cxx/polynomentry.cpp (PolynomEntry::SetCoefficient) + bindings/cxx/phaseentry.cpp (PhaseEntry::SetShift) + bindings/cxx/sbitentry.cpp (SBitEntry::SetFirstBit SBitEntry::SetNumBits) + bindings/cxx/recipentry.cpp (RecipEntry::SetDividend): + Call Entry::SetScalar. + * bindings/cxx/entry.cpp (Entry::Scalar): Call scalar_ok. + * bindings/cxx/carrayentry.cpp bindings/cxx/getdata/carrayentry.h: Added. + * bindings/cxx/dirfile.cpp (Dirfile::ErrorString): Let the C library malloc + the string. Also added a prototype with no parameters. + + * bindings/f77/fgetdata.c (GDGECA GDADCA GDGTCA GDGCAS GDCALN GDPTCA GDPCAS + GDALCA): + * bindings/f77/fgetdata.c (GDGTCO GDPTCO): Removed the returned integer. + * bindings/f77/fgetdata.c (GDGSCA GDASCA): Deal with scalar index. + * bindings/f77/getdata.f90.in (fgd_get_constant_n fgd_get_constant_i1 + fgd_get_constant_i2 fgd_get_constant_i4 fgd_get_constant_i8 + fgd_get_constant_r4 fgd_get_constant_r8 fgd_get_constant_c8 + fgd_get_constant_c16 fgd_put_constant_i1 fgd_put_constant_i2 + fgd_put_constant_i4 fgd_put_constant_i8 fgd_put_constant_r4 + fgd_put_constant_r8 fgd_put_constant_c8 fgd_put_constant_c16): Convert to + subroutines. + * bindings/f77/getdata.f90.in (fgd_entry fgd_add fgd_madd fgd_alter_entry): + Update for CARRAY. + * bindings/f77/getdata.f90.in (fgd_get_carray_n fgd_get_carray_i1 + fgd_get_carray_i2 fgd_get_carray_i4 fgd_get_carray_i8 fgd_get_carray_c16 + fgd_put_carray_i1 fgd_put_carray_i2 fgd_put_carray_i4 fgd_put_carray_i8 + fgd_put_carray_r4 fgd_put_carray_r8 fgd_put_carray_c8 fgd_put_carray_c16 + fgd_carray_len fgd_add_carray fgd_madd_carray fgd_alter_carray): Added. + + * bindings/idl/getdata.c (gdidl_make_idl_entry): Update for CARRAY. + * bindings/idl/getdata.c (gdidl_add_const): fix handling of data values + * bindings/idl/getdata.c (gdidl_add_carray gdidl_alter_carray + gdidl_get_carray gdidl_carray_len gdidl_put_carray): Added. + * bindings/idl/getdata.c (gdidl_getdata): Free data on error. + * bindings/idl/getdata.c (gdidl_get_constant): Free data on return. + + * src/interna.h: Replace the const data union with a void pointer. + * src/getdata.h.in: Define GD_MAX_CARRAY_LENGTH. + + * src/common.c (_GD_GetLine): Call getdelim. Return string length not + string itself. + * src/parse.c (_GD_ParseFragment): Handle n_cols < 2. Raise + GD_E_LINE_TOO_LONG on overflow. + * src/parse.c (_GD_ParseFragment) mod.c (gd_alter_spec gd_malter_spec) + src/add.c (gd_add_spec gd_madd_spec): Don't provide buffers for instring and + outstring: they will be malloc'd by others. + * src/parse.c (_GD_Tokenise): Dynamically allocate outstring. Also, + remember position, so tokenising can resume. + * src/parse.c (_GD_ParseFieldSpec _GD_ParseDirective): Pass through tok_pos + and outstring. + * src/compat.c (getdelim): Added. + + * src/parse.c (_GD_ParseFragment): Permit the parser callback to re-malloc + pdata.line. Also pass it the current length of pdata.line. + + * src/entry.c (_GD_FreeE) src/nmeta.c (gd_nmvectors gd_nmfields_by_type) + src/close.c (_GD_FreeD) src/flush.c (_GD_FieldSpec) src/nfields.c + (gd_nvectors gd_nfields_by_type) src/native.c (_GD_NativeType) src/del.c + (gd_delete) src/parse.c (_GD_ParseFieldSpec) src/mod.c (_GD_Change) + src/add.c (_GD_Add): Update for CARRAY. + * src/getdata.c (_GD_DoConst) src/putdata.c (_GD_DoConstOut) src/flush.c + (_GD_WriteConst): Handle both CONST and CARRAY. + * src/constant.c (gd_get_carray_slice gd_get_carray gd_carray_len + gd_put_carray_slice gd_put_carray) src/parse.c (_GD_ConstType + _GD_ParseCarray) gd_field_lists (gd_carrays) src/mod.c (gd_alter_carray) + src/meta_list.c (gd_mcarrays) src/add.c (gd_add_carray gd_madd_carray): Added. + * src/parse.c (_GD_ParseConst): Storage for constant value is now dynamic. + + * src/del.c (gd_delete): Update parent when deleting a metafield. + + * src/ascii.c (_GD_AsciiSize) src/common.c (_GD_ReadLinterpFile): Call + getdelim. + + * src/flush.c (_GD_FlushFragment): Skip writing and /ENCODING directive if + not known. + + * src/errors.c (gd_error_string): malloc a suitably sized buffer for the + string if passed buffer=NULL. + + * src/name.c (gd_rename) src/del.c (gd_delete) src/include.c (gd_uninclude): + Invalidate the field lists. + + * src/flush.c (_GD_StringEscapeise _GD_PadField) _GD_FieldSpec: Write directly + to the stream, rathen than an intermediate buffer. + + * src/entry.c (_GD_GetScalar) parse.c (_GD_SetScalar) src/mod.c + (_GD_AlterScalar): Handle the scalar index. + + * src/legacy.c (_GD_CopyGlobalError): Dynamically handle error strings, rather + than using _GD_GlobalErrorString and _GD_GlobalErrorFile. + 2010-10-28 D. V. Wiebe <ge...@ke...> svn:468 * src/legacy.c (GetFormat): Fix counting of POLYNOM fields. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/NEWS 2010-11-05 22:20:38 UTC (rev 469) @@ -2,9 +2,15 @@ Dirfile Changes - * Dirfile Standards Version 8 has been released. It adds two new field types: - DIVIDE, which computes X/Y for vectors X and Y, and RECIP, which computes - A/X for vector X and scalar A. A few other changes are listed below. + * Dirfile Standards Version 8 has been released. It adds three new field + types: DIVIDE, which computes X/Y for vectors X and Y, and RECIP, which + computes A/X for vector X and scalar A, and CARRAY, which is an array of + CONST scalars. A few other changes are listed below. + * Like CONST fields, CARRAY elements can be used as parametersin the + definition of other fields. Syntax is 'field<n>', where 'field' is the + field name and 'n' the element index in the CARRAY (and the angle brackets + are literal angle brackets). If the '<n>' is omitted, the first element + (numbered 0) is assumed. * Slashes on reserved words are now mandatory, allowing fields with reserved words as names. * The long deprecated single character data type codes have been removed. @@ -51,9 +57,14 @@ * The C library now sports an "ANSI C" mode, which allows compilation of GetData without a C99-compliant compiler. Some functionality may be lost, most prominently, but unsurprisingly, the default (C99) API. + * The artificial maximum line length of 4096 bytes for format metadata has + been removed. The maximum line length is now 2**31 bytes on 32-bit systems, + and more on 64-bit systems. This also has the side-effect of removing the + same length limit which had been applied to field names. * LINTERP tables are no longer required to be sorted. The library will sort them, if needed. As a side-effect of this, tables are no longer read twice when loading, leading to potential speed-up. + * BUG FIX: The library wasn't properly checking that the second and higher input fields in LINCOM and MULTIPLY fields were, in fact, vectors, leading to possible segfaults. @@ -65,6 +76,15 @@ * BUG FIX: Trying to write to a LINTERP via a table which isn't monotonic now results in error. Previously, this was allowed, with arbitrary data stored to disk. + * BUG FIX: On encountering a line longer than it was prepared to deal with, + the parser used to get very confused, potentially resulting in bizarre + behaviour. On the off chance such a line is encountered, GetData will now + raise GD_E_LINE_TOO_LONG in these cases. (And, since the maxmium line + length has been increased to at least 2**31 bytes, this should only occur + in pathological situations.) + * BUG FIX: Deleting a metafield was not being communicated to its parent, + resulting in differing opinions within the library as to the deleted field's + exsitence. API Changes @@ -127,13 +147,20 @@ different for different functions. * getdata.h now wraps itself in an extern "C" block if included by a C++ compiler. - * BUG FIX: gd_metaflush() now fails and raises GD_E_ACCMODE if called on a - read-only dirfile + * If passed a NULL pointer, gd_error_string() will return a newly malloc'd + buffer long enough to hold the entire string. It should be free'd by the + caller. + * The parser data passed to the callback function now includes the length of + the buffer. The parser also permits the callback to assign a new pointer to + the 'line' element of the parser data if the buffer passed in is too small. + * gd_metaflush() now fails and raises GD_E_ACCMODE if called on a read-only + dirfile. (Previously it would successfully do nothing.) Legacy API Changes * In the legacy format struct, DIVIDE fields are listed as MULTIPLYs and RECIP fields are listed as LINCOMs, with the dividend stored in m[0]. + * BUG FIX: In previous versions, attempting to access an invalid dirfile (anything that would cause gd_open to fail) resulted in leaked memory. This leak has been plugged. @@ -145,14 +172,21 @@ * Bindings for the functionality introduced into 0.7.0 have been added. * F77: GDPROT has been renamed GDAPRT to mirror the renaming of gd_alter_protection(). + * F77: GDGTCO and GDPTCO no longer return an indicator of success. + * F77: The signatues of GDGSCA and GDASCA have changed to return/take the + scalar index as well. * F95: For consistency sake, the Fortran 95 bindings have undergone the same renaming so they have the same name as their C counterparts. All functions are now preceded by 'fgd_'. + * F95: The fgd_get_constant_* and fgd_put_constant_* procedures are now + subroutines, not functions. * C++: Const member functions are now flagged as such. + * C++: The len parameter to Dirfile::ErrorString is now ignored. * IDL: The IDL bindings have also followed suit in the great renaming. The exception to this is GETDATA_CONSTANTS(), which is not renamed. * IDL: Various constants defined in getdata.h but not used by the IDL bindings have been removed from the structure returned by GETDATA_CONSTANTS(). + * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. * Python BUG FIX: A non-literal phase shift is now properly reported. * Python BUG FIX: Calling Dirfile.discard() or Dirfile.close() no longer Modified: trunk/getdata/bindings/cxx/Makefile.am =================================================================== --- trunk/getdata/bindings/cxx/Makefile.am 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/Makefile.am 2010-11-05 22:20:38 UTC (rev 469) @@ -40,15 +40,16 @@ getdata/stringentry.h getdata/indexentry.h \ getdata/sbitentry.h getdata/polynomentry.h \ getdata/fragment.h getdata/divideentry.h \ - getdata/recipentry.h + getdata/recipentry.h getdata/carrayentry.h lib_LTLIBRARIES=libgetdata++.la -libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp constentry.cpp \ - divideentry.cpp entry.cpp fragment.cpp \ - indexentry.cpp lincomentry.cpp linterpentry.cpp \ - multiplyentry.cpp phaseentry.cpp polynomentry.cpp \ - rawentry.cpp recipentry.cpp sbitentry.cpp \ - stringentry.cpp ${getdata_include_HEADERS} +libgetdata___la_SOURCES = dirfile.cpp bitentry.cpp carrayentry.cpp \ + constentry.cpp divideentry.cpp entry.cpp \ + fragment.cpp indexentry.cpp lincomentry.cpp \ + linterpentry.cpp multiplyentry.cpp phaseentry.cpp \ + polynomentry.cpp rawentry.cpp recipentry.cpp \ + sbitentry.cpp stringentry.cpp \ + ${getdata_include_HEADERS} libgetdata___la_LIBADD=../../src/libgetdata.la libgetdata___la_LDFLAGS = -version-info @GETDATAXX_VERSION@ Modified: trunk/getdata/bindings/cxx/bitentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/bitentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/bitentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -84,15 +84,19 @@ return E.scalar[index]; } +int BitEntry::ScalarIndex(int index) const +{ + if (index != 0 && index != 1) + return 0; + + return E.scalar_ind[index]; +} + int BitEntry::SetFirstBit(const char *first_bit) { int r = 0; - free(E.scalar[0]); - if (first_bit == NULL) - E.scalar[0] = NULL; - else - E.scalar[0] = strdup(first_bit); + SetScalar(0, first_bit); if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); @@ -108,10 +112,7 @@ { int r = 0; - free(E.scalar[1]); - if (num_bits == NULL) - E.scalar[1] = NULL; - else + SetScalar(1, num_bits); E.scalar[1] = strdup(num_bits); if (D != NULL) { Added: trunk/getdata/bindings/cxx/carrayentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/carrayentry.cpp (rev 0) +++ trunk/getdata/bindings/cxx/carrayentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -0,0 +1,59 @@ +// (C) 2010 D. V. Wiebe +// +/////////////////////////////////////////////////////////////////////////// +// +// This file is part of the GetData project. +// +// GetData is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or (at your +// option) any later version. +// +// GetData is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +// License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with GetData; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// +#ifdef HAVE_CONFIG_H +#include "../../src/config.h" +#endif +#undef GETDATA_LEGACY_API +#include "getdata/dirfile.h" + +#include <cstring> + +using namespace GetData; + +CarrayEntry::CarrayEntry(const char* field_code, DataType data_type, + size_t array_len, int fragment_index) +{ + E.field = strdup(field_code); + E.field_type = GD_CARRAY_ENTRY; + E.u.cons.const_type = (gd_type_t)data_type; + E.u.cons.array_len = array_len; + E.fragment_index = fragment_index; +} + +int CarrayEntry::SetType(DataType type) +{ + E.u.cons.const_type = (gd_type_t)type; + + if (D != NULL) + return gd_alter_entry(D->D, E.field, &E, 0); + + return 0; +} + +int CarrayEntry::SetArrayLen(size_t array_len) +{ + E.u.cons.array_len = array_len; + + if (D != NULL) + return gd_alter_entry(D->D, E.field, &E, 0); + + return 0; +} Modified: trunk/getdata/bindings/cxx/dirfile.cpp =================================================================== --- trunk/getdata/bindings/cxx/dirfile.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/dirfile.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -24,6 +24,10 @@ #undef GETDATA_LEGACY_API #include "getdata/dirfile.h" +#include <stdlib.h> + +#define __gd_unused __attribute__ (( unused )) + using namespace GetData; Dirfile::Dirfile() @@ -48,7 +52,7 @@ Dirfile::~Dirfile() { if (error_string != NULL) - delete error_string; + free(error_string); gd_close(D); } @@ -104,6 +108,8 @@ return new GetData::PolynomEntry(this, field_code); case ConstEntryType: return new GetData::ConstEntry(this, field_code); + case CarrayEntryType: + return new GetData::CarrayEntry(this, field_code); case StringEntryType: return new GetData::StringEntry(this, field_code); case IndexEntryType: @@ -130,15 +136,18 @@ return gd_error(D); } -const char* Dirfile::ErrorString(size_t len) +const char *Dirfile::ErrorString(size_t n __gd_unused) { - if (error_string == NULL) - error_string = new char[4096]; + return ErrorString(); +} - if (len > 4096) - len = 4096; - - return gd_error_string(D, error_string, len); +const char *Dirfile::ErrorString() +{ + if (error_string) + free(error_string); + error_string = gd_error_string(D, NULL, 0); + + return error_string; } int Dirfile::Include(const char* file, int format_file, unsigned long flags) @@ -182,6 +191,16 @@ return gd_mfield_list_by_type(D, parent, (gd_entype_t)type); } +const gd_carray_t *Dirfile::Carrays(DataType type) const +{ + return gd_carrays(D, (gd_type_t)type); +} + +size_t Dirfile::CarrayLen(const char *field_code) const +{ + return gd_carray_len(D, field_code); +} + const void *Dirfile::Constants(DataType type) const { return gd_constants(D, (gd_type_t)type); @@ -192,6 +211,10 @@ return gd_strings(D); } +const gd_carray_t *Dirfile::MCarrays(const char *parent, DataType type) const +{ + return gd_mcarrays(D, parent, (gd_type_t)type); +} const void *Dirfile::MConstants(const char *parent, DataType type) const { return gd_mconstants(D, parent, (gd_type_t)type); @@ -247,9 +270,19 @@ return gd_bof(D, field_code); } -size_t Dirfile::GetConstant(const char *field_code, DataType type, - void *data_out) const +int Dirfile::GetCarray(const char *field_code, DataType type, void *data_out, + unsigned int start, size_t len) const { + if (len == 0) + return gd_get_carray(D, field_code, (gd_type_t)type, data_out); + else + return gd_get_carray_slice(D, field_code, start, len, (gd_type_t)type, + data_out); +} + +int Dirfile::GetConstant(const char *field_code, DataType type, void *data_out) + const +{ return gd_get_constant(D, field_code, (gd_type_t)type, data_out); } @@ -267,7 +300,17 @@ return gd_get_string(D, field_code, len, data_out); } -size_t Dirfile::PutConstant(const char *field_code, DataType type, +int Dirfile::PutCarray(const char *field_code, DataType type, + const void *data_in, unsigned int start, size_t len) const +{ + if (len == 0) + return gd_put_carray(D, field_code, (gd_type_t)type, data_in); + else + return gd_put_carray_slice(D, field_code, start, len, (gd_type_t)type, + data_in); +} + +int Dirfile::PutConstant(const char *field_code, DataType type, const void *data_in) const { return gd_put_constant(D, field_code, (gd_type_t)type, data_in); Modified: trunk/getdata/bindings/cxx/entry.cpp =================================================================== --- trunk/getdata/bindings/cxx/entry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/entry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -129,43 +129,70 @@ this->Move(fragment_index); } -const char *Entry::Scalar(int index) const +static inline int scalar_ok(const gd_entry_t &E, int index) { if (index < 0) - return NULL; + return 0; switch (E.field_type) { case GD_LINCOM_ENTRY: if (index >= GD_MAX_LINCOM + E.u.lincom.n_fields || (index >= E.u.lincom.n_fields && index < GD_MAX_LINCOM)) { - return NULL; + return 0; } break; case GD_POLYNOM_ENTRY: if (index > E.u.polynom.poly_ord) - return NULL; + return 0; break; case GD_BIT_ENTRY: case GD_SBIT_ENTRY: if (index >= 2) - return NULL; + return 0; break; case GD_RAW_ENTRY: case GD_PHASE_ENTRY: case GD_RECIP_ENTRY: if (index >= 1) - return NULL; + return 0; break; case GD_LINTERP_ENTRY: case GD_MULTIPLY_ENTRY: case GD_DIVIDE_ENTRY: case GD_INDEX_ENTRY: case GD_CONST_ENTRY: + case GD_CARRAY_ENTRY: case GD_STRING_ENTRY: case GD_NO_ENTRY: - return NULL; + return 0; } - return E.scalar[index]; + return 1; } + +const char *Entry::Scalar(int index) const +{ + return scalar_ok(E, index) ? E.scalar[index] : NULL; +} + +int Entry::ScalarIndex(int index) const +{ + return scalar_ok(E, index) ? E.scalar_ind[index] : 0; +} + +void Entry::SetScalar(int n, const char *code) +{ + free(E.scalar[n]); + if (code == NULL) + E.scalar[n] = NULL; + else { + E.scalar[n] = strdup(code); + char *ptr = strchr(E.scalar[n], '<'); + if (ptr) { + *ptr = '\0'; + E.scalar_ind[n] = atoi(ptr + 1); + } else + E.scalar_ind[n] = -1; + } +} Modified: trunk/getdata/bindings/cxx/getdata/bitentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/bitentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/bitentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -51,6 +51,8 @@ virtual const char *Scalar(int index = 0) const; + virtual int ScalarIndex(int index = 0) const; + private: BitEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; Added: trunk/getdata/bindings/cxx/getdata/carrayentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/carrayentry.h (rev 0) +++ trunk/getdata/bindings/cxx/getdata/carrayentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -0,0 +1,57 @@ +// (C) 2010 D. V. Wiebe +// +/////////////////////////////////////////////////////////////////////////// +// +// This file is part of the GetData project. +// +// GetData is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2.1 of the License, or (at your +// option) any later version. +// +// GetData is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +// License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with GetData; if not, write to the Free Software Foundation, Inc., +// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +// + +#ifndef GETDATA_CARRAYENTRY_H +#define GETDATA_CARRAYENTRY_H + +#include <getdata/entry.h> + +namespace GetData { + + class Dirfile; + + class CarrayEntry : public Entry { + friend class Dirfile; + + public: + CarrayEntry() : Entry::Entry() { E.field_type = GD_CARRAY_ENTRY; }; + + CarrayEntry(const char* field_code, DataType type, size_t array_len, + int fragment_index = 0); + + virtual DataType ConstType() const + { + return (DataType)E.u.cons.const_type; + } + + virtual size_t ArrayLen() const { return E.u.cons.array_len; } + + int SetArrayLen(size_t array_len); + + int SetType(DataType type); + + private: + CarrayEntry(const GetData::Dirfile *dirfile, const char* field_code) : + Entry(dirfile, field_code) { }; + }; +} + +#endif Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-11-05 22:20:38 UTC (rev 469) @@ -42,6 +42,7 @@ #include <getdata/indexentry.h> #include <getdata/polynomentry.h> #include <getdata/constentry.h> +#include <getdata/carrayentry.h> #include <getdata/stringentry.h> #include <getdata/multiplyentry.h> #include <getdata/divideentry.h> @@ -65,6 +66,7 @@ friend class PhaseEntry; friend class PolynomEntry; friend class ConstEntry; + friend class CarrayEntry; friend class StringEntry; friend class IndexEntry; friend class Fragment; @@ -87,6 +89,10 @@ off_t BoF(const char *field_code) const; + size_t CarrayLen(const char *field_code) const; + + const gd_carray_t *Carrays(DataType type = Float64) const; + int Close(); const void *Constants(DataType type = Float64) const; @@ -101,7 +107,8 @@ int Error() const; - const char *ErrorString(size_t len = 4096); + const char *ErrorString(); + const char *ErrorString(size_t n) gd_deprecated; const char **FieldList() const; @@ -116,7 +123,10 @@ double FrameNum(const char* field_code, double value, off_t frame_start = 0, off_t frame_end = 0) const; - size_t GetConstant(const char *field_code, DataType type, void *data_out) + int GetCarray(const char *field_code, DataType type, void *data_out, + unsigned int start = 0, size_t len = 0) const; + + int GetConstant(const char *field_code, DataType type, void *data_out) const; size_t GetData(const char *field_code, off_t first_frame, @@ -136,6 +146,9 @@ int MAlterSpec(const char *line, const char *parent, int recode = 0) const; + const gd_carray_t *MCarrays(const char *parent, DataType type = Float64) + const; + const void *MConstants(const char *parent, DataType type = Float64) const; int MetaFlush() const; @@ -168,7 +181,10 @@ unsigned int NVectors() const; - size_t PutConstant(const char *field_code, DataType type, + int PutCarray(const char *field_code, DataType type, const void *data_in, + unsigned int start = 0, size_t len = 0) const; + + int PutConstant(const char *field_code, DataType type, const void *data_in) const; size_t PutData(const char *field_code, off_t first_frame, Modified: trunk/getdata/bindings/cxx/getdata/entry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/entry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/entry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -60,6 +60,7 @@ SBitEntryType = GD_SBIT_ENTRY, PolynomEntryType = GD_POLYNOM_ENTRY, ConstEntryType = GD_CONST_ENTRY, + CarrayEntryType = GD_CARRAY_ENTRY, StringEntryType = GD_STRING_ENTRY, IndexEntryType = GD_INDEX_ENTRY, DivideEntryType = GD_DIVIDE_ENTRY, @@ -102,6 +103,8 @@ virtual const char *Scalar(int index = 0) const; + virtual int ScalarIndex(int index = 0) const; + /* RAW methods */ virtual gd_spf_t SamplesPerFrame() const { return (E.field_type == GD_RAW_ENTRY) ? E.u.raw.spf : 0; @@ -164,10 +167,15 @@ /* CONST methods */ virtual DataType ConstType() const { - return (E.field_type == GD_CONST_ENTRY) ? (DataType)E.u.cons.const_type : - Unknown; + return (E.field_type == GD_CONST_ENTRY || E.field_type == + GD_CARRAY_ENTRY) ? (DataType)E.u.cons.const_type : Unknown; }; + /* CARRAY methods */ + virtual size_t ArrayLen() const { + return (E.field_type == GD_CARRAY_ENTRY) ? E.u.cons.array_len : 0; + }; + /* POLYNOM methods */ virtual int PolyOrd() const { return (E.field_type == GD_POLYNOM_ENTRY) ? E.u.polynom.poly_ord : 0; @@ -203,10 +211,13 @@ protected: Entry(const Dirfile *dirfile, const char* field_code); - static int CheckIndex(gd_entype_t field_type, int n_fields, int index); + static int CheckIndex(gd_entype_t field_type, int n_fields, + int index); void SetDirfile(const GetData::Dirfile* dirfile); + void SetScalar(int n, const char *code); + gd_entry_t E; const Dirfile* D; }; Modified: trunk/getdata/bindings/cxx/getdata/lincomentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/lincomentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/lincomentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -74,6 +74,8 @@ virtual const char *Scalar(int index = 0) const; + virtual int ScalarIndex(int index = 0) const; + int SetNFields(int nfields); int SetInput(const char* field, int index = 0); int SetScale(double scale, int index = 0); Modified: trunk/getdata/bindings/cxx/getdata/phaseentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/phaseentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/phaseentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -47,6 +47,8 @@ const char *Scalar() const { return E.scalar[0]; }; + virtual int ScalarIndex() const { return E.scalar_ind[0]; }; + private: PhaseEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; Modified: trunk/getdata/bindings/cxx/getdata/polynomentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/polynomentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/polynomentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -58,6 +58,8 @@ virtual const char *Scalar(int index = 0) const; + virtual int ScalarIndex(int index = 0) const; + int SetPolyOrd(int poly_ord); int SetInput(const char* field); int SetCoefficient(double coeff, int index = 0); Modified: trunk/getdata/bindings/cxx/getdata/rawentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/rawentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -48,6 +48,8 @@ virtual const char *Scalar() const { return E.scalar[0]; }; + virtual int ScalarIndex() const { return E.scalar_ind[0]; }; + private: RawEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; Modified: trunk/getdata/bindings/cxx/getdata/recipentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/recipentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/recipentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -44,6 +44,8 @@ virtual const char *Scalar() const { return E.scalar[0]; } + virtual int ScalarIndex() const { return E.scalar_ind[0]; }; + virtual int ComplexScalars() const { return E.comp_scal; } virtual double Dividend() const { return E.u.recip.dividend; }; Modified: trunk/getdata/bindings/cxx/getdata/sbitentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/sbitentry.h 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/getdata/sbitentry.h 2010-11-05 22:20:38 UTC (rev 469) @@ -51,6 +51,8 @@ virtual const char *Scalar(int index = 0) const; + virtual int ScalarIndex(int index = 0) const; + private: SBitEntry(const GetData::Dirfile *dirfile, const char* field_code) : Entry(dirfile, field_code) { }; Modified: trunk/getdata/bindings/cxx/lincomentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/lincomentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/lincomentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -107,13 +107,8 @@ if (index < 0 || index >= GD_MAX_LINCOM) return -1; - free(E.scalar[index]); + SetScalar(index, scale); - if (scale == NULL) - E.scalar[index] = NULL; - else - E.scalar[index] = strdup(scale); - if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); @@ -162,13 +157,8 @@ if (index < 0 || index >= GD_MAX_LINCOM) return -1; - free(E.scalar[index + GD_MAX_LINCOM]); + SetScalar(index + GD_MAX_LINCOM, scale); - if (scale == NULL) - E.scalar[index + GD_MAX_LINCOM] = NULL; - else - E.scalar[index + GD_MAX_LINCOM] = strdup(scale); - if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); @@ -228,3 +218,11 @@ return E.scalar[index]; } + +int LincomEntry::ScalarIndex(int index) const +{ + if (index < 0 || index >= E.u.lincom.n_fields) + return 0; + + return E.scalar_ind[index]; +} Modified: trunk/getdata/bindings/cxx/phaseentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/phaseentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/phaseentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -69,11 +69,7 @@ { int r = 0; - free(E.scalar[0]); - if (shift == NULL) - E.scalar[0] = NULL; - else - E.scalar[0] = strdup(shift); + SetScalar(0, shift); if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); Modified: trunk/getdata/bindings/cxx/polynomentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/polynomentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/polynomentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -99,13 +99,8 @@ if (index < 0 || index > GD_MAX_POLYORD) return -1; - free(E.scalar[index]); + SetScalar(index, scale); - if (scale == NULL) - E.scalar[index] = NULL; - else - E.scalar[index] = strdup(scale); - if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); @@ -162,3 +157,11 @@ return E.scalar[index]; } + +int PolynomEntry::ScalarIndex(int index) const +{ + if (index < 0 || index > E.u.polynom.poly_ord) + return 0; + + return E.scalar_ind[index]; +} Modified: trunk/getdata/bindings/cxx/rawentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/rawentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/rawentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -54,11 +54,7 @@ { int r = 0; - free(E.scalar[0]); - if (spf == NULL) - E.scalar[0] = NULL; - else - E.scalar[0] = strdup(spf); + SetScalar(0, spf); if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, recode); Modified: trunk/getdata/bindings/cxx/recipentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/recipentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/recipentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -86,13 +86,8 @@ { int r = 0; - free(E.scalar[0]); + SetScalar(0, scale); - if (scale == NULL) - E.scalar[0] = NULL; - else - E.scalar[0] = strdup(scale); - if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); Modified: trunk/getdata/bindings/cxx/sbitentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/sbitentry.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/sbitentry.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -84,15 +84,19 @@ return E.scalar[index]; } +int SBitEntry::ScalarIndex(int index) const +{ + if (index != 0 && index != 1) + return 0; + + return E.scalar_ind[index]; +} + int SBitEntry::SetFirstBit(const char *first_bit) { int r = 0; - free(E.scalar[0]); - if (first_bit == NULL) - E.scalar[0] = NULL; - else - E.scalar[0] = strdup(first_bit); + SetScalar(0, first_bit); if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); @@ -108,11 +112,7 @@ { int r = 0; - free(E.scalar[1]); - if (num_bits == NULL) - E.scalar[1] = NULL; - else - E.scalar[1] = strdup(num_bits); + SetScalar(1, num_bits); if (D != NULL) { r = gd_alter_entry(D->D, E.field, &E, 0); Modified: trunk/getdata/bindings/cxx/test/big_test.cpp =================================================================== --- trunk/getdata/bindings/cxx/test/big_test.cpp 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/cxx/test/big_test.cpp 2010-11-05 22:20:38 UTC (rev 469) @@ -57,6 +57,9 @@ #define CHECK_OK(t) CHECK_ERROR(t,GD_E_OK) #define CHECK_OK2(t,n) CHECK_ERROR2(t,n,GD_E_OK) +#define CHECK_NONNULL(t,v) \ + if ((v) == NULL) { ne++; cerr << "p[" << t << "] = " << (v) << endl; } + #define CHECK_INT(t,v,g) \ if ((v) != (g)) { ne++; cerr << "n[" << t << "] = " << (v) << endl; } #define CHECK_INT2(t,n,v,g) \ @@ -109,6 +112,7 @@ "/META data mconst CONST COMPLEX128 3.3;4.4\n" "/META data mlut LINTERP DATA ./lut\n" "const CONST FLOAT64 5.5\n" + "carray CARRAY FLOAT64 1.1 2.2 3.3 4.4 5.5 6.6\n" "linterp LINTERP data /look/up/file\n" "polynom POLYNOM data 1.1 2.2 2.2 3.3;4.4 const const\n" "bit BIT data 3 4\n" @@ -119,13 +123,13 @@ "phase PHASE data 11\n" "string STRING \"Zaphod Beeblebrox\"\n"; const char* form2_data = "const2 CONST INT8 -19\n"; - const int nfields = 13; + const int nfields = 14; unsigned char c[8]; unsigned char data_data[80]; signed char sc; int n, i, e, ne = 0; float fl; - double dp, q[6]; + double dp, p[6], q[6]; complex<double> cq[6]; const char **list; const char* str; @@ -143,14 +147,15 @@ RecipEntry oent, *oep; SBitEntry sent, *sep; ConstEntry cent, *cep; + CarrayEntry aent, *aep; StringEntry gent; Fragment *frag; - char* fields[nfields + 9] = {(char*)"INDEX", (char*)"bit", (char*)"const", - (char*)"data", (char*)"div", (char*)"lincom", (char*)"linterp", - (char*)"mult", (char*)"phase", (char*)"polynom", (char*)"recip", - (char*)"sbit", (char*)"string", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL}; + char* fields[nfields + 7] = {(char*)"INDEX", (char*)"bit", (char*)"carray", + (char*)"const", (char*)"data", (char*)"div", (char*)"lincom", + (char*)"linterp", (char*)"mult", (char*)"phase", (char*)"polynom", + (char*)"recip", (char*)"sbit", (char*)"string", NULL, NULL, NULL, NULL, + NULL, NULL, NULL}; // Write the test dirfile mkdir(filedir, 0777); @@ -613,7 +618,6 @@ fields[18] = (char*)"polynom"; fields[19] = (char*)"recip"; fields[20] = (char*)"sbit"; - fields[21] = (char*)"string"; list = d->VectorList(); CHECK_OK(45); CHECK_STRING_ARRAY(45,n,list[i],fields[i]); @@ -756,6 +760,7 @@ CHECK_OK2(68,4); lep->SetOffset(0.22,2); CHECK_OK2(68,5); + delete lep; q[0] = 9.9; q[1] = 8.8; @@ -784,6 +789,7 @@ CHECK_OK2(70,3); yep->SetCoefficient(55.5,4); CHECK_OK2(70,4); + delete yep; q[0] = 3.9; q[1] = 4.8; @@ -806,6 +812,7 @@ CHECK_OK2(72,2); nep->SetTable("./other/table"); CHECK_OK2(72,3); + delete nep; ent = d->Entry("new6"); CHECK_OK2(72,2); @@ -823,6 +830,7 @@ CHECK_OK2(73,3); bep->SetNumBits(2); CHECK_OK2(73,4); + delete bep; ent = d->Entry("new7"); CHECK_OK(73); @@ -841,6 +849,7 @@ CHECK_OK2(74,3); sep->SetNumBits(22); CHECK_OK2(74,4); + delete sep; ent = d->Entry("new8"); CHECK_OK(74); @@ -857,6 +866,7 @@ CHECK_OK2(75,2); mep->SetInput("in5",1); CHECK_OK2(75,3); + delete mep; ent = d->Entry("new9"); CHECK_OK2(75,2); @@ -872,6 +882,7 @@ CHECK_OK2(76,2); pep->SetShift(8); CHECK_OK2(76,3); + delete pep; ent = d->Entry("new10"); CHECK_OK(76); @@ -882,9 +893,10 @@ // 77: ConstEntry check cep = reinterpret_cast<ConstEntry*>(d->Entry("new11")); - CHECK_OK2(76,1); + CHECK_OK2(77,1); cep->SetType(Float32); - CHECK_OK2(76,2); + CHECK_OK2(77,2); + delete cep; ent = d->Entry("new11"); CHECK_OK2(77,2); @@ -928,6 +940,7 @@ rep = d->Reference("new1"); CHECK_OK(85); CHECK_STRING(85,rep->Name(),"new1"); + delete rep; // 135: Dirfile::ReferenceFilename check str = d->ReferenceFilename(); @@ -1111,6 +1124,7 @@ CHECK_OK2(152,2); dep->SetInput("in5",1); CHECK_OK2(152,3); + delete dep; ent = d->Entry("new14"); CHECK_OK2(152,2); @@ -1126,6 +1140,7 @@ CHECK_OK2(153,2); oep->SetDividend(complex<double>(1.01,9.33)); CHECK_OK2(153,3); + delete oep; ent = d->Entry("new15"); CHECK_INT2(148,1,ent->Type(),RecipEntryType); @@ -1152,8 +1167,97 @@ d->Standards(0); CHECK_ERROR2(157,2,GD_E_BAD_VERSION); + // 158 gd_get_carray + n = d->GetCarray("carray", Float64, p); + CHECK_OK(158); + CHECK_INT(158,n,0); + CHECK_DOUBLE_ARRAY(158,1,6,p[i],1.1 * (i + 1)); + // 159 gd_get_carray_slice (INT8) + n = d->GetCarray("carray", Float64, p, 2, 2); + CHECK_OK(159); + CHECK_INT(159,n,0); + CHECK_DOUBLE_ARRAY(159,1,2,p[i],1.1 * (i + 3)); + // 167 gd_carrays + const gd_carray_t *carrays = d->Carrays(Float64); + CHECK_OK(167); + CHECK_NONNULL(167,carrays); + CHECK_INT2(167,1,carrays[0].n,6); + CHECK_DOUBLE_ARRAY(167,2,6,((double*)carrays[0].d)[i],1.1 * (i + 1)); + CHECK_INT2(167,2,carrays[1].n,0); + + // 168 gd_put_carray + p[0] = 9.6; + p[1] = 8.5; + p[2] = 7.4; + p[3] = 6.3; + p[4] = 5.2; + p[5] = 4.1; + n = d->PutCarray("carray", Float64, p); + CHECK_OK2(168, 1); + + n = d->GetCarray("carray", Float64, q); + CHECK_OK2(168,2); + CHECK_INT(168,n,0); + CHECK_DOUBLE_ARRAY(168,1,6,q[i],9.6 - i * 1.1); + + // 169 gd_put_carray_slice (INT8) + p[0] = 2.2; + p[1] = 3.3; + n = d->PutCarray("carray", Float64, p, 2, 2); + CHECK_OK2(168, 1); + + n = d->GetCarray("carray", Float64, q); + CHECK_OK2(168,2); + CHECK_INT(168,n,0); + CHECK_DOUBLE_ARRAY(168,1,6,q[i],(i == 2 || i == 3) ? i * 1.1 : 9.6 - i * 1.1); + + // 177 gd_carray_len + n = (int)d->CarrayLen("carray"); + CHECK_OK(177); + CHECK_INT(177,n,6); + + // 178 gd_entry (CARRAY) + ent = d->Entry("const"); + CHECK_OK(178); + CHECK_INT2(178,1,ent->Type(),ConstEntryType); + CHECK_INT2(178,2,ent->FragmentIndex(),0); + CHECK_INT2(178,3,ent->ConstType(),Float64); + + // 179 gd_add_carray + aent.SetName("new17"); + aent.SetFragmentIndex(0); + aent.SetType(Float64); + aent.SetArrayLen(4); + d->Add(aent); + CHECK_OK2(179,1); + + ent = d->Entry("new17"); + CHECK_OK2(179,2); + CHECK_INT2(179,1,ent->Type(),CarrayEntryType); + CHECK_INT2(179,2,ent->FragmentIndex(),0); + CHECK_INT2(179,3,ent->ConstType(),Float64); + CHECK_INT2(179,4,ent->ArrayLen(),4); + + // 181 gd_alter_carray + aep = reinterpret_cast<CarrayEntry*>(d->Entry("new17")); + CHECK_OK2(181,1); + aep->SetType(Float32); + CHECK_OK2(181,2); + aep->SetArrayLen(12); + CHECK_OK2(181,3); + delete aep; + + ent = d->Entry("new17"); + CHECK_OK2(181,2); + CHECK_INT2(181,1,ent->Type(),CarrayEntryType); + CHECK_INT2(181,2,ent->FragmentIndex(),0); + CHECK_INT2(181,3,ent->ConstType(),Float32); + CHECK_INT2(181,4,ent->ArrayLen(),12); + + + // =================================================================== d->Discard(); delete d; Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-10-28 03:02:03 UTC (rev 468) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-11-05 22:20:38 UTC (rev 469) @@ -832,6 +832,31 @@ dreturnvoid(); } +/* gd_entry wrapper for CARRAY */ +void F77_FUNC(gdgeca, GDGECA) (int* data_type, int *array_len, + int* fragment_index, const int* dirfile, const char* field_code, + const int* field_code_l) +{ + dtrace("%p, %p, %p, %i, %p, %i", data_type, array_len, fragment_index, + *dirfile, field_code, *field_code_l); + + char* out = (char *)malloc(*field_code_l + 1); + gd_entry_t E; + + if (gd_entry(_GDF_GetDirfile(*dirfile), _GDF_CString(out, field_code, + *field_code_l), &E) || E.field_type != GD_CARRAY_ENTRY) + *data_type = 0; + else { + *data_type = E.EN(cons,const_type); + *array_len = E.EN(cons,array_len); + *fragment_index = E.fragment_index; + gd_free_entry_strings(&E); + } + + free(out); + dreturnvoid(); +} + /* gd_fragment_index wrapper */ void F77_FUNC(gdfrgi, GDFRGI) (int* fragment_index, const int* dirfile, const char* field_code, const int* field_code_l) @@ -1253,6 +1278,8 @@ void F77_FUNC(gdvecn, GDVECN) (char* name, int* name_l, const int* dirfile, const int* field_num) { + dtrace("%p, %p, %i, %i", name, name_l, *dirfile, *field_num); + const char** fl; DIRFILE* D = _GDF_GetDirfile(*dirfile); unsigned int nfields = gd_nvectors(D); @@ -1264,6 +1291,8 @@ _GDF_FString(name, name_l, fl[*field_num - 1]); } else *name_l = 0; + + dreturnvoid(); } /* gd_mfield_list_by_type wrapper -- this only returns one field name */ @@ -1707,6 +1736,46 @@ free(fc); } +/* gd_add_carray wrapper */ +void F77_FUNC(gdadca, GDADCA) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *const_type, int *array_len, + const int *data_type, const void *value, const int *fragment_index) +{ + dtrace("%i, %p, %i, %x, %i, %x, %p, %i", *dirfile, field_code, + *field_code_l, *const_type, *array_len, *data_type, value, + *fragment_index); + + char *fc = (char *)malloc(*field_code_l + 1); + + gd_add_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (gd_type_t)*const_type, *array_len, + (gd_type_t)*data_type, value, *fragment_index); + + free(fc); + dreturnvoid(); +} + +/* gd_madd_carray wrapper */ +void F77_FUNC(gdmdca, GDMDCA) (const int *dirfile, const char *parent, + const int *parent_l, const char *field_code, const int *field_code_l, + const int *const_type, const int *array_len, const int *data_type, + const void *value) +{ + dtrace("%i, %p, %i, %p, %i, %x, %i, %x, %p", *dirfile, parent, *parent_l, + field_code, *field_code_l, *const_type, *array_len, *data_type, value); + + char *pa = (char *)malloc(*parent_l + 1); + char *fc = (char *)malloc(*field_code_l + 1); + + gd_madd_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(pa, parent, + *parent_l), _GDF_CString(fc, field_code, *field_code_l), + (gd_type_t)*const_type, *array_len, (gd_type_t)*data_type, value); + + free(pa); + free(fc); + dreturnvoid(); +} + /* gd_add_string wrapper */ void F77_FUNC(gdadst, GDADST) (const int* dirfile, const char* field_code, const int* field_code_l, const char* value, const int* value_l, @@ -1767,27 +1836,72 @@ } /* gd_get_constant wrapper */ -void F77_FUNC(gdgtco, GDGTCO) (int* n_read, const int* dirfile, - const char* field_code, const int* field_code_l, const int* return_type, - void* data_out) +void F77_FUNC(gdgtco, GDGTCO) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *return_type, void *data_out) { - char* fc = (char *)malloc(*field_code_l + 1); - *n_read = gd_get_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, - field_code, *field_code_l), (gd_type_t)*return_type, data_out); + dtrace("%i, %p, %i, %i, %p", *dirfile, field_code, *field_code_l, + *return_type, data_out); + + char *fc = (char *)malloc(*field_code_l + 1); + gd_get_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (gd_type_t)*return_type, data_out); free(fc); + dreturnvoid(); } +/* gd_get_carray wrapper */ +void F77_FUNC(gdgtca, GDGTCA) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *return_type, void *data_out) +{ + dtrace("%i, %p, %i, %x, %p", *dirfile, field_code, *field_code_l, + *return_type, data_out); + + char *fc = (char *)malloc(*field_code_l + 1); + gd_get_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (gd_type_t)*return_type, data_out); + free(fc); + dreturnvoid(); +} + +/* gd_get_carray_slice wrapper */ +void F77_FUNC(gdgcas, GDGCAS) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *start, const int *n, + const int *return_type, void *data_out) +{ + dtrace("%i, %p, %i, %i, %i, %x, %p", *dirfile, field_code, *field_code_l, + *start, *n, *return_type, data_out); + + char *fc = (char *)malloc(*field_code_l + 1); + gd_get_carray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), *start - 1, (size_t)*n, (gd_type_t)*return_type, + data_out); + free(fc); + dreturnvoid(); +} + +/* gd_carray_len wrapper */ +void F77_FUNC(gdcaln, GDCALN) (int *len, const int *dirfile, + const char *field_code, const int *field_code_l) +{ + dtrace("%p, %i, %p, %i", len, *dirfile, field_code, *field_code_l); + char *fc = (char *)malloc(*field_code_l + 1); + *len = gd_carray_len(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l)); + free(fc); + dreturnvoid(); +} + /* gd_get_string wrapper */ -void F77_FUNC(gdgtst, GDGTST) (int* n_read, const int* dirfile, - const char* field_code, const int* field_code_l, const int* len, - char* data_out) +void F77_FUNC(gdgtst, GDGTST) (int *size, const int *dirfile, + const char *field_code, const int *field_code_l, const int *len, + char *data_out) { - char* fc = (char *)malloc(*field_code_l + 1); - char* out = (char *)malloc(*len + 1); + char *fc = (char *)malloc(*field_code_l + 1); + char *out = (char *)malloc(*len + 1); int l = *len; - *n_read = gd_get_string(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, - field_code, *field_code_l), (size_t)*len, out) - 1; + *size = gd_get_string(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (size_t)*len, out) - 1; _GDF_FString(data_out, &l, out); free(fc); @@ -1795,16 +1909,45 @@ } /* gd_put_constant wrapper */ -void F77_FUNC(gdptco, GDPTCO) (int* n_wrote, const int* dirfile, - const char* field_code, const int* field_code_l, const int* data_type, - const void* data_in) +void F77_FUNC(gdptco, GDPTCO) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *data_type, const void *data_in) { - char* fc = (char *)malloc(*field_code_l + 1); - *n_wrote = gd_put_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, - field_code, *field_code_l), (gd_type_t)*data_type, data_in); + dtrace("%i, %p, %i, %x, %p", *dirfile, field_code, *field_code_l, *data_type, + data_in); + char *fc = (char *)malloc(*field_code_l + 1); + gd_put_constant(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (gd_type_t)*data_type, data_in); free(fc); + dreturnvoid(); } +/* gd_put_carray wrapper */ +void F77_FUNC(gdptca, GDPTCA) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *data_type, const void *data_in) +{ + dtrace("%i, %p, %i, %x, %p", *dirfile, field_code, *field_code_l, *data_type, + data_in); + char *fc = (char *)malloc(*field_code_l + 1); + gd_put_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (gd_type_t)*data_type, data_in); + free(fc); + dreturnvoid(); +} + +/* gd_put_carray_slice wrapper */ +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) +{ + dtrace("%i, %p, %i, %i, %i, %x, %p", *dirfile, field_code, *field_code_l, + *start, *n, *data_type, data_in); + char *fc = (char *)malloc(*field_code_l + 1); + gd_put_carray_slice(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), *start - 1, (size_t)*n, (gd_type_t)*data_type, data_in); + free(fc); + dreturnvoid(); +} + /* gd_put_string wrapper */ void F77_FUNC(gdptst, GDPTST) (int* n_wrote, const int* dirfile, const char* field_code, const int* field_code_l, const int* len, @@ -1934,6 +2077,22 @@ free(fc); } +/* gd_alter_carray wrapper */ +void F77_FUNC(gdalca, GDALCA) (const int* dirfile, const char* field_code, + const int* field_code_l, const int* const_type, const int *array_len) +{ + dtrace("%i, %p, %i, %x, %i", *dirfile, field_code, *field_code_l, *const_type, + *array_len); + + char* fc = (char *)malloc(*field_code_l + 1); + + gd_alter_carray(_GDF_GetDirfile(*dirfile), _GDF_CString(fc, field_code, + *field_code_l), (gd_type_t)*const_type, (size_t)*array_len); + + free(fc); + dreturnvoid(); +} + /* gd_alter_lincom wrapper */ void F77_FUNC(gdallc, GDALLC) (const int* dirfile, const char* field_code, const int* field_code_l, const int* n_fields, const char* in_field1, @@ -2485,11 +2644,12 @@ } /* retrieve a scalar parameter */ -void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, const int* dirfile, - const char* field_code, const int *field_code_l, const int* index) +void F77_FUNC(gdgsca, GDGSCA) (char* scalar, int* scalar_l, int *scalar_index, + const int* dirfile, const char* field_code, const int *field_code_l, + const int* index) { - dtrace("%p, %p, %i, %p, %i, %i", scalar, scalar_l, *dirfile, field_code, - *field_code_l, *index); + dtrace("%p, %p, %p, %i, %p, %i, %i", scalar, scalar_l, scalar_index, + *dirfile, field_code, *field_code_l, *index); char *fc = (char *)malloc(*field_code_l + 1); gd_entry_t E; @@ -2509,6 +2669,7 @@ case GD_DIVIDE_ENTRY: case GD_INDEX_ENTRY: case GD_CONST_ENTRY: + case GD_CARRAY_ENTRY: case GD_STRING_ENTRY: ok = 0; break; @@ -2541,6 +2702,7 @@ ok = 0; _GDF_FString(scalar, scalar_l, (ok) ? E.scalar[*index - 1] : ""); + *scalar_index = E.scalar_ind[*index - 1]; gd_free_entry_strings(&E); @@ -2548,12 +2710,12 @@ } /* set a scalar parameter */ -void F77_FUNC(gdasca, GDASCA) (const int* dirfile, const char* field_code, +void F77_FUNC(gdasca, GDASCA) (const int *dirfile, const char *field_code, const int *field_code_l, const int *index, con... [truncated message content] |
From: <ket...@us...> - 2010-11-06 21:18:47
|
Revision: 472 http://getdata.svn.sourceforge.net/getdata/?rev=472&view=rev Author: ketiltrout Date: 2010-11-06 21:18:41 +0000 (Sat, 06 Nov 2010) Log Message: ----------- Fix our getdelim() to handle deficiencies in the MSVCRT. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/configure.ac trunk/getdata/src/ascii.c trunk/getdata/src/common.c trunk/getdata/src/compat.c trunk/getdata/src/internal.h Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-06 09:26:57 UTC (rev 471) +++ trunk/getdata/ChangeLog 2010-11-06 21:18:41 UTC (rev 472) @@ -1,3 +1,13 @@ +2010-11-06 D. V. Wiebe <ge...@ke...> svn:472 + * src/ascii.c (_GD_AsciiOpen _GD_AsciiSize _GD_AsciiTemp) src/common.c + (_GD_ReadLinterpFile): Open text files in binary mode. + + * src/internal.h: Define EOVERFLOW if necessary. Also handle missing + fseeko64 and ftello64. + + * src/compat.c (getdelim): Work around the bizarre behaviour of MSVCRT's + standard I/O. + 2010-11-06 D. V. Wiebe <ge...@ke...> svn:470 * src/getdata.h.in: Rename 'cons' to 'scalar' in the unified entry struct. Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-11-06 09:26:57 UTC (rev 471) +++ trunk/getdata/configure.ac 2010-11-06 21:18:41 UTC (rev 472) @@ -507,9 +507,9 @@ fi dnl functions -AC_CHECK_FUNCS([_commit fchmod _fdopen fsync getdelim gmtime_r _lseeki64 \ - _mkdir mkstemp _open _read _rmdir stat64 _stat64 strtoll \ - strtoull _unlink _write]) +AC_CHECK_FUNCS([_commit fchmod _fdopen fseeko fseeko64 fsync ftello ftello64 \ + getdelim gmtime_r _lseeki64 _mkdir mkstemp _open _read _rmdir \ + stat64 _stat64 strtoll strtoull _unlink _write]) if test "x$disable_c99" = "xno"; then AC_CHECK_FUNCS([cabs]) fi Modified: trunk/getdata/src/ascii.c =================================================================== --- trunk/getdata/src/ascii.c 2010-11-06 09:26:57 UTC (rev 471) +++ trunk/getdata/src/ascii.c 2010-11-06 21:18:41 UTC (rev 472) @@ -40,10 +40,9 @@ dtrace("%p, %i, %i", file, mode, creat); int fp = open(file->name, ((mode == GD_RDWR) ? O_RDWR : O_RDONLY) | - (creat ? O_CREAT : 0) | O_TEXT, 0666); + (creat ? O_CREAT : 0) | O_BINARY, 0666); - file->edata = fdopen(fp, (mode == GD_RDWR) ? "r+" FOPEN_TEXT : - "r" FOPEN_TEXT); + file->edata = fdopen(fp, (mode == GD_RDWR) ? "r+" : "r"); if (file->edata != NULL) { file->fp = 0; @@ -359,7 +358,7 @@ dtrace("%p, <unused>", file); - stream = fopen(file->name, "r" FOPEN_TEXT); + stream = fopen(file->name, "r"); if (stream == NULL) { dreturn("%i", -1); @@ -389,7 +388,7 @@ case GD_TEMP_OPEN: fp = mkstemp(file[1].name); - file[1].edata = fdopen(fp, "r+" FOPEN_TEXT); + file[1].edata = fdopen(fp, "r+"); if (file[1].edata == NULL) { dreturn("%i", -1); Modified: trunk/getdata/src/common.c =================================================================== --- trunk/getdata/src/common.c 2010-11-06 09:26:57 UTC (rev 471) +++ trunk/getdata/src/common.c 2010-11-06 21:18:41 UTC (rev 472) @@ -242,7 +242,7 @@ return; } - fp = fopen(E->e->u.linterp.table_path, "r" FOPEN_TEXT); + fp = fopen(E->e->u.linterp.table_path, "r"); if (fp == NULL) { _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_OPEN, NULL, 0, E->e->u.linterp.table_path); Modified: trunk/getdata/src/compat.c =================================================================== --- trunk/getdata/src/compat.c 2010-11-06 09:26:57 UTC (rev 471) +++ trunk/getdata/src/compat.c 2010-11-06 21:18:41 UTC (rev 472) @@ -120,6 +120,7 @@ ssize_t count = 0; char *p, *q; size_t len, new_len; + off64_t pos; dtrace("%p, %p, '\\x%02x', %p", lineptr, n, (char)delim, stream); @@ -136,6 +137,7 @@ /* apparently getdelim returns -1 if encountering EOF at the start of * a read, so try reading some text before beginning the main loop */ + pos = ftello64(stream); nread = fread(p, 1, len, stream); if (nread == 0) { @@ -154,7 +156,21 @@ /* make sure we have room for a terminating NUL */ new_len = count; /* rewind */ - fseek(stream, -nread + (q - p) + 1, SEEK_CUR); + pos += (q - p); +#ifndef __MSVCRT__ + pos++; +#endif + fseeko64(stream, pos, SEEK_SET); +#ifdef __MSVCRT__ + /* Even when we open a text file in binary mode, fseek/ftell seem able + * to screw up. So, do things the hard way. */ + int r = fgetc(stream); + off64_t new_pos = ftello64(stream); + while (r != EOF && (new_pos <= pos || r != '\n')) { + r = fgetc(stream); + new_pos = ftello64(stream); + } +#endif } else { /* no delim, increase the buffer size */ count += nread; @@ -180,9 +196,11 @@ return -1; } *n = new_len; + p = ptr + (p - *lineptr); + *lineptr = ptr; } - /* quit if there's not need to read more */ + /* quit if there's no need to read more */ if (q) break; @@ -192,6 +210,7 @@ } /* read some more */ + pos = ftello64(stream); nread = fread(p, 1, len, stream); } *(q + 1) = '\0'; Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-11-06 09:26:57 UTC (rev 471) +++ trunk/getdata/src/internal.h 2010-11-06 21:18:41 UTC (rev 472) @@ -175,6 +175,22 @@ #endif /* function aliases */ +#ifndef HAVE_FSEEKO64 +# ifndef HAVE_FSEEKO +# define fseeko64(a,b,c) fseek(a,(long)(b),c) +# else +# define fseeko64(a,b,c) fseeko(a,(off_t)(b),c) +# endif +#endif + +#ifndef HAVE_FTELLO64 +# ifndef HAVE_FTELLO +# define ftello64 (off64_t)ftell +# else +# define ftello64 (off64_t)ftello +# endif +#endif + #ifndef HAVE_STRTOLL # define strtoll strtol #endif @@ -208,6 +224,10 @@ #endif #endif +#ifndef EOVERFLOW +#define EOVERFLOW EINVAL +#endif + #ifndef HAVE_MKSTEMP int mkstemp(char*); #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-07 00:38:00
|
Revision: 473 http://getdata.svn.sourceforge.net/getdata/?rev=473&view=rev Author: ketiltrout Date: 2010-11-07 00:37:52 +0000 (Sun, 07 Nov 2010) Log Message: ----------- 0.7.0rc4: Fix complaints from various compilers. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/bindings/f77/fgetdata.h trunk/getdata/bindings/python/pygetdata.c trunk/getdata/configure.ac trunk/getdata/src/errors.c trunk/getdata/test/add_carray.c trunk/getdata/test/add_const.c trunk/getdata/test/add_spec_meta.c trunk/getdata/test/madd.c trunk/getdata/test/madd_carray.c trunk/getdata/test/madd_const.c trunk/getdata/test/madd_spec.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/ChangeLog 2010-11-07 00:37:52 UTC (rev 473) @@ -1,3 +1,11 @@ +2010-11-06 D. V. Wiebe <ge...@ke...> svn:473 + GetData-0.7.0rc4: + + * src/errors.c (_GD_SetError): Rename variable.o + + * bindings/python/pygetdata.c (gdpy_type_from_npytype): Explicitly cast the + computed types. + 2010-11-06 D. V. Wiebe <ge...@ke...> svn:472 * src/ascii.c (_GD_AsciiOpen _GD_AsciiSize _GD_AsciiTemp) src/common.c (_GD_ReadLinterpFile): Open text files in binary mode. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/NEWS 2010-11-07 00:37:52 UTC (rev 473) @@ -1,4 +1,4 @@ -New in version 0.7.0rc3: +New in version 0.7.0rc4: Dirfile Changes Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-11-07 00:37:52 UTC (rev 473) @@ -823,7 +823,7 @@ *field_code_l), &E) || E.field_type != GD_CONST_ENTRY) *data_type = 0; else { - *data_type = E.EN(cons,const_type); + *data_type = E.EN(scalar,const_type); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } @@ -847,8 +847,8 @@ *field_code_l), &E) || E.field_type != GD_CARRAY_ENTRY) *data_type = 0; else { - *data_type = E.EN(cons,const_type); - *array_len = E.EN(cons,array_len); + *data_type = E.EN(scalar,const_type); + *array_len = E.EN(scalar,array_len); *fragment_index = E.fragment_index; gd_free_entry_strings(&E); } Modified: trunk/getdata/bindings/f77/fgetdata.h =================================================================== --- trunk/getdata/bindings/f77/fgetdata.h 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/bindings/f77/fgetdata.h 2010-11-07 00:37:52 UTC (rev 473) @@ -537,3 +537,20 @@ void F77_FUNC(gdaprt, GDAPRT) (const int* dirfile, const int* protection_level, const int* fragment); + +void F77_FUNC(gdgeca, GDGECA) (int* data_type, int *array_len, + int* fragment_index, const int* dirfile, const char* field_code, + const int* field_code_l); + +void F77_FUNC(gdadca, GDADCA) (const int *dirfile, const char *field_code, + const int *field_code_l, const int *const_type, int *array_len, + const int *data_type, const void *value, const int *fragment_index); + +void F77_FUNC(gdmdca, GDMDCA) (const int *dirfile, const char *parent, + const int *parent_l, const char *field_code, const int *field_code_l, + const int *const_type, const int *array_len, const int *data_type, + const void *value); + +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); Modified: trunk/getdata/bindings/python/pygetdata.c =================================================================== --- trunk/getdata/bindings/python/pygetdata.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/bindings/python/pygetdata.c 2010-11-07 00:37:52 UTC (rev 473) @@ -236,50 +236,50 @@ break; #if NPY_SIZEOF_SHORT <= 8 case NPY_SHORT: - type = NPY_SIZEOF_SHORT | GD_SIGNED; + type = (gd_type_t)(NPY_SIZEOF_SHORT | GD_SIGNED); break; case NPY_USHORT: - type = NPY_SIZEOF_SHORT; + type = (gd_type_t)NPY_SIZEOF_SHORT; break; #endif #if NPY_SIZEOF_INT <= 8 case NPY_INT: - type = NPY_SIZEOF_INT | GD_SIGNED; + type = (gd_type_t)(NPY_SIZEOF_INT | GD_SIGNED); break; case NPY_UINT: - type = NPY_SIZEOF_INT; + type = (gd_type_t)NPY_SIZEOF_INT; break; #endif #if NPY_SIZEOF_LONG <= 8 case NPY_LONG: - type = NPY_SIZEOF_LONG | GD_SIGNED; + type = (gd_type_t)(NPY_SIZEOF_LONG | GD_SIGNED); break; case NPY_ULONG: - type = NPY_SIZEOF_LONG; + type = (gd_type_t)NPY_SIZEOF_LONG; break; #endif #if NPY_SIZEOF_LONGLONG <= 8 case NPY_LONGLONG: - type = NPY_SIZEOF_LONGLONG | GD_SIGNED; + type = (gd_type_t)(NPY_SIZEOF_LONGLONG | GD_SIGNED); break; case NPY_ULONGLONG: - type = NPY_SIZEOF_LONGLONG; + type = (gd_type_t)NPY_SIZEOF_LONGLONG; break; #endif #if NPY_SIZEOF_FLOAT <= 8 case NPY_FLOAT: - type = NPY_SIZEOF_FLOAT | GD_IEEE754; + type = (gd_type_t)NPY_SIZEOF_FLOAT | GD_IEEE754; break; case NPY_CFLOAT: - type = (2 * NPY_SIZEOF_FLOAT) | GD_COMPLEX; + type = (gd_type_t)((2 * NPY_SIZEOF_FLOAT) | GD_COMPLEX); break; #endif #if NPY_SIZEOF_DOUBLE <= 8 case NPY_DOUBLE: - type = NPY_SIZEOF_DOUBLE | GD_IEEE754; + type = (gd_type_t)(NPY_SIZEOF_DOUBLE | GD_IEEE754); break; case NPY_CDOUBLE: - type = (2 * NPY_SIZEOF_DOUBLE) | GD_COMPLEX; + type = (gd_type_t)((2 * NPY_SIZEOF_DOUBLE) | GD_COMPLEX); break; #endif default: Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/configure.ac 2010-11-07 00:37:52 UTC (rev 473) @@ -22,7 +22,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 7) m4_define(getdata_revision, 0) -m4_define(getdata_extra, [rc3]) +m4_define(getdata_extra, [rc4]) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/getdata/src/errors.c =================================================================== --- trunk/getdata/src/errors.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/src/errors.c 2010-11-07 00:37:52 UTC (rev 473) @@ -208,9 +208,9 @@ strncpy(D->error_string, token, FILENAME_MAX); if (D->flags & GD_VERBOSE) { - char *error = gd_error_string(D, NULL, 0); - fprintf(stderr, PACKAGE_NAME ": %s\n", error); - free(error); + char *error_string = gd_error_string(D, NULL, 0); + fprintf(stderr, PACKAGE_NAME ": %s\n", error_string); + free(error_string); } dreturnvoid(); Modified: trunk/getdata/test/add_carray.c =================================================================== --- trunk/getdata/test/add_carray.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/add_carray.c 2010-11-07 00:37:52 UTC (rev 473) @@ -31,7 +31,7 @@ else { CHECKI(e.field_type, GD_CARRAY_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_free_entry_strings(&e); } n = (int)gd_carray_len(D, "data"); Modified: trunk/getdata/test/add_const.c =================================================================== --- trunk/getdata/test/add_const.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/add_const.c 2010-11-07 00:37:52 UTC (rev 473) @@ -30,7 +30,7 @@ else { CHECKI(e.field_type, GD_CONST_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_get_constant(D, "data", GD_UINT8, &val); CHECKI(val, 3); gd_free_entry_strings(&e); Modified: trunk/getdata/test/add_spec_meta.c =================================================================== --- trunk/getdata/test/add_spec_meta.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/add_spec_meta.c 2010-11-07 00:37:52 UTC (rev 473) @@ -33,7 +33,7 @@ else { CHECKI(e.field_type, GD_CONST_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_get_constant(D, "INDEX/meta", GD_UINT8, &val); CHECKI(val, 2); gd_free_entry_strings(&e); Modified: trunk/getdata/test/madd.c =================================================================== --- trunk/getdata/test/madd.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/madd.c 2010-11-07 00:37:52 UTC (rev 473) @@ -29,7 +29,7 @@ DIRFILE* D = gd_open(filedir, GD_RDWR | GD_CREAT | GD_VERBOSE); gd_add(D, &E); E.field_type = GD_CONST_ENTRY; - E.EN(cons,const_type) = GD_UINT8; + E.EN(scalar,const_type) = GD_UINT8; gd_madd(D, &E, "data"); int error = gd_error(D); @@ -41,7 +41,7 @@ if (!r) { CHECKI(e.field_type, GD_CONST_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_free_entry_strings(&e); } Modified: trunk/getdata/test/madd_carray.c =================================================================== --- trunk/getdata/test/madd_carray.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/madd_carray.c 2010-11-07 00:37:52 UTC (rev 473) @@ -32,7 +32,7 @@ else { CHECKI(e.field_type, GD_CARRAY_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_free_entry_strings(&e); } n = (int)gd_carray_len(D, "new/data"); Modified: trunk/getdata/test/madd_const.c =================================================================== --- trunk/getdata/test/madd_const.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/madd_const.c 2010-11-07 00:37:52 UTC (rev 473) @@ -31,7 +31,7 @@ if (!r) { CHECKI(e.field_type, GD_CONST_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_get_constant(D, "new/data", GD_UINT8, &val); CHECKU(val, 3); gd_free_entry_strings(&e); Modified: trunk/getdata/test/madd_spec.c =================================================================== --- trunk/getdata/test/madd_spec.c 2010-11-06 21:18:41 UTC (rev 472) +++ trunk/getdata/test/madd_spec.c 2010-11-07 00:37:52 UTC (rev 473) @@ -33,7 +33,7 @@ if (!r) { CHECKI(e.field_type, GD_CONST_ENTRY); CHECKI(e.fragment_index, 0); - CHECKI(e.EN(cons,const_type), GD_UINT8); + CHECKI(e.EN(scalar,const_type), GD_UINT8); gd_get_constant(D, "INDEX/meta", GD_UINT8, &val); CHECKU(val, 2); gd_free_entry_strings(&e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-17 00:51:24
|
Revision: 475 http://getdata.svn.sourceforge.net/getdata/?rev=475&view=rev Author: ketiltrout Date: 2010-11-17 00:51:18 +0000 (Wed, 17 Nov 2010) Log Message: ----------- Python: complain if getdata() is given neither num_frames nor num_samples. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/TODO trunk/getdata/bindings/python/pydirfile.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-12 19:10:24 UTC (rev 474) +++ trunk/getdata/ChangeLog 2010-11-17 00:51:18 UTC (rev 475) @@ -1,3 +1,7 @@ +2010-11-16 D. V. Wiebe <ge...@ke...> svn:475 + * bindings/python/pydirfile.c (gdpy_dirfile_getdata): If neither num_samples + or num_frames are specified, raise ValueError. + 2010-11-06 D. V. Wiebe <ge...@ke...> svn:473 GetData-0.7.0rc4: Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-11-12 19:10:24 UTC (rev 474) +++ trunk/getdata/NEWS 2010-11-17 00:51:18 UTC (rev 475) @@ -186,6 +186,9 @@ exception to this is GETDATA_CONSTANTS(), which is not renamed. * IDL: Various constants defined in getdata.h but not used by the IDL bindings have been removed from the structure returned by GETDATA_CONSTANTS(). + * Pyhon: dirfile.getdata() now raises ValueError if neither num_frames nor + num_samples are specified. In the past, it would happily return nothing + in this case. * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. * Python BUG FIX: A non-literal phase shift is now properly reported. Modified: trunk/getdata/TODO =================================================================== --- trunk/getdata/TODO 2010-11-12 19:10:24 UTC (rev 474) +++ trunk/getdata/TODO 2010-11-17 00:51:18 UTC (rev 475) @@ -3,5 +3,4 @@ * Hashed compressed files * streaming * linterp table path munging [MH] -* Fix ARM python bug * Make webpage suck less Modified: trunk/getdata/bindings/python/pydirfile.c =================================================================== --- trunk/getdata/bindings/python/pydirfile.c 2010-11-12 19:10:24 UTC (rev 474) +++ trunk/getdata/bindings/python/pydirfile.c 2010-11-17 00:51:18 UTC (rev 475) @@ -574,6 +574,7 @@ "first_sample", "num_frames", "num_samples", "as_list", NULL }; const char* field_code; PY_LONG_LONG first_frame = 0, first_sample = 0; + PyObject *num_frames_obj = NULL, *num_samples_obj = NULL; long int num_frames = 0, num_samples = 0; int as_list = 0; gd_type_t return_type; @@ -584,14 +585,48 @@ #endif if (!PyArg_ParseTupleAndKeywords(args, keys, - "si|LLlli:pygetdata.dirfile.getdata", keywords, &field_code, - &return_type, &first_frame, &first_sample, &num_frames, &num_samples, - &as_list)) + "si|LLOOi:pygetdata.dirfile.getdata", keywords, &field_code, + &return_type, &first_frame, &first_sample, &num_frames_obj, + &num_samples_obj, &as_list)) { dreturn("%p", NULL); return NULL; } + /* sanity check */ + if (num_frames_obj == NULL && num_samples_obj == NULL) { + PyErr_SetString(PyExc_ValueError, "pygetdata.dirfile.gd_getdata(): at " + "least one of num_frames and num_samples must be specified"); + dreturn("%p", NULL); + return NULL; + } + + if (num_frames_obj) { + num_frames = PyInt_AsLong(num_frames_obj); + if (num_frames == -1 && PyErr_Occurred()) { + dreturn("%p", NULL); + return NULL; + } else if (num_frames < 0) { + PyErr_SetString(PyExc_ValueError, "pygetdata.dirfile.gd_getdata(): " + "num_frames must be non-negative"); + dreturn("%p", NULL); + return NULL; + } + } + + if (num_samples_obj) { + num_samples = PyInt_AsLong(num_samples_obj); + if (num_samples == -1 && PyErr_Occurred()) { + dreturn("%p", NULL); + return NULL; + } else if (num_samples < 0) { + PyErr_SetString(PyExc_ValueError, "pygetdata.dirfile.gd_getdata(): " + "num_samples must be non-negative"); + dreturn("%p", NULL); + return NULL; + } + } + /* we need the SPF to know how many samples we have to allocate */ if (num_frames) { spf = gd_spf(self->D, field_code); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-17 15:26:19
|
Revision: 476 http://getdata.svn.sourceforge.net/getdata/?rev=476&view=rev Author: ketiltrout Date: 2010-11-17 15:26:13 +0000 (Wed, 17 Nov 2010) Log Message: ----------- Make RDONLY the default in C++ and Python bindings, for consistency with C. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/TODO trunk/getdata/bindings/cxx/getdata/dirfile.h trunk/getdata/bindings/python/pydirfile.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-17 00:51:18 UTC (rev 475) +++ trunk/getdata/ChangeLog 2010-11-17 15:26:13 UTC (rev 476) @@ -1,3 +1,8 @@ +2010-11-17 D. V. Wiebe <ge...@ke...> svn:476 + * bindings/python/pydirfile.c (gdpy_dirfile_init) + bindings/cxx/getdata/dirfile.h: Open dirfiles read-only by default (for + compatibility with the C API. + 2010-11-16 D. V. Wiebe <ge...@ke...> svn:475 * bindings/python/pydirfile.c (gdpy_dirfile_getdata): If neither num_samples or num_frames are specified, raise ValueError. Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-11-17 00:51:18 UTC (rev 475) +++ trunk/getdata/NEWS 2010-11-17 15:26:13 UTC (rev 476) @@ -182,6 +182,7 @@ subroutines, not functions. * C++: Const member functions are now flagged as such. * C++: The len parameter to Dirfile::ErrorString is now ignored. + * C++: dirfiles are now opened read-only by default. * IDL: The IDL bindings have also followed suit in the great renaming. The exception to this is GETDATA_CONSTANTS(), which is not renamed. * IDL: Various constants defined in getdata.h but not used by the IDL bindings @@ -189,6 +190,7 @@ * Pyhon: dirfile.getdata() now raises ValueError if neither num_frames nor num_samples are specified. In the past, it would happily return nothing in this case. + * Python: dirfiles are now opened read-only by default. * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. * Python BUG FIX: A non-literal phase shift is now properly reported. Modified: trunk/getdata/TODO =================================================================== --- trunk/getdata/TODO 2010-11-17 00:51:18 UTC (rev 475) +++ trunk/getdata/TODO 2010-11-17 15:26:13 UTC (rev 476) @@ -4,3 +4,4 @@ * streaming * linterp table path munging [MH] * Make webpage suck less +* Handle RW dirfile on RO data better [JPF] Modified: trunk/getdata/bindings/cxx/getdata/dirfile.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-11-17 00:51:18 UTC (rev 475) +++ trunk/getdata/bindings/cxx/getdata/dirfile.h 2010-11-17 15:26:13 UTC (rev 476) @@ -74,7 +74,7 @@ public: Dirfile(); - Dirfile(const char *dirfilename, unsigned long flags = GD_RDWR, + Dirfile(const char *dirfilename, unsigned long flags = GD_RDONLY, gd_parser_callback_t sehandler = NULL, void* extra = NULL); Dirfile(DIRFILE *D); Modified: trunk/getdata/bindings/python/pydirfile.c =================================================================== --- trunk/getdata/bindings/python/pydirfile.c 2010-11-17 00:51:18 UTC (rev 475) +++ trunk/getdata/bindings/python/pydirfile.c 2010-11-17 15:26:13 UTC (rev 476) @@ -150,7 +150,7 @@ PyObject* pycallback_data = Py_None; char *keywords[] = {"name", "flags", "callback", "extra", NULL}; PyObject* name = NULL; - unsigned long flags = GD_RDWR; + unsigned long flags = GD_RDONLY; if (!PyArg_ParseTupleAndKeywords(args, keys, "|OkOO:pygetdata.dirfile.__init__", keywords, &name, &flags, @@ -2554,7 +2554,7 @@ "The dirfile is opened by a call to gd_cbopen(3). See that manual page\n" \ "for full details on arguments. If present, 'flags' should be a bitwise\n" \ "or'd collection of gd_cbopen flags. If it is omitted, the default,\n" \ -"pygetdata.RDRW, is used.\n\n" \ +"pygetdata.RDONLY, is used.\n\n" \ "If a callback handler is desired, 'sehandler' should be a callable\n"\ "object (ie. a function) which accepts two objects. The first object is\n"\ "a dictionary with keys: 'suberror', 'line', 'linenum', and 'filename',\n"\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-20 17:55:31
|
Revision: 478 http://getdata.svn.sourceforge.net/getdata/?rev=478&view=rev Author: ketiltrout Date: 2010-11-20 17:55:25 +0000 (Sat, 20 Nov 2010) Log Message: ----------- Properly terminate IDL keyword lists. Modified Paths: -------------- trunk/getdata/bindings/idl/getdata.c trunk/getdata/doc/README.cxx Modified: trunk/getdata/bindings/idl/getdata.c =================================================================== --- trunk/getdata/bindings/idl/getdata.c 2010-11-17 20:16:55 UTC (rev 477) +++ trunk/getdata/bindings/idl/getdata.c 2010-11-20 17:55:25 UTC (rev 478) @@ -2020,6 +2020,7 @@ { "FRAGMENT", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(fragment_index_x), IDL_KW_OFFSETOF(fragment_index) }, { "RECODE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(recode) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -2073,6 +2074,7 @@ { "LITTLE_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(little_end) }, { "NOT_ARM_ENDIAN", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(not_arm_end) }, { "RECODE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(recode) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -2114,6 +2116,7 @@ GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "RECODE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(recode) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -2157,6 +2160,7 @@ { "FRAGMENT", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(fragment_index_x), IDL_KW_OFFSETOF(fragment_index) }, { "RECODE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(recode) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -2827,6 +2831,7 @@ { "DISCARD", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(discard) }, GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -2884,7 +2889,8 @@ { "DEREF", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(deref) }, GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, - { "FORCE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(force) } + { "FORCE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(force) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -3079,7 +3085,8 @@ GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "FRAGMENT", IDL_TYP_INT, 1, 0, IDL_KW_OFFSETOF(fragment_index_x), - IDL_KW_OFFSETOF(fragment_index) } + IDL_KW_OFFSETOF(fragment_index) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -3117,6 +3124,7 @@ GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "MOVE_DATA", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(move_data) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -3297,6 +3305,7 @@ GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "MOVE_DATA", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(move_data) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -3333,6 +3342,7 @@ GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "DELETE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(del) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -3398,7 +3408,8 @@ { "FIRST_SAMPLE", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_sample) }, { "NUM_FRAMES", IDL_TYP_LONG, 1, 0, 0, IDL_KW_OFFSETOF(n_frames) }, { "NUM_SAMPLES", IDL_TYP_LONG, 1, 0, 0, IDL_KW_OFFSETOF(n_samples) }, - { "TYPE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(return_type) } + { "TYPE", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(return_type) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -4485,6 +4496,7 @@ GDIDL_KW_PAR_ESTRING, { "FIRST_FRAME", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_frame) }, { "FIRST_SAMPLE", IDL_TYP_LONG64, 1, 0, 0, IDL_KW_OFFSETOF(first_sample) }, + { NULL } }; IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); @@ -4625,6 +4637,7 @@ GDIDL_KW_PAR_ERROR, GDIDL_KW_PAR_ESTRING, { "LATEST", IDL_TYP_INT, 1, 0, 0, IDL_KW_OFFSETOF(latest) }, + { NULL } }; argc = IDL_KWProcessByOffset(argc, argv, argk, kw_pars, NULL, 1, &kw); Modified: trunk/getdata/doc/README.cxx =================================================================== --- trunk/getdata/doc/README.cxx 2010-11-17 20:16:55 UTC (rev 477) +++ trunk/getdata/doc/README.cxx 2010-11-20 17:55:25 UTC (rev 478) @@ -18,7 +18,7 @@ The empty constructor creates an invalid dirfile. Attempting to call any member function will result in a GD_E_BAD_DIRFILE error. -* Dirfile::Dirfile(const char *dirfilename, unsigned int flags = GD_RDWR, +* Dirfile::Dirfile(const char *dirfilename, unsigned int flags = GD_RDONLY, gd_parser_callback_t sehandler = NULL, void *extra = NULL) This constructor takes the name of the dirfile, the dirfile flags, and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-27 02:20:13
|
Revision: 484 http://getdata.svn.sourceforge.net/getdata/?rev=484&view=rev Author: ketiltrout Date: 2010-11-27 02:20:05 +0000 (Sat, 27 Nov 2010) Log Message: ----------- Correctly remember our position in the ASCII encoding; fix big-endian bug in python bindings reported by Matthew Truch; some provisional work on dirfile2ascii; fix a few memory indecora reported by Christian Trippe. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/f77/fgetdata.c trunk/getdata/bindings/python/pygetdata.c trunk/getdata/configure.ac trunk/getdata/src/ascii.c trunk/getdata/src/common.c trunk/getdata/src/del.c trunk/getdata/src/entry.c trunk/getdata/src/errors.c trunk/getdata/src/getdata.c trunk/getdata/src/index.c trunk/getdata/src/internal.h trunk/getdata/src/open.c trunk/getdata/test/Makefile.am trunk/getdata/util/dirfile2ascii.c Added Paths: ----------- trunk/getdata/src/nan.h trunk/getdata/test/ascii_get_get.c Property Changed: ---------------- trunk/getdata/test/ Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/ChangeLog 2010-11-27 02:20:05 UTC (rev 484) @@ -1,3 +1,25 @@ +2010-11-25 D. V. Wiebe <ge...@ke...> svn:484 + * test/ascii_get_get.c: Added. + + * src/ascii.c (_GD_AsciiRead): Update fp as necessary so we don't get lost. + + * bindings/python/pygetdata.c (gdpy_convert_from_pylist): Don't type-pun + the return array into a gdpy_quadruple_value. + + * src/open.c (gd_cbopen): Don't allocate error string buffers. + * src/errors.c (_GD_SetError): Use strdup to copy error strings. + + * bindings/f77/fgetdata.c (GDASCA): Clean-up. + * src/del.c (gd_delete): Alloc the correct del_list for metafields. + * src/common.c (_GD_GetLine): Deallocate the line before returning NULL. + * src/entry.c (_GD_FreeE): Free p.meta_entry when appropriate. + + * src/nan.h: Added. + * src/internal.h: Removed NAN code. + * util/dirfile2ascii.c: Add missing -u option. Allow cart-before-horse + arguments (ie. "dirfile2ascii -e field dirfile"). Handle running past the + end-of-field nicelier (added -z option). Complain on no dirfile. + 2010-11-22 D. V. Wiebe <ge...@ke...> svn:480 GetData 0.7.0 released. Modified: trunk/getdata/bindings/f77/fgetdata.c =================================================================== --- trunk/getdata/bindings/f77/fgetdata.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/bindings/f77/fgetdata.c 2010-11-27 02:20:05 UTC (rev 484) @@ -2776,6 +2776,8 @@ gd_alter_entry(D, fc, &E, *recode); + gd_free_entry_strings(&E); + free(fc); dreturnvoid(); } Modified: trunk/getdata/bindings/python/pygetdata.c =================================================================== --- trunk/getdata/bindings/python/pygetdata.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/bindings/python/pygetdata.c 2010-11-27 02:20:05 UTC (rev 484) @@ -167,13 +167,13 @@ gd_type_t gdpy_convert_from_pylist(PyObject* value, void *data, gd_type_t type, size_t ns) { + size_t i; + union gdpy_quadruple_value tmp; + dtrace("%p, %p, %02x, %zi", value, data, type, ns); - size_t i; - /* use the first element to determine the data type */ - int data_type = gdpy_convert_from_pyobj(PyList_GetItem(value, 0), - (union gdpy_quadruple_value*)data, type); + int data_type = gdpy_convert_from_pyobj(PyList_GetItem(value, 0), &tmp, type); if (data_type == -1) { dreturn("%02x", GD_UNKNOWN); @@ -183,32 +183,38 @@ switch(data_type) { case GDPY_INT_AS_LONG: type = GD_INT32; + *(int32_t*)data = tmp.s; for (i = 1; i < ns; ++i) ((int32_t*)data)[i] = PyInt_AsLong(PyList_GetItem(value, i)); break; case GDPY_LONG_AS_ULL: type = GD_UINT64; + *(uint64_t*)data = tmp.u; for (i = 1; i < ns; ++i) ((uint64_t*)data)[i] = PyLong_AsUnsignedLongLong(PyList_GetItem(value, i)); break; case GDPY_LONG_AS_SLL: type = GD_INT64; + *(int64_t*)data = tmp.s; for (i = 1; i < ns; ++i) ((int64_t*)data)[i] = PyLong_AsLongLong(PyList_GetItem(value, i)); break; case GDPY_LONG_AS_DOUBLE: type = GD_FLOAT64; + *(double*)data = tmp.f; for (i = 1; i < ns; ++i) ((double*)data)[i] = PyLong_AsDouble(PyList_GetItem(value, i)); break; case GDPY_FLOAT_AS_DOUBLE: type = GD_FLOAT64; + *(double*)data = tmp.f; for (i = 1; i < ns; ++i) ((double*)data)[i] = PyFloat_AsDouble(PyList_GetItem(value, i)); break; case GDPY_COMPLEX_AS_COMPLEX: type = GD_COMPLEX128; + *(complex double*)data = tmp.c; for (i = 1; i < ns; ++i) ((double complex*)data)[i] = gdpy_as_complex(PyList_GetItem(value, i)); break; Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/configure.ac 2010-11-27 02:20:05 UTC (rev 484) @@ -508,8 +508,8 @@ dnl functions AC_CHECK_FUNCS([_commit fchmod _fdopen fseeko fseeko64 fsync ftello ftello64 \ - getdelim gmtime_r _lseeki64 _mkdir mkstemp _open _read _rmdir \ - stat64 _stat64 strtoll strtoull _unlink _write]) + getdelim gmtime_r _lseeki64 _mkdir mkstemp nan _open _read \ + _rmdir stat64 _stat64 strtoll strtoull _unlink _write]) if test "x$disable_c99" = "xno"; then AC_CHECK_FUNCS([cabs]) fi Modified: trunk/getdata/src/ascii.c =================================================================== --- trunk/getdata/src/ascii.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/ascii.c 2010-11-27 02:20:05 UTC (rev 484) @@ -158,6 +158,7 @@ ret = -1; break; } + file->fp++; } } else { for (n = 0; n < nmemb; ++n) { @@ -187,6 +188,7 @@ break; } } + file->fp++; } } Modified: trunk/getdata/src/common.c =================================================================== --- trunk/getdata/src/common.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/common.c 2010-11-27 02:20:05 UTC (rev 484) @@ -69,6 +69,7 @@ return line; /* a line was read */ } + free(line); dreturn("%p", NULL); return NULL; /* there were no valid lines */ } Modified: trunk/getdata/src/del.c =================================================================== --- trunk/getdata/src/del.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/del.c 2010-11-27 02:20:05 UTC (rev 484) @@ -275,7 +275,7 @@ /* gather a list of fields */ gd_entry_t **del_list = (gd_entry_t **)malloc(sizeof(gd_entry_t*) * - (1 + E->e->n_meta)); + ((E->e->n_meta == -1) ? 1 : 1 + E->e->n_meta)); if (del_list == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); Modified: trunk/getdata/src/entry.c =================================================================== --- trunk/getdata/src/entry.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/entry.c 2010-11-27 02:20:05 UTC (rev 484) @@ -109,6 +109,8 @@ for (i = 0; entry->e->carray_value_list[i].n != 0; ++i) free(entry->e->carray_value_list[i].d); free(entry->e->carray_value_list); + if (entry->e->n_meta > -1) + free(entry->e->p.meta_entry); free(entry->e); free(entry); } Modified: trunk/getdata/src/errors.c =================================================================== --- trunk/getdata/src/errors.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/errors.c 2010-11-27 02:20:05 UTC (rev 484) @@ -202,10 +202,14 @@ D->error = error; D->suberror = suberror; D->error_line = line; - if (format_file != NULL) - strncpy(D->error_file, format_file, FILENAME_MAX); - if (token != NULL) - strncpy(D->error_string, token, FILENAME_MAX); + if (format_file != NULL) { + free(D->error_file); + D->error_file = strdup(format_file); + } + if (token != NULL) { + free(D->error_string); + D->error_string = strdup(token); + } if (D->flags & GD_VERBOSE) { char *error_string = gd_error_string(D, NULL, 0); Modified: trunk/getdata/src/getdata.c =================================================================== --- trunk/getdata/src/getdata.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/getdata.c 2010-11-27 02:20:05 UTC (rev 484) @@ -31,6 +31,8 @@ #include <string.h> #endif +#include "nan.h" + #define EXTRACT_REPR(it,ot,f) \ for (i = 0; i < n; ++i) ((ot *)rdata)[i] = (ot)f(((it *)cdata)[i]) Modified: trunk/getdata/src/index.c =================================================================== --- trunk/getdata/src/index.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/index.c 2010-11-27 02:20:05 UTC (rev 484) @@ -25,6 +25,8 @@ #include <string.h> #endif +#include "nan.h" + static double _GD_Extrapolate(DIRFILE *D, gd_entry_t *E, int repr, double value, off64_t limit, int eof) { Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/internal.h 2010-11-27 02:20:05 UTC (rev 484) @@ -724,30 +724,6 @@ return strcmp((*(gd_entry_t**)a)->field, (*(gd_entry_t**)b)->field); } -/* The following has been extracted from internal.cpp from kjs */ - -/* - * For systems without NAN, this is a NAN in IEEE double format. - */ - -#if !defined(NAN) -static inline __attribute__ ((__const__)) double __NAN() -{ - typedef union { unsigned char b[8]; double d; } nan_t; -#ifdef ARM_ENDIAN_DOUBLES - static const nan_t NaN_Bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } }; -#elif defined(FLOATS_BIGENDIAN) - static const nan_t NaN_Bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } }; -#else - static const nan_t NaN_Bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }; -#endif - - const double NaN = NaN_Bytes.d; - return NaN; -} -#define NAN __NAN() -#endif /* !defined(NAN) */ - #ifndef __cplusplus # undef gd_nothrow # define gd_nothrow Added: trunk/getdata/src/nan.h =================================================================== --- trunk/getdata/src/nan.h (rev 0) +++ trunk/getdata/src/nan.h 2010-11-27 02:20:05 UTC (rev 484) @@ -0,0 +1,37 @@ +/* Copyright (C) 2010 D. V. Wiebe + * + *************************************************************************** + * + * This file is part of the GetData project. + * + * GetData is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation; either version 2.1 of the License, or (at your + * option) any later version. + * + * GetData is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with GetData; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef GETDATA_NAN_H +#define GETDATA_NAN_H + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <math.h> + +#ifndef NAN +# if HAVE_NAN +# define NAN nan("") +# else +# define NAN strtod("NAN", NULL) +# endif +#endif + +#endif Modified: trunk/getdata/src/open.c =================================================================== --- trunk/getdata/src/open.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/src/open.c 2010-11-27 02:20:05 UTC (rev 484) @@ -236,15 +236,15 @@ if (flags & GD_PERMISSIVE && flags & GD_PEDANTIC) flags &= ~GD_PERMISSIVE; - D->error_string = (char *)malloc(FILENAME_MAX); - D->error_file = (char *)malloc(FILENAME_MAX); + D->error_string = NULL; + D->error_file = NULL; D->name = strdup(filedir); D->flags = (flags | GD_INVALID) & ~GD_IGNORE_REFS; D->sehandler = sehandler; D->sehandler_extra = extra; D->standards = GD_DIRFILE_STANDARDS_VERSION; - if (D->error_string == NULL || D->error_file == NULL || D->name == NULL) { + if (D->name == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); dreturn("%p", D); return D; 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 + 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 Modified: trunk/getdata/test/Makefile.am =================================================================== --- trunk/getdata/test/Makefile.am 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/test/Makefile.am 2010-11-27 02:20:05 UTC (rev 484) @@ -63,7 +63,7 @@ alter_polynom_ord alter_raw_spf alter_raw_type alter_recip \ alter_spec alter_spec_meta -ASCII_TESTS=ascii_get ascii_nframes ascii_put +ASCII_TESTS=ascii_get ascii_get_get ascii_nframes ascii_put BOF_TESTS=bof bof_lincom bof_phase Added: trunk/getdata/test/ascii_get_get.c =================================================================== --- trunk/getdata/test/ascii_get_get.c (rev 0) +++ trunk/getdata/test/ascii_get_get.c 2010-11-27 02:20:05 UTC (rev 484) @@ -0,0 +1,58 @@ +/* Attempt to read UINT8 */ +#include "test.h" + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <stdio.h> +#include <errno.h> +#include <unistd.h> + +int main(void) +{ + const char* filedir = __TEST__ "dirfile"; + const char* format = __TEST__ "dirfile/format"; + const char* data = __TEST__ "dirfile/data.txt"; + const char* format_data = "data RAW UINT8 8\n"; + unsigned char c[8], d[8]; + int fd, i, r = 0; + FILE* stream; + + memset(c, 0, 8); + mkdir(filedir, 0777); + + fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666); + write(fd, format_data, strlen(format_data)); + close(fd); + + stream = fopen(data, "w" FOPEN_TEXT); + for (i = 0; i < 256; ++i) + fprintf(stream, "%i\n", i); + fclose(stream); + + DIRFILE* D = gd_open(filedir, GD_RDONLY | GD_VERBOSE); + int n = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, c); + int error = gd_error(D); + + int n2 = gd_getdata(D, "data", 5, 0, 1, 0, GD_UINT8, d); + int error2 = gd_error(D); + + gd_close(D); + + unlink(data); + unlink(format); + rmdir(filedir); + + CHECKI(error, 0); + CHECKI(n, 8); + CHECKI(error2, 0); + CHECKI(n2, 8); + for (i = 0; i < 8; ++i) { + CHECKIi(i,c[i], 40 + i); + CHECKIi(i+8,d[i], 40 + i); + } + + return r; +} Modified: trunk/getdata/util/dirfile2ascii.c =================================================================== --- trunk/getdata/util/dirfile2ascii.c 2010-11-23 02:20:51 UTC (rev 483) +++ trunk/getdata/util/dirfile2ascii.c 2010-11-27 02:20:05 UTC (rev 484) @@ -32,6 +32,7 @@ #include <inttypes.h> #include <getopt.h> #include <math.h> +#include "nan.h" #include "getdata.h" #ifndef HAVE_OFF64_T @@ -53,6 +54,7 @@ uint64_t *u64; } u; char format[F_LEN]; + size_t n_read; }; void version(void) @@ -142,35 +144,39 @@ char *tmp; char *delimiter = " "; char *precision = ""; + char *zero = NULL; char *dirfile_name = NULL; DIRFILE *dirfile; size_t nf = 0; off64_t ff = 0; - size_t n_read, n_want; + size_t n_want; gd_spf_t max_spf = 0; gd_spf_t min_spf = UINT16_MAX; int c; - int numfields = -1; + int numfields = 0; struct field fields[BUF_LEN]; int verbose = 0; int interpolate = 0; size_t skip = 0; int skipping = 0; + size_t k; int average = 0; int optind = 0; + const double NaN = NAN; const struct option longopts[] = { #if 0 { "boxcar", 0, NULL, 'b' }, #endif { "delimieter", 1, NULL, 'd' }, + { "empty-sample",1, NULL, 'z' }, + { "first-frame", 1, NULL, 'f' }, { "help", 0, NULL, '?' }, - { "first-frame", 1, NULL, 'f' }, { "num-frames", 1, NULL, 'n' }, { "precision", 1, NULL, 'p' }, { "quiet", 0, NULL, 'q' }, { "skip", 1, NULL, 's' }, { "verbose", 0, NULL, 'v' }, - { "version", 0, NULL, 2 } + { "version", 0, NULL, 2 } }; /* handy things to know about conversion specifiers */ @@ -209,12 +215,11 @@ type_data[(int)'X'].f = PRIX64; while ((c = getopt_long(argc, argv, - "-f:n:d:x:X:g:G:e:E:a:A:F:i:o:p:s:bvqh?", longopts, &optind)) != -1) + "-f:n:d:x:X:g:G:e:E:a:A:F:i:o:p:s:u:z:bvqh?", longopts, &optind)) != -1) { switch (c) { case 1: /* The case of no option */ - if (numfields == -1) { /* This is the dirfile */ - numfields = 0; + if (dirfile_name == NULL) { dirfile_name = optarg; } else { /* Standard output field */ if (numfields > BUF_LEN) { @@ -278,6 +283,9 @@ case 's': skip = strtoll(optarg, NULL, 0); break; + case 'z': + zero = optarg; + break; case 'b': average = 1; fprintf(stderr, "Warning: Ignoring -b found on command line.\n"); @@ -290,6 +298,11 @@ } } + if (dirfile_name == NULL) { + fprintf(stderr, "Error: No dirfile specified.\n"); + exit(-4); + } + if (numfields < 1) { fprintf(stderr, "Error: At least one field must be specified.\n"); exit(-3); @@ -355,7 +368,7 @@ exit(3); } - if (!max_spf && fields[i].spf != max_spf) + if (max_spf && fields[i].spf != max_spf) interpolate = 1; if (fields[i].spf > max_spf) @@ -389,8 +402,8 @@ exit(4); } - n_read = gd_getdata(dirfile, fields[i].name, ff, 0, nf, 0, GD_FLOAT64, - fields[i].u.dbl); + fields[i].n_read = gd_getdata(dirfile, fields[i].name, ff, 0, nf, 0, + GD_FLOAT64, fields[i].u.dbl); } else if (type_data[fields[i].type].t == READ_AS_INT) { fields[i].u.i64 = (int64_t *)malloc(sizeof(int64_t) * n_want); if (fields[i].u.i64 == NULL) { @@ -398,8 +411,8 @@ gd_close(dirfile); exit(4); } - n_read = gd_getdata(dirfile, fields[i].name, ff, 0, nf, 0, GD_INT64, - fields[i].u.i64); + fields[i].n_read = gd_getdata(dirfile, fields[i].name, ff, 0, nf, 0, + GD_INT64, fields[i].u.i64); } else { fields[i].u.u64 = (uint64_t *)malloc(sizeof(uint64_t) * n_want); if (fields[i].u.u64 == NULL) { @@ -407,8 +420,8 @@ gd_close(dirfile); exit(4); } - n_read = gd_getdata(dirfile, fields[i].name, ff, 0, nf, 0, GD_UINT64, - fields[i].u.u64); + fields[i].n_read = gd_getdata(dirfile, fields[i].name, ff, 0, nf, 0, + GD_UINT64, fields[i].u.u64); } if (gd_error(dirfile)) { @@ -416,6 +429,20 @@ char_buffer, BUF_LEN)); gd_close(dirfile); exit(5); + } else if (!zero && n_want > fields[i].n_read) { + if (verbose) + fprintf(stderr, "Short read on field %i, padding %zu frames\n", + i, n_want - fields[i].n_read); + if (type_data[fields[i].type].t == READ_AS_DOUBLE) { + for (k = fields[i].n_read; k < n_want; ++k) + fields[i].u.dbl[k] = NaN; + } else if (type_data[fields[i].type].t == READ_AS_INT) { + memset(fields[i].u.i64 + fields[i].n_read, 0, + (n_want - fields[i].n_read) * sizeof(int64_t)); + } else { + memset(fields[i].u.u64 + fields[i].n_read, 0, + (n_want - fields[i].n_read) * sizeof(uint64_t)); + } } } @@ -424,13 +451,14 @@ snprintf(fields[i].format, F_LEN, "%%%s%s", precision, type_data[fields[i].type].f); - size_t k; gd_spf_t j; for (k = 0; k < nf; k += skip) { for (j = 0; j < (skipping ? 1 : max_spf); j++) { for (i = 0; i < numfields; i++) { if (fields[i].spf == max_spf || skipping) { - if (type_data[fields[i].type].t == READ_AS_DOUBLE) + if (zero && k * fields[i].spf + j >= fields[i].n_read) + printf("%s", zero); + else if (type_data[fields[i].type].t == READ_AS_DOUBLE) printf(fields[i].format, fields[i].u.dbl[k * fields[i].spf + j]); else if (type_data[fields[i].type].t == READ_AS_INT) printf(fields[i].format, fields[i].u.i64[k * fields[i].spf + j]); @@ -456,7 +484,9 @@ else offset = 0; - if (type_data[fields[i].type].t == READ_AS_DOUBLE) { + if (zero && k * fields[i].spf + j >= fields[i].n_read) { + printf("%s", zero); + } else if (type_data[fields[i].type].t == READ_AS_DOUBLE) { slope = (fields[i].u.dbl[k * fields[i].spf + next_samp - offset] - fields[i].u.dbl[k * fields[i].spf + prev_samp - offset]) / ((double)next_samp - (double)prev_samp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |