getdata-commits Mailing List for GetData (Page 19)
Scientific Database Format
Brought to you by:
ketiltrout
This list is closed, nobody may subscribe to it.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(5) |
Oct
(20) |
Nov
(21) |
Dec
(16) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(1) |
Feb
(1) |
Mar
(56) |
Apr
(20) |
May
(4) |
Jun
(2) |
Jul
(3) |
Aug
(11) |
Sep
(2) |
Oct
(4) |
Nov
(18) |
Dec
(16) |
2012 |
Jan
(8) |
Feb
(12) |
Mar
(30) |
Apr
(13) |
May
(10) |
Jun
(17) |
Jul
(18) |
Aug
(19) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(9) |
2013 |
Jan
(1) |
Feb
(4) |
Mar
(27) |
Apr
(6) |
May
(3) |
Jun
(1) |
Jul
(10) |
Aug
|
Sep
(3) |
Oct
(15) |
Nov
(4) |
Dec
(9) |
2014 |
Jan
|
Feb
(3) |
Mar
(4) |
Apr
(10) |
May
(15) |
Jun
|
Jul
(14) |
Aug
|
Sep
(2) |
Oct
(6) |
Nov
|
Dec
(9) |
2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ket...@us...> - 2010-11-27 05:36:31
|
Revision: 485 http://getdata.svn.sourceforge.net/getdata/?rev=485&view=rev Author: ketiltrout Date: 2010-11-27 05:36:23 +0000 (Sat, 27 Nov 2010) Log Message: ----------- Several indecorous memory leaks removed. Also fixed the GD_VERBOSE | GD_IGNORE_DUPS bug. Some tidying in the test suite. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/src/add.c trunk/getdata/src/bzip.c trunk/getdata/src/close.c trunk/getdata/src/entry.c trunk/getdata/src/getdata.c trunk/getdata/src/include.c trunk/getdata/src/internal.h trunk/getdata/src/lzma.c trunk/getdata/src/mod.c trunk/getdata/src/move.c trunk/getdata/src/open.c trunk/getdata/src/parse.c trunk/getdata/src/putdata.c trunk/getdata/src/raw.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/bzip_move_from.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_multiply.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/file.c trunk/getdata/test/fragment_name.c trunk/getdata/test/global_name.c trunk/getdata/test/global_ref.c trunk/getdata/test/global_ref_set.c trunk/getdata/test/gzip_move_from.c trunk/getdata/test/header_complex.c trunk/getdata/test/include_auto.c trunk/getdata/test/include_ignore.c trunk/getdata/test/include_ref.c trunk/getdata/test/move.c trunk/getdata/test/move_data_enc_ar.c trunk/getdata/test/move_data_enc_ra.c trunk/getdata/test/move_data_endian.c trunk/getdata/test/move_data_foffs.c trunk/getdata/test/move_data_nop.c trunk/getdata/test/move_index.c trunk/getdata/test/move_meta.c trunk/getdata/test/move_protect.c trunk/getdata/test/move_subdir.c trunk/getdata/test/name.c trunk/getdata/test/name_move.c trunk/getdata/test/open_nonexistent.c trunk/getdata/test/open_notdirfile.c trunk/getdata/test/parse_duplicate_ignore.c trunk/getdata/test/trunc_rofs.c Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/ChangeLog 2010-11-27 05:36:23 UTC (rev 485) @@ -1,4 +1,45 @@ -2010-11-25 D. V. Wiebe <ge...@ke...> svn:484 +2010-11-27 D. V. Wiebe <ge...@ke...> svn:485 + * test/alter_polynom_coeff.c test/include_ignore.c test/alter_entry.c + test/entry_linterp.c test/entry_multiply.c test/move_data_enc_ar.c + test/gzip_move_from.c test/include_ref.c test/global_name.c + test/entry_phase.c test/move_data_foffs.c test/entry_raw_scalar.c + test/alter_entry_scalar3.c test/move_data_endian.c test/move.c + test/entry_raw.c test/move_data_nop.c test/alter_entry_scalar4.c + test/entry_polynom_scalar.c test/move_index.c test/header_complex.c + test/alter_entry_recode.c test/entry_bit_scalar.c test/entry_scalar_repr.c + test/entry_polynom.c test/file.c test/entry_lincom.c test/name_move.c + test/fragment_name.c test/move_data_enc_ra.c test/move_protect.c + test/alter_entry_scalar2n.c test/move_subdir.c test/entry_lincom_scalar.c + test/entry_phase_scalar.c test/alter_crecip89.c test/bzip_move_from.c + test/move_meta.c test/name.c test/entry_bit.c test/alter_entry_scalar2a.c + test/alter_linterp.c test/global_ref_set.c test/global_ref.c + test/include_auto.c: Free strings. + + * test/trunc_rofs.c test/open_notdirfile.c test/open_nonexistent.c: Close + dirfiles. + + * src/entry.c (_GD_FreeE): Free LUT. + * src/open.c (_GD_CreateDirfile): Close DIR after truncation. + * src/close.c (_GD_FreeD): Free dot list. + * src/getdata.c (_GD_DoRaw) src/putdata.c (_GD_DoRawOut): Free databuffer on + error. + * src/lzma.c (_GD_LzmaSize) src/bzip.c (_GD_Bzip2Size): Close file. + * src/move.c (_GD_MogrifyFile): Free new_filebase if necessary. + * src/parse.c (_GD_ParseFieldSpec): Free entry on duplicate field name. + * src/mod.c (_GD_Change): Transfer the old file structure to the new entry + in the case of RAW fields. Don't forget to free the old CONST storage, if + necessary. + * src/include.c (gd_include): Always free ref_name. + + * src/raw.c (_GD_RawTemp): Call the right close function on error. + + * src/mod.c (gd_alter_crecip89): For some reason, intialise scalar_ind[0]. + + * src/parse.c (_GD_ParseFragment _GD_ParseFieldSpec): Handle GD_IGNORE_DUPS + inside _GD_ParseFieldSpec, which eliminates the spurious error message if + GD_VERBOSE is given. + +2010-11-26 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. Modified: trunk/getdata/src/add.c =================================================================== --- trunk/getdata/src/add.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/add.c 2010-11-27 05:36:23 UTC (rev 485) @@ -557,7 +557,7 @@ /* Directive parsing is skipped -- The Field Spec parser will add the field */ if (!D->error) _GD_ParseFieldSpec(D, n_cols, in_cols, E, "dirfile_madd_spec()", 0, me, - D->standards, 1, 1, 1, &outstring, tok_pos); + D->standards, 1, GD_PEDANTIC, 1, &outstring, tok_pos); free(outstring); @@ -619,7 +619,7 @@ /* Directive parsing is skipped -- The Field Spec parser will add the field */ if (!D->error) _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_add_spec()", 0, - fragment_index, D->standards, 1, 1, 1, &outstring, tok_pos); + fragment_index, D->standards, 1, GD_PEDANTIC, 1, &outstring, tok_pos); free(outstring); Modified: trunk/getdata/src/bzip.c =================================================================== --- trunk/getdata/src/bzip.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/bzip.c 2010-11-27 05:36:23 UTC (rev 485) @@ -258,10 +258,14 @@ ptr->end = n; } else { free(ptr); + BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile); + fclose(ptr->stream); dreturn("%i", -1); return -1; } } + BZ2_bzReadClose(&ptr->bzerror, ptr->bzfile); + fclose(ptr->stream); off_t n = (ptr->base + ptr->end) / GD_SIZE(data_type); free(ptr); Modified: trunk/getdata/src/close.c =================================================================== --- trunk/getdata/src/close.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/close.c 2010-11-27 05:36:23 UTC (rev 485) @@ -44,6 +44,7 @@ } free(D->entry); + free(D->dot_list); free(D->error_string); free(D->error_file); free(D->field_list); Modified: trunk/getdata/src/entry.c =================================================================== --- trunk/getdata/src/entry.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/entry.c 2010-11-27 05:36:23 UTC (rev 485) @@ -49,8 +49,10 @@ case GD_LINTERP_ENTRY: free(entry->in_fields[0]); free(entry->EN(linterp,table)); - if (priv) + if (priv) { free(entry->e->u.linterp.table_path); + free(entry->e->u.linterp.lut); + } break; case GD_RECIP_ENTRY: free(entry->in_fields[0]); Modified: trunk/getdata/src/getdata.c =================================================================== --- trunk/getdata/src/getdata.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/getdata.c 2010-11-27 05:36:23 UTC (rev 485) @@ -293,11 +293,13 @@ /** open the file (and cache the fp) if it hasn't been opened yet. */ if (E->e->u.raw.file[0].fp < 0) { if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_SEEK | GD_EF_READ)) { + free(databuffer); dreturn("%i", 0); return 0; } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) { + free(databuffer); dreturn("%i", 0); return 0; } else if ((*_gd_ef[E->e->u.raw.file[0].encoding].open)(E->e->u.raw.file, @@ -305,6 +307,7 @@ { _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); + free(databuffer); dreturn("%i", 0); return 0; } @@ -314,6 +317,7 @@ E->EN(raw,data_type), 0) == -1) { _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); + free(databuffer); dreturn("%i", 0); return 0; } Modified: trunk/getdata/src/include.c =================================================================== --- trunk/getdata/src/include.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/include.c 2010-11-27 05:36:23 UTC (rev 485) @@ -239,8 +239,8 @@ ref_name); else D->reference_field = E; - free(ref_name); } + free(ref_name); dreturn("%i", new_fragment); return new_fragment; Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/internal.h 2010-11-27 05:36:23 UTC (rev 485) @@ -634,7 +634,7 @@ gd_type_t _GD_NativeType(DIRFILE* D, gd_entry_t* E, int repr); gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols, const gd_entry_t* P, const char* format_file, int linenum, int me, - int standards, int creat, int pedantic, int insert, char **outstring, + int standards, int creat, unsigned long flags, int insert, char **outstring, const char *tok_pos); char* _GD_ParseFragment(FILE* fp, DIRFILE *D, int me, int* standards, unsigned long int *flags); Modified: trunk/getdata/src/lzma.c =================================================================== --- trunk/getdata/src/lzma.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/lzma.c 2010-11-27 05:36:23 UTC (rev 485) @@ -315,10 +315,14 @@ /* seek forward the slow way to the end */ while (!ptr->stream_end) { if (_GD_LzmaDecode(ptr)) { + lzma_end(&ptr->xzfile); + fclose(ptr->stream); dreturn("%i", -1); return -1; } } + lzma_end(&ptr->xzfile); + fclose(ptr->stream); off_t n = (ptr->base + ptr->end) / GD_SIZE(data_type); free(ptr); Modified: trunk/getdata/src/mod.c =================================================================== --- trunk/getdata/src/mod.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/mod.c 2010-11-27 05:36:23 UTC (rev 485) @@ -392,6 +392,7 @@ _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); } + memcpy(Qe.u.raw.file, E->e->u.raw.file, sizeof(struct _gd_raw_file)); break; case GD_LINCOM_ENTRY: @@ -721,10 +722,9 @@ if (Q.EN(scalar,const_type) != E->EN(scalar,const_type)) modified = 1; - if (type == _GD_ConstType(D, E->EN(scalar,const_type))) { + if (type == _GD_ConstType(D, E->EN(scalar,const_type))) Qe.u.scalar.d = E->e->u.scalar.d; - E->e->u.scalar.d = NULL; - } else { + else { /* type convert */ Qe.u.scalar.d = malloc(GD_SIZE(type)); if (Qe.u.scalar.d == NULL) { @@ -751,6 +751,7 @@ *(uint64_t*)Qe.u.scalar.d = (E->EN(scalar,const_type) & (GD_COMPLEX | GD_IEEE754)) ? (uint64_t)*(double*)E->e->u.scalar.d : (uint64_t)*(int64_t*)E->e->u.scalar.d; + free(E->e->u.scalar.d); } break; @@ -1184,6 +1185,7 @@ N.in_fields[0] = (char *)in_field; N.scalar[0] = (cdividend[0] == 0 && cdividend[1] == 0) ? (char *)"" : NULL; _gd_a2c(N.EN(recip,cdividend), cdividend); + N.scalar_ind[0] = 0; N.comp_scal = 1; N.e = NULL; @@ -1487,7 +1489,7 @@ /* Let the parser compose the entry */ N = _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, "dirfile_alter_spec()", 0, - N->fragment_index, standards, 0, 1, 0, &outstring, tok_pos); + N->fragment_index, standards, 0, GD_PEDANTIC, 0, &outstring, tok_pos); free(outstring); @@ -1554,7 +1556,7 @@ if (!D->error) /* Let the parser compose the entry */ N = _GD_ParseFieldSpec(D, n_cols, in_cols, N, "dirfile_malter_spec()", 0, - N->fragment_index, standards, 0, 1, 0, &outstring, tok_pos); + N->fragment_index, standards, 0, GD_PEDANTIC, 0, &outstring, tok_pos); free(outstring); Modified: trunk/getdata/src/move.c =================================================================== --- trunk/getdata/src/move.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/move.c 2010-11-27 05:36:23 UTC (rev 485) @@ -281,10 +281,10 @@ E->e->u.raw.filebase = new_filebase; } } - } + } else + free(new_filebase); if (D->error) { - free(new_filebase); dreturn("%i", -1); return -1; } Modified: trunk/getdata/src/open.c =================================================================== --- trunk/getdata/src/open.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/open.c 2010-11-27 05:36:23 UTC (rev 485) @@ -138,6 +138,7 @@ if (stat(fullname, &statbuf)) { _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_STAT, fullname, errno, NULL); + closedir(dir); dreturn("%p", NULL); return NULL; } @@ -146,11 +147,14 @@ if (S_ISREG(statbuf.st_mode)) { if (unlink(fullname)) { _GD_SetError(D, GD_E_TRUNC, GD_E_TRUNC_UNLINK, fullname, errno, NULL); + closedir(dir); dreturn("%p", NULL); return NULL; } } } + + closedir(dir); } /* Create, if needed */ Modified: trunk/getdata/src/parse.c =================================================================== --- trunk/getdata/src/parse.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/parse.c 2010-11-27 05:36:23 UTC (rev 485) @@ -1239,16 +1239,17 @@ * specification */ gd_entry_t* _GD_ParseFieldSpec(DIRFILE* D, int n_cols, char** in_cols, const gd_entry_t* P, const char* format_file, int linenum, int me, - int standards, int creat, int pedantic, int insert, char **outstring, + int standards, int creat, unsigned long flags, int insert, char **outstring, const char *tok_pos) { gd_entry_t* E = NULL; void *ptr; char *cptr; int is_dot = 0; + const int pedantic = flags & GD_PEDANTIC; - dtrace("%p, %i, %p, %p, \"%s\", %i, %u, %i, %i, %i, %i, %p, %p", D, n_cols, - in_cols, P, format_file, linenum, me, standards, creat, pedantic, insert, + dtrace("%p, %i, %p, %p, \"%s\", %i, %i, %i, %i, %lx, %i, %p, %p", D, n_cols, + in_cols, P, format_file, linenum, me, standards, creat, flags, insert, outstring, tok_pos); /* Check for barth-style metafield definition */ @@ -1270,8 +1271,7 @@ /* point in_cols[0] to the metafield name */ in_cols[0] = cptr + 1; E = _GD_ParseFieldSpec(D, n_cols, in_cols, P, D->fragment[me].cname, - linenum, me, standards, creat, pedantic, insert, outstring, - tok_pos); + linenum, me, standards, creat, flags, insert, outstring, tok_pos); } dreturn("%p", (!insert) ? E : NULL); return (!insert) ? E : NULL; @@ -1389,8 +1389,10 @@ &u); if (Q) { - _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_DUPLICATE, format_file, linenum, - D->fragment[Q->fragment_index].cname); + if (~flags & GD_IGNORE_DUPS) + _GD_SetError(D, GD_E_FORMAT, GD_E_FORMAT_DUPLICATE, format_file, + linenum, D->fragment[Q->fragment_index].cname); + _GD_FreeE(E, 1); dreturn("%p", NULL); return NULL; } @@ -1741,7 +1743,7 @@ linenum, NULL); else _GD_ParseFieldSpec(D, n_cols - 2, in_cols + 2, P, D->fragment[me].cname, - linenum, me, *standards, 0, pedantic, 1, outstring, tok_pos); + linenum, me, *standards, 0, *flags, 1, outstring, tok_pos); } else if (strcmp(ptr, "PROTECT") == 0 && (!pedantic || *standards >= 6)) { if (strcmp(in_cols[1], "none") == 0) D->fragment[me].protection = GD_PROTECT_NONE; @@ -1820,13 +1822,10 @@ if (D->error == GD_E_OK && !match) first_raw = _GD_ParseFieldSpec(D, n_cols, in_cols, NULL, - D->fragment[me].cname, linenum, me, *standards, 0, - *flags & GD_PEDANTIC, 1, &outstring, tok_pos); + D->fragment[me].cname, linenum, me, *standards, 0, *flags, 1, + &outstring, tok_pos); - if (*flags & GD_IGNORE_DUPS && D->error == GD_E_FORMAT && - D->suberror == GD_E_FORMAT_DUPLICATE) - _GD_ClearError(D); /* ignore this line, continue parsing */ - else if (D->error == GD_E_FORMAT) { + if (D->error == GD_E_FORMAT) { /* we guarantee a buffer size of at least GD_MAX_LINE_LENGTH */ if (n < GD_MAX_LINE_LENGTH) { char *ptr = (char *)realloc(instring, GD_MAX_LINE_LENGTH); Modified: trunk/getdata/src/putdata.c =================================================================== --- trunk/getdata/src/putdata.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/putdata.c 2010-11-27 05:36:23 UTC (rev 485) @@ -54,6 +54,11 @@ s0 -= D->fragment[E->fragment_index].frame_offset * E->EN(raw,spf); + if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_SEEK | GD_EF_WRITE)) { + dreturn("%i", 0); + return 0; + } + databuffer = _GD_Alloc(D, E->EN(raw,data_type), ns); if (databuffer == NULL) { @@ -69,11 +74,6 @@ return 0; } - if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_SEEK | GD_EF_WRITE)) { - dreturn("%i", 0); - return 0; - } - if (_gd_ef[E->e->u.raw.file[0].encoding].ecor) { /* convert to/from middle-ended doubles */ if ((E->EN(raw,data_type) == GD_FLOAT64 || E->EN(raw,data_type) == @@ -104,12 +104,14 @@ /* open file for reading / writing if not already opened */ if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) { + free(databuffer); dreturn("%i", 0); return 0; } else if ((*_gd_ef[E->e->u.raw.file[0].encoding].open)(E->e->u.raw.file, D->flags & GD_ACCMODE, 1)) { _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); + free(databuffer); dreturn("%i", 0); return 0; } @@ -119,6 +121,7 @@ E->EN(raw,data_type), 1) == -1) { _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); + free(databuffer); dreturn("%i", 0); return 0; } Modified: trunk/getdata/src/raw.c =================================================================== --- trunk/getdata/src/raw.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/src/raw.c 2010-11-27 05:36:23 UTC (rev 485) @@ -153,7 +153,7 @@ case GD_TEMP_DESTROY: if (file[1].name != NULL) { if (file[1].fp >= 0) - if (_GD_AsciiClose(file + 1)) { + if (_GD_RawClose(file + 1)) { dreturn("%i", -1); return -1; } Modified: trunk/getdata/test/alter_crecip89.c =================================================================== --- trunk/getdata/test/alter_crecip89.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_crecip89.c 2010-11-27 05:36:23 UTC (rev 485) @@ -54,6 +54,7 @@ CHECKF(E.EN(recip,cdividend)[0], div[0]); CHECKF(E.EN(recip,cdividend)[1], div[1]); CHECKS(E.in_fields[0], "phase"); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_entry.c =================================================================== --- trunk/getdata/test/alter_entry.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_entry.c 2010-11-27 05:36:23 UTC (rev 485) @@ -50,6 +50,7 @@ CHECKI(error, 0); CHECKI(n, 11); CHECKI(ret, 0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_entry_recode.c =================================================================== --- trunk/getdata/test/alter_entry_recode.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_entry_recode.c 2010-11-27 05:36:23 UTC (rev 485) @@ -66,6 +66,7 @@ CHECKI(error, 0); CHECKI(n, 32); CHECKI(ret, 0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_entry_scalar2a.c =================================================================== --- trunk/getdata/test/alter_entry_scalar2a.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_entry_scalar2a.c 2010-11-27 05:36:23 UTC (rev 485) @@ -45,6 +45,7 @@ CHECKI(n, 0); CHECKI(ret, 0); CHECKI(E.EN(bit,bitnum), 11); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_entry_scalar2n.c =================================================================== --- trunk/getdata/test/alter_entry_scalar2n.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_entry_scalar2n.c 2010-11-27 05:36:23 UTC (rev 485) @@ -53,6 +53,7 @@ CHECKI(n, 0); CHECKI(ret, 0); CHECKI(E.EN(raw,spf), 11); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_entry_scalar3.c =================================================================== --- trunk/getdata/test/alter_entry_scalar3.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_entry_scalar3.c 2010-11-27 05:36:23 UTC (rev 485) @@ -44,6 +44,7 @@ CHECKI(ret,0); CHECKI(E.EN(bit,bitnum), 3); CHECKP(E.scalar[0]); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_entry_scalar4.c =================================================================== --- trunk/getdata/test/alter_entry_scalar4.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_entry_scalar4.c 2010-11-27 05:36:23 UTC (rev 485) @@ -45,6 +45,7 @@ CHECKI(ret, 0); CHECKI(E.EN(bit,numbits), 11); CHECKP(E.scalar[1]); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/alter_linterp.c =================================================================== --- trunk/getdata/test/alter_linterp.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_linterp.c 2010-11-27 05:36:23 UTC (rev 485) @@ -72,6 +72,7 @@ CHECKI(error2, 0); CHECKS(e.in_fields[0], "data"); CHECKS(e.EN(linterp,table), "table1"); + gd_free_entry_strings(&e); return r; } Modified: trunk/getdata/test/alter_polynom_coeff.c =================================================================== --- trunk/getdata/test/alter_polynom_coeff.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/alter_polynom_coeff.c 2010-11-27 05:36:23 UTC (rev 485) @@ -64,6 +64,7 @@ CHECKI(error2,0); CHECKI(n,0); CHECKI(ret,0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/bzip_move_from.c =================================================================== --- trunk/getdata/test/bzip_move_from.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/bzip_move_from.c 2010-11-27 05:36:23 UTC (rev 485) @@ -100,6 +100,7 @@ CHECKI(unlink_data, -1); CHECKI(unlink_bz2data, 0); #endif + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_bit.c =================================================================== --- trunk/getdata/test/entry_bit.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_bit.c 2010-11-27 05:36:23 UTC (rev 485) @@ -42,6 +42,7 @@ CHECKI(E.EN(bit,numbits), 4); CHECKP(E.scalar[0]); CHECKP(E.scalar[1]); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_bit_scalar.c =================================================================== --- trunk/getdata/test/entry_bit_scalar.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_bit_scalar.c 2010-11-27 05:36:23 UTC (rev 485) @@ -43,6 +43,7 @@ CHECKS(E.in_fields[0], "in1"); CHECKI(E.EN(bit,bitnum), 3); CHECKI(E.EN(bit,numbits), 4); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_lincom.c =================================================================== --- trunk/getdata/test/entry_lincom.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_lincom.c 2010-11-27 05:36:23 UTC (rev 485) @@ -48,6 +48,7 @@ CHECKF(E.EN(lincom,b)[1], 4.); CHECKF(E.EN(lincom,m)[2], 5.); CHECKF(E.EN(lincom,b)[2], 6.); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_lincom_scalar.c =================================================================== --- trunk/getdata/test/entry_lincom_scalar.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_lincom_scalar.c 2010-11-27 05:36:23 UTC (rev 485) @@ -61,6 +61,7 @@ CHECKF(E.EN(lincom,b)[1], 4.); CHECKF(E.EN(lincom,m)[2], 5.); CHECKF(E.EN(lincom,b)[2], 6.); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_linterp.c =================================================================== --- trunk/getdata/test/entry_linterp.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_linterp.c 2010-11-27 05:36:23 UTC (rev 485) @@ -38,6 +38,7 @@ CHECKI(E.field_type, GD_LINTERP_ENTRY); CHECKS(E.in_fields[0], "in1"); CHECKS(E.EN(linterp,table), "../tablefile"); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_multiply.c =================================================================== --- trunk/getdata/test/entry_multiply.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_multiply.c 2010-11-27 05:36:23 UTC (rev 485) @@ -38,6 +38,7 @@ CHECKX(E.field_type, GD_MULTIPLY_ENTRY); CHECKS(E.in_fields[0], "in1"); CHECKS(E.in_fields[1], "in2"); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_phase.c =================================================================== --- trunk/getdata/test/entry_phase.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_phase.c 2010-11-27 05:36:23 UTC (rev 485) @@ -38,6 +38,7 @@ CHECKX(E.field_type, GD_PHASE_ENTRY); CHECKS(E.in_fields[0], "in1"); CHECKI(E.EN(phase,shift), 3); + gd_free_entry_strings(&E); return 0; } Modified: trunk/getdata/test/entry_phase_scalar.c =================================================================== --- trunk/getdata/test/entry_phase_scalar.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_phase_scalar.c 2010-11-27 05:36:23 UTC (rev 485) @@ -40,6 +40,7 @@ CHECKS(E.in_fields[0], "in1"); CHECKS(E.scalar[0], "shift"); CHECKI(E.EN(phase,shift), 3); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_polynom.c =================================================================== --- trunk/getdata/test/entry_polynom.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_polynom.c 2010-11-27 05:36:23 UTC (rev 485) @@ -42,6 +42,7 @@ CHECKS(E.in_fields[0], "in"); for (fd = 0; fd < 4; ++fd) CHECKFi(fd,E.EN(polynom,a)[fd], fd + 1.); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_polynom_scalar.c =================================================================== --- trunk/getdata/test/entry_polynom_scalar.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_polynom_scalar.c 2010-11-27 05:36:23 UTC (rev 485) @@ -54,6 +54,7 @@ CHECKS(E.scalar[4], "a4"); for (fd = 0; fd < 4; ++fd) CHECKFi(fd,E.EN(polynom,a)[fd], fd + 1.); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_raw.c =================================================================== --- trunk/getdata/test/entry_raw.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_raw.c 2010-11-27 05:36:23 UTC (rev 485) @@ -38,6 +38,7 @@ CHECKI(E.field_type, GD_RAW_ENTRY); CHECKU(E.EN(raw,spf), 8); CHECKX(E.EN(raw,data_type), GD_UINT8); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_raw_scalar.c =================================================================== --- trunk/getdata/test/entry_raw_scalar.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_raw_scalar.c 2010-11-27 05:36:23 UTC (rev 485) @@ -40,6 +40,7 @@ CHECKS(E.scalar[0], "const"); CHECKU(E.EN(raw,spf), 8); CHECKX(E.EN(raw,data_type), GD_UINT8); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/entry_scalar_repr.c =================================================================== --- trunk/getdata/test/entry_scalar_repr.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/entry_scalar_repr.c 2010-11-27 05:36:23 UTC (rev 485) @@ -47,6 +47,7 @@ CHECKS(E.scalar[GD_MAX_LINCOM], "b1.i"); CHECKF(E.EN(lincom,m)[0], 1.1); CHECKF(E.EN(lincom,b)[0], 9.3); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/file.c =================================================================== --- trunk/getdata/test/file.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/file.c 2010-11-27 05:36:23 UTC (rev 485) @@ -43,6 +43,7 @@ CHECKI(error, 0); CHECKS(path, __TEST__ "dirfile/data"); + free(path); return r; } Modified: trunk/getdata/test/fragment_name.c =================================================================== --- trunk/getdata/test/fragment_name.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/fragment_name.c 2010-11-27 05:36:23 UTC (rev 485) @@ -43,6 +43,8 @@ CHECKS(form0, __TEST__ "dirfile/format"); CHECKS(form1, __TEST__ "dirfile/format1"); + free(form0); + free(form1); return r; } Modified: trunk/getdata/test/global_name.c =================================================================== --- trunk/getdata/test/global_name.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/global_name.c 2010-11-27 05:36:23 UTC (rev 485) @@ -34,6 +34,7 @@ CHECKI(error, GD_E_OK); CHECKS(name, filedir); + free(name); return r; } Modified: trunk/getdata/test/global_ref.c =================================================================== --- trunk/getdata/test/global_ref.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/global_ref.c 2010-11-27 05:36:23 UTC (rev 485) @@ -34,6 +34,7 @@ CHECKI(error, 0); CHECKS(ref, "data"); + free(ref); return r; } Modified: trunk/getdata/test/global_ref_set.c =================================================================== --- trunk/getdata/test/global_ref_set.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/global_ref_set.c 2010-11-27 05:36:23 UTC (rev 485) @@ -35,6 +35,7 @@ CHECKI(error, GD_E_OK); CHECKS(ref, "data2"); + free(ref); return r; } Modified: trunk/getdata/test/gzip_move_from.c =================================================================== --- trunk/getdata/test/gzip_move_from.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/gzip_move_from.c 2010-11-27 05:36:23 UTC (rev 485) @@ -100,6 +100,7 @@ CHECKI(unlink_data, -1); CHECKI(unlink_gzdata, 0); #endif + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/header_complex.c =================================================================== --- trunk/getdata/test/header_complex.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/header_complex.c 2010-11-27 05:36:23 UTC (rev 485) @@ -41,7 +41,6 @@ CHECKFi(0,E.EN(lincom,cm)[1][1], 8.8); CHECKFi(0,E.EN(lincom,cb)[1][0], 9.9); CHECKFi(0,E.EN(lincom,cb)[1][1], 1.1); - gd_free_entry_strings(&E); const double ca[] = { 2.1, 3.2, 4.3, 5.4, 6.5, 7.6 }; @@ -62,6 +61,7 @@ CHECKFi(1,E.EN(polynom,ca)[1][1], ca[3]); CHECKFi(1,E.EN(polynom,ca)[2][0], ca[4]); CHECKFi(1,E.EN(polynom,ca)[2][1], ca[5]); + gd_free_entry_strings(&E); gd_close(D); Modified: trunk/getdata/test/include_auto.c =================================================================== --- trunk/getdata/test/include_auto.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/include_auto.c 2010-11-27 05:36:23 UTC (rev 485) @@ -47,6 +47,7 @@ CHECKPN(ptr); CHECKS(reference, "data"); CHECKU(spf, 11); + free(reference); return r; } Modified: trunk/getdata/test/include_ignore.c =================================================================== --- trunk/getdata/test/include_ignore.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/include_ignore.c 2010-11-27 05:36:23 UTC (rev 485) @@ -45,6 +45,7 @@ CHECKI(error2, 0); CHECKS(reference, "data1"); CHECKU(spf, 11); + free(reference); return r; } Modified: trunk/getdata/test/include_ref.c =================================================================== --- trunk/getdata/test/include_ref.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/include_ref.c 2010-11-27 05:36:23 UTC (rev 485) @@ -45,6 +45,7 @@ CHECKI(error2, 0); CHECKS(reference, "data"); CHECKU(spf, 11); + free(reference); return r; } Modified: trunk/getdata/test/move.c =================================================================== --- trunk/getdata/test/move.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move.c 2010-11-27 05:36:23 UTC (rev 485) @@ -44,6 +44,7 @@ CHECKI(error, GD_E_OK); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 1); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_data_enc_ar.c =================================================================== --- trunk/getdata/test/move_data_enc_ar.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_data_enc_ar.c 2010-11-27 05:36:23 UTC (rev 485) @@ -74,6 +74,7 @@ CHECKI(E.fragment_index, 1); CHECKI(unlink_data, 0); CHECKI(unlink_txtdata, -1); + gd_free_entry_strings(&E); return 0; } Modified: trunk/getdata/test/move_data_enc_ra.c =================================================================== --- trunk/getdata/test/move_data_enc_ra.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_data_enc_ra.c 2010-11-27 05:36:23 UTC (rev 485) @@ -79,6 +79,7 @@ CHECKI(E.fragment_index, 1); CHECKI(unlink_data, -1); CHECKI(unlink_txtdata, 0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_data_endian.c =================================================================== --- trunk/getdata/test/move_data_endian.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_data_endian.c 2010-11-27 05:36:23 UTC (rev 485) @@ -69,6 +69,7 @@ CHECKI(error, GD_E_OK); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 1); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_data_foffs.c =================================================================== --- trunk/getdata/test/move_data_foffs.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_data_foffs.c 2010-11-27 05:36:23 UTC (rev 485) @@ -63,6 +63,7 @@ CHECKI(error, GD_E_OK); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 1); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_data_nop.c =================================================================== --- trunk/getdata/test/move_data_nop.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_data_nop.c 2010-11-27 05:36:23 UTC (rev 485) @@ -54,6 +54,7 @@ CHECKI(error, GD_E_OK); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 1); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_index.c =================================================================== --- trunk/getdata/test/move_index.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_index.c 2010-11-27 05:36:23 UTC (rev 485) @@ -44,6 +44,7 @@ CHECKI(error, GD_E_BAD_INDEX); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_meta.c =================================================================== --- trunk/getdata/test/move_meta.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_meta.c 2010-11-27 05:36:23 UTC (rev 485) @@ -45,6 +45,7 @@ CHECKI(error, GD_E_OK); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 1); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_protect.c =================================================================== --- trunk/getdata/test/move_protect.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_protect.c 2010-11-27 05:36:23 UTC (rev 485) @@ -44,6 +44,7 @@ CHECKI(error, GD_E_PROTECTED); CHECKI(ge_ret, 0); CHECKI(E.fragment_index, 0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/move_subdir.c =================================================================== --- trunk/getdata/test/move_subdir.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/move_subdir.c 2010-11-27 05:36:23 UTC (rev 485) @@ -57,6 +57,7 @@ CHECKI(E.fragment_index, 1); CHECKI(unlink_data, -1); CHECKI(unlink_new_data, 0); + gd_free_entry_strings(&E); return r; } Modified: trunk/getdata/test/name.c =================================================================== --- trunk/getdata/test/name.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/name.c 2010-11-27 05:36:23 UTC (rev 485) @@ -61,6 +61,10 @@ CHECKS(field_list[3], "zata"); CHECKI(unlink_data, 0); CHECKI(unlink_zata, -1); + free(field_list[0]); + free(field_list[1]); + free(field_list[2]); + free(field_list[3]); return r; } Modified: trunk/getdata/test/name_move.c =================================================================== --- trunk/getdata/test/name_move.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/name_move.c 2010-11-27 05:36:23 UTC (rev 485) @@ -61,6 +61,10 @@ CHECKS(field_list[3], "zata"); CHECKI(unlink_data, -1); CHECKI(unlink_zata, 0); + free(field_list[0]); + free(field_list[1]); + free(field_list[2]); + free(field_list[3]); return r; } Modified: trunk/getdata/test/open_nonexistent.c =================================================================== --- trunk/getdata/test/open_nonexistent.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/open_nonexistent.c 2010-11-27 05:36:23 UTC (rev 485) @@ -8,6 +8,7 @@ int error = gd_error(D); CHECKI(error, GD_E_OPEN); + gd_discard(D); return r; } Modified: trunk/getdata/test/open_notdirfile.c =================================================================== --- trunk/getdata/test/open_notdirfile.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/open_notdirfile.c 2010-11-27 05:36:23 UTC (rev 485) @@ -20,6 +20,7 @@ rmdir(filedir); int error = gd_error(D); CHECKI(error, GD_E_OPEN); + gd_discard(D); return r; } Modified: trunk/getdata/test/parse_duplicate_ignore.c =================================================================== --- trunk/getdata/test/parse_duplicate_ignore.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/parse_duplicate_ignore.c 2010-11-27 05:36:23 UTC (rev 485) @@ -22,7 +22,7 @@ write(fd, format_data, strlen(format_data)); close(fd); - DIRFILE* D = gd_open(filedir, GD_RDONLY | GD_IGNORE_DUPS); + DIRFILE* D = gd_open(filedir, GD_RDONLY | GD_IGNORE_DUPS | GD_VERBOSE); int error = gd_error(D); gd_close(D); Modified: trunk/getdata/test/trunc_rofs.c =================================================================== --- trunk/getdata/test/trunc_rofs.c 2010-11-27 02:20:05 UTC (rev 484) +++ trunk/getdata/test/trunc_rofs.c 2010-11-27 05:36:23 UTC (rev 485) @@ -26,12 +26,13 @@ } DIRFILE* D = gd_open(filedir, GD_RDWR | GD_TRUNC); + int error = gd_error(D); + gd_discard(D); chmod(filedir, 0777); unlink(format); rmdir(filedir); - int error = gd_error(D); CHECKI(error, GD_E_TRUNC); return r; } 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. |
From: <ket...@us...> - 2010-11-23 02:20:57
|
Revision: 483 http://getdata.svn.sourceforge.net/getdata/?rev=483&view=rev Author: ketiltrout Date: 2010-11-23 02:20:51 +0000 (Tue, 23 Nov 2010) Log Message: ----------- How did that not make it in to the repository...? Modified Paths: -------------- trunk/getdata/ChangeLog Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-23 02:02:00 UTC (rev 482) +++ trunk/getdata/ChangeLog 2010-11-23 02:20:51 UTC (rev 483) @@ -1,3 +1,6 @@ +2010-11-22 D. V. Wiebe <ge...@ke...> svn:480 + GetData 0.7.0 released. + 2010-11-20 D. V. Wiebe <ge...@ke...> svn:478 * bindings/idl/getdata.c: Properly terminate IDL keyword lists. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-23 02:02:06
|
Revision: 482 http://getdata.svn.sourceforge.net/getdata/?rev=482&view=rev Author: ketiltrout Date: 2010-11-23 02:02:00 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Done with the 0.6 branch. Removed Paths: ------------- branches/getdata-0.6/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-23 02:01:25
|
Revision: 481 http://getdata.svn.sourceforge.net/getdata/?rev=481&view=rev Author: ketiltrout Date: 2010-11-23 02:01:19 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Tag getdata-0.7.0 Added Paths: ----------- tags/getdata-0.7.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-23 01:21:41
|
Revision: 480 http://getdata.svn.sourceforge.net/getdata/?rev=480&view=rev Author: ketiltrout Date: 2010-11-23 01:21:34 +0000 (Tue, 23 Nov 2010) Log Message: ----------- Contemporise! Modified Paths: -------------- trunk/getdata/RELEASE_NOTES.in Modified: trunk/getdata/RELEASE_NOTES.in =================================================================== --- trunk/getdata/RELEASE_NOTES.in 2010-11-23 00:51:47 UTC (rev 479) +++ trunk/getdata/RELEASE_NOTES.in 2010-11-23 01:21:34 UTC (rev 480) @@ -1,4 +1,4 @@ -GetData 0.6.1 is known to compile and pass the test suite on the following systems (including C++ and Fortran bindings): +GetData 0.7.0 is known to compile and pass the test suite on the following systems (including C++ and Fortran bindings): Linux: * x86 and x86_64, using gcc 4.5 or icc 10.1, under Slackware, Fedora, Ubuntu, CentOS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-23 00:51:55
|
Revision: 479 http://getdata.svn.sourceforge.net/getdata/?rev=479&view=rev Author: ketiltrout Date: 2010-11-23 00:51:47 +0000 (Tue, 23 Nov 2010) Log Message: ----------- GetData 0.7.0. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/NEWS trunk/getdata/RELEASE_NOTES.in trunk/getdata/bindings/idl/Makefile.am trunk/getdata/configure.ac trunk/getdata/man/Makefile.am trunk/html/api.html trunk/html/dirfile.html trunk/html/encoding.html trunk/html/getdata.css trunk/html/getdata.html trunk/html/index.html Added Paths: ----------- trunk/getdata/man/checkdirfile.1 trunk/getdata/man/dirfile2ascii.1 Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/getdata/ChangeLog 2010-11-23 00:51:47 UTC (rev 479) @@ -1,3 +1,6 @@ +2010-11-20 D. V. Wiebe <ge...@ke...> svn:478 + * bindings/idl/getdata.c: Properly terminate IDL keyword lists. + 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 Modified: trunk/getdata/NEWS =================================================================== --- trunk/getdata/NEWS 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/getdata/NEWS 2010-11-23 00:51:47 UTC (rev 479) @@ -1,4 +1,4 @@ -New in version 0.7.0rc4: +New in version 0.7.0: Dirfile Changes @@ -13,9 +13,9 @@ (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. - * Just to be clear: these removed features are still supported by GetData, - since it can handle older Standards Versions as well. + * The long-deprecated single character data type codes have been removed from + Standards Version 8. (They are still accepted by GetData, which handles + all previous 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 @@ -45,7 +45,7 @@ assumptions as to their behaviour in certain undocumented situtations. Most noticably, they still prohibit ASCII control codes (bytes < 0x20) and '/' in field names. We also assume these dirfiles have native byte sex, even - though some early Standards Version implied only little-ended data was + though some early GetData behaviour 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 @@ -193,6 +193,9 @@ * Python: dirfiles are now opened read-only by default. * C++ BUG FIX: Entry::Scalar() no longer rejects valid values of index. + * IDL BUG FIX: A memory impropriety involving keyword arguments. This bug + manifested by rejecting valid keyword arguments on 64-bit systems, but may + have had other, subtle effects on 32-bit systems as well. * 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. Modified: trunk/getdata/RELEASE_NOTES.in =================================================================== --- trunk/getdata/RELEASE_NOTES.in 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/getdata/RELEASE_NOTES.in 2010-11-23 00:51:47 UTC (rev 479) @@ -1,12 +1,18 @@ GetData 0.6.1 is known to compile and pass the test suite on the following systems (including C++ and Fortran bindings): -gcc 4.4.2 / glibc 2.11 / i686, x86_64, ppc, ppc64 / Fedora 12 and 13 -gcc 4.4.3 / glibc 2.11 / i686 / Slackware -current -gcc 4.1.2, icc 10.1.015 / glibc 2.5 / x86_64 / CentOS Release 5 +Linux: +* x86 and x86_64, using gcc 4.5 or icc 10.1, under Slackware, Fedora, Ubuntu, CentOS +* armv5tej, using gcc 3.3 under Debian +MacOS X: +* x86 and x86_64, using Xcode 3.2/gcc 4.2, under MacOS X Snow Leopard +Cygwin: +* x86_64, using gcc 4.3 +Win32: +* x86_64, using mingw/gcc 4.5, under MSys -The Python bindings are known to work and pass the test suite using Python 2.4.3 and Python 2.6.4. +The Python bindings have been tested with Python 2.4 and Python 2.6. -The IDL bindings are known to work and pass the test suite using IDL 6.0 and IDL 7.1. +The IDL bindings have been tested with IDL 6.0, IDL 7.1 and IDL 8.0. -------------------------------------------------------------------------------------------------------- Modified: trunk/getdata/bindings/idl/Makefile.am =================================================================== --- trunk/getdata/bindings/idl/Makefile.am 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/getdata/bindings/idl/Makefile.am 2010-11-23 00:51:47 UTC (rev 479) @@ -31,7 +31,7 @@ SUBDIRS=test idl_LTLIBRARIES = idl_getdata.la -idl_HEADERS = idl_getdata.dlm +nodist_idl_HEADERS = idl_getdata.dlm # idl makes heavy use of type punning, ergo -fno-strict-aliasing AM_CFLAGS = ${WALL} $(IDL_CFLAGS) -fno-strict-aliasing Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/getdata/configure.ac 2010-11-23 00:51:47 UTC (rev 479) @@ -22,7 +22,7 @@ m4_define(getdata_major, 0) m4_define(getdata_minor, 7) m4_define(getdata_revision, 0) -m4_define(getdata_extra, [rc4]) +m4_define(getdata_extra, []) m4_define(getdata_version, getdata_major.getdata_minor.getdata_revision[]getdata_extra) Modified: trunk/getdata/man/Makefile.am =================================================================== --- trunk/getdata/man/Makefile.am 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/getdata/man/Makefile.am 2010-11-23 00:51:47 UTC (rev 479) @@ -28,28 +28,29 @@ nodist_man_MANS = gd_alter_encoding.3 gd_alter_endianness.3 \ gd_alter_frameoffset.3 -dist_man_MANS = gd_add.3 gd_add_bit.3 gd_add_spec.3 gd_alter_bit.3 \ - gd_alter_entry.3 gd_alter_protection.3 gd_alter_spec.3 \ - gd_bof.3 gd_carray_len.3 gd_carrays.3 gd_cbopen.3 gd_close.3 \ - gd_get_carray_slice.3 gd_put_carray_slice.3 gd_get_constant.3 \ - gd_put_constant.3 gd_constants.3 gd_getdata.3 gd_putdata.3 \ - gd_delete.3 gd_encoding.3 gd_endianness.3 gd_entry.3 \ - gd_entry_type.3 gd_eof.3 gd_error.3 gd_error_string.3 \ - gd_field_list.3 gd_field_list_by_type.3 gd_flush.3 \ - gd_fragment_index.3 gd_fragmentname.3 gd_framenum_subset.3 \ - gd_frameoffset.3 gd_free_entry_strings.3 gd_include.3 \ - gd_invalid_dirfile.3 gd_madd_bit.3 gd_mcarrays.3 \ - gd_mconstants.3 gd_metaflush.3 gd_mfield_list.3 \ - gd_mfield_list_by_type.3 gd_move.3 gd_mstrings.3 \ - gd_mvector_list.3 gd_dirfilename.3 gd_native_type.3 \ - gd_nfields.3 gd_nfields_by_type.3 gd_nfragments.3 \ - gd_nframes.3 gd_nmfields.3 gd_nmfields_by_type.3 \ - gd_nmvectors.3 gd_nvectors.3 gd_parent_fragment.3 \ - gd_parser_callback.3 gd_protection.3 gd_raw_filename.3 \ - gd_reference.3 gd_rename.3 gd_rewrite_fragment.3 gd_spf.3 \ - gd_get_string.3 gd_put_string.3 gd_strings.3 gd_uninclude.3 \ - gd_validate.3 gd_vector_list.3 dirfile.5 dirfile-encoding.5 \ - dirfile-format.5 $(LFS_transitional_mans) +dist_man_MANS = checkdirfile.1 dirfile2ascii.1 gd_add.3 gd_add_bit.3 \ + gd_add_spec.3 gd_alter_bit.3 gd_alter_entry.3 \ + gd_alter_protection.3 gd_alter_spec.3 gd_bof.3 gd_carray_len.3 \ + gd_carrays.3 gd_cbopen.3 gd_close.3 gd_get_carray_slice.3 \ + gd_put_carray_slice.3 gd_get_constant.3 gd_put_constant.3 \ + gd_constants.3 gd_getdata.3 gd_putdata.3 gd_delete.3 \ + gd_encoding.3 gd_endianness.3 gd_entry.3 gd_entry_type.3 \ + gd_eof.3 gd_error.3 gd_error_string.3 gd_field_list.3 \ + gd_field_list_by_type.3 gd_flush.3 gd_fragment_index.3 \ + gd_fragmentname.3 gd_framenum_subset.3 gd_frameoffset.3 \ + gd_free_entry_strings.3 gd_include.3 gd_invalid_dirfile.3 \ + gd_madd_bit.3 gd_mcarrays.3 gd_mconstants.3 gd_metaflush.3 \ + gd_mfield_list.3 gd_mfield_list_by_type.3 gd_move.3 \ + gd_mstrings.3 gd_mvector_list.3 gd_dirfilename.3 \ + gd_native_type.3 gd_nfields.3 gd_nfields_by_type.3 \ + gd_nfragments.3 gd_nframes.3 gd_nmfields.3 \ + gd_nmfields_by_type.3 gd_nmvectors.3 gd_nvectors.3 \ + gd_parent_fragment.3 gd_parser_callback.3 gd_protection.3 \ + gd_raw_filename.3 gd_reference.3 gd_rename.3 \ + gd_rewrite_fragment.3 gd_spf.3 gd_get_string.3 gd_put_string.3 \ + gd_strings.3 gd_uninclude.3 gd_validate.3 gd_vector_list.3 \ + dirfile.5 dirfile-encoding.5 dirfile-format.5 \ + $(LFS_transitional_mans) install-data-hook: ${INSTALL_DATA_HOOK64} cd $(DESTDIR)$(mandir)/man3 && \ Added: trunk/getdata/man/checkdirfile.1 =================================================================== --- trunk/getdata/man/checkdirfile.1 (rev 0) +++ trunk/getdata/man/checkdirfile.1 2010-11-23 00:51:47 UTC (rev 479) @@ -0,0 +1,48 @@ +.\" checkdirfile.1. The checkdirfile 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 checkdirfile 1 "22 November 2010" "Version 0.7.0" "GETDATA" +.SH NAME +checkdirfile \(em verify Dirfile database metadata +.SH SYNOPSIS +.nh +.ad l +.P +.B checkdirfile +.I DIRFILE +.P +.B checkdirfile +.RB "[\| " \-\-help " | " \-\-version " \|]" +.hy +.ad n +.SH DESCRIPTION +Report errors in metadata of the dirfile(5) database specified by +.IR DIRFILE . + +Three separate checks are performed. First, the format specification metadata +is scanned for syntax errors (see dirfile-format(5)) and Dirfile Standards +compliance. Second, fields defined in the database are checked for +self-consistency. Finally, the database is queried for its length. +.P +.B --help +.PD 0 +.TP +.PD +.B --version +Show usage and version information and exit. + +.SH SEE ALSO +.BR dirfile (5), +.BR dirfile-format (5) Added: trunk/getdata/man/dirfile2ascii.1 =================================================================== --- trunk/getdata/man/dirfile2ascii.1 (rev 0) +++ trunk/getdata/man/dirfile2ascii.1 2010-11-23 00:51:47 UTC (rev 479) @@ -0,0 +1,131 @@ +.\" dirfile2ascii.1. The dirfile2ascii 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 dirfile2ascii 1 "22 November 2010" "Version 0.7.0" "GETDATA" +.SH NAME +dirfile2ascii \(em output dirfile database vectors as ASCII text +.SH SYNOPSIS +.nh +.ad l +.TP +\fBdirfile2ascii\fR [ \fIOPTION\fR ]... \fIDIRFILE\fR +.RB "[ [ " \-a " | " \-A " | " \-e " | " \-E " | " \-F " | " \-g " | " \-G " |" +.BR \-o " | " \-i " | " \-u " | " \-x " | " \-X " ]" +.IR FIELD " ]..." +.hy +.ad n +.SH DESCRIPTION +Fetches data from a dirfile(5) database specified by +.I DIRFILE +and writes it as ASCII to standard output. Any number of vector +.IR FIELD s +may be specified. Each specified field is printed in a separate column. + +Mandatory arguments to long options are mandatory for short options too. +.TP +.BR \-d ", " \-\-delimeter =\fIdelim\fR +separate columns by +.IR delim . +(Default: a single space.) +.TP +.BR \-f ", " \-\-first\-frame =\fIfirst_frame\fB\-\fIlast_frame\fR +read from frame +.I first_frame +to frame +.I last_frame +(inclusive). +.TP +.BR \-f ", " \-\-first\-frame =\fIfirst_frame\fB:\fInframes\fR +equivalent to \fB\-\-first\-frame\fR=\fIfirst_frame\fR +\fB--num-frames\fR=\fInframes\fR. +.TP +.BR \-f ", " \-\-first\-frame =\fIfirst_frame\fR +If \fIfirst_frame\fR\~>=\~0, start reading at frame +.IR first_frame . +If +.I first_frame +is -1 and \fB\-\-num-frames\fR=\fInframes\fR is specified, read the last +.I nframes +frames. If +.B --first-frame +is not specified, reading starts at frame zero. +.TP +.BR \-n ", " \-\-num\-frames =\fInframes\fR +read at most +.I nframes +frames. If not specified, or if \fBnframes\fR\~=\~0, all frames to the +end-of-field are read. +.TP +.BR \-p ", " \-\-precision =\fIformat\fR +use +.I format +to format output. +.I format +may contain any of the flag characters, a field width, and/or a precision as +specified in +.BR printf (3). +It may \fInot\fR contain a length modifier. +.TP +.BR \-q ", " \-\-quiet +don't write diagnostic messages on standard error. (This is the default +behaviour). +.TP +.BR \-s ", " \-\-skip =\fIframe_skip\fR +if \fIframe_skip\fR\~>\~0, output only one sample for every +.I frame_skip +frames. +.TP +.BR \-v ", " \-\-verbose +write diagnostic messages on standard error. +.P +In addition to the above, each +.I FIELD +argument may be preceded by a short option, one of: +.BR \-a ", " \-A ", " \-e ", " \-E ", " \-F ", " \-g ", " \-G ", " \-i , +.BR \-o ", " \-u ", " \-x ", " \-X , +indicating the conversion to be used. See +.BR printf (3) +for the meaning of these conversion specifiers. The output flags, width, and +precision may be specified by using +.BR \-\-precision . +If no conversion specifier is given, +.B %f +is used. + +For conversion specifiers +.BR %a ", " %A ", " %e ", " %E ", " %f ", " %F ", " %g ", " %G , +data is read from the dirfile as double precision floats. For conversion +specifier \fB%i\fR, data is read as 64-bit signed integers. For conversion +specifiers +.BR %o ", " %u ", " %x ", " %X , +data is read as 64-bit unsigned integers. + +.SH LIMITATIONS +No native support for printing complex data is provided. This may be worked +around by using dirfile(5) representation suffixes. For example, the command +.IP +$ +.B dirfile2ascii +.I DIRFILE +.IB FIELD .r +.IB FIELD .i +.P +will print the real and imaginary parts of the complex valued field +.I FIELD +in the first and second columns, respectively. + +.SH SEE ALSO +.BR dirfile (5), +.BR printf (3) Modified: trunk/html/api.html =================================================================== --- trunk/html/api.html 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/html/api.html 2010-11-23 00:51:47 UTC (rev 479) @@ -50,131 +50,13 @@ <li><a href="getdata.html#header">The GetData Header</a> <li><a href="getdata.html#bindings">Language Bindings</a> <li><a href="getdata.html#dirfile">Working with Dirfiles</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_cbopen">gd_cbopen()</a> - <li><a href="getdata.html#gd_open">gd_open()</a> - <li><a href="getdata.html#gd_parser_callback">gd_parser_callback()</a> - <li><a href="getdata.html#gd_close">gd_close()</a> - <li><a href="getdata.html#gd_discard">gd_discard()</a> - <li><a href="getdata.html#gd_flush">gd_flush()</a> - <li><a href="getdata.html#gd_metaflush">gd_metaflush()</a> - <li><a href="getdata.html#gd_error">gd_error()</a> - <li><a href="getdata.html#gd_error_string">gd_error_string()</a> - </ul> <li><a href="getdata.html#rmeta">Reading Metadata</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_dirfilename">gd_dirfilename()</a> - <li><a href="getdata.html#gd_reference">gd_reference()</a> - <li><a href="getdata.html#gd_nframes">gd_nframes()</a> - <li><a href="getdata.html#gd_nfragments">gd_nfragments()</a> - <li><a href="getdata.html#gd_encoding">gd_encoding()</a> - <li><a href="getdata.html#gd_endianness">gd_endianness()</a> - <li><a href="getdata.html#gd_frameoffset">gd_frameoffset()</a> - <li><a href="getdata.html#gd_protection">gd_protection()</a> - <li><a href="getdata.html#gd_fragmentname">gd_fragmentname()</a> - <li><a href="getdata.html#gd_parent_fragment">gd_parent_fragment()</a> - <li><a href="getdata.html#gd_raw_filename">gd_raw_filename()</a> - <li><a href="getdata.html#gd_spf">gd_spf()</a> - <li><a href="getdata.html#gd_entry">gd_entry()</a> - <li><a href="getdata.html#dfes">gd_free_entry_strings()</a> - <li><a href="getdata.html#gd_entry_type">gd_entry_type()</a> - <li><a href="getdata.html#gd_fragment_index">gd_fragment_index()</a> - <li><a href="getdata.html#gd_native_type">gd_native_type()</a> - <li><a href="getdata.html#gd_validate">gd_validate()</a> - </ul> <li><a href="getdata.html#count">Counting Fields</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_nfields">gd_nfields()</a> - <li><a href="getdata.html#gd_nvectors">gd_nvectors()</a> - <li><a href="getdata.html#gd_nfields_by_type">gd_nfields_by_type()</a> - <li><a href="getdata.html#gd_nmfields">gd_nmfields()</a> - <li><a href="getdata.html#gd_nmvectors">gd_nmvectors()</a> - <li><a href="getdata.html#gd_nmfields_by_type">gd_nmfields_by_type()</a> - </ul> <li><a href="getdata.html#list">Listing Fields</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_field_list">gd_field_list()</a> - <li><a href="getdata.html#gd_vector_list">gd_vector_list()</a> - <li><a href="getdata.html#gd_field_list_by_type">gd_field_list_by_type()</a> - <li><a href="getdata.html#gd_mfield_list">gd_mfield_list()</a> - <li><a href="getdata.html#gd_mvector_list">gd_mvector_list()</a> - <li><a href="getdata.html#gd_mfield_list_by_type">gd_mfield_list_by_type()</a> - </ul> <li><a href="getdata.html#mmeta">Modifying Metadata</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_include">gd_include()</a> - <li><a href="getdata.html#gd_uninclude">gd_uninclude()</a> - <li><a href="getdata.html#gd_reference">gd_reference()</a> - <li><a href="getdata.html#gd_alter_encoding">gd_alter_encoding()</a> - <li><a href="getdata.html#gd_alter_endianness">gd_alter_endianness()</a> - <li><a href="getdata.html#gd_alter_frameoffset">gd_alter_frameoffset()</a> - <li><a href="getdata.html#gd_protect">gd_protect()</a> - </ul> <li><a href="getdata.html#add">Adding or Deleting Fields</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_add">gd_add()</a> - <li><a href="getdata.html#gd_add_spec">gd_add_spec()</a> - <li><a href="getdata.html#gd_add_bit">gd_add_bit()</a> - <li><a href="getdata.html#gd_add_const">gd_add_const()</a> - <li><a href="getdata.html#gd_add_lincom">gd_add_lincom()</a> - <li><a href="getdata.html#gd_add_clincom">gd_add_clincom()</a> - <li><a href="getdata.html#gd_add_linterp">gd_add_linterp()</a> - <li><a href="getdata.html#gd_add_multiply">gd_add_multiply()</a> - <li><a href="getdata.html#gd_add_phase">gd_add_phase()</a> - <li><a href="getdata.html#gd_add_polynom">gd_add_polynom()</a> - <li><a href="getdata.html#gd_add_cpolynom">gd_add_cpolynom()</a> - <li><a href="getdata.html#gd_add_raw">gd_add_raw()</a> - <li><a href="getdata.html#gd_add_sbit">gd_add_sbit()</a> - <li><a href="getdata.html#gd_add_string">gd_add_string()</a> - <li><a href="getdata.html#gd_madd">gd_madd()</a> - <li><a href="getdata.html#gd_madd_spec">gd_madd_spec()</a> - <li><a href="getdata.html#gd_madd_bit">gd_madd_bit()</a> - <li><a href="getdata.html#gd_madd_const">gd_madd_const()</a> - <li><a href="getdata.html#gd_madd_lincom">gd_madd_lincom()</a> - <li><a href="getdata.html#gd_madd_clincom">gd_madd_clincom()</a> - <li><a href="getdata.html#gd_madd_linterp">gd_madd_linterp()</a> - <li><a href="getdata.html#gd_madd_multiply">gd_madd_multiply()</a> - <li><a href="getdata.html#gd_madd_phase">gd_madd_phase()</a> - <li><a href="getdata.html#gd_madd_polynom">gd_madd_polynom()</a> - <li><a href="getdata.html#gd_madd_cpolynom">gd_madd_cpolynom()</a> - <li><a href="getdata.html#gd_madd_sbit">gd_madd_sbit()</a> - <li><a href="getdata.html#gd_madd_string">gd_madd_string()</a> - <li><a href="getdata.html#gd_delete">gd_delete()</a> - </ul> <li><a href="getdata.html#alter">Modifying Field Metadata</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_alter_entry">gd_alter_entry()</a> - <li><a href="getdata.html#gd_alter_spec">gd_alter_spec()</a> - <li><a href="getdata.html#gd_malter_spec">gd_malter_spec()</a> - <li><a href="getdata.html#gd_alter_bit">gd_alter_bit()</a> - <li><a href="getdata.html#gd_alter_const">gd_alter_const()</a> - <li><a href="getdata.html#gd_alter_lincom">gd_alter_lincom()</a> - <li><a href="getdata.html#gd_alter_clincom">gd_alter_clincom()</a> - <li><a href="getdata.html#gd_alter_linterp">gd_alter_linterp()</a> - <li><a href="getdata.html#gd_alter_multiply">gd_alter_multiply()</a> - <li><a href="getdata.html#gd_alter_phase">gd_alter_phase()</a> - <li><a href="getdata.html#gd_alter_polynom">gd_alter_polynom()</a> - <li><a href="getdata.html#gd_alter_cpolynom">gd_alter_cpolynom()</a> - <li><a href="getdata.html#gd_alter_raw">gd_alter_raw()</a> - <li><a href="getdata.html#gd_alter_sbit">gd_alter_sbit()</a> - <li><a href="getdata.html#gd_move">gd_move()</a> - <li><a href="getdata.html#gd_rename">gd_rename()</a> - </ul> <li><a href="getdata.html#data">Reading and Writing Data</a> - <ul class="submenu"> - <li><a href="getdata.html#gd_getdata">gd_getdata()</a> - <li><a href="getdata.html#gd_get_constant">gd_get_constant()</a> - <li><a href="getdata.html#gd_constants">gd_constants()</a> - <li><a href="getdata.html#gd_mconstants">gd_mconstants()</a> - <li><a href="getdata.html#gd_string">gd_string()</a> - <li><a href="getdata.html#gd_strings">gd_strings()</a> - <li><a href="getdata.html#gd_mstrings">gd_mstrings()</a> - <li><a href="getdata.html#gd_framenum_subset">gd_framenum_subset()</a> - <li><a href="getdata.html#gd_framenum">gd_framenum()</a> - <li><a href="getdata.html#gd_putdata">gd_putdata()</a> - <li><a href="getdata.html#gd_put_constant">gd_put_constant()</a> - <li><a href="getdata.html#gd_put_string">gd_put_string()</a> - </ul> <li><a href="getdata.html#callback">The Parser Callback Function</a> <li><a href="getdata.html#unclean">Unclean Database Recovery</a> </ul> @@ -472,9 +354,11 @@ COMPLEX64, and COMPLEX128 cannot be represented by the legacy API. The legacy API will incorrectly report fields of these types to have the NULL (<span class="syntax character">'n'</span>) type. - Furthermore, since the legacy API does not support <b>POLYNOM</b> - nor <b>SBIT</b> fields, these are listed in the legacy API's - structure as <b>LINCOM</b> and <b>BIT</b> fields, respectively. + Furthermore, since the legacy API does not support <b>POLYNOM</b>, + <b>SBIT</b>, <b>DIVIDE</b>, and <b>RECIP</b> fields, these are + listed in the legacy API's structure as <b>LINCOM</b>, <b>BIT</b>, + <b>MULTIPLY</b>, and <b>LINCOM</b> fields, respectively. Scalar + fields are completely ignored by the legacy API. </tr> <tr> <td class="syntax"> @@ -561,7 +445,8 @@ </tr> <tr class="changed"> <td class="syntax">GD_E_OPEN_FRAGMENT</td> - <td class="syntax">GD_E_OPEN_INCLUDE</td><td>Renamed.</td> + <td class="syntax">GD_E_OPEN_INCLUDE</td><td>Renamed. Old name + remains as an alias.</td> </tr> <tr> <td class="syntax span" colspan="2">GD_E_INTERNAL_ERROR</td> Modified: trunk/html/dirfile.html =================================================================== --- trunk/html/dirfile.html 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/html/dirfile.html 2010-11-23 00:51:47 UTC (rev 479) @@ -107,7 +107,7 @@ <b>dirfile-encoding</b>(5). Additionally, this document discusses some implementation-dependant behaviour specific to GetData not found in those documents. The latest release of the Dirfile Standards is Standards - Version 8 (October 2010). + Version 8 (November 2010). <p>The dirfile database is centred around one or more time-ordered data streams (a <i>time stream</i>). Each time stream is written to disk in a separate file, in its native binary format. The name of these time stream @@ -211,7 +211,9 @@ tab (0x09), vertical tab (0x0B), form-feed (0x0C), and carriage return (0x0D). The first token of a directive line is always a <i>reserved word</i>, while a field specification line begins with a field name. As - a result, no field may have the same name as a reserved word. + a result, no field may have the same name as a reserved word (although, + as of Standards Version 8, all reserved words contain a forward slash + character (<b>/</b>), which are prohibited in field names in any case). <p>Since tokens are separated by whitespace, to include a whitespace character in a token, it must either be escaped by preceding it by a backslash character (<span class="syntax"><b>\</b></span>), or replaced by @@ -286,19 +288,21 @@ </tr> <tr> <td class="syntax"><b>\</b><i>ooo</i></td> - <td>the single byte given by the octal number <i>ooo</i>.</td> + <td>the single byte given by the octal number <i>ooo</i>. (1 to 3 + digits)</td> <td>0<i>ooo</i></td> </tr> <tr> <td class="syntax"><b>\x</b><i>hh</i></td> - <td>the single byte given by the hexadecimal number <i>hh</i>.</td> + <td>the single byte given by the hexadecimal number <i>hh</i>. (1 or + 2 digits)</td> <td>0x<i>hh</i></td> </tr> <tr> <td class="syntax"><b>\u</b><i>hhhhhhh</i></td> <td colspan="2"> the UTF-8 byte sequence encoding the Unicode code point given by the - hexadecimal number <i>hhhhhhh</i>. + hexadecimal number <i>hhhhhhh</i>. (1 to 7 digits) </td></tr> </table> </div> @@ -499,18 +503,19 @@ </tr> <tr> <td>0–4</td><td><b>#</b><sup>†</sup> <b>/</b> - <i>whitespace</i></td> + <i>whitespace</i><sup>†</sup></td> </tr> <tr> <td>5</td><td><b>#</b><sup>†</sup> <b>/ & ; < > |</b> - <i>whitespace</i></td> + <i>whitespace</i><sup>†</sup></td> </tr> <tr> <td>6—</td><td><b>/ & ; < > | .</b></td> </tr> </table> <div class="footnote"> - †: By virtue of being the comment delimieter. + †: By virtue of there being no way to include such characters in + tokens. </div> </div> @@ -918,7 +923,7 @@ </td> </tr> <tr> - <td>0</td><td>before<br/>March 2003</td><td> + <td>0</td><td>before<br>March 2003</td><td> This Refers to the dirfile standards supported by the GetData library originally introduced into the <a href="http://kst.kde.org/">kst</a> sources, which contained Modified: trunk/html/encoding.html =================================================================== --- trunk/html/encoding.html 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/html/encoding.html 2010-11-23 00:51:47 UTC (rev 479) @@ -197,8 +197,8 @@ the encoding scheme discovered by GetData is not well defined. <h2><a name="schemes">Supported Encoding Schemes</a></h2> - <p>In addition to raw (<i>unencoded</i>) data, GetData 0.6 supports six - other encoding <i>schemes</i>: + <p>In addition to raw (<i>unencoded</i>) data, GetData 0.6 and newer + support six other encoding <i>schemes</i>: <ul> <li><a href="#text">text encoding</a>, <li><a href="#bzip2">bzip2 encoding</a>, @@ -215,19 +215,22 @@ encoding schemes. <p>The text encoding replaces the binary data files with 7-bit ASCII files containing a decimal text encoding of the data, one sample per line. All - operations are supported by the Text Encoding. The file extension of the - text encoding is <b>.txt</b>. + operations are supported by the Text Encoding. Note: because this is a + <i>decimal</i> encoding, storing floating point data may lose precision. + The file extension of the text encoding is <b>.txt</b>. <h3><a name="bzip2">Bzip2 Encoding</a></h3> <p>The <i>bzip2 encoding</i> compresses raw binary files using the bzip2 compression scheme (Burrows-Wheeler block sorting algorithm with Huffman coding), using the <a href="http://www.bzip.org/">bz2 library</a> developed by Julian Seward. GetData's bzip2 encoding framework currently - lacks write capabilities; as a result, only - <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#gd_nframes"><span - class="syntax">gd_nframes()</span></a> are supported by the encoding. - The file extension of the bzip2 encoding is <b>.bz2</b>. + lacks write capabilities; as a result, only <a + href="getdata.html#getdata"><span class="syntax">getdata()</span></a>, + <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a>, and + <a href="getdata.html#gd_eof"><span class="syntax">gd_eof()</span></a> are + supported by the encoding. The file extension of the bzip2 encoding is + <b>.bz2</b>. <h3><a name="gzip">Gzip Encoding</a></h3> <p>The <i>gzip encoding</i> compresses raw binary files using the gzip @@ -235,17 +238,20 @@ href="http://wwww.zlib.org/">zlib library</a> written by Jean-loup Gailly and Mark Adler. GetData's gzip encoding framework currently lacks write capabilities; as a result, only <a - href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#gd_nframes"><span - class="syntax">gd_nframes()</span></a> are supported by the encoding. - The file extension of the gzip encoding is <b>.gz</b>. + href="getdata.html#getdata"><span class="syntax">getdata()</span></a>, + <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a>, and + <a href="getdata.html#gd_eof"><span class="syntax">gd_eof()</span></a> are + supported by the encoding. The file extension of the gzip encoding is + <b>.gz</b>. <p>To speed the operation of <a href="getdata.html#gd_nframes"><span - class="syntax">gd_nframes()</span></a>, the gzip compression - scheme takes the uncompressed size of the file from the gzip footer, which - contains the file's uncompressed size in bytes, modulo 2<sup>32</sup>. As - a result, using a field with an (uncompressed) binary file size larger - than 2<sup>32</sup> bytes (4 GiB) as the reference field will result - in a wrong number of frames being reported. + class="syntax">gd_nframes()</span></a> and <a + href="getdata.html#gd_eof"><span class="syntax">gd_eof()</span></a>, the + gzip compression scheme takes the uncompressed size of the file from the + gzip footer, which contains the file's uncompressed size in bytes, modulo + 2<sup>32</sup>. As a result, using a field with an (uncompressed) binary + file size larger than 2<sup>32</sup> bytes (4 GiB) as the reference + field will result in a wrong number of frames being reported. <h3><a name="lzma">LZMA Encoding</a></h3> <p>The <i>lzma encoding</i> compresses raw binary files using the @@ -254,10 +260,12 @@ <a href="http://xztools.com/">XZ Utils</a> suite written by Lasse Collin, Ville Koskinen, and Igor Pavlov. GetData's lzma encoding framework currently lacks write capabilities; as a result, only <a - href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#gd_nframes"><span - class="syntax">gd_nframes()</span></a> are supported by the encoding. - The file extension of the gzip encoding is <b>.xz</b> or <b>.lzma</b>. + href="getdata.html#getdata"><span class="syntax">getdata()</span></a>, + <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a>, and + <a href="getdata.html#gd_eof"><span class="syntax">gd_eof()</span></a> are + supported by the encoding. The file extension of the gzip encoding is + <b>.xz</b> or <b>.lzma</b>. <h3><a name="slim">Slim Encoding</a></h3> <p>The <i>slim encoding</i> compresses raw binary files using the slim @@ -265,11 +273,12 @@ compress dirfile or similar binary data for <a href="http://www.physics.princeton.edu/act/">ACT</a>. GetData's slim encoding framework currently lacks write capabilities; as a result, only - <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#gd_nframes"><span - class="syntax">gd_nframes()</span></a> are supported by the encoding. - (Slim itself is distributed with executables which can perform both reads - and writes.) The file extension of the slim encoding is <b>.slm</b>. + <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a>, + <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a>, and + <a href="getdata.html#gd_eof"><span class="syntax">gd_eof()</span></a> are + supported by the encoding. The file extension of the slim encoding is + <b>.slm</b>. <p> Slim was written by Joseph Fowler. It has been released under the GNU Public License, and is <a href="http://slimdata.sourceforge.net/">distributed on SourceForge</a>. Modified: trunk/html/getdata.css =================================================================== --- trunk/html/getdata.css 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/html/getdata.css 2010-11-23 00:51:47 UTC (rev 479) @@ -206,6 +206,10 @@ padding-left: 1em; } +ol.sublist { + list-style-type: lower-latin +} + sup { font-size: x-small; } @@ -216,4 +220,4 @@ dt { font-weight: bold; - +} Modified: trunk/html/getdata.html =================================================================== --- trunk/html/getdata.html 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/html/getdata.html 2010-11-23 00:51:47 UTC (rev 479) @@ -1001,10 +1001,19 @@ <span class="keyword">size_t</span> <span class="identifier">buflen</span><span class="operator">);</span> </div> - The string will be written in the user supplied <span class="syntax - identifier">buffer</span>. At most <span class="syntax - identifier">buflen</span> characters, which always includes a trailing - NUL byte, will be written to the string. + If <span class="syntax identifier">buffer</span> is non-<span + class="syntax literal">NULL</span>, the string will be written there. + At most <span class="syntax identifier">buflen</span> characters, which + always includes a trailing NUL byte, will be written to the string, which + may result in the string being truncated. In this case <span + class="syntax identifier">buffer</span> is returned. + <p>If <span class="syntax identifier">buffer</span> is <span + class="syntax literal">NULL</span>, a pointer to a newly-allocated + buffer containing the entire error string is returned. In this case, + <span class="syntax identifier">buflen</span> is ignored. This string + will be allocated by <span class="syntax">malloc()</span> and should + be <span class="syntax">free()</span>'d by the caller when no longer + needed. <h3><a name="gd_error_string">gd_invalid_dirfile()</a></h3> <p>A new, invalid <span class="syntax keyword">DIRFILE</span> object may @@ -1273,7 +1282,7 @@ <tr> <td class="syntax">gd_spf_t</td> <td class="syntax">spf<br> - <span class="c89 syntax">u.raw.spf</div></td> + <span class="c89 syntax">u.raw.spf</span></td> <td colspan="2" rowspan="2">RAW</td> <td colspan="2">The samples-per-frame of the binary data on disk. <span class="syntax">gd_spf_t</span> is a 16-bit unsigned integer @@ -1282,7 +1291,7 @@ <tr> <td class="syntax">gd_type_t</td> <td class="syntax">data_type<br> - <span class="c89 syntax">u.raw.data_type</div></td> + <span class="c89 syntax">u.raw.data_type</span></td> <td colspan="2">The data type of the binary data on disk.</td> </tr> <tr> @@ -1312,16 +1321,16 @@ <tr> <td class="syntax">int</td> <td class="syntax">n_fields<br> - <span class="c89 syntax">u.lincom.n_fields</div></td> + <span class="c89 syntax">u.lincom.n_fields</span></td> <td colspan="2" rowspan="5">LINCOM</td> <td colspan="2">The number of input fields, between one and three, inclusive.</td> </tr> <tr> <td class="syntax">double complex<br> - <span class="c89 syntax">double</div></td> + <span class="c89 syntax">double</span></td> <td class="syntax">cm[3]<br> - <span class="c89 syntax">u.lincom.cm[3][2]</div></td> + <span class="c89 syntax">u.lincom.cm[3][2]</span></td> <td colspan="2" rowspan="2">Scale factors (slopes). The number of array elements initialised equals <span class="syntax">n_fields</span>. The array <span @@ -1330,13 +1339,13 @@ </tr> <tr> <td class="syntax">double</td><td class="syntax">m[3]<br> - <span class="c89 syntax">u.lincom.m[3]</div></td> + <span class="c89 syntax">u.lincom.m[3]</span></td> </tr> <tr> <td class="syntax">double complex<br> - <span class="c89 syntax">double</div></td> + <span class="c89 syntax">double</span></td> <td class="syntax">cb[3]<br> - <span class="c89 syntax">u.lincom.cb[3][2]</div></td> + <span class="c89 syntax">u.lincom.cb[3][2]</span></td> <td colspan="2" rowspan="2">Offset terms. The number of array elements initialised equals <span class="syntax">n_fields</span>. The array <span class="syntax">b</span> contains only the real @@ -1345,21 +1354,21 @@ <tr> <td class="syntax">double</td> <td class="syntax">b[3]<br> - <span class="c89 syntax">u.lincom.b[3]</div></td> + <span class="c89 syntax">u.lincom.b[3]</span></td> </tr> <tr> <td class="syntax">int</td> - <td class="syntax">poly_ord<a> - <span class="c89 syntax">u.polynom.poly_ord</div></td> + <td class="syntax">poly_ord<br> + <span class="c89 syntax">u.polynom.poly_ord</span></td> <td colspan="2" rowspan="3">POLYNOM</td> <td colspan="2">The order of the polynomial, between one and five, inclusive.</td> </tr> <tr> <td class="syntax">double complex<br> - <span class="c89 syntax">double</div></td> + <span class="c89 syntax">double</span></td> <td class="syntax">ca[6]<br> - <span class="c89 syntax">u.polynom.ca[3][2]</div></td> + <span class="c89 syntax">u.polynom.ca[3][2]</span></td> <td colspan="2" rowspan="2">Co-efficients. The number of array elements initialised is one more than <span class="syntax">poly_ord</span>. The array <span @@ -1369,19 +1378,19 @@ <tr> <td class="syntax">double</td> <td class="syntax">a[6]<br> - <span class="c89 syntax">u.polynom.a[3]</div></td> + <span class="c89 syntax">u.polynom.a[3]</span></td> </tr> <tr> <td class="syntax">const char*</td> <td class="syntax">table<br> - <span class="c89 syntax">u.literp.table</div></td> + <span class="c89 syntax">u.literp.table</span></td> <td colspan="2">LINTERP</td> <td colspan="2">Pathname of the look-up table</td> </tr> <tr> <td class="syntax">gd_bit_t</td> <td class="syntax">bitnum<br> - <span class="c89 syntax">u.bit.bitnum</div></td> + <span class="c89 syntax">u.bit.bitnum</span></td> <td colspan="2" rowspan="2">BIT, SBIT</td> <td>The first bit of the input field (counting from zero).</td> <td rowspan="2"><span class="syntax">gd_bit_t</span> is a 16-bit @@ -1390,13 +1399,13 @@ <tr> <td class="syntax">gd_bit_t</td> <td class="syntax">numbis<br> - <span class="c89 syntax">u.bit.numbits</div></td> + <span class="c89 syntax">u.bit.numbits</span></td> <td>The width of the field (in bits).</td> </tr> <tr> <td class="syntax">gd_shift_t</td> <td class="syntax">shift<br> - <span class="c89 syntax">u.phase.shift</div></td> + <span class="c89 syntax">u.phase.shift</span></td> <td colspan="2">PHASE</td> <td colspan="2">The phase shift (in samples). <span class="syntax">gd_shift_t</span> is a 64-bit signed integer @@ -1404,9 +1413,9 @@ </tr> <tr> <td class="syntax">double complex<br> - <span class="c89 syntax">double</div></td> + <span class="c89 syntax">double</span></td> <td class="syntax">cdividend<br> - <span class="c89 syntax">u.recip.cdividend[2]</div></td> + <span class="c89 syntax">u.recip.cdividend[2]</span></td> <td colspan="2" rowspan="2">RECIP</td> <td colspan="2" rowspan="2">Dividend (a multiplicitave factor). The <span class="syntax">dividend</span> member contains only the @@ -1415,19 +1424,19 @@ <tr> <td class="syntax">double</td> <td class="syntax">dividend<br> - <span class="c89 syntax">u.recip.dividend</div></td> + <span class="c89 syntax">u.recip.dividend</span></td> </tr> <tr> <td class="syntax">gd_type_t</td> <td class="syntax">const_type<br> - <span class="c89 syntax">u.scalar.const_type</div></td> + <span class="c89 syntax">u.scalar.const_type</span></td> <td colspan="2">CONST, CARRAY</td> <td colspan="2">The storage type of the field.</td> </tr> <tr> <td class="syntax">size_t</td> <td class="syntax">array_len<br> - <span class="c89 syntax">u.scalar.array_len</div></td> + <span class="c89 syntax">u.scalar.array_len</span></td> <td colspan="2">CARRAY</td> <td colspan="2">The number of elements in the field.</td> </tr> @@ -4252,7 +4261,7 @@ <li>copies are made of all the binary data files, after modification, for the fragment <li> - <ol type="a"> + <ol class="sublist"> <li>If an error occurred in step one, the binary file copies are deleted. <li>If no error occurred in step one, the binary data files are Modified: trunk/html/index.html =================================================================== --- trunk/html/index.html 2010-11-20 17:55:25 UTC (rev 478) +++ trunk/html/index.html 2010-11-23 00:51:47 UTC (rev 479) @@ -149,24 +149,22 @@ <h3><a name="source">Latest Release</a></h3> <p>The complete source code for official releases of the GetData project are available from SourceForge. The latest version of GetData, released - 27 April, 2010, is: + 22 November, 2010, is: <ul> <li><a - href="http://sourceforge.net/projects/getdata/files/getdata/0.6.3/" - >0.6.3</a>—<a - href="http://sourceforge.net/projects/getdata/files/getdata/0.6.3/RELEASE_NOTES-0.6.3/view" + href="http://sourceforge.net/projects/getdata/files/getdata/0.7.0/" + >0.7.0</a>—<a + href="http://sourceforge.net/projects/getdata/files/getdata/0.7.0/RELEASE_NOTES-0.7.0/view" >Release Notes</a> </ul> It may be <a href="http://sourceforge.net/projects/getdata/files/" >downloaded</a> from your local SourceForge mirror. - <p class="inset">GetData 0.6 adds support for the LZMA compression scheme, - and the ability to manipulate non-literal scalar field parameters. - GetData 0.6 supports Dirfile Standards Version Seven. Highlights of - Standards Version Seven include complex valued data, signed bitfields, - and polynomial derived fields. This version also adds <a - href="bindings.html">bindings</a> for Python and the Interactive Data - Language (IDL).</p> + <p class="inset">GetData 0.7 supports Dirfile Standards Version Eight. + Highlights of Standards Version Eight include vector division and + reciprocal field types, and scalar arrays. This version is also the first + GetData version to be supported under MacOS X and Win32. + </p> <h3><a name="distro">Pre-Built Linux Packages</a></h3> <p>GetData has been packaged for release on various Linux distributions, including: @@ -229,9 +227,9 @@ <p>Older getdata releases available include the following: <ul> <li><a - href="http://sourceforge.net/projects/getdata/files/getdata/0.6.2/" - >0.6.2</a>—<a - href="http://sourceforge.net/projects/getdata/files/getdata/0.6.2/RELEASE_NOTES-0.6.2/view" + href="http://sourceforge.net/projects/getdata/files/getdata/0.6.3/" + >0.6.3</a>—<a + href="http://sourceforge.net/projects/getdata/files/getdata/0.6.3/RELEASE_NOTES-0.6.3/view" >Release Notes</a> <li><a href="http://sourceforge.net/projects/getdata/files/getdata/0.5.0/" @@ -252,11 +250,13 @@ <p class="inset"> GetData 0.3 only supports dirfiles up to and including Dirfile Standards Version Five. GetData 0.4 and 0.5 support dirfiles only up to and - including Standards Version Six. GetData 0.4 added the ability to add - fields, support for the <a href="http://slimdata.sourceforge.net/">slim - compression scheme</a>. GetData 0.5 added support for gzip and bzip2 - complession schemes, and added functionality for the manipulation of - metadata. + including Standards Version Six. GetData 0.6 supports dirfiles only up to + and including Standards Version Seven. + <p class="inset">GetData 0.4 added the ability to add fields, support for + the <a href="http://slimdata.sourceforge.net/">slim compression + scheme</a>. GetData 0.5 added support for gzip and bzip2 complession + schemes, and added functionality for the manipulation of metadata. + GetData 0.6 added Python and IDL bindings. <p class="inset">GetData 0.5 and earlier are released under the terms of the <a href="COPYING.GPL">GNU General Public License</a>. Later releases are available under the <a href="#warranty">GNU Lesser General Public @@ -277,8 +277,8 @@ License</a> as published by the Free Software Foundation: either version 2.1 of the License, or (at your option) any later version. <p>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 <a href="COPYING">GNU + without any warranty; without even the implied warranty of merchantability + or fitness for a particular purpose. See the <a href="COPYING">GNU Lesser General Public License</a> for more details. <h2><a name="contact">Contact</a></h2> 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-17 20:17:01
|
Revision: 477 http://getdata.svn.sourceforge.net/getdata/?rev=477&view=rev Author: ketiltrout Date: 2010-11-17 20:16:55 +0000 (Wed, 17 Nov 2010) Log Message: ----------- C++ compiler tweaks. Modified Paths: -------------- trunk/getdata/bindings/cxx/dirfile.cpp trunk/getdata/bindings/f77/fgetdata.h Modified: trunk/getdata/bindings/cxx/dirfile.cpp =================================================================== --- trunk/getdata/bindings/cxx/dirfile.cpp 2010-11-17 15:26:13 UTC (rev 476) +++ trunk/getdata/bindings/cxx/dirfile.cpp 2010-11-17 20:16:55 UTC (rev 477) @@ -136,7 +136,7 @@ return gd_error(D); } -const char *Dirfile::ErrorString(size_t n __gd_unused) +const char *Dirfile::ErrorString(size_t __gd_unused n) { return ErrorString(); } Modified: trunk/getdata/bindings/f77/fgetdata.h =================================================================== --- trunk/getdata/bindings/f77/fgetdata.h 2010-11-17 15:26:13 UTC (rev 476) +++ trunk/getdata/bindings/f77/fgetdata.h 2010-11-17 20:16:55 UTC (rev 477) @@ -41,6 +41,9 @@ #endif +#ifdef __cplusplus +extern "C" { +#endif /* Forward declarations to keep icc happy */ void F77_FUNC(gdopen, GDOPEN) (int* dirfile, const char* dirfilename, const int* dirfilename_l, const int* flags); @@ -554,3 +557,6 @@ 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); +#ifdef __cplusplus +} +#endif 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-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-12 19:10:34
|
Revision: 474 http://getdata.svn.sourceforge.net/getdata/?rev=474&view=rev Author: ketiltrout Date: 2010-11-12 19:10:24 +0000 (Fri, 12 Nov 2010) Log Message: ----------- Doc updates Modified Paths: -------------- trunk/html/dirfile.html trunk/html/getdata.html Modified: trunk/html/dirfile.html =================================================================== --- trunk/html/dirfile.html 2010-11-07 00:37:52 UTC (rev 473) +++ trunk/html/dirfile.html 2010-11-12 19:10:24 UTC (rev 474) @@ -524,13 +524,13 @@ Additionally, the filesystem will put restrictions on the length of a <b>RAW</b> field name, regardless of Standards Version. <h3><a name="fieldtype">Field Types</a></h3> - <p>There are twelve field types. Of these, ten are of vector type + <p>There are thirteen field types. Of these, ten are of vector type (<b>BIT</b>, <b>DIVIDE</b>, <b>LINCOM</b>, <b>LINTERP</b>, <b>MULTIPLY</b>, <b>PHASE</b>, <b>POLYNOM</b>, <b>RAW</b>, <b>RECIP</b>, - and <b>SBIT</b>) and two are of scalar type (<b>CONST</b> and - <b>STRING</b>). The possible fields types are listed below with their - field specification lines. For information on how to specify the - parameters in the specification lines, see below under <a + and <b>SBIT</b>) and three are of scalar type (<b>CARRAY</b>, + <b>CONST</b>, and <b>STRING</b>). The possible fields types are listed + below with their field specification lines. For information on how to + specify the parameters in the specification lines, see below under <a href="#fieldparam">Field Parameters</a>. <ul> <li><b>BIT</b>: The BIT field type extracts one or more bits out of an @@ -546,6 +546,19 @@ ><bits></span> is omitted, it is assumed to be <b>1</b>. Standards Version 0 doesn't recognise the <span class="syntax"><bits></span> token. + <li><b>CARRAY</b>: The ARRAY scalar field type is an list of constants + fully specified in the format file metadata. Syntax is: + <div class="syntax"> <field-name> <b>CARRAY</b> <type> + <value0> <value1> <value2> ... + </div> + where <i>type</i> may be any supported <a href="#datatype">native data + type</a> and <i>value0</i>, <i>value1</i>, &c. are the values of + successive elements in the scalar list, interpreted as indicated by + <i>type</i>. GetData is prepared to deal with at least 2<sup>24</sup> + values. Note: despite being multivalued, this is not considered a + vector field since the elements of the <b>CARRAY</b> are not indexed by + frames. A <b>CARRAY</b> with a single element is identical to a + <b>CONST</b> field. Introduced in Standards Version 8. <li><b>CONST</b>: The CONST scalar field type is a constant fully specified in the format file metadata. Syntax is: <div class="syntax"> <field-name> <b>CONST</b> <type> @@ -748,8 +761,13 @@ <p>All input vector field parameters should be a <a href="#fieldcode"><i>field codes</i></a>. Additionally, in Standards Version 6 and later, some of the numerical field parameters may be - either literal numbers or else the <i>field code</i> of a <b>CONST</b> - field containing the value. Parameters for which this is possible are: + either literal numbers or else the <i>field code</i> of a <b>CONST</b> or + <b>CARRAY</b> scalar field containing the value. In the case of a + <b>CARRAY</b>, the field code may be immediately followed by an integer + enclosed in angle brackets (<b>< ></b>) specifying which element + (counting from zero) of the <b>CARRAY</b> to use (so: + <i>field_code</i><b><</b><i>n</i><b>></b>). If this is omitted, the + first element is assumed. Parameters for which this is possible are: <ul> <li><b>RAW</b>: <span class="syntax">spf</span> <li><b>BIT, SBIT</b>: <span class="syntax">bitnum</span>, <span @@ -764,7 +782,7 @@ </ul> Since it is possible to create a field code which is identical to a literal number, a parameter is assumed to be the field code of a - <b>CONST</b> field only if it doesn't look like a number. + scalar field only if it doesn't look like a number. <p>In Standards Version 7 and later, a literal complex number is specified as two real (floating point) numbers separated by a semicolon (<b>;</b>) with no intervening whitespace. So, for example, the tokens: @@ -784,7 +802,7 @@ 0</div> <h3><a name="fieldcode">Field Codes</a></h3> - <p>Both when specifying the inputs to a field (as a <b>CONST</b> scalar + <p>Both when specifying the inputs to a field (as a non-literal scalar parameter, or as an input vector field to a field), and when specifying a field to a GetData call, <i>field codes</i> are used. A <i>field code</i> is one of: @@ -836,12 +854,12 @@ <th>Version</th><th>Release Date</th><th>Notes</th> </tr> <tr> - <td>8</td><td>October 2010</td><td>Added the <b>DIVIDE</b> and - <b>RECIP</b> field types, made the forward slash on reserved words - mandatory, and prohibited using the single character data type - aliases in the specification of <b>RAW</b> fields. It also - introduced the optional second (<i>arm</i>) token to the - <b>/ENDIAN</b> directive. + <td>8</td><td>November 2010</td><td>Added the <b>DIVIDE</b>, + <b>RECIP</b> and <b>CARRAY</b> field types, made the forward slash + on reserved words mandatory, and prohibited using the single + character data type aliases in the specification of <b>RAW</b> + fields. It also introduced the optional second (<i>arm</i>) token + to the <b>/ENDIAN</b> directive. </tr> <tr> <td>7</td><td>October 2009</td><td>Added the <b>POLYNOM</b> and @@ -900,7 +918,7 @@ </td> </tr> <tr> - <td>0</td><td>before March 2003</td><td> + <td>0</td><td>before<br/>March 2003</td><td> This Refers to the dirfile standards supported by the GetData library originally introduced into the <a href="http://kst.kde.org/">kst</a> sources, which contained Modified: trunk/html/getdata.html =================================================================== --- trunk/html/getdata.html 2010-11-07 00:37:52 UTC (rev 473) +++ trunk/html/getdata.html 2010-11-12 19:10:24 UTC (rev 474) @@ -53,6 +53,7 @@ <li><a href="getdata.html#gd_parent_fragment">gd_parent_fragment()</a> <li><a href="getdata.html#gd_raw_filename">gd_raw_filename()</a> <li><a href="getdata.html#gd_spf">gd_spf()</a> + <li><a href="getdata.html#gd_carray_len">gd_carray_len()</a> <li><a href="getdata.html#gd_entry">gd_entry()</a> <li><a href="getdata.html#dfes">gd_free_entry_strings()</a> <li><a href="getdata.html#gd_entry_type">gd_entry_type()</a> @@ -95,6 +96,7 @@ <li><a href="getdata.html#gd_add">gd_add()</a> <li><a href="getdata.html#gd_add_spec">gd_add_spec()</a> <li><a href="getdata.html#gd_add_bit">gd_add_bit()</a> + <li><a href="getdata.html#gd_add_carray">gd_add_carray()</a> <li><a href="getdata.html#gd_add_const">gd_add_const()</a> <li><a href="getdata.html#gd_add_divide">gd_add_divide()</a> <li><a href="getdata.html#gd_add_lincom">gd_add_lincom()</a> @@ -112,6 +114,7 @@ <li><a href="getdata.html#gd_madd">gd_madd()</a> <li><a href="getdata.html#gd_madd_spec">gd_madd_spec()</a> <li><a href="getdata.html#gd_madd_bit">gd_madd_bit()</a> + <li><a href="getdata.html#gd_madd_carray">gd_madd_carray()</a> <li><a href="getdata.html#gd_madd_const">gd_madd_const()</a> <li><a href="getdata.html#gd_madd_divide">gd_madd_divide()</a> <li><a href="getdata.html#gd_madd_lincom">gd_madd_lincom()</a> @@ -133,6 +136,7 @@ <li><a href="getdata.html#gd_alter_spec">gd_alter_spec()</a> <li><a href="getdata.html#gd_malter_spec">gd_malter_spec()</a> <li><a href="getdata.html#gd_alter_bit">gd_alter_bit()</a> + <li><a href="getdata.html#gd_alter_carray">gd_alter_carray()</a> <li><a href="getdata.html#gd_alter_const">gd_alter_const()</a> <li><a href="getdata.html#gd_alter_divide">gd_alter_divide()</a> <li><a href="getdata.html#gd_alter_lincom">gd_alter_lincom()</a> @@ -155,6 +159,10 @@ <li><a href="getdata.html#gd_get_constant">gd_get_constant()</a> <li><a href="getdata.html#gd_constants">gd_constants()</a> <li><a href="getdata.html#gd_mconstants">gd_mconstants()</a> + <li><a href="getdata.html#gd_get_carray">gd_get_carray()</a> + <li><a href="getdata.html#gd_get_carray_slice">gd_get_carray_slice()</a> + <li><a href="getdata.html#gd_carrays">gd_carrays()</a> + <li><a href="getdata.html#gd_mcarrays">gd_mcarrays()</a> <li><a href="getdata.html#gd_get_string">gd_get_string()</a> <li><a href="getdata.html#gd_strings">gd_strings()</a> <li><a href="getdata.html#gd_mstrings">gd_mstrings()</a> @@ -162,6 +170,8 @@ <li><a href="getdata.html#gd_framenum">gd_framenum()</a> <li><a href="getdata.html#gd_putdata">gd_putdata()</a> <li><a href="getdata.html#gd_put_constant">gd_put_constant()</a> + <li><a href="getdata.html#gd_put_carray">gd_put_carray()</a> + <li><a href="getdata.html#gd_put_carray_slice">gd_put_carray_slice()</a> <li><a href="getdata.html#gd_put_string">gd_put_string()</a> </ul> <li><a href="getdata.html#callback">The Parser Callback Function</a> @@ -848,7 +858,7 @@ <tr> <td class="syntax">GD_E_BAD_SCALAR</td> <td>A field code used as a field parameter did not specify a valid - <b>CONST</b> field.</td> + scalar field.</td> </tr> <tr> <td class="syntax">GD_E_BAD_TYPE</td> @@ -861,6 +871,10 @@ specified.</td> </tr> <tr> + <td class="syntax">GD_E_BOUNDS</td> + <td>An attmept was made to read a <b>CARRAY</b> element past the + end of the field.</td> + <tr> <td class="syntax">GD_E_CALLBACK</td> <td>The return value of the <a href="#callback">parser callback function</a> was not recognised.</td> @@ -908,6 +922,13 @@ </td> </tr> <tr> + <td class="syntax">GD_E_LINE_TOO_LONG</td> + <td>GetData encountered a line in a format fragment or linterp table + longer than it was able to deal with. On 32-bit systems this is + 2<sup>31</sup> bytes, which means this error usually indicates a + pathological problem.</td> + </tr> + <tr> <td class="syntax">GD_E_OPEN</td> <td>An error occurred while attempting to open a dirfile.</td> </tr> @@ -1190,6 +1211,20 @@ <p>Here <span class="syntax keyword">gd_spf_t</span> is an unsigned 16-bit integer type. On error, zero is returned. + <h3><a name="gd_carray_len">gd_carray_len()</a></h3> + <p>The number of elements in a <b>CARRAY</b> field may be obtained from + a call to + <div class="syntax"> + <span class="keyword">size_t</span> <span + class="identifier">gd_carray_len</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> <span + class="operator">*</span><span class="identifier">dirfile</span><span + class="operator">,</span> <span class="keyword">const char</span> + <span class="operator">*</span><span + class="identifier">field_code</span><span class="operator">);</span> + </div> + On error, zero is returned. + <h3><a name="gd_entry">gd_entry()</a></h3> <p>The metadata for a particular field may be obtained from a call to <div class="syntax"> @@ -1446,6 +1481,7 @@ <span class="literal">GD_DIVIDE_ENTRY</span>, <span class="literal">GD_RECIP_ENTRY</span>, <span class="literal">GD_CONST_ENTRY</span>, + <span class="literal">GD_CARRAY_ENTRY</span>, <span class="literal">GD_STRING_ENTRY</span>, <span class="literal">GD_INDEX_ENTRY</span> (the field type of the implicit <i>INDEX</i> field). @@ -1646,8 +1682,8 @@ <h3><a name="gd_nvectors">gd_nvectors()</a></h3> <p>A count of the number of vector fields (that is all field types - except <b>CONST</b> and <b>STRING</b>) in the dirfile may be obtained by - calling + except <b>CONST</b>, <b>CARRAY</b>, and <b>STRING</b>) in the dirfile may + be obtained by calling <div class="syntax"> <span class="keyword">unsigned int</span> <span class="identifier">gd_nvectors</span><span @@ -1689,8 +1725,8 @@ <h3><a name="gd_nmvectors">gd_nmvectors()</a></h3> <p>A count of the number of vector metafields (that is all field types - except <b>CONST</b> and <b>STRING</b>) for a particular parent field in - the dirfile may be obtained by calling + except <b>CONST</b>, <b>CARRAY</b>, and <b>STRING</b>) for a particular + parent field in the dirfile may be obtained by calling <div class="syntax"> <span class="keyword">unsigned int</span> <span class="identifier">gd_nmvectors</span><span @@ -1750,8 +1786,9 @@ class="syntax">gd_nframes()</span></a>. <h3><a name="gd_vector_list">gd_vector_list()</a></h3> - <p>A list of vector fields (that is all field types except <b>CONST</b> - and <b>STRING</b>) in the dirfile may be obtained by calling + <p>A list of vector fields (that is all field types except <b>CONST</b>, + <b>CARRAY</b>, and <b>STRING</b>) in the dirfile may be obtained by + calling <div class="syntax"> <span class="keyword">const char</span> <span class="operator">**</span><span @@ -1806,8 +1843,9 @@ href="#gd_nmframes"><span class="syntax">gd_nmframes()</span></a>. <h3><a name="gd_mvector_list">gd_mvector_list()</a></h3> - <p>A list of vector fields (that is all field types except <b>CONST</b> - and <b>STRING</b>) in the dirfile may be obtained by calling + <p>A list of vector fields (that is all field types except <b>CONST</b>, + <b>CARRAY</b>, and <b>STRING</b>) in the dirfile may be obtained by + calling <div class="syntax"> <span class="keyword">const char</span> <span class="operator">**</span><span @@ -2117,6 +2155,38 @@ href="#gd_madd_bit"><span class="syntax">gd_madd_bit()</span></a> instead. + <h3><a name="gd_add_carray">gd_add_carray()</a></h3> + A <b>CARRAY</b> field may be added to a dirfile by calling + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_add_carray</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_name</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">const_type</span><span class="operator">,</span> + <span class="keyword">size_t</span> <span + class="identifier">array_len</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">data_type</span><span class="operator">,</span> + <span class="keyword">void</span> <span + class="operator">*</span><span + class="identifier">values</span><span class="operator">,</span> + <span class="keyword">int</span> <span + class="identifier">fragment_index</span><span + class="operator">);</span> + </div> + In addition to adding the field, this will also set the list to the values + pointed to by <span class="syntax identifier">values</span>, which should + point to an array of type <span class="syntax identifier">data_type</span> + and length <span class="syntax identifier">array_len</span>. Other + methods of adding the same field are given above. This function cannot + add metafields. To do that, use <a href="#gd_madd_carray"><span + class="syntax">gd_madd_carray()</span></a> instead. + <h3><a name="gd_add_const">gd_add_const()</a></h3> A <b>CONST</b> field may be added to a dirfile by calling <div class="syntax"> @@ -2586,6 +2656,36 @@ </div> Other methods of adding the same metafield are given above. + <h3><a name="gd_madd_carray">gd_madd_carray()</a></h3> + A <b>CONST</b> metafield may be added to a dirfile by calling + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_madd_carray</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">parent</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_name</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">const_type</span><span class="operator">,</span> + <span class="keyword">size_t</span> <span + class="identifier">array_len</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">data_type</span><span class="operator">,</span> + <span class="keyword">void</span> <span + class="operator">*</span><span + class="identifier">values</span><span class="operator">);</span> + </div> + In addition to adding the field, this will also set the list to the values + pointed to by <span class="syntax identifier">values</span>, which should + point to an array of type <span class="syntax identifier">data_type</span> + and length <span class="syntax identifier">array_len</span>. Other + methods of adding the same metafield are given above. + <h3><a name="gd_madd_const">gd_madd_const()</a></h3> A <b>CONST</b> metafield may be added to a dirfile by calling <div class="syntax"> @@ -3066,6 +3166,24 @@ </div> Other methods of modifying the same field are given above. + <h3><a name="gd_alter_carray">gd_alter_carray()</a></h3> + A <b>CONST</b> field may be modified by calling + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_alter_carray</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_code</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">const_type</span><span class="operator">,</span> + <span class="keyword">size_t</span> <span + class="identifier">array_len</span><span class="operator">);</span> + </div> + Other methods of modifying the same field are given above. + <h3><a name="gd_alter_const">gd_alter_const()</a></h3> A <b>CONST</b> field may be modified by calling <div class="syntax"> @@ -3584,6 +3702,142 @@ class="syntax">gd_mfield_list_by_type()</span></a>. On error, <span class="syntax literal">NULL</span> is returned. + <h3><a name="gd_get_carray">gd_get_carray()</a></h3> + <p>A list of the value of all elements in a <b>CARRAY</b> field (including + metafields) may be fetched from the dirfile with + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_get_carray</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_code</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">return_type</span><span class="operator">,</span> + <span class="keyword">void</span> <span + class="operator">*</span><span + class="identifier">data_out</span><span class="operator">);</span> + </div> + The memory pointed to by <span class="syntax identifier">data_out</span> + must be sufficient to hold the value of all elements in the field, after + type conversion to the return type specified. To retrieve only part of + the field, call <a href="#gd_get_carray_slice"><span + class="syntax">gd_get_carray_slice()</span></a>. The length of a + <B>CARRAY</B> is provided by <a href="#gd_carray_len"><span + class="syntax">gd_carray_len()</span></a>. This function returns + zero on success or -1 on error. + + <h3><a name="gd_get_carray_slice">gd_get_carray_slice()</a></h3> + <p>A list of the value of a portion of a <b>CARRAY</b> field (including + metafields) may be fetched from the dirfile with + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_get_carray_slice</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_code</span><span class="operator">,</span> + <span class="keyword">unsigned int</span> <span + class="identifier">start</span><span class="operator">,</span> + <span class="keyword">size_t</span> <span + class="identifier">n</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">return_type</span><span class="operator">,</span> + <span class="keyword">void</span> <span + class="operator">*</span><span + class="identifier">data_out</span><span class="operator">);</span> + </div> + The first element returned is given by <span class="syntax + identifier">start</span> (with the first element numbered zero). + The memory pointed to by <span class="syntax identifier">data_out</span> + must be sufficient to hold <span class="syntax identifier">n</span> values + of the return type specified. To retrieve the whole field, call + <a href="#gd_get_carray"><span class="syntax">gd_get_carray()</span></a>. + This function returns zero on success or -1 on error. + + <h3><a name="gd_carrays">gd_carrays()</a></h3> + <p>The value of <i>all</i> <b>CARRAY</b> fields may be fetched from the + dirfile with + <div class="syntax"> + <span class="keyword">const gd_carray_t</span> <span + class="operator">*</span><span + class="identifier">gd_carrays</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">return_type</span><span class="operator">);</span> + </div> + The <span class="syntax">gd_carray_t</span> type is a structure with the + form: + <div class="syntax"> + <span class="keyword">typedef struct</span> <span + class="operator">{</span><br> <span + class="keyword">size_t</span> <span class="identifier">n</span><span + class="operator">;</span><br> <span + class="keyword">void</span> <span class="operator">*</span><span + class="identfier">d</span><span class="operator">;</span><br><span + class="operator">}</span> <span + class="identifier">gd_carray_t</span><span class="operator">;</span> + </div> + An array of such objects will be returned. Here the <span + class="syntax">n</span> element indicates the number of elements in the + field, and <span class="syntax">d</span> is an array of element values + after being converted to the data type indicated by <span + class="syntax">return_type</span>. This function acts like the <a + href="#list">list functions</a>: it returns a list which is allocated by + GetData and which GetData will de-allocate when the dirfile is closed. + The pointer is guaranteed to be valid only until <span + class="syntax">gd_carrays()</span> is called again (with any <span + class="syntax identifier">return_type</span>). The ordering is not + specified, but is guaranteed to be the same as the ordering of the list of + <b>CARRAY</b> fields returned by <a href="#gd_field_list_by_type"><span + class="syntax">gd_field_list_by_type()</span></a>. The list is + terminated by a <span class="syntax">gd_carray_t</span> object with + <span class="syntax">n</span> equal to zero. The length of the list + returned may be obtained by calling <a href="#gd_nfields_by_type"><span + class="syntax">gd_nfields_by_type()</span></a>. + The values of metafields are not returned by this function; for that, use + <a href="#gd_mcarrays"><span class="syntax">gd_mcarrays()</span></a>. + On error, <span class="syntax literal">NULL</span> is returned. + + <h3><a name="gd_mcarrays">gd_mcarrays()</a></h3> + <p>The value of <i>all</i> <b>CARRAY</b> metafields for a given parent + fieldmay be fetched from the dirfile with + <div class="syntax"> + <span class="keyword">const gd_carray_t</span> <span + class="operator">*</span><span + class="identifier">gd_mcarrays</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">parent</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">return_type</span><span class="operator">);</span> + </div> + The form of the array returned is described <a + href="#gd_carrays">above</a>. This function acts like the <a + href="#list">list functions</a>: it returns a list which is allocated by + GetData and which GetData will de-allocate when the dirfile is closed. + The pointer is guaranteed to be valid only until <span + class="syntax">gd_mcarrays()</span> is called again (the same <span + class="syntax identifier">parent</span>, but any <span + class="syntax identifier">return_type</span>). The ordering is not + specified, but is guaranteed to be the same as the ordering of the list of + <b>CARRAY</b> fields returned by <a href="#gd_mfield_list_by_type"><span + class="syntax">gd_mfield_list_by_type()</span></a>. The list is + terminated by a <span class="syntax">gd_carray_t</span> object with + <span class="syntax">n</span> equal to zero. The length of the list + returned may be obtained by calling <a href="#gd_nmfields_by_type"><span + class="syntax">gd_nmfields_by_type()</span></a>. + On error, <span class="syntax literal">NULL</span> is returned. + <h3><a name="gd_get_string">gd_get_string()</a></h3> <p>The value of a <b>STRING</b> field (including metafields) may be fetched from the dirfile with @@ -3761,6 +4015,62 @@ </div> This function returns zero on success or -1 on error. + <h3><a name="gd_put_carray">gd_put_carray()</a></h3> + <p>An entire <b>CARRAY</b> field (including metafields) may be + stored to the dirfile with + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_put_carray</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_code</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">data_type</span><span class="operator">,</span> + <span class="keyword">const void</span> <span + class="operator">*</span><span + class="identifier">data_in</span><span class="operator">);</span> + </div> + A sufficient number of values for all elements of the field must be + provided in the memory pointed to by <span + class="syntax identifier">data_in</span>. To store only part of + a field, call <a href="#gd_put_carray_slice"><span + class="syntax">gd_put_carray_slice()</span></a>. The length of a + <B>CARRAY</B> is provided by <a href="#gd_carray_len"><span + class="syntax">gd_carray_len()</span></a>. This function returns + zero on success or -1 on error. + + <h3><a name="gd_put_carray_slice">gd_put_carray_slice()</a></h3> + <p>A portion of a <b>CARRAY</b> field (including metafields) may be + stored to the dirfile with + <div class="syntax"> + <span class="keyword">int</span> <span + class="identifier">gd_put_carray_slice</span><span + class="operator">(</span><span class="keyword">DIRFILE</span> + <span class="operator">*</span><span + class="identifier">dirfile</span><span class="operator">,</span> + <span class="keyword">const char</span> <span + class="operator">*</span><span + class="identifier">field_code</span><span class="operator">,</span> + <span class="keyword">unsigned int</span> <span + class="identifier">start</span><span class="operator">,</span> + <span class="keyword">size_t</span> <span + class="identifier">n</span><span class="operator">,</span> + <span class="keyword">gd_type_t</span> <span + class="identifier">data_type</span><span class="operator">,</span> + <span class="keyword">const void</span> <span + class="operator">*</span><span + class="identifier">data_int</span><span class="operator">);</span> + </div> + This will store <span class="syntax identifier">n</span> consecutive + elements, starting with the element indicated by <span class="syntax + identifier">start</span> (with the first element numbered zero). + To store the whole field, call <a href="#gd_put_carray"><span + class="syntax">gd_put_carray()</span></a>. + This function returns zero on success or -1 on error. + <h3><a name="gd_put_string">gd_put_string()</a></h3> <p>The value of a <b>STRING</b> field (including metafields) may be stored to the dirfile with 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-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-06 09:27:04
|
Revision: 471 http://getdata.svn.sourceforge.net/getdata/?rev=471&view=rev Author: ketiltrout Date: 2010-11-06 09:26:57 +0000 (Sat, 06 Nov 2010) Log Message: ----------- Well, that's not right. Modified Paths: -------------- trunk/getdata/src/common.c Modified: trunk/getdata/src/common.c =================================================================== --- trunk/getdata/src/common.c 2010-11-06 00:41:34 UTC (rev 470) +++ trunk/getdata/src/common.c 2010-11-06 09:26:57 UTC (rev 471) @@ -332,8 +332,7 @@ if (ptr == NULL) { free(E->e->u.linterp.lut); - _GD_SetEr - or(D, GD_E_ALLOC, 0, NULL, 0, NULL); + _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); fclose(fp); dreturnvoid(); return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-11-06 00:41:45
|
Revision: 470 http://getdata.svn.sourceforge.net/getdata/?rev=470&view=rev Author: ketiltrout Date: 2010-11-06 00:41:34 +0000 (Sat, 06 Nov 2010) Log Message: ----------- Remove GD_ANON from the private entry. Also rename 'cons' to 'scalar' in the public entry. Modified Paths: -------------- trunk/getdata/ChangeLog trunk/getdata/bindings/cxx/carrayentry.cpp trunk/getdata/bindings/cxx/constentry.cpp trunk/getdata/bindings/cxx/getdata/carrayentry.h trunk/getdata/bindings/cxx/getdata/constentry.h trunk/getdata/bindings/cxx/getdata/entry.h trunk/getdata/configure.ac trunk/getdata/man/gd_entry.3 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/html/getdata.html Modified: trunk/getdata/ChangeLog =================================================================== --- trunk/getdata/ChangeLog 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/ChangeLog 2010-11-06 00:41:34 UTC (rev 470) @@ -1,4 +1,10 @@ -2010-10-28 D. V. Wiebe <ge...@ke...> svn:469 +2010-11-06 D. V. Wiebe <ge...@ke...> svn:470 + * src/getdata.h.in: Rename 'cons' to 'scalar' in the unified entry struct. + + * src/internal.h: Remove GD_ANON from the private entry struct. + +2010-11-06 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. Modified: trunk/getdata/bindings/cxx/carrayentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/carrayentry.cpp 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/bindings/cxx/carrayentry.cpp 2010-11-06 00:41:34 UTC (rev 470) @@ -33,14 +33,14 @@ { 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.u.scalar.const_type = (gd_type_t)data_type; + E.u.scalar.array_len = array_len; E.fragment_index = fragment_index; } int CarrayEntry::SetType(DataType type) { - E.u.cons.const_type = (gd_type_t)type; + E.u.scalar.const_type = (gd_type_t)type; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); @@ -50,7 +50,7 @@ int CarrayEntry::SetArrayLen(size_t array_len) { - E.u.cons.array_len = array_len; + E.u.scalar.array_len = array_len; if (D != NULL) return gd_alter_entry(D->D, E.field, &E, 0); Modified: trunk/getdata/bindings/cxx/constentry.cpp =================================================================== --- trunk/getdata/bindings/cxx/constentry.cpp 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/bindings/cxx/constentry.cpp 2010-11-06 00:41:34 UTC (rev 470) @@ -33,13 +33,13 @@ { E.field = strdup(field_code); E.field_type = GD_CONST_ENTRY; - E.u.cons.const_type = (gd_type_t)data_type; + E.u.scalar.const_type = (gd_type_t)data_type; E.fragment_index = fragment_index; } int ConstEntry::SetType(DataType type) { - E.u.cons.const_type = (gd_type_t)type; + E.u.scalar.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/carrayentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/carrayentry.h 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/bindings/cxx/getdata/carrayentry.h 2010-11-06 00:41:34 UTC (rev 470) @@ -39,10 +39,10 @@ virtual DataType ConstType() const { - return (DataType)E.u.cons.const_type; + return (DataType)E.u.scalar.const_type; } - virtual size_t ArrayLen() const { return E.u.cons.array_len; } + virtual size_t ArrayLen() const { return E.u.scalar.array_len; } int SetArrayLen(size_t array_len); Modified: trunk/getdata/bindings/cxx/getdata/constentry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/constentry.h 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/bindings/cxx/getdata/constentry.h 2010-11-06 00:41:34 UTC (rev 470) @@ -36,7 +36,10 @@ ConstEntry(const char* field_code, DataType type, int fragment_index = 0); - virtual DataType ConstType() const { return (DataType)E.u.cons.const_type; } + virtual DataType ConstType() const + { + return (DataType)E.u.scalar.const_type; + } int SetType(DataType type); Modified: trunk/getdata/bindings/cxx/getdata/entry.h =================================================================== --- trunk/getdata/bindings/cxx/getdata/entry.h 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/bindings/cxx/getdata/entry.h 2010-11-06 00:41:34 UTC (rev 470) @@ -168,12 +168,12 @@ /* CONST methods */ virtual DataType ConstType() const { return (E.field_type == GD_CONST_ENTRY || E.field_type == - GD_CARRAY_ENTRY) ? (DataType)E.u.cons.const_type : Unknown; + GD_CARRAY_ENTRY) ? (DataType)E.u.scalar.const_type : Unknown; }; /* CARRAY methods */ virtual size_t ArrayLen() const { - return (E.field_type == GD_CARRAY_ENTRY) ? E.u.cons.array_len : 0; + return (E.field_type == GD_CARRAY_ENTRY) ? E.u.scalar.array_len : 0; }; /* POLYNOM methods */ Modified: trunk/getdata/configure.ac =================================================================== --- trunk/getdata/configure.ac 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/configure.ac 2010-11-06 00:41:34 UTC (rev 470) @@ -486,8 +486,8 @@ AC_DEFINE([_BSD_SOURCE], [], [ Expose BSD-derived definitions ]) AC_DEFINE([_SVID_SOURCE], [], [ Expose System V-derived definitions ]) AC_DEFINE([_POSIX_SOURCE], [], [ Expose POSIX.1-1990 conforming definitions ]) -AC_DEFINE([_POSIX_C_SOURCE], [200112L], - [ Expose POSIX.1-2001 conforming definitions ]) +AC_DEFINE([_POSIX_C_SOURCE], [200809L], + [ Expose POSIX:2008 conforming definitions ]) dnl libraries echo Modified: trunk/getdata/man/gd_entry.3 =================================================================== --- trunk/getdata/man/gd_entry.3 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/man/gd_entry.3 2010-11-06 00:41:34 UTC (rev 470) @@ -748,8 +748,8 @@ gd_shift_t|shift|gd_shift_t|u.phase.shift double compex|cdividend|double|u.recip.cdividend[2] double|dividend|double|u.recip.dividend -gd_type_t|const_type|gd_type_t|u.cons.const_type -size_t|array_len|size_t|u.cons.array_len +gd_type_t|const_type|gd_type_t|u.scalar.const_type +size_t|array_len|size_t|u.scalar.array_len .TE .P In the case of complex valued data in the C89 API, the first element of the two Modified: trunk/getdata/src/add.c =================================================================== --- trunk/getdata/src/add.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/add.c 2010-11-06 00:41:34 UTC (rev 470) @@ -187,39 +187,35 @@ } 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; + E->e->u.raw.file[0].fp = E->e->u.raw.file[1].fp = -1; + E->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN; - if ((E->e->EN(raw,filebase) = (char *)malloc(FILENAME_MAX)) == NULL) { + if ((E->e->u.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->EN(raw,filebase), FILENAME_MAX, "%s/%s/%s", D->name, + snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s/%s", D->name, D->fragment[E->fragment_index].sname, E->field); else - snprintf(E->e->EN(raw,filebase), FILENAME_MAX, "%s/%s", D->name, + snprintf(E->e->u.raw.filebase, FILENAME_MAX, "%s/%s", D->name, E->field); if ((E->EN(raw,spf) = entry->EN(raw,spf)) == 0) _GD_SetError(D, GD_E_BAD_ENTRY, GD_E_BAD_ENTRY_SPF, NULL, entry->EN(raw,spf), NULL); - else if (E->EN(raw,data_type) & 0x40 || (E->e->EN(raw,size) = + else if (E->EN(raw,data_type) & 0x40 || (E->e->u.raw.size = GD_SIZE(E->EN(raw,data_type))) == 0) _GD_SetError(D, GD_E_BAD_TYPE, entry->EN(raw,data_type), NULL, 0, NULL); else if (!_GD_Supports(D, E, GD_EF_TOUCH)) ; /* error already set */ - else if (_GD_SetEncodedName(D, E->e->EN(raw,file), E->e->EN(raw,filebase), - 0)) - { + else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) ; /* error already set */ - } else if ((*_gd_ef[E->e->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, + 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 (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) @@ -267,7 +263,7 @@ } break; case GD_LINTERP_ENTRY: - E->e->EN(linterp,table_len) = -1; + E->e->u.linterp.table_len = -1; if ((E->in_fields[0] = strdup(entry->in_fields[0])) == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); @@ -325,36 +321,40 @@ copy_scalar[0] = 1; break; case GD_CONST_ENTRY: - E->EN(cons,const_type) = entry->EN(cons,const_type); - E->EN(cons,array_len) = -1; + E->EN(scalar,const_type) = entry->EN(scalar,const_type); + E->EN(scalar,array_len) = -1; - if (E->EN(cons,const_type) & 0x40 || GD_SIZE(E->EN(cons,const_type)) == 0) - _GD_SetError(D, GD_E_BAD_TYPE, E->EN(cons,const_type), NULL, 0, NULL); - else { - E->e->EN(cons,d) = malloc(GD_SIZE(_GD_ConstType(D, - E->EN(cons,const_type)))); - if (!D->error && E->e->EN(cons,d) == NULL) + if (E->EN(scalar,const_type) & 0x40 || GD_SIZE(E->EN(scalar,const_type)) + == 0) + { + _GD_SetError(D, GD_E_BAD_TYPE, E->EN(scalar,const_type), NULL, 0, NULL); + } else { + E->e->u.scalar.d = malloc(GD_SIZE(_GD_ConstType(D, + E->EN(scalar,const_type)))); + if (!D->error && E->e->u.scalar.d == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); } break; case GD_CARRAY_ENTRY: - E->EN(cons,const_type) = entry->EN(cons,const_type); - E->EN(cons,array_len) = entry->EN(cons,array_len); + E->EN(scalar,const_type) = entry->EN(scalar,const_type); + E->EN(scalar,array_len) = entry->EN(scalar,array_len); - if (E->EN(cons,const_type) & 0x40 || GD_SIZE(E->EN(cons,const_type)) == 0) - _GD_SetError(D, GD_E_BAD_TYPE, E->EN(cons,const_type), NULL, 0, NULL); - else if (E->EN(cons,array_len) > GD_MAX_CARRAY_LENGTH) + if (E->EN(scalar,const_type) & 0x40 || GD_SIZE(E->EN(scalar,const_type)) + == 0) + { + _GD_SetError(D, GD_E_BAD_TYPE, E->EN(scalar,const_type), NULL, 0, NULL); + } else if (E->EN(scalar,array_len) > GD_MAX_CARRAY_LENGTH) _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL); else { - E->e->EN(cons,d) = malloc(GD_SIZE(_GD_ConstType(D, - E->EN(cons,const_type))) * E->EN(cons,array_len)); - if (!D->error && E->e->EN(cons,d) == NULL) + E->e->u.scalar.d = malloc(GD_SIZE(_GD_ConstType(D, + E->EN(scalar,const_type))) * E->EN(scalar,array_len)); + if (!D->error && E->e->u.scalar.d == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); } break; case GD_STRING_ENTRY: - E->e->ES(string) = strdup(""); - if (E->e->ES(string) == NULL) + E->e->u.string = strdup(""); + if (E->e->u.string == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); break; case GD_POLYNOM_ENTRY: @@ -1135,7 +1135,7 @@ memset(&C, 0, sizeof(gd_entry_t)); C.field = (char *)field_code; C.field_type = GD_CONST_ENTRY; - C.EN(cons,const_type) = const_type; + C.EN(scalar,const_type) = const_type; C.fragment_index = fragment_index; int error = _GD_Add(D, &C, NULL); @@ -1175,8 +1175,8 @@ memset(&C, 0, sizeof(gd_entry_t)); C.field = (char *)field_code; C.field_type = GD_CARRAY_ENTRY; - C.EN(cons,const_type) = const_type; - C.EN(cons,array_len) = array_len; + C.EN(scalar,const_type) = const_type; + C.EN(scalar,array_len) = array_len; C.fragment_index = fragment_index; int error = _GD_Add(D, &C, NULL); @@ -1680,7 +1680,7 @@ gd_entry_t C; C.field = (char *)field_code; C.field_type = GD_CONST_ENTRY; - C.EN(cons,const_type) = const_type; + C.EN(scalar,const_type) = const_type; C.fragment_index = 0; int error = _GD_Add(D, &C, parent); @@ -1729,8 +1729,8 @@ gd_entry_t C; C.field = (char *)field_code; C.field_type = GD_CARRAY_ENTRY; - C.EN(cons,const_type) = const_type; - C.EN(cons,array_len) = array_len; + C.EN(scalar,const_type) = const_type; + C.EN(scalar,array_len) = array_len; C.fragment_index = 0; int error = _GD_Add(D, &C, parent); Modified: trunk/getdata/src/common.c =================================================================== --- trunk/getdata/src/common.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/common.c 2010-11-06 00:41:34 UTC (rev 470) @@ -189,24 +189,24 @@ dtrace("%p, %p, %p", D, E, e); if (E->EN(linterp,table)[0] == '/') { - e->EN(linterp,table_path) = strdup(E->EN(linterp,table)); - if (e->EN(linterp,table_path) == NULL) { + e->u.linterp.table_path = strdup(E->EN(linterp,table)); + if (e->u.linterp.table_path == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); dreturn("%i", 1); return 1; } } else { - e->EN(linterp,table_path) = (char *)malloc(FILENAME_MAX); - if (e->EN(linterp,table_path) == NULL) { + e->u.linterp.table_path = (char *)malloc(FILENAME_MAX); + if (e->u.linterp.table_path == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); dreturn("%i", 1); return 1; } char temp_buffer[FILENAME_MAX]; strcpy(temp_buffer, D->fragment[E->fragment_index].cname); - strcpy(e->EN(linterp,table_path), dirname(temp_buffer)); - strcat(e->EN(linterp,table_path), "/"); - strcat(e->EN(linterp,table_path), E->EN(linterp,table)); + strcpy(e->u.linterp.table_path, dirname(temp_buffer)); + strcat(e->u.linterp.table_path, "/"); + strcat(e->u.linterp.table_path, E->EN(linterp,table)); } dreturn("%i", 0); @@ -236,16 +236,16 @@ dtrace("%p, %p", D, E); - if (E->e->EN(linterp,table_path) == NULL) + if (E->e->u.linterp.table_path == NULL) if (_GD_SetTablePath(D, E, E->e)) { dreturnvoid(); return; } - fp = fopen(E->e->EN(linterp,table_path), "r" FOPEN_TEXT); + fp = fopen(E->e->u.linterp.table_path, "r" FOPEN_TEXT); if (fp == NULL) { _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_OPEN, NULL, 0, - E->e->EN(linterp,table_path)); + E->e->u.linterp.table_path); dreturnvoid(); return; } @@ -254,25 +254,25 @@ if ((line = _GD_GetLine(fp, &n, &linenum))) { char ystr[50]; if (sscanf(line, "%lg %49s", &yr, ystr) == 2) - E->e->EN(linterp,complex_table) = (strchr(ystr, ';') == NULL) ? 0 : 1; + E->e->u.linterp.complex_table = (strchr(ystr, ';') == NULL) ? 0 : 1; } else { if (errno == EOVERFLOW) /* line too long */ - _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->e->EN(linterp,table_path), + _GD_SetError(D, GD_E_LINE_TOO_LONG, 0, E->e->u.linterp.table_path, linenum, NULL); else /* no data in file! */ _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, NULL, 0, - E->e->EN(linterp,table_path)); + E->e->u.linterp.table_path); fclose(fp); dreturnvoid(); return; } - E->e->EN(linterp,lut) = (struct _gd_lut *)malloc(buf_len * + E->e->u.linterp.lut = (struct _gd_lut *)malloc(buf_len * sizeof(struct _gd_lut)); - if (E->e->EN(linterp,lut) == NULL) { + if (E->e->u.linterp.lut == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); fclose(fp); dreturnvoid(); @@ -282,72 +282,70 @@ /* now read in the data -- we've already read line one */ i = 0; do { - if (E->e->EN(linterp,complex_table)) { - sscanf(line, "%lg %lg;%lg", &(E->e->EN(linterp,lut)[i].x), &yr, &yi); - _gd_l2c(E->e->EN(linterp,lut)[i].y.c, yr, yi); + if (E->e->u.linterp.complex_table) { + sscanf(line, "%lg %lg;%lg", &(E->e->u.linterp.lut[i].x), &yr, &yi); + _gd_l2c(E->e->u.linterp.lut[i].y.c, yr, yi); } else - sscanf(line, "%lg %lg", &(E->e->EN(linterp,lut)[i].x), - &(E->e->EN(linterp,lut)[i].y.r)); + sscanf(line, "%lg %lg", &(E->e->u.linterp.lut[i].x), + &(E->e->u.linterp.lut[i].y.r)); - if (dir > -2 && i > 0 && E->e->EN(linterp,lut)[i].x != - E->e->EN(linterp,lut)[i - 1].x) + if (dir > -2 && i > 0 && E->e->u.linterp.lut[i].x != + E->e->u.linterp.lut[i - 1].x) { if (dir == -1) - dir = (E->e->EN(linterp,lut)[i].x > E->e->EN(linterp,lut)[i - 1].x); - else if (dir != (E->e->EN(linterp,lut)[i].x > E->e->EN(linterp,lut)[i - - 1].x)) - { + dir = (E->e->u.linterp.lut[i].x > E->e->u.linterp.lut[i - 1].x); + else if (dir != (E->e->u.linterp.lut[i].x > E->e->u.linterp.lut[i - 1].x)) dir = -2; - } } i++; if (i >= buf_len) { buf_len += 100; - ptr = (struct _gd_lut *)realloc(E->e->EN(linterp,lut), buf_len * + ptr = (struct _gd_lut *)realloc(E->e->u.linterp.lut, buf_len * sizeof(struct _gd_lut)); if (ptr == NULL) { - free(E->e->EN(linterp,lut)); + free(E->e->u.linterp.lut); _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); fclose(fp); dreturnvoid(); return; } - E->e->EN(linterp,lut) = ptr; + E->e->u.linterp.lut = ptr; } free(line); } while ((line = _GD_GetLine(fp, &n, &linenum))); if (i < 2) { - free(E->e->EN(linterp,lut)); + free(E->e->u.linterp.lut); _GD_SetError(D, GD_E_OPEN_LINFILE, GD_E_LINFILE_LENGTH, NULL, 0, - E->e->EN(linterp,table_path)); + E->e->u.linterp.table_path); fclose(fp); dreturnvoid(); return; } /* Free unused memory */ - ptr = (struct _gd_lut *)realloc(E->e->EN(linterp,lut), i + ptr = (struct _gd_lut *)realloc(E->e->u.linterp.lut, i * sizeof(struct _gd_lut)); if (ptr == NULL) { - free(E->e->EN(linterp,lut)); - _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); + free(E->e->u.linterp.lut); + _GD_SetEr + or(D, GD_E_ALLOC, 0, NULL, 0, NULL); fclose(fp); dreturnvoid(); return; } - E->e->EN(linterp,table_monotonic) = -1; - E->e->EN(linterp,lut) = ptr; - E->e->EN(linterp,table_len) = i; + E->e->u.linterp.table_monotonic = -1; + E->e->u.linterp.lut = ptr; + E->e->u.linterp.table_len = i; /* sort the LUT */ if (dir == -2) - qsort(E->e->EN(linterp,lut), i, sizeof(struct _gd_lut), lutcmp); + qsort(E->e->u.linterp.lut, i, sizeof(struct _gd_lut), lutcmp); fclose(fp); dreturnvoid(); Modified: trunk/getdata/src/constant.c =================================================================== --- trunk/getdata/src/constant.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/constant.c 2010-11-06 00:41:34 UTC (rev 470) @@ -94,7 +94,7 @@ if (entry->field_type != GD_CARRAY_ENTRY) _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code); - else if (start + n > entry->EN(cons,array_len)) + else if (start + n > entry->EN(scalar,array_len)) _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL); else if (!D->error) _GD_DoField(D, entry, repr, start, n, return_type, data_out); @@ -138,7 +138,7 @@ if (entry->field_type != GD_CARRAY_ENTRY) _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code); else if (!D->error) - _GD_DoField(D, entry, repr, 0, entry->EN(cons,array_len), return_type, + _GD_DoField(D, entry, repr, 0, entry->EN(scalar,array_len), return_type, data_out); if (field_code != field_code_in) @@ -187,8 +187,8 @@ return 0; } - dreturn("%zu", entry->EN(cons,array_len)); - return entry->EN(cons,array_len); + dreturn("%zu", entry->EN(scalar,array_len)); + return entry->EN(scalar,array_len); } /* this function is little more than a public boilerplate for _GD_DoFieldOut */ @@ -237,13 +237,13 @@ } /* Flag all clients as needing recalculation */ - for (i = 0; i < entry->e->EN(cons,n_client); ++i) - entry->e->EN(cons,client)[i]->e->calculated = 0; + for (i = 0; i < entry->e->u.scalar.n_client; ++i) + entry->e->u.scalar.client[i]->e->calculated = 0; /* Clear the client list */ - free(entry->e->EN(cons,client)); - entry->e->EN(cons,client) = NULL; - entry->e->EN(cons,n_client) = 0; + free(entry->e->u.scalar.client); + entry->e->u.scalar.client = NULL; + entry->e->u.scalar.n_client = 0; dreturn("%i", 0); return 0; @@ -284,7 +284,7 @@ if (entry->field_type != GD_CARRAY_ENTRY) _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code); - else if (first + n > entry->EN(cons,array_len)) + else if (first + n > entry->EN(scalar,array_len)) _GD_SetError(D, GD_E_BOUNDS, 0, NULL, 0, NULL); else _GD_DoFieldOut(D, entry, repr, first, n, data_type, data_in); @@ -298,13 +298,13 @@ } /* Flag all clients as needing recalculation */ - for (i = 0; i < entry->e->EN(cons,n_client); ++i) - entry->e->EN(cons,client)[i]->e->calculated = 0; + for (i = 0; i < entry->e->u.scalar.n_client; ++i) + entry->e->u.scalar.client[i]->e->calculated = 0; /* Clear the client list */ - free(entry->e->EN(cons,client)); - entry->e->EN(cons,client) = NULL; - entry->e->EN(cons,n_client) = 0; + free(entry->e->u.scalar.client); + entry->e->u.scalar.client = NULL; + entry->e->u.scalar.n_client = 0; dreturn("%i", 0); return 0; @@ -344,7 +344,7 @@ if (entry->field_type != GD_CARRAY_ENTRY) _GD_SetError(D, GD_E_BAD_FIELD_TYPE, GD_E_FIELD_BAD, NULL, 0, field_code); else - _GD_DoFieldOut(D, entry, repr, 0, entry->EN(cons,array_len), data_type, + _GD_DoFieldOut(D, entry, repr, 0, entry->EN(scalar,array_len), data_type, data_in); if (field_code != field_code_in) @@ -356,13 +356,13 @@ } /* Flag all clients as needing recalculation */ - for (i = 0; i < entry->e->EN(cons,n_client); ++i) - entry->e->EN(cons,client)[i]->e->calculated = 0; + for (i = 0; i < entry->e->u.scalar.n_client; ++i) + entry->e->u.scalar.client[i]->e->calculated = 0; /* Clear the client list */ - free(entry->e->EN(cons,client)); - entry->e->EN(cons,client) = NULL; - entry->e->EN(cons,n_client) = 0; + free(entry->e->u.scalar.client); + entry->e->u.scalar.client = NULL; + entry->e->u.scalar.n_client = 0; dreturn("%i", 0); return 0; Modified: trunk/getdata/src/del.c =================================================================== --- trunk/getdata/src/del.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/del.c 2010-11-06 00:41:34 UTC (rev 470) @@ -324,21 +324,21 @@ return -1; } - if (_GD_SetEncodedName(D, E->e->EN(raw,file), E->e->EN(raw,filebase), 0)) { + if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) { free(del_list); dreturn("%i", -1); return -1; } - if ((*_gd_ef[E->e->EN(raw,file)[0].encoding].unlink)(E->e->EN(raw,file))) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, NULL); + if ((*_gd_ef[E->e->u.raw.file[0].encoding].unlink)(E->e->u.raw.file)) { + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); free(del_list); dreturn("%i", -1); return -1; } - } else if (E->field_type == GD_RAW_ENTRY && E->e->EN(raw,file)->fp != -1) { - if ((*_gd_ef[E->e->EN(raw,file)[0].encoding].close)(E->e->EN(raw,file))) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, NULL); + } else if (E->field_type == GD_RAW_ENTRY && E->e->u.raw.file->fp != -1) { + if ((*_gd_ef[E->e->u.raw.file[0].encoding].close)(E->e->u.raw.file)) { + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); free(del_list); dreturn("%i", -1); return -1; Modified: trunk/getdata/src/encoding.c =================================================================== --- trunk/getdata/src/encoding.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/encoding.c 2010-11-06 00:41:34 UTC (rev 470) @@ -333,8 +333,8 @@ /* Figure out the dirfile encoding type, if required */ if (D->fragment[E->fragment_index].encoding == GD_AUTO_ENCODED) { D->fragment[E->fragment_index].encoding = - _GD_ResolveEncoding(E->e->EN(raw,filebase), GD_AUTO_ENCODED, - E->e->EN(raw,file)); + _GD_ResolveEncoding(E->e->u.raw.filebase, GD_AUTO_ENCODED, + E->e->u.raw.file); } /* If the encoding scheme is unknown, complain */ @@ -345,12 +345,12 @@ } /* Figure out the encoding subtype, if required */ - if (E->e->EN(raw,file)[0].encoding == GD_ENC_UNKNOWN) - _GD_ResolveEncoding(E->e->EN(raw,filebase), - D->fragment[E->fragment_index].encoding, E->e->EN(raw,file)); + if (E->e->u.raw.file[0].encoding == GD_ENC_UNKNOWN) + _GD_ResolveEncoding(E->e->u.raw.filebase, + D->fragment[E->fragment_index].encoding, E->e->u.raw.file); /* check for our function(s) */ - if (_GD_MissingFramework(E->e->EN(raw,file)[0].encoding, funcs)) { + if (_GD_MissingFramework(E->e->u.raw.file[0].encoding, funcs)) { _GD_SetError(D, GD_E_UNSUPPORTED, 0, NULL, 0, NULL); dreturn("%i", 0); return 0; @@ -429,42 +429,42 @@ * remove the temporary files */ if (D->error) { for (i = 0; i < n_raw; ++i) - if (_gd_ef[raw_entry[i]->e->EN(raw,file)[1].encoding].temp != NULL && - (*_gd_ef[raw_entry[i]->e->EN(raw,file)[1].encoding].temp)( - raw_entry[i]->e->EN(raw,file), GD_TEMP_DESTROY)) + if (_gd_ef[raw_entry[i]->e->u.raw.file[1].encoding].temp != NULL && + (*_gd_ef[raw_entry[i]->e->u.raw.file[1].encoding].temp)( + raw_entry[i]->e->u.raw.file, GD_TEMP_DESTROY)) { - _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->EN(raw,file)[0].name, + _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->u.raw.file[0].name, errno, NULL); } } else for (i = 0; i < n_raw; ++i) { struct _gd_raw_file temp; - memcpy(&temp, raw_entry[i]->e->EN(raw,file), sizeof(temp)); + memcpy(&temp, raw_entry[i]->e->u.raw.file, sizeof(temp)); - raw_entry[i]->e->EN(raw,file)[0].name = NULL; - raw_entry[i]->e->EN(raw,file)[0].encoding = - raw_entry[i]->e->EN(raw,file)[1].encoding; + raw_entry[i]->e->u.raw.file[0].name = NULL; + raw_entry[i]->e->u.raw.file[0].encoding = + raw_entry[i]->e->u.raw.file[1].encoding; - if (_GD_SetEncodedName(D, raw_entry[i]->e->EN(raw,file), - raw_entry[i]->e->EN(raw,filebase), 0)) + if (_GD_SetEncodedName(D, raw_entry[i]->e->u.raw.file, + raw_entry[i]->e->u.raw.filebase, 0)) { - raw_entry[i]->e->EN(raw,file)[0].name = temp.name; - raw_entry[i]->e->EN(raw,file)[0].encoding = temp.encoding; + raw_entry[i]->e->u.raw.file[0].name = temp.name; + raw_entry[i]->e->u.raw.file[0].encoding = temp.encoding; } else if ( - (*_gd_ef[raw_entry[i]->e->EN(raw,file)[1].encoding].temp)( - raw_entry[i]->e->EN(raw,file), GD_TEMP_MOVE)) + (*_gd_ef[raw_entry[i]->e->u.raw.file[1].encoding].temp)( + raw_entry[i]->e->u.raw.file, GD_TEMP_MOVE)) { _GD_SetError(D, GD_E_UNCLEAN_DB, 0, D->fragment[D->entry[i]->fragment_index].cname, 0, NULL); D->flags |= GD_INVALID; - raw_entry[i]->e->EN(raw,file)[0].name = temp.name; - raw_entry[i]->e->EN(raw,file)[0].encoding = temp.encoding; + raw_entry[i]->e->u.raw.file[0].name = temp.name; + raw_entry[i]->e->u.raw.file[0].encoding = temp.encoding; } else if ((*_gd_ef[temp.encoding].unlink)(&temp)) { _GD_SetError(D, GD_E_UNCLEAN_DB, 0, D->fragment[D->entry[i]->fragment_index].cname, 0, NULL); D->flags |= GD_INVALID; - raw_entry[i]->e->EN(raw,file)[0].name = temp.name; - raw_entry[i]->e->EN(raw,file)[0].encoding = temp.encoding; + raw_entry[i]->e->u.raw.file[0].name = temp.name; + raw_entry[i]->e->u.raw.file[0].encoding = temp.encoding; } else free(temp.name); } @@ -481,16 +481,16 @@ D->entry[i]->field_type == GD_RAW_ENTRY) { /* close the old file */ - if (D->entry[i]->e->EN(raw,file)[0].fp != -1 && - (*_gd_ef[D->entry[i]->e->EN(raw,file)[0].encoding].close)( - D->entry[i]->e->EN(raw,file))) + if (D->entry[i]->e->u.raw.file[0].fp != -1 && + (*_gd_ef[D->entry[i]->e->u.raw.file[0].encoding].close)( + D->entry[i]->e->u.raw.file)) { - _GD_SetError(D, GD_E_RAW_IO, 0, D->entry[i]->e->EN(raw,file)[1].name, + _GD_SetError(D, GD_E_RAW_IO, 0, D->entry[i]->e->u.raw.file[1].name, errno, NULL); break; } /* reset encoding subscheme. */ - D->entry[i]->e->EN(raw,file)[0].encoding = GD_ENC_UNKNOWN; + D->entry[i]->e->u.raw.file[0].encoding = GD_ENC_UNKNOWN; } } @@ -577,8 +577,8 @@ D->entry[i]->field_type == GD_RAW_ENTRY) { D->fragment[fragment].encoding = - _GD_ResolveEncoding(D->entry[i]->e->EN(raw,filebase), GD_AUTO_ENCODED, - D->entry[i]->e->EN(raw,file)); + _GD_ResolveEncoding(D->entry[i]->e->u.raw.filebase, GD_AUTO_ENCODED, + D->entry[i]->e->u.raw.file); if (D->fragment[fragment].encoding != GD_AUTO_ENCODED) break; Modified: trunk/getdata/src/endian.c =================================================================== --- trunk/getdata/src/endian.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/endian.c 2010-11-06 00:41:34 UTC (rev 470) @@ -66,7 +66,7 @@ D->entry[i]->field_type == GD_RAW_ENTRY) { /* if the field's data type is one byte long, do nothing */ - if (D->entry[i]->e->EN(raw,size) == 1) + if (D->entry[i]->e->u.raw.size == 1) continue; /* check subencoding support */ @@ -87,14 +87,14 @@ * remove the temporary files */ if (D->error) { for (i = 0; i < n_raw; ++i) - if ((*_gd_ef[raw_entry[i]->e->EN(raw,file)[0].encoding].temp)( - raw_entry[i]->e->EN(raw,file), GD_TEMP_DESTROY)) - _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->EN(raw,file)[0].name, + if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)( + raw_entry[i]->e->u.raw.file, GD_TEMP_DESTROY)) + _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->u.raw.file[0].name, errno, NULL); } else { for (i = 0; i < n_raw; ++i) - if ((*_gd_ef[raw_entry[i]->e->EN(raw,file)[0].encoding].temp)( - raw_entry[i]->e->EN(raw,file), GD_TEMP_MOVE)) + if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)( + raw_entry[i]->e->u.raw.file, GD_TEMP_MOVE)) { _GD_SetError(D, GD_E_UNCLEAN_DB, 0, D->fragment[D->entry[i]->fragment_index].cname, 0, NULL); Modified: trunk/getdata/src/entry.c =================================================================== --- trunk/getdata/src/entry.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/entry.c 2010-11-06 00:41:34 UTC (rev 470) @@ -50,7 +50,7 @@ free(entry->in_fields[0]); free(entry->EN(linterp,table)); if (priv) - free(entry->e->EN(linterp,table_path)); + free(entry->e->u.linterp.table_path); break; case GD_RECIP_ENTRY: free(entry->in_fields[0]); @@ -76,21 +76,21 @@ break; case GD_STRING_ENTRY: if (priv) - free(entry->e->ES(string)); + free(entry->e->u.string); break; case GD_CONST_ENTRY: case GD_CARRAY_ENTRY: if (priv) { - free(entry->e->EN(cons,client)); - free(entry->e->EN(cons,d)); + free(entry->e->u.scalar.client); + free(entry->e->u.scalar.d); } break; case GD_RAW_ENTRY: free(entry->scalar[0]); if (priv) { - free(entry->e->EN(raw,filebase)); - free(entry->e->EN(raw,file)[0].name); - free(entry->e->EN(raw,file)[1].name); + free(entry->e->u.raw.filebase); + free(entry->e->u.raw.file[0].name); + free(entry->e->u.raw.file[1].name); } break; case GD_INDEX_ENTRY: @@ -162,7 +162,7 @@ } if ((D->flags & GD_ACCMODE) == GD_RDWR) { - ptr = realloc(C->e->EN(cons,client), (C->e->EN(cons,n_client) + 1) * + ptr = realloc(C->e->u.scalar.client, (C->e->u.scalar.n_client + 1) * sizeof(gd_entry_t*)); if (ptr == NULL) _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); @@ -171,8 +171,8 @@ _GD_DoField(D, C, repr, index, 1, type, data); if (ptr) { - C->e->EN(cons,client) = (gd_entry_t **)ptr; - C->e->EN(cons,client)[C->e->EN(cons,n_client)++] = E; + C->e->u.scalar.client = (gd_entry_t **)ptr; + C->e->u.scalar.client[C->e->u.scalar.n_client++] = E; } } @@ -289,27 +289,26 @@ if (field_code != field_code_in) free(field_code); - if (E->e->EN(raw,file)[0].name == NULL) { + if (E->e->u.raw.file[0].name == NULL) { /* ensure encoding sybtype is known */ if (!_GD_Supports(D, E, 0)) { dreturn("%p", NULL); return NULL; } - if (E->e->EN(raw,file)[0].encoding == GD_ENC_UNKNOWN) { + if (E->e->u.raw.file[0].encoding == GD_ENC_UNKNOWN) { _GD_SetError(D, GD_E_UNKNOWN_ENCODING, 0, NULL, 0, NULL); dreturn("%p", NULL); return NULL; - } else if (_GD_SetEncodedName(D, E->e->EN(raw,file), E->e->EN(raw,filebase), - 0)) + } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) { dreturn("%p", NULL); return NULL; } } - dreturn("%p", E->e->EN(raw,file)[0].name); - return E->e->EN(raw,file)[0].name; + dreturn("%p", E->e->u.raw.file[0].name); + return E->e->u.raw.file[0].name; } int gd_entry(DIRFILE* D, const char* field_code_in, gd_entry_t* entry) Modified: trunk/getdata/src/field_list.c =================================================================== --- trunk/getdata/src/field_list.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/field_list.c 2010-11-06 00:41:34 UTC (rev 470) @@ -115,7 +115,7 @@ for (i = n = 0; i < D->n_entries; ++i) { if (D->entry[i]->field_type == GD_CARRAY_ENTRY && D->entry[i]->e->n_meta != -1) { - fl[n].n = D->entry[i]->EN(cons,array_len); + fl[n].n = D->entry[i]->EN(scalar,array_len); fl[n].d = _GD_Alloc(D, return_type, fl[n].n); if (D->error || _GD_DoField(D, D->entry[i], 0, 0, fl[n].n, return_type, fl[n].d) != 1) @@ -169,7 +169,7 @@ for (i = n = 0; i < D->n_entries; ++i) { if (D->entry[i]->field_type == GD_STRING_ENTRY && D->entry[i]->e->n_meta != -1) - fl[n++] = D->entry[i]->e->ES(string); + fl[n++] = D->entry[i]->e->u.string; } fl[n] = NULL; Modified: trunk/getdata/src/flimits.c =================================================================== --- trunk/getdata/src/flimits.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/flimits.c 2010-11-06 00:41:34 UTC (rev 470) @@ -74,14 +74,14 @@ * remove the temporary files */ if (D->error) { for (i = 0; i < n_raw; ++i) - if ((*_gd_ef[raw_entry[i]->e->EN(raw,file)[0].encoding].temp)( - raw_entry[i]->e->EN(raw,file), GD_TEMP_DESTROY)) - _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->EN(raw,file)[0].name, + if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)( + raw_entry[i]->e->u.raw.file, GD_TEMP_DESTROY)) + _GD_SetError(D, GD_E_RAW_IO, 0, raw_entry[i]->e->u.raw.file[0].name, errno, NULL); } else { for (i = 0; i < n_raw; ++i) - if ((*_gd_ef[raw_entry[i]->e->EN(raw,file)[0].encoding].temp)( - raw_entry[i]->e->EN(raw,file), GD_TEMP_MOVE)) + if ((*_gd_ef[raw_entry[i]->e->u.raw.file[0].encoding].temp)( + raw_entry[i]->e->u.raw.file, GD_TEMP_MOVE)) { _GD_SetError(D, GD_E_UNCLEAN_DB, 0, D->fragment[D->entry[i]->fragment_index].cname, 0, NULL); @@ -205,15 +205,14 @@ if (!_GD_Supports(D, E, GD_EF_SIZE)) break; - if (_GD_SetEncodedName(D, E->e->EN(raw,file), E->e->EN(raw,filebase), 0)) + if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) break; - ns = (*_gd_ef[E->e->EN(raw,file)[0].encoding].size)(E->e->EN(raw,file), + ns = (*_gd_ef[E->e->u.raw.file[0].encoding].size)(E->e->u.raw.file, E->EN(raw,data_type)); if (ns < 0) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, - NULL); + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); ns = -1; break; } Modified: trunk/getdata/src/flush.c =================================================================== --- trunk/getdata/src/flush.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/flush.c 2010-11-06 00:41:34 UTC (rev 470) @@ -48,16 +48,16 @@ switch(E->field_type) { case GD_RAW_ENTRY: - if (E->e->EN(raw,file)[0].fp >= 0) { + if (E->e->u.raw.file[0].fp >= 0) { if ((D->flags & GD_ACCMODE) == GD_RDWR && - _gd_ef[E->e->EN(raw,file)[0].encoding].sync != NULL && - (*_gd_ef[E->e->EN(raw,file)[0].encoding].sync)(E->e->EN(raw,file))) - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + _gd_ef[E->e->u.raw.file[0].encoding].sync != NULL && + (*_gd_ef[E->e->u.raw.file[0].encoding].sync)(E->e->u.raw.file)) + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); - else if ((*_gd_ef[E->e->EN(raw,file)[0].encoding].close)(E->e->EN(raw, - file))) + else if ((*_gd_ef[E->e->u.raw.file[0].encoding].close)( + E->e->u.raw.file)) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); } } @@ -371,38 +371,38 @@ break; case GD_CONST_ENTRY: fprintf(stream, " CONST%s %s ", pretty ? " " : "", _GD_TypeName(D, - E->EN(cons,const_type))); - if (E->EN(cons,const_type) & GD_SIGNED) - fprintf(stream, "%" PRIi64 "\n", *(int64_t*)E->e->EN(cons,d)); - else if (E->EN(cons,const_type) & GD_IEEE754) - fprintf(stream, "%.15g\n", *(double*)E->e->EN(cons,d)); - else if (E->EN(cons,const_type) & GD_COMPLEX) - fprintf(stream, "%.15g;%.15g\n", *(double*)E->e->EN(cons,d), - *((double*)E->e->EN(cons,d) + 1)); + E->EN(scalar,const_type))); + if (E->EN(scalar,const_type) & GD_SIGNED) + fprintf(stream, "%" PRIi64 "\n", *(int64_t*)E->e->u.scalar.d); + else if (E->EN(scalar,const_type) & GD_IEEE754) + fprintf(stream, "%.15g\n", *(double*)E->e->u.scalar.d); + else if (E->EN(scalar,const_type) & GD_COMPLEX) + fprintf(stream, "%.15g;%.15g\n", *(double*)E->e->u.scalar.d, + *((double*)E->e->u.scalar.d + 1)); else - fprintf(stream, "%" PRIu64 "\n", *(uint64_t*)E->e->EN(cons,d)); + fprintf(stream, "%" PRIu64 "\n", *(uint64_t*)E->e->u.scalar.d); break; case GD_CARRAY_ENTRY: fprintf(stream, " CARRAY%s %s", pretty ? " " : "", _GD_TypeName(D, - E->EN(cons,const_type))); - if (E->EN(cons,const_type) & GD_SIGNED) - for (z = 0; z < E->EN(cons,array_len); ++z) - fprintf(stream, " %" PRIi64, ((int64_t*)E->e->EN(cons,d))[z]); - else if (E->EN(cons,const_type) & GD_IEEE754) - for (z = 0; z < E->EN(cons,array_len); ++z) - fprintf(stream, " %.15g", ((double*)E->e->EN(cons,d))[z]); - else if (E->EN(cons,const_type) & GD_COMPLEX) - for (z = 0; z < E->EN(cons,array_len); ++z) - fprintf(stream, " %.15g;%.15g", ((double*)E->e->EN(cons,d))[2 * z], - ((double*)E->e->EN(cons,d))[2 * z + 1]); + E->EN(scalar,const_type))); + if (E->EN(scalar,const_type) & GD_SIGNED) + for (z = 0; z < E->EN(scalar,array_len); ++z) + fprintf(stream, " %" PRIi64, ((int64_t*)E->e->u.scalar.d)[z]); + else if (E->EN(scalar,const_type) & GD_IEEE754) + for (z = 0; z < E->EN(scalar,array_len); ++z) + fprintf(stream, " %.15g", ((double*)E->e->u.scalar.d)[z]); + else if (E->EN(scalar,const_type) & GD_COMPLEX) + for (z = 0; z < E->EN(scalar,array_len); ++z) + fprintf(stream, " %.15g;%.15g", ((double*)E->e->u.scalar.d)[2 * z], + ((double*)E->e->u.scalar.d)[2 * z + 1]); else - for (z = 0; z < E->EN(cons,array_len); ++z) - fprintf(stream, " %" PRIu64, ((uint64_t*)E->e->EN(cons,d))[z]); + for (z = 0; z < E->EN(scalar,array_len); ++z) + fprintf(stream, " %" PRIu64, ((uint64_t*)E->e->u.scalar.d)[z]); fputs("\n", stream); break; case GD_STRING_ENTRY: fprintf(stream, " STRING%s \"", pretty ? " " : ""); - _GD_StringEscapeise(stream, E->e->ES(string), permissive, D->standards); + _GD_StringEscapeise(stream, E->e->u.string, permissive, D->standards); fputs("\"\n", stream); break; case GD_INDEX_ENTRY: @@ -803,7 +803,7 @@ D->av &= GD_VERS_GE_7; break; case GD_CONST_ENTRY: - if (D->entry[i]->EN(cons,const_type) & GD_COMPLEX128) + if (D->entry[i]->EN(scalar,const_type) & GD_COMPLEX128) D->av &= GD_VERS_GE_7; else D->av &= GD_VERS_GE_6; Modified: trunk/getdata/src/getdata.c =================================================================== --- trunk/getdata/src/getdata.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/getdata.c 2010-11-06 00:41:34 UTC (rev 470) @@ -272,7 +272,7 @@ else s0 -= E->EN(raw,spf) * D->fragment[E->fragment_index].frame_offset; - databuffer = (char *)malloc(ns * E->e->EN(raw,size)); + databuffer = (char *)malloc(ns * E->e->u.raw.size); if (databuffer == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); dreturn("%i", 0); @@ -289,52 +289,51 @@ if (ns > 0) { /** open the file (and cache the fp) if it hasn't been opened yet. */ - if (E->e->EN(raw,file)[0].fp < 0) { + if (E->e->u.raw.file[0].fp < 0) { if (!_GD_Supports(D, E, GD_EF_OPEN | GD_EF_SEEK | GD_EF_READ)) { dreturn("%i", 0); return 0; - } else if (_GD_SetEncodedName(D, E->e->EN(raw,file), - E->e->EN(raw,filebase), 0)) + } else if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, + 0)) { dreturn("%i", 0); return 0; - } else if ((*_gd_ef[E->e->EN(raw,file)[0].encoding].open)(E->e->EN(raw, - file), D->flags & GD_ACCMODE, 0)) + } else if ((*_gd_ef[E->e->u.raw.file[0].encoding].open)(E->e->u.raw.file, + D->flags & GD_ACCMODE, 0)) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); dreturn("%i", 0); return 0; } } - if ((*_gd_ef[E->e->EN(raw,file)[0].encoding].seek)(E->e->EN(raw,file), s0, - E->EN(raw,data_type), 0) - == -1) + if ((*_gd_ef[E->e->u.raw.file[0].encoding].seek)(E->e->u.raw.file, s0, + E->EN(raw,data_type), 0) == -1) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, NULL); + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); dreturn("%i", 0); return 0; } samples_read = - (*_gd_ef[E->e->EN(raw,file)[0].encoding].read)(E->e->EN(raw,file), - databuffer + n_read * E->e->EN(raw,size), E->EN(raw,data_type), ns); + (*_gd_ef[E->e->u.raw.file[0].encoding].read)(E->e->u.raw.file, + databuffer + n_read * E->e->u.raw.size, E->EN(raw,data_type), ns); if (samples_read == -1) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, NULL); + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); free(databuffer); dreturn("%i", 0); return 0; } - if (_gd_ef[E->e->EN(raw,file)[0].encoding].ecor) { + if (_gd_ef[E->e->u.raw.file[0].encoding].ecor) { /* convert to/from middle-ended doubles */ if ((E->EN(raw,data_type) == GD_FLOAT64 || E->EN(raw,data_type) == GD_COMPLEX128) && D->fragment[E->fragment_index].byte_sex & GD_ARM_FLAG) { - _GD_ArmEndianise((uint64_t *)(databuffer + n_read * E->e->EN(raw,size)), + _GD_ArmEndianise((uint64_t *)(databuffer + n_read * E->e->u.raw.size), E->EN(raw,data_type) & GD_COMPLEX, samples_read); } @@ -347,11 +346,11 @@ ) { if (E->EN(raw,data_type) & GD_COMPLEX) - _GD_FixEndianness(databuffer + n_read * E->e->EN(raw,size), - E->e->EN(raw,size) / 2, samples_read * 2); + _GD_FixEndianness(databuffer + n_read * E->e->u.raw.size, + E->e->u.raw.size / 2, samples_read * 2); else - _GD_FixEndianness(databuffer + n_read * E->e->EN(raw,size), - E->e->EN(raw,size), samples_read); + _GD_FixEndianness(databuffer + n_read * E->e->u.raw.size, + E->e->u.raw.size, samples_read); } } @@ -1293,7 +1292,7 @@ dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first_samp, num_samp, return_type, data_out); - if (E->e->EN(linterp,table_len) < 0) { + if (E->e->u.linterp.table_len < 0) { _GD_ReadLinterpFile(D, E); if (D->error != GD_E_OK) { dreturn("%i", 0); @@ -1324,8 +1323,8 @@ return 0; } - _GD_LinterpData(D, data_out, return_type, E->e->EN(linterp,complex_table), - data_in, n_read, E->e->EN(linterp,lut), E->e->EN(linterp,table_len)); + _GD_LinterpData(D, data_out, return_type, E->e->u.linterp.complex_table, + data_in, n_read, E->e->u.linterp.lut, E->e->u.linterp.table_len); free(data_in); dreturn("%zu", n_read); @@ -1381,8 +1380,8 @@ dtrace("%p, %p, %lli, %zu, 0x%x, %p", D, E, first, len, return_type, data_out); - gd_type_t type = _GD_ConstType(D, E->EN(cons,const_type)); - _GD_ConvertType(D, (char *)E->e->EN(cons,d) + first * GD_SIZE(type), type, + gd_type_t type = _GD_ConstType(D, E->EN(scalar,const_type)); + _GD_ConvertType(D, (char *)E->e->u.scalar.d + first * GD_SIZE(type), type, data_out, return_type, len); if (D->error) { /* bad input type */ @@ -1402,10 +1401,10 @@ dtrace("%p, %zu, %p", E, num_samp, data_out); if (num_samp > 0 && data_out != NULL) - strncpy(data_out, E->e->ES(string), num_samp); + strncpy(data_out, E->e->u.string, num_samp); - dreturn("%zu", strlen(E->e->ES(string)) + 1); - return strlen(E->e->ES(string)) + 1; + dreturn("%zu", strlen(E->e->u.string) + 1); + return strlen(E->e->u.string) + 1; } /* _GD_DoField: Locate the field in the database and read it. Modified: trunk/getdata/src/getdata.h.in =================================================================== --- trunk/getdata/src/getdata.h.in 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/getdata.h.in 2010-11-06 00:41:34 UTC (rev 470) @@ -325,7 +325,7 @@ struct { /* CONST */ gd_type_t const_type; size_t array_len; - } GD_ANON(cons); + } GD_ANON(scalar); } GD_ANON(u); struct _gd_private_entry *e; Modified: trunk/getdata/src/internal.h =================================================================== --- trunk/getdata/src/internal.h 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/internal.h 2010-11-06 00:41:34 UTC (rev 470) @@ -387,21 +387,21 @@ char* filebase; size_t size; struct _gd_raw_file file[2]; /* encoding framework data */ - } GD_ANON(raw); + } raw; struct { /* LINTERP */ char *table_path; int table_len; int complex_table; int table_monotonic; struct _gd_lut *lut; - } GD_ANON(linterp); + } linterp; struct { /* CONST */ void *d; int n_client; gd_entry_t** client; - } GD_ANON(cons); + } scalar; char* string; - } GD_ANON(u); + } u; }; #define GD_ENC_NONE 0 @@ -735,10 +735,8 @@ #ifdef GD_C89_API # define EN(t,v) u.t.v -# define ES(v) u.v #else # define EN(t,v) v -# define ES(v) v #endif #endif Modified: trunk/getdata/src/legacy.c =================================================================== --- trunk/getdata/src/legacy.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/legacy.c 2010-11-06 00:41:34 UTC (rev 470) @@ -117,7 +117,8 @@ /* _GD_GetDirfile: Locate the legacy DIRFILE given the filespec. This started * life as GetFormat... */ -static DIRFILE* _GD_GetDirfile(const char *filename_in, int mode, int *error_code) +static DIRFILE *_GD_GetDirfile(const char *filename_in, int mode, + int *error_code) { unsigned int i_dirfile; void *ptr; @@ -215,7 +216,7 @@ break; } - R->size = (int)E->e->EN(raw,size); + R->size = (int)E->e->u.raw.size; R->samples_per_frame = (int)E->EN(raw,spf); dreturnvoid(); Modified: trunk/getdata/src/meta_list.c =================================================================== --- trunk/getdata/src/meta_list.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/meta_list.c 2010-11-06 00:41:34 UTC (rev 470) @@ -131,7 +131,7 @@ * as purely real */ for (i = n = 0; i < e->n_meta; ++i) { if (e->p.meta_entry[i]->field_type == GD_CARRAY_ENTRY) { - fl[n].n = e->p.meta_entry[i]->EN(cons,array_len); + fl[n].n = e->p.meta_entry[i]->EN(scalar,array_len); fl[n].d = _GD_Alloc(D, return_type, fl[n].n); if (D->error || _GD_DoField(D, e->p.meta_entry[i], 0, 0, fl[n].n, return_type, fl[n].d) != 1) @@ -188,7 +188,7 @@ for (i = n = 0; i < e->n_meta; ++i) { if (e->p.meta_entry[i]->field_type == GD_STRING_ENTRY) - fl[n++] = e->p.meta_entry[i]->e->ES(string); + fl[n++] = e->p.meta_entry[i]->e->u.string; } fl[n] = NULL; Modified: trunk/getdata/src/mod.c =================================================================== --- trunk/getdata/src/mod.c 2010-11-05 22:20:38 UTC (rev 469) +++ trunk/getdata/src/mod.c 2010-11-06 00:41:34 UTC (rev 470) @@ -255,7 +255,7 @@ modified = 1; if (Q.EN(raw,data_type) & 0x40 || - (Qe.EN(raw,size) = GD_SIZE(Q.EN(raw,data_type))) == 0) + (Qe.u.raw.size = GD_SIZE(Q.EN(raw,data_type))) == 0) { _GD_SetError(D, GD_E_BAD_TYPE, Q.EN(raw,data_type), NULL, 0, NULL); dreturn("%i", -1); @@ -272,7 +272,7 @@ if (gd_get_constant(D, Q.scalar[0], GD_UINT16, &Q.EN(raw,spf))) break; - const off64_t nf = BUFFER_SIZE / max(E->e->EN(raw,size), + const off64_t nf = BUFFER_SIZE / max(E->e->u.raw.size, GD_SIZE(Q.EN(raw,data_type))) / max(E->EN(raw,spf), Q.EN(raw,spf)); if (D->fragment[E->fragment_index].protection & GD_PROTECT_DATA) @@ -286,21 +286,19 @@ if (D->error) break; - const struct encoding_t* enc = _gd_ef + E->e->EN(raw,file)[0].encoding; + const struct encoding_t* enc = _gd_ef + E->e->u.raw.file[0].encoding; - if (_GD_SetEncodedName(D, E->e->EN(raw,file), E->e->EN(raw,filebase), - 0)) - { + if (_GD_SetEncodedName(D, E->e->u.raw.file, E->e->u.raw.filebase, 0)) ; /* error already set */ - } else if (E->e->EN(raw,file)[0].fp == -1 && (*enc->open)(E->e->EN(raw, - file), 0, 0)) + else if (E->e->u.raw.file[0].fp == -1 && (*enc->open)(E->e->u.raw.file, + 0, 0)) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); - } else if ((*enc->seek)(E->e->EN(raw,file), 0, E->EN(raw,data_type), 1) + } else if ((*enc->seek)(E->e->u.raw.file, 0, E->EN(raw,data_type), 1) == -1) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); } @@ -308,22 +306,22 @@ break; /* Create a temporary file and open it */ - if (_GD_SetEncodedName(D, E->e->EN(raw,file) + 1, - E->e->EN(raw,filebase), 1)) + if (_GD_SetEncodedName(D, E->e->u.raw.file + 1, E->e->u.raw.filebase, + 1)) { ; /* error already set */ - } else if ((*enc->temp)(E->e->EN(raw,file), GD_TEMP_OPEN)) - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[1].name, errno, + } else if ((*enc->temp)(E->e->u.raw.file, GD_TEMP_OPEN)) + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL); - else if ((*enc->seek)(E->e->EN(raw,file) + 1, 0, E->EN(raw,data_type), - 1) == -1) + else if ((*enc->seek)(E->e->u.raw.file + 1, 0, E->EN(raw,data_type), 1) + == -1) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[1].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL); } if (D->error) { - (*enc->temp)(E->e->EN(raw,file), GD_TEMP_DESTROY); + (*enc->temp)(E->e->u.raw.file, GD_TEMP_DESTROY); break; } @@ -332,11 +330,11 @@ /* Now copy the old file to the new file */ for (;;) { - nread = (*enc->read)(E->e->EN(raw,file), buffer1, - E->EN(raw,data_type), nf * E->EN(raw,spf)); + nread = (*enc->read)(E->e->u.raw.file, buffer1, E->EN(raw,data_type), + nf * E->EN(raw,spf)); if (nread < 0) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[1].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL); break; } @@ -366,11 +364,11 @@ buffer2 = ptr; } - nwrote = (*enc->write)(E->e->EN(raw,file) + 1, buffer1, + nwrote = (*enc->write)(E->e->u.raw.file + 1, buffer1, Q.EN(raw,data_type), ns_out); if (nwrote < ns_out) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[1].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL); break; } @@ -381,17 +379,17 @@ /* An error occurred, clean up */ if (D->error) - (*enc->temp)(E->e->EN(raw,file), GD_TEMP_DESTROY); + (*enc->temp)(E->e->u.raw.file, GD_TEMP_DESTROY); /* Well, I suppose the copy worked. Close both files */ - else if ((*enc->close)(E->e->EN(raw,file)) || - (*enc->sync)(E->e->EN(raw,file) + 1) || - (*enc->close)(E->e->EN(raw,file) + 1)) + else if ((*enc->close)(E->e->u.raw.file) || + (*enc->sync)(E->e->u.raw.file + 1) || + (*enc->close)(E->e->u.raw.file + 1)) { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[1].name, errno, + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[1].name, errno, NULL); /* Move the temporary file over the old file */ - } else if ((*enc->temp)(E->e->EN(raw,file), GD_TEMP_MOVE)) - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(raw,file)[0].name, errno, + } else if ((*enc->temp)(E->e->u.raw.file, GD_TEMP_MOVE)) + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.raw.file[0].name, errno, NULL); } @@ -503,7 +501,7 @@ N->EN(linterp,table))) { Q.EN(linterp,table) = strdup(N->EN(linterp,table)); - Qe.EN(linterp,table_path) = NULL; + Qe.u.linterp.table_path = NULL; if (Q.EN(linterp,table) == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NULL, 0, NULL); @@ -511,18 +509,16 @@ } if (flags) { - if (E->e->EN(linterp,table_path) == NULL) + if (E->e->u.linterp.table_path == NULL) if (_GD_SetTablePath(D, E, E->e)) break; - if (Qe.EN(linterp,table_path) == NULL) + if (Qe.u.linterp.table_path == NULL) if (_GD_SetTablePath(D, &Q, &Qe)) break; - if (_GD_Rename(E->e->EN(linterp,table_path), - Qe.EN(linterp,table_path))) - { - _GD_SetError(D, GD_E_RAW_IO, 0, E->e->EN(linterp,table_path), errno, + if (_GD_Rename(E->e->u.linterp.table_path, Qe.u.linterp.table_path)) { + _GD_SetError(D, GD_E_RAW_IO, 0, E->e->u.linterp.table_path, errno, 0); break; } @@ -530,7 +526,7 @@ modified = 1; free(E->EN(linterp,table)); - free(E->e->EN(linterp,table_path)); + free(E->e->u.linterp.table_path); } break; @@ -710,78 +706,82 @@ break; case GD_CONST_ENTRY: - Q.EN(cons,const_type) = (N->EN(cons,const_type) == GD_NULL) ? - E->EN(cons,const_type) : N->EN(cons,const_type); + Q.EN(scalar,const_type) = (N->EN(scalar,const_type) == GD_NULL) ? + E->EN(scalar,const_type) : N->EN(scalar,const_type); - if (Q.EN(cons,const_type) & 0x40 || GD_SIZE(Q.EN(cons,const_type)) == 0) { - _GD_SetError(D, GD_E_BAD_TYPE, Q.EN(cons,const_type), NULL, 0, NULL); + if (Q.EN(scalar,const_type) & 0x40 || GD_SIZE(Q.EN(scalar,const_type)) + == 0) + { + _GD_SetError(D, GD_E_BAD_TYPE, Q.EN(scalar,const_type), NULL, 0, NULL); dreturn("%i", -1); return -1; } - type = _GD_ConstType(D, Q.EN(cons,const_type)); - if (Q.EN(cons,const_type) != E->EN(cons,const_type)) + type = _GD_ConstType(D, Q.EN(scalar,const_type)); + if (Q.EN(scalar,const_type) != E->EN(scalar,const_type)) modified = 1; - if (type == _GD_ConstType(D, E->EN(cons,const_type))) { - Qe.EN(cons,d) = E->e->EN(cons,d); - E->e->EN(cons,d) = NULL; + if (type == _GD_ConstType(D, E->EN(scalar,const_type))) { + Qe.u.scalar.d = E->e->u.scalar.d; + E->e->u.scalar.d = NULL; } else { /* type convert */ - Qe.EN(cons,d) = malloc(GD_SIZE(type)); - if (Qe.EN(cons,d) == NULL) { + Qe.u.scalar.d = malloc(GD_SIZE(type)); + if (Qe.u.scalar.d == NULL) { _GD_SetError(D, GD_E_ALLOC, 0, NUL... [truncated message content] |
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-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-10-27 20:38:11
|
Revision: 467 http://getdata.svn.sourceforge.net/getdata/?rev=467&view=rev Author: ketiltrout Date: 2010-10-27 20:38:05 +0000 (Wed, 27 Oct 2010) Log Message: ----------- Don't need THIS anymore. Removed Paths: ------------- branches/getdata-arm/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-24 16:38:37
|
Revision: 466 http://getdata.svn.sourceforge.net/getdata/?rev=466&view=rev Author: ketiltrout Date: 2010-10-24 16:38:31 +0000 (Sun, 24 Oct 2010) Log Message: ----------- C89-API. Modified Paths: -------------- trunk/getdata/man/gd_entry.3 Modified: trunk/getdata/man/gd_entry.3 =================================================================== --- trunk/getdata/man/gd_entry.3 2010-10-23 19:28:25 UTC (rev 465) +++ trunk/getdata/man/gd_entry.3 2010-10-24 16:38:31 UTC (rev 466) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH gd_entry 3 "15 October 2010" "Version 0.7.0" "GETDATA" +.TH gd_entry 3 "24 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_entry \(em retrieve a dirfile field's metadata .SH SYNOPSIS @@ -237,7 +237,7 @@ typedef struct { ... - gd_type_t const_type; /* data type in format specification */ + gd_type_t const_type; /* data type in format specification */ ... } gd_entry_t; @@ -666,27 +666,37 @@ .SH NOTES When using the C89 GetData API (by defining .B GD_C89_API -before including getdata.h), the complex valued array members of gd_entry_t used -in the specification of -.BR LINCOM ,\~ POLYNOM , -and -.B RECIP -entries will be replaced by purely real arrays. These will have the prototypes -such as: -.PP -.in +4n -.nf -.fam C - double cm[GD_MAX_LINCOM][2]; - double cb[GD_MAX_LINCOM][2]; - double ca[GD_MAX_POLY_ORD + 1][2]; - double cdividend[2]; -.fam -.fi -.in +before including getdata.h), the data types and names of several of the entry +parameters are different. The following table lists the correspondences between +members in the C99 and C89 APIs. + +.TS +center tab(|); +cbscbs +rlrl. +C99 API|C89 API +gd_spf_t|spf|gd_spf_t|u.raw.spf +gd_type_t|data_type|gd_type_t|u.raw.data_type +int|n_fields|int|u.lincom.n_fields +double compex|cm[3]|double|u.lincom.cm[3][2] +double|m[3]|double|u.lincom.m[3] +double compex|cb[3]|double|u.lincom.cb[3][2] +double|b[3]|double|u.lincom.b[3] +int|poly_ord|int|u.polynom.poly_ord +double compex|ca[3]|double|u.polynom.ca[3][2] +double|a[3]|double|u.polynom.a[3] +const char*|table|const char*|u.linterp.table +gd_bit_t|bitnum|gd_bit_t|u.bit.bitnum +gd_bit_t|numbits|gd_bit_t|u.bit.numbits +gd_shift_t|shift|gd_shift_t|u.phase.shift +double compex|cdividend|double|u.recip.cdividend[2] +double|dividend|double|u.recip.dividend +gd_type_t|const_type|gd_type_t|u.cons.const_type +.TE .P -The first element of the two element array is the real part of the complex -number, and the second element is the imaginary part. +In the case of complex valued data in the C89 API, the first element of the two +element array is the real part of the complex number, and the second element is +the imaginary part. .SH SEE ALSO .BR dirfile (5), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ket...@us...> - 2010-10-23 19:28:33
|
Revision: 465 http://getdata.svn.sourceforge.net/getdata/?rev=465&view=rev Author: ketiltrout Date: 2010-10-23 19:28:25 +0000 (Sat, 23 Oct 2010) Log Message: ----------- Doc updates Modified Paths: -------------- trunk/getdata/man/dirfile-format.5 trunk/getdata/man/gd_framenum_subset.3 trunk/html/bindings.html trunk/html/dirfile.html trunk/html/encoding.html trunk/html/getdata.css trunk/html/getdata.html Modified: trunk/getdata/man/dirfile-format.5 =================================================================== --- trunk/getdata/man/dirfile-format.5 2010-10-22 22:22:47 UTC (rev 464) +++ trunk/getdata/man/dirfile-format.5 2010-10-23 19:28:25 UTC (rev 465) @@ -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 "21 October 2010" "Standards Version 8" "DATA FORMATS" +.TH dirfile\-format 5 "23 October 2010" "Standards Version 8" "DATA FORMATS" .SH NAME dirfile\-format \(em the dirfile database format specification file .SH DESCRIPTION @@ -181,7 +181,7 @@ .TP .B /ENCODING -The ENCODING directive specifies the encoding scheme used to encode binary +The /ENCODING directive specifies the encoding scheme used to encode binary files in the dirfile. The encoding scheme may be one of the predefined names listed below, which are described in more detail in .BR dirfile\-encoding (5), @@ -212,12 +212,12 @@ .IP .BI /ENCODING\~ <scheme> .PP -The ENCODING directive has +The /ENCODING directive has .IR "fragment scope" . .RE .TP .B /ENDIAN -The ENDIAN directive specifies the endianness of the raw data in the database. +The /ENDIAN directive specifies the endianness of the raw data in the database. The assumed endianness of raw data in dirfiles which omit this directive is implementation dependent. Syntax is: @@ -227,12 +227,12 @@ .IR "( " big " | " little " ) [ " arm " ]" .PP where the "arm" token should be included if double precision floating point data -are stored in the ARM middle-endian format. The ENDIAN directive has +are stored in the ARM middle-endian format. The /ENDIAN directive has .IR "fragment scope" . .RE .TP .B /FRAMEOFFSET -The FRAMEOFFSET directive specifies the frame number of the first frame for +The /FRAMEOFFSET directive specifies the frame number of the first frame for which data exists in binary files associated with .B RAW fields. Syntax is: @@ -240,12 +240,12 @@ .IP .BI /FRAMEOFFSET\~ <integer> .PP -The FRAMEOFFSET directive has +The /FRAMEOFFSET directive has .IR "fragment scope" . .RE .TP .B /INCLUDE -The INCLUDE directive specifies another file (called a +The /INCLUDE directive specifies another file (called a .IR "fragment" ) to parse for additional format specification for the dirfile. The inclusion is treated as if the lines of the fragment were pasted verbatim in place of the @@ -258,12 +258,12 @@ .IP .BI /INCLUDE\~ <file> .PP -The INCLUDE directive has no scope: it is processed immediately and has no +The /INCLUDE directive has no scope: it is processed immediately and has no long-term effect. .RE .TP .B /META -The META directive specifies a metafield attached to a particular parent +The /META directive specifies a metafield attached to a particular parent field. The field metadata may be of any allowed type except .BR RAW . Metafields are retrieved in exactly the same way as regular field data, but the @@ -297,7 +297,7 @@ the same name, since all references to metafields must include the parent field name. Metafields may not themselves have further sub-metafields. .PP -As an alternative to the META directive, a metafield may be specified by a +As an alternative to the /META directive, a metafield may be specified by a standard field specification line, using .IP .IB <parent-field> / <meta-field> @@ -309,12 +309,12 @@ .B CONST FLOAT64 3.291882 .PP -The META directive has no scope: it is processed immediately and has no +The /META directive has no scope: it is processed immediately and has no long-term effect. .RE .TP .B /PROTECT -The PROTECT directive specifies the advisory protection level of the current +The /PROTECT directive specifies the advisory protection level of the current fragment and of the .B RAW fields defined therein. The protection level indicates whether writing to the @@ -327,7 +327,7 @@ .TP .I none No protection at all: data and metadata may be freely changed. This is the -default, if no PROTECT directive is present. +default, if no /PROTECT directive is present. .TP .I format The dirfile metadata is protected from change, but @@ -342,17 +342,17 @@ .I all Both metadata and data on disk are protected from change. .PP -The PROTECT directive has +The /PROTECT directive has .IR "fragment scope" . .RE .TP .B /REFERENCE -The REFERENCE directive specifies the name of the field to use as the dirfile's +The /REFERENCE directive specifies the name of the field to use as the dirfile's reference field (see .BR dirfile (5)). -If no REFERENCE directive is specified, the first +If no /REFERENCE directive is specified, the first .B RAW -field encountered is used as the reference field. The REFERENCE directive must +field encountered is used as the reference field. The /REFERENCE directive must specify a .B RAW field. Syntax is: @@ -360,14 +360,14 @@ .IP .BI /REFERENCE\~ <field-code> .PP -The REFERENCE directive has +The /REFERENCE directive has .IR "global scope" : -if multiple REFERENCE directives appear in the dirfile metadata, only the last +if multiple /REFERENCE directives appear in the dirfile metadata, only the last such will be honoured. .RE .TP .B /VERSION -The VERSION directive specifies the particular version of the Dirfile Standards +The /VERSION directive specifies the particular version of the Dirfile Standards to which the dirfile format specification conforms. This directive should occur before any version dependent syntax is encountered. As of Standards Version 6, no such syntax exists, and this directive is provided primarily to @@ -376,7 +376,7 @@ .IP .BI /VERSION\~ <integer> .PP -The VERSION directive has +The /VERSION directive has .IR "immediate scope" : its effect is immediate, and it applies only to metadata below it, including and propagating downwards to sub-fragments after the directive. Its effect @@ -414,7 +414,7 @@ If the field name beginning a field specification line does contain a .B / character, the line is assumed to specify a metafield. See the -.B META +.B /META directive above for further details. .SS Field Types @@ -885,7 +885,7 @@ .IP \(bu 4 a parent field name, followed by a forward slash, followed by a metafield name, indicating a metafield. See the description of the -.B META +.B /META directive above for further details. .IP \(bu 4 either of the above, followed by a period, followed by a @@ -950,7 +950,11 @@ field types, made the forward slash on reserved words mandatory, and prohibited using the single character data type aliases in the specification of .B RAW -fields. +fields. It also introduced the optional second +.RI ( arm ) +token to the +.B /ENDIAN +directive. Version 7 of the Standards (October 2009) added the .B SBIT @@ -989,9 +993,9 @@ in field names. Version 5 of the Standards (August 2008) added -.B /VERSION +.B VERSION and -.BR /ENDIAN , +.BR ENDIAN , slash demarcation of reserved words, and removed the restriction on field name length. It introduced the data types .IR INT8 ,\~ INT64 , @@ -1000,7 +1004,7 @@ the new-style type specifiers, and increased the range of the .B BIT field type from 32 to 64 bits. It also prohibited the characters -.B #&;<>\e| +.B &;<>\e| in field names. Version 4 of the Standards (October 2006) added the Modified: trunk/getdata/man/gd_framenum_subset.3 =================================================================== --- trunk/getdata/man/gd_framenum_subset.3 2010-10-22 22:22:47 UTC (rev 464) +++ trunk/getdata/man/gd_framenum_subset.3 2010-10-23 19:28:25 UTC (rev 465) @@ -13,7 +13,7 @@ .\" Texts. A copy of the license is included in the `COPYING.DOC' file .\" as part of this distribution. .\" -.TH gd_framenum_subset 3 "15 October 2010" "Version 0.7.0" "GETDATA" +.TH gd_framenum_subset 3 "23 October 2010" "Version 0.7.0" "GETDATA" .SH NAME gd_framenum_subset, gd_framenum \(em perform a reverse look-up on a monotonic dirfile field @@ -86,7 +86,7 @@ point number, may result in an inaccurate returned value. Attempting to use this function on a complex valued field will result in an error. -If the field is constant across the entire range, and error results, even if +If the field is constant across the entire range, an error results, even if the value to search for is equal to the constant value of the field. .SH RETURN VALUE Modified: trunk/html/bindings.html =================================================================== --- trunk/html/bindings.html 2010-10-22 22:22:47 UTC (rev 464) +++ trunk/html/bindings.html 2010-10-23 19:28:25 UTC (rev 465) @@ -220,6 +220,8 @@ <span class="literal">PhaseEntryType</span>, <span class="literal">PolynomEntryType</span>, <span class="literal">SBitEntryType</span>, + <span class="literal">DivideEntryType</span>, + <span class="literal">RecipEntryType</span>, <span class="literal">ConstEntryType</span>, <span class="literal">StringEntryType</span>, <span class="literal">IndexEntryType</span>, Modified: trunk/html/dirfile.html =================================================================== --- trunk/html/dirfile.html 2010-10-22 22:22:47 UTC (rev 464) +++ trunk/html/dirfile.html 2010-10-23 19:28:25 UTC (rev 465) @@ -58,123 +58,15 @@ <li><a href="getdata.html#header">The GetData Header</a> <li><a href="getdata.html#bindings">Language Bindings</a> <li><a href="getdata.html#dirfile">Working with Dirfiles</a> - <ul class="submenu"> - <li><a href="getdata.html#dirfile_cbopen">dirfile_cbopen()</a> - <li><a href="getdata.html#dirfile_open">dirfile_open()</a> - <li><a href="getdata.html#dirfile_parser_callback">dirfile_parser_callback()</a> - <li><a href="getdata.html#dirfile_close">dirfile_close()</a> - <li><a href="getdata.html#dirfile_discard">dirfile_discard()</a> - <li><a href="getdata.html#dirfile_flush">dirfile_flush()</a> - <li><a href="getdata.html#dirfile_metaflush">dirfile_metaflush()</a> - <li><a href="getdata.html#get_error">get_error()</a> - <li><a href="getdata.html#get_error_string">get_error_string()</a> - </ul> <li><a href="getdata.html#rmeta">Reading Metadata</a> - <ul class="submenu"> - <li><a href="getdata.html#dirfilename">dirfilename()</a> - <li><a href="getdata.html#get_reference">get_reference()</a> - <li><a href="getdata.html#get_nframes">get_nframes()</a> - <li><a href="getdata.html#get_nfragments">get_nfragments()</a> - <li><a href="getdata.html#get_encoding">get_encoding()</a> - <li><a href="getdata.html#get_endianness">get_endianness()</a> - <li><a href="getdata.html#get_frameoffset">get_frameoffset()</a> - <li><a href="getdata.html#get_protection">get_protection()</a> - <li><a href="getdata.html#get_fragmentname">get_fragmentname()</a> - <li><a href="getdata.html#get_parent_fragment">get_parent_fragment()</a> - <li><a href="getdata.html#get_raw_filename">get_raw_filename()</a> - <li><a href="getdata.html#get_spf">get_spf()</a> - <li><a href="getdata.html#get_entry">get_entry()</a> - <li><a href="getdata.html#dfes">dirfile_free_entry_strings()</a> - <li><a href="getdata.html#get_entry_type">get_entry_type()</a> - <li><a href="getdata.html#get_fragment_index">get_fragment_index()</a> - </ul> <li><a href="getdata.html#count">Counting Fields</a> - <ul class="submenu"> - <li><a href="getdata.html#get_nfields">get_nfields()</a> - <li><a href="getdata.html#get_nvectors">get_nvectors()</a> - <li><a href="getdata.html#get_nfields_by_type">get_nfields_by_type()</a> - <li><a href="getdata.html#get_nmfields">get_nmfields()</a> - <li><a href="getdata.html#get_nmvectors">get_nmvectors()</a> - <li><a href="getdata.html#get_nmfields_by_type">get_nmfields_by_type()</a> - </ul> <li><a href="getdata.html#list">Listing Fields</a> - <ul class="submenu"> - <li><a href="getdata.html#get_field_list">get_field_list()</a> - <li><a href="getdata.html#get_vector_list">get_vector_list()</a> - <li><a href="getdata.html#get_field_list_by_type">get_field_list_by_type()</a> - <li><a href="getdata.html#get_mfield_list">get_mfield_list()</a> - <li><a href="getdata.html#get_mvector_list">get_mvector_list()</a> - <li><a href="getdata.html#get_mfield_list_by_type">get_mfield_list_by_type()</a> - </ul> <li><a href="getdata.html#mmeta">Modifying Metadata</a> - <ul class="submenu"> - <li><a href="getdata.html#dirfile_include">dirfile_include()</a> - <li><a href="getdata.html#dirfile_uninclude">dirfile_uninclude()</a> - <li><a href="getdata.html#dirfile_reference">dirfile_reference()</a> - <li><a href="getdata.html#dirfile_alter_encoding">dirfile_alter_encoding()</a> - <li><a href="getdata.html#dirfile_alter_endianness">dirfile_alter_endianness()</a> - <li><a href="getdata.html#dirfile_alter_frameoffset">dirfile_alter_frameoffset()</a> - <li><a href="getdata.html#dirfile_protect">dirfile_protect()</a> - </ul> <li><a href="getdata.html#add">Adding or Deleting Fields</a> - <ul class="submenu"> - <li><a href="getdata.html#dirfile_add">dirfile_add()</a> - <li><a href="getdata.html#dirfile_add_spec">dirfile_add_spec()</a> - <li><a href="getdata.html#dirfile_add_bit">dirfile_add_bit()</a> - <li><a href="getdata.html#dirfile_add_const">dirfile_add_const()</a> - <li><a href="getdata.html#dirfile_add_lincom">dirfile_add_lincom()</a> - <li><a href="getdata.html#dirfile_add_linterp">dirfile_add_linterp()</a> - <li><a href="getdata.html#dirfile_add_multiply">dirfile_add_multiply()</a> - <li><a href="getdata.html#dirfile_add_phase">dirfile_add_phase()</a> - <li><a href="getdata.html#dirfile_add_raw">dirfile_add_raw()</a> - <li><a href="getdata.html#dirfile_add_string">dirfile_add_string()</a> - <li><a href="getdata.html#dirfile_madd">dirfile_madd()</a> - <li><a href="getdata.html#dirfile_madd_spec">dirfile_madd_spec()</a> - <li><a href="getdata.html#dirfile_madd_bit">dirfile_madd_bit()</a> - <li><a href="getdata.html#dirfile_madd_const">dirfile_madd_const()</a> - <li><a href="getdata.html#dirfile_madd_lincom">dirfile_madd_lincom()</a> - <li><a href="getdata.html#dirfile_madd_linterp">dirfile_madd_linterp()</a> - <li><a href="getdata.html#dirfile_madd_multiply">dirfile_madd_multiply()</a> - <li><a href="getdata.html#dirfile_madd_phase">dirfile_madd_phase()</a> - <li><a href="getdata.html#dirfile_madd_string">dirfile_madd_string()</a> - <li><a href="getdata.html#dirfile_delete">dirfile_delete()</a> - </ul> <li><a href="getdata.html#alter">Modifying Field Metadata</a> - <ul class="submenu"> - <li><a href="getdata.html#dirfile_alter_entry">dirfile_alter_entry()</a> - <li><a href="getdata.html#dirfile_alter_spec">dirfile_alter_spec()</a> - <li><a href="getdata.html#dirfile_malter_spec">dirfile_malter_spec()</a> - <li><a href="getdata.html#dirfile_alter_bit">dirfile_alter_bit()</a> - <li><a href="getdata.html#dirfile_alter_const">dirfile_alter_const()</a> - <li><a href="getdata.html#dirfile_alter_lincom">dirfile_alter_lincom()</a> - <li><a href="getdata.html#dirfile_alter_linterp">dirfile_alter_linterp()</a> - <li><a href="getdata.html#dirfile_alter_multiply">dirfile_alter_multiply()</a> - <li><a href="getdata.html#dirfile_alter_phase">dirfile_alter_phase()</a> - <li><a href="getdata.html#dirfile_alter_raw">dirfile_alter_raw()</a> - <li><a href="getdata.html#dirfile_move">dirfile_move()</a> - <li><a href="getdata.html#dirfile_rename">dirfile_rename()</a> - </ul> <li><a href="getdata.html#data">Reading and Writing Data</a> - <ul class="submenu"> - <li><a href="getdata.html#getdata">getdata()</a> - <li><a href="getdata.html#get_constant">get_constant()</a> - <li><a href="getdata.html#get_constants">get_constants()</a> - <li><a href="getdata.html#get_mconstants">get_mconstants()</a> - <li><a href="getdata.html#get_string">get_string()</a> - <li><a href="getdata.html#get_strings">get_strings()</a> - <li><a href="getdata.html#get_mstrings">get_mstrings()</a> - <li><a href="getdata.html#putdata">putdata()</a> - <li><a href="getdata.html#put_constant">put_constant()</a> - <li><a href="getdata.html#put_string">put_string()</a> - </ul> <li><a href="getdata.html#callback">The Parser Callback Function</a> <li><a href="getdata.html#unclean">Unclean Database Recovery</a> - <ul class="submenu"> - <li><a href="getdata.html#preamble">Preamble</a> - <li><a href="getdata.html#mitigation">Mitigation</a> - <li><a href="getdata.html#recovery">Recovery</a> - <li><a href="getdata.html#checking">Checking</a> - </ul> </ul> <h2 class="menu"><a href="encoding.html">Dirfile Encodings</a></h2> <ul> @@ -182,12 +74,6 @@ <li><a href="encoding.html#framework">The Encoding Framework</a> <li><a href="encoding.html#discovery">Automatic Encoding Detection</a> <li><a href="encoding.html#schemes">Supported Encoding Schemes</a> - <ul class="submenu"> - <li><a href="encoding.html#text">Text Encoding</a> - <li><a href="encoding.html#bzip2">Bzip2 Encoding</a> - <li><a href="encoding.html#gzip">Gzip Encoding</a> - <li><a href="encoding.html#slim">Slim Encoding</a> - </ul> </ul> <h2 class="menu"><a href="api.html">The API Transition</a></h2> <ul> @@ -214,12 +100,14 @@ <p>The <i>Dirfile Standards</i> describe the <i>dirfile</i> database format, a filesystem based database for time-ordered binary data. <i>Dirfiles</i> are designed to be a fast, simple format for storing - and reading binary time-ordered data. This page provides an unofficial - overview of the Dirfile Standards. The official Dirfile Standards are - distributed with GetData as three Unix man pages: dirfile(5), - dirfile-format(5), and dirfile-encoding(5). This page, however, discusses - some implementation-dependant behaviour specific to GetData not found in - those documents. + and reading binary time-ordered data. This document provides an + <i>unofficial</i> overview of the Dirfile Standards. The official Dirfile + Standards are distributed with GetData as three Unix man pages: + <b>dirfile</b>(5), <b>dirfile-format</b>(5), and + <b>dirfile-encoding</b>(5). Additionally, this document discusses some + implementation-dependant behaviour specific to GetData not found in those + documents. The latest release of the Dirfile Standards is Standards + Version 8 (October 2010). <p>The dirfile database is centred around one or more time-ordered data streams (a <i>time stream</i>). Each time stream is written to disk in a separate file, in its native binary format. The name of these time stream @@ -234,10 +122,10 @@ position in the dirfile can be specified in frames, which will ensure synchronicity. <p>The time stream files are all located in a central directory, known as - the <i>dirfile directory</i>. The dirfile as a whole iis to - by its dirfile directory. Included in the dirfile along with the time - streams is the <i>dirfile format specification</I>, which is an ASCII text - file called <b>format</b> located in the dirfile directory. + the <i>dirfile directory</i>. The dirfile as a whole is typically + referred to by its dirfile directory. Included in the dirfile along with + the time streams is the <i>dirfile format specification</I>, which is an + ASCII text file called <b>format</b> located in the dirfile directory. <p>Version 3 of the Dirfile Standards introduced the <i>large dirfile</i> extension. This extension added the ability to distribute the dirfile format specification among multiple files (called <i>fragments</i>) in @@ -305,7 +193,7 @@ <h2><a name="format">The Format File</a></h2> The <b>format</b> file is a case-sensitive text file which contains the dirfile database metadata. The explicit text encoding is not specified - by these standards, but must be 7-bit ASCII compatible. Examples of + by the Standards, but it must be 7-bit ASCII compatible. Examples of acceptable character encodings include all the ISO 8859 character sets (<i>i.e.</i> Latin-1 through Latin-10, among others), as well as the UTF-8 encoding of Unicode and UCS. @@ -347,6 +235,7 @@ which is escaped is interpreted as the character itself. (<i>i.e.</i> <span class="syntax"><b>\c</b></span> is interpreted as <span class="syntax"><b>c</b></span>). + <div class="inset"> <table> <caption><b>Table 1:</b> Character Escape Sequences</caption> <tr><th>Sequence</th><th>Interpretation</th><th>Byte</th> @@ -412,20 +301,25 @@ hexadecimal number <i>hhhhhhh</i>. </td></tr> </table> + </div> <p>No token may contain the NUL character (0x00). Furthermore, although support is present to create UTF-8 byte sequences, tokens are not required to be valid UTF-8 sequences. Any byte sequence not containing the NULL character forms a valid token. However, there may be further restrictions on allowed characters for a token in a particular situation, (for example, when used as a field name). + <p>Standards Versions 5 and earlier do not recognise the character escape + sequences, nor allow quoting of tokens. As a result, they prohibit both + whitespace and the comment delimileter from being used in tokens. <h2><a name="directives">Directives</a></h2> <p>There are eight <i>directives</i>, each specified by a different - <i>reserved word</i>, all of which are optional. Any reserved word may - optionally omit its initial forward slash - (<span class="syntax"><b>/</b></span>), without change in meaning. Future - versions of the Standards may prohibit this, to distinguish a reserved - word from a field name. + <i>reserved word</i>; all directives are optional. In Standards Version + 8, all reserved words start with an initial forward slash (<span + class="syntax"><b>/</b></span>), to distinguish them from field names. + Standards Versions 5, 6 and 7 permit any reserved word to optionally omit + its initial forward slash, without change in meaning. Reserved words in + Standards Version 4 and earlier have no initial forward slash. <p>A number of the directives have <a name="fragscope"><i>fragment scope</i></a>. A directive with fragment scope only applies to the fragment in which it is present, plus any sub-fragments indicated by the @@ -455,7 +349,7 @@ encoded</a> using the bzip2 compression library. <li><b>gzip</b>: The dirfile is <a href="encoding.html#gzip">gzip encoded</a> using the zlib compression library. - <li><b>gzip</b>: The dirfile is <a href="encoding.html#lzma">lzma + <li><b>lzma</b>: The dirfile is <a href="encoding.html#lzma">lzma encoded</a> using the liblzma compression library. <li><b>slim</b>: The dirfile is <a href="encoding.html#slim">slim encoded</a> using the slimlib compression library. @@ -468,19 +362,26 @@ <span class="syntax">putdata()</span>, <span class="syntax">get_nframes()</span>, &c.) will be possible on the dirfile. If no encoding scheme is specified, GetData assumes the - dirfile is unencoded. The ENCODING directive has - <a href="#fragscope"><i>fragment scope</i></a>. + dirfile is unencoded. The /ENCODING directive has + <a href="#fragscope"><i>fragment scope</i></a>. Introduced in Standards + Version 6. <li><b>/ENDIAN</b>: The /ENDIAN directive specifies the endianness of the raw data in the database. Syntax is: <div class="syntax"><b>/ENDIAN</b> ( <i>big</i> | <i>little </i> ) + [ <i>arm</i> ] </div> - GetData will assume that and dirfile that omits this directive is in the - native endianness of the architecture on which it is running (i.e. no - endianness swapping will take place.) Otherwise, if the endianness of - the dirfile is different than the endianness of the architecture, + where <i>big</i>, and <i>little</i> specify the byte-ordering the data, + and <i>arm</i> is specified when double-precision floating point data + are in the middle-endian format used by older ARM processors. + <p>GetData will assume that any dirfile that omits this directive is in + the native endianness of the architecture on which it is running (i.e. + no endianness swapping will take place.) Otherwise, if the endianness + of the dirfile is different than the endianness of the architecture, GetData will perform endianness conversion while reading from and - writing to raw data on disk. The ENDIANNESS directive has - <a href="#fragscope"><i>fragment scope</i></a>. + writing to raw data on disk. The /ENDIAN directive has + <a href="#fragscope"><i>fragment scope</i></a>. Introduced in Standards + Version 5; Standards Version 8 added the optional second ("<i>arm</i>") + token. <li><b>/FRAMEOFFSET</b>: The /FRAMEOFFSET directive specifies the frame number of the first frame in the database (the beginning-of-field marker). Syntax is: @@ -488,8 +389,9 @@ Requests for data before the beginning-of-field marker will result in zero (for integer return types) or IEEE not-a-number (for floating point types). Attempts to write to the data before the beginning-of-field - marker will result in an error, and no data written. The FRAMEOFFSET + marker will result in an error, and no data written. The /FRAMEOFFSET directive has <a href="#fragscope"><i>fragment scope</i></a>. + Introduced in Standards Version 1. <li><b>/INCLUDE</b>: The /INCLUDE directive specifies another file to parse for additional metadata for the dirfile. Syntax is: <div class="syntax"><b>/INCLUDE</b> <filename></div> @@ -499,13 +401,15 @@ included file will be looked for in the directory containing the included file and not in the directory containing the parent format file. The included file may be specified either with an absolute path, - or else a relative path from the current file. The INCLUDE directive + or else a relative path from the current file. The /INCLUDE directive has no scope: it is processed immediately and has no long-term effect. - <li><b>/META</b>: The /META directive specifies a metafield attached to - to a particular parent field. The field metadata may be of any allowed - type except <b>RAW</b>. Metafields are retrieved in exactly the same - way as regular field data, but the field code specified consists of the - parent and metafield names joined with a forward slash: + Introduced in Standards Version 3. + <li><a name="meta"><b>/META</b></a>: The /META directive specifies a + metafield attached to to a particular parent field. The field metadata + may be of any allowed type except <b>RAW</b>. Metafields are retrieved + in exactly the same way as regular field data, but the field code + specified consists of the parent and metafield names joined with a + forward slash: <div class="syntax"><parent-field><b>/</b><meta-field></div> /META field directives may not be specified before the parent field has been. Syntax is: @@ -516,16 +420,19 @@ 3.291882</div> provides a scalar metadatum called <i>meta</i> with value 3.291882 attached to the field <i>parent</i>. This particular metafield may be - referred to by the field code "<i>pfield<b>/</b>meta</i>". Note that + referred to by the field code "<i>parent<b>/</b>meta</i>". Note that different parent fields may have metafields with the same name, since all references to metafields must include the parent field name. - Metafields may not themselves have further sub-metafields. The META + Metafields may not themselves have further sub-metafields. The /META directive has no scope: it is processed immediately and has no - long-term effect. For simplicity, starting with Standards Version 7, + long-term effect. /META directives are required to appear after their + parent's specification, and in the same fragment. + <p>For simplicity, starting with Standards Version 7, the above metafield can also be specified as: <div class="syntax">parent/meta <b>CONST FLOAT64</b> 3.291882</div> - making it look like a regular field specification line. - <li><a name="protect"><b>/PROTECT</b></a>: The PROTECT directive + making it look like a regular field specification line. Introduced in + Standards Version 6. + <li><a name="protect"><b>/PROTECT</b></a>: The /PROTECT directive specifies the advisory protection level of the current fragment and of the <b>RAW</b> fields defined therein. The protection level indicates whether writing to the format file fragment, or the binary data on disk @@ -534,7 +441,7 @@ <a name="protlevel">Four</a> advisory protection levels are defined: <ul> <li><i>none</i>: No protection at all: data and metadata may be - freely changed. This is the default, if no PROTECT directive is + freely changed. This is the default, if no /PROTECT directive is present. <li><i>format</i>: The dirfile metadata is protected from change, but <b>RAW</b> data on disk may be modified. @@ -543,17 +450,17 @@ <li><i>all</i>: Both metadata and data on disk are protected from change. </ul> - The PROTECT directive has <a href="#fragscope"><i>fragment - scope</i></a>. - <li><b>/REFERENCE</b>: The REFERENCE directive specifies the name of the - field to use as the dirfile's <a href="#reffield">reference field</a>. - If no REFERENCE directive is specified, the first <b>RAW</b> field - encountered is used as the reference field. The REFERENCE directive - must specify a <B>RAW</b> field. Syntax is: + The /PROTECT directive has <a href="#fragscope"><i>fragment + scope</i></a>. Introduced in Standards Version 6. + <li><b>/REFERENCE</b>: The /REFERENCE directive specifies the name of + the field to use as the dirfile's <a href="#reffield">reference + field</a>. If no /REFERENCE directive is specified, the first + <b>RAW</b> field encountered is used as the reference field. The + /REFERENCE directive must specify a <B>RAW</b> field. Syntax is: <div class="syntax"><b>/REFERENCE</b> <field-code></div> - The REFERENCE directive has <i>global scope</i>: if multiple REFERENCE + The /REFERENCE directive has <i>global scope</i>: if multiple /REFERENCE directives appear in the dirfile metadata, only the last such will be - honoured. + honoured. Introduced in Standards Version 6. <li><b>/VERSION</b>: The /VERSION directive specifies the particular version of the Dirfile Standards to which the dirfile conforms. Syntax is: @@ -562,11 +469,11 @@ GetData is prepared to deal with, it triggers permissive mode. In permissive mode, unrecognised lines (which it assumes are valid syntax in a newer version of the Standards) are silently ignored. - <p>The VERSION directive has <i>immediate scope</i>: its effect is + <p>The /VERSION directive has <i>immediate scope</i>: its effect is immediate, and it applies only to metadata below it, including and propagating downwards to sub-fragments after the directive. Its effect will also propagate upwards back to the parent fragment, and affect - subsequent metadata. + subsequent metadata. Introduced in Standards Version 5. </ul> <h2><a name="fields">Field Specifications</a></h2> @@ -579,28 +486,52 @@ <h3><a name="fieldname">Field Names</a></h3> <p>A field name consists of one or more characters, excluding both ASCII control characters (bytes 0x00 through - 0x1F) and the seven reserved characters: <b>/ | & > < . ;</b> - (although <b>/</b> can be used to define metafields, see above under the - <b>/META</b> directive). Like - the rest of the format file, field names are case sensitive. + 0x1F) and the reserved characters listed in Table 2 according to Standards + Version. Furthermore, the field name of a <b>RAW</b> field may only + contain characters allowed in filenames. Although never allowed in a + field name, a forward slash (<b>/</b>) can be used to define metafields; + see above under the <a href="#meta"><b>/META</b></a> directive. Like the + rest of the format file, field names are case sensitive. + <div class="inset"> + <table> + <caption><b>Table 2:</b> Reserved Characters in Field Names</caption> + <tr><th>Version</th><th>Reserved Characters</th> + </tr> + <tr> + <td>0–4</td><td><b>#</b><sup>†</sup> <b>/</b> + <i>whitespace</i></td> + </tr> + <tr> + <td>5</td><td><b>#</b><sup>†</sup> <b>/ & ; < > |</b> + <i>whitespace</i></td> + </tr> + <tr> + <td>6—</td><td><b>/ & ; < > | .</b></td> + </tr> + </table> + <div class="footnote"> + †: By virtue of being the comment delimieter. + </div> + </div> + <p>The field name may not be <b>INDEX</b>, which is a special, implicit - field which contains the integer frame index. Previous Standards - Versions allowed <b>FILEFRAM</b> (which arose in the prehistoric times of - ReadData, GetData's spiritual predecessor) as an alias for <b>INDEX</b>. - This is no longer supported by GetData, and <b>FILEFRAM</b> may be used as - a normal field name. To recover the old behaviour, add the field - specification line: - <div class="syntax">FILEFRAM <b>PHASE</b> INDEX 0</div> - to your format file. (Better yet: update your software to use - <b>INDEX</b>.) + field which contains the integer frame index. Standards Version 5 also + prohibit <b>FILEFRAM</b> as a field name; it was an alias for + <b>INDEX</b>, (which arose in the prehistoric times of ReadData, GetData's + spiritual predecessor). + <p>Standards Version 3 and 4 restrict field names to 50 characters. + Standards Version 2 and earlier restrict field names to 16 characters. + Additionally, the filesystem will put restrictions on the length of a + <b>RAW</b> field name, regardless of Standards Version. <h3><a name="fieldtype">Field Types</a></h3> - <p>There are ten field types. Of these, eight are of vector type - (<b>BIT</b>, <b>LINCOM</b>, <b>LINTERP</b>, <b>MULTIPLY</b>, - <b>PHASE</b>, <b>POLYNOM</b>, <b>RAW</b>, and <b>SBIT</b>) and two are of - scalar type (<b>CONST</b> and <b>STRING</b>). The possible fields types - are listed below with their field specification lines. For information on - how to specify the parameters in the specification lines, see below under - <a href="#fieldparam">Field Parameters</a>. + <p>There are twelve field types. Of these, ten are of vector type + (<b>BIT</b>, <b>DIVIDE</b>, <b>LINCOM</b>, <b>LINTERP</b>, + <b>MULTIPLY</b>, <b>PHASE</b>, <b>POLYNOM</b>, <b>RAW</b>, <b>RECIP</b>, + and <b>SBIT</b>) and two are of scalar type (<b>CONST</b> and + <b>STRING</b>). The possible fields types are listed below with their + field specification lines. For information on how to specify the + parameters in the specification lines, see below under <a + href="#fieldparam">Field Parameters</a>. <ul> <li><b>BIT</b>: The BIT field type extracts one or more bits out of an input vector field, treating the result as unsigned. Syntax is: @@ -613,6 +544,8 @@ <span class="syntax"><input></span> is converted to an endianness-corrected unsigned 64-bit integer). If <span class="syntax" ><bits></span> is omitted, it is assumed to be <b>1</b>. + Standards Version 0 doesn't recognise the <span + class="syntax"><bits></span> token. <li><b>CONST</b>: The CONST scalar field type is a constant fully specified in the format file metadata. Syntax is: <div class="syntax"> <field-name> <b>CONST</b> <type> @@ -620,7 +553,20 @@ where <i>type</i> may be any supported <a href="#datatype">native data type</a> and <i>value</i> is the numerical value of the constant interpreted as - indicated by <i>type</i>. + indicated by <i>type</i>. Introduced in Standards Version 6. + <li><b>DIVIDE</b>: The DIVIDE field type is the quotient of two + vector fields. Syntax is: + <div class="syntax"><field-name> <b>DIVIDE</b> + <field<sub>1</sub>> <field<sub>2</sub>></div> + where <span class="syntax"><field-name></span> will be computed + as: + <div class="syntax">field-name[n] = field<sub>1</sub>[n] / + field<sub>2</sub>[n<sub>2</sub>]</div> + with the index <span class="syntax">n<sub>2</sub></span> computed + appropriately for the (potentially differing) sample rates of the input + fields. The resultant field will have the same sample rate as <span + class="syntax"><field1></span>. Introduced in Standards Version + 8. <li><b>LINCOM</b>: The LINCOM field type is the linear combination of one, two or three input vector fields. Syntax is: <div class="syntax"> <field-name> <b>LINCOM</b> [<n>] @@ -631,14 +577,15 @@ where: <ul> <li><span class="syntax"><n></span> indicates the number of - input fields (i.e. 1, 2, or 3). It is optional. If omitted, the + input fields (i.e. 1, 2, or 3). In Standards Version 7 and 8 it is + optional; earlier Standards Versions require it. If omitted, the number of input fields will be determined by the number given. <li><span class="syntax"><field-name></span> will be computed as: - <div class="syntax"> field-name[n] = (m<sub>1</sub> * - field<sub>1</sub>[n] + b<sub>1</sub>) + (m<sub>2</sub> * - field<sub>2</sub>[n<sub>2</sub>] + b<sub>2</sub>) + (m<sub>3</sub> * - field<sub>3</sub>[n<sub>3</sub>] + b<sub>3</sub>)</div> + <div class="syntax"> field-name[n] = (m<sub>1</sub> × + field<sub>1</sub>[n] + b<sub>1</sub>) + (m<sub>2</sub> × + field<sub>2</sub>[n<sub>2</sub>] + b<sub>2</sub>) + (m<sub>3</sub> + × field<sub>3</sub>[n<sub>3</sub>] + b<sub>3</sub>)</div> with <span class="syntax"><field<sub>2</sub>></span>, <span class="syntax"><m<sub>2</sub>></span>, <span class="syntax"><b<sub>2</sub>></span>, and <span @@ -671,12 +618,13 @@ <field<sub>1</sub>> <field<sub>2</sub>></div> where <span class="syntax"><field-name></span> will be computed as: - <div class="syntax">field-name[n] = field<sub>1</sub>[n] * + <div class="syntax">field-name[n] = field<sub>1</sub>[n] × field<sub>2</sub>[n<sub>2</sub>]</div> with the index <span class="syntax">n<sub>2</sub></span> computed appropriately for the (potentially differing) sample rates of the input fields. The resultant field will have the same sample rate as <span - class="syntax"><field1></span>. + class="syntax"><field1></span>. Introduced in Standards Version + 2. <li><b>PHASE</b>: The PHASE field type shifts an input vector field by a specified number of samples. Syntax is: <div class="syntax"><field-name> <b>PHASE</b> <input> @@ -688,9 +636,10 @@ A positive shift indicates a shift forward in time (towards larger frame numbers). </ul> + Introduced in Standards Version 4. <li><b>POLYNOM</b>: The POLYNOM field type specifies a polynomial function of a single input field. Synax is: - <div class="syntax"><field_name> <b>POLYNOM</b> <input> + <div class="syntax"><field-name> <b>POLYNOM</b> <input> <a<sub>0</sub>> <a<sub>1</sub>> [ <a<sub>2</sub>> [ <a<sub>3</sub>> [ <a<sub>4</sub>> [ <a<sub>5</sub>> ]]]]</div> @@ -700,14 +649,15 @@ <li><span class="syntax"><field-name></span> will be computed as: <div class="syntax">field-name[n] = a<sub>0</sub> - + a<sub>1</sub> * input[n] - + a<sub>2</sub> * (input[n])<sup>2</sup> - + a<sub>3</sub> * (input[n])<sup>3</sup> - + a<sub>4</sub> * (input[n])<sup>4</sup> - + a<sub>5</sub> * (input[n])<sup>5</sup></div> + + a<sub>1</sub> × input[n] + + a<sub>2</sub> × (input[n])<sup>2</sup> + + a<sub>3</sub> × (input[n])<sup>3</sup> + + a<sub>4</sub> × (input[n])<sup>4</sup> + + a<sub>5</sub> × (input[n])<sup>5</sup></div> with the highter-order terms computed only if the corresponding co-efficients a<sub><i>i</i></sub> are specified. </ul> + Introduced in Standards Version 7. <li><b>RAW</b>: The RAW field type specifies time streams on disk. In this case, the field name must correspond to the name of the file containing the time stream. Syntax is: @@ -721,28 +671,31 @@ a token specifying the native data type: <ul> <li><b>UINT8</b>: unsigned 8-bit integer - <li><b>INT8</b>: signed 8-bit integer + <li><b>INT8</b>: signed 8-bit integer (Standards Version 5 and + later) <li><b>UINT16</b>: unsigned 16-bit integer <li><b>INT16</b>: signed 16-bit integer <li><b>UINT32</b>: unsigned 32-bit integer <li><b>INT32</b>: signed 32-bit integer - <li><b>UINT64</b>: unsigned 64-bit integer - <li><b>INT64</b>: signed 64-bit integer + <li><b>UINT64</b>: unsigned 64-bit integer (Standards Version 5 and + later) + <li><b>INT64</b>: signed 64-bit integer (Standards Version 5 and + later) <li><b>FLOAT32</b> or <b>FLOAT</b>: IEEE-754 standard 32-bit (single precision) floating point number <li><b>FLOAT64</b> or <b>DOUBLE</b>: IEEE-754 standard 64-bit (double precision) floating point number - <li><b>COMPLEX64</b>: C99 compatible single precision complex - number - <li><b>COMPLEX128</b>: C99 compatible double precision complex - number + <li><b>COMPLEX64</b>: C99-compatible single precision complex + number (Standards Version 7 and later) + <li><b>COMPLEX128</b>: C99-compatible double precision complex + number (Standards Version 7 and later) </ul> See the dirfile(5) manual page for full details on complex number storage formats. <p>GetData will also recognise the following single character type - aliases, which were used in earlier Standards Versions, and should - be considered obsolete (also note that not all supported types have - a single character type alias): + aliases, which were allowed by Standards Versions 7 and earlier + (note that not all supported types have a single character type + alias): <ul> <li><b>c</b>: UINT8 <li><b>u</b>: UINT16 @@ -753,6 +706,19 @@ <li><b>d</b>: FLOAT64 </ul> </ul> + <li><b>RECIP</b>: The RECIP field computes the reciprocal of an input + field. Syntax is: + <div class="syntax"><field-name> <b>RECIP</b> <input> + <dividend></div> + where: + <ul> + <li><span class="syntax"><input></span> is the input field code + <li><span class="syntax"><field-name></span> will be computed + as: + <div class="syntax">field-name[n] = dividend / input[n]</div> + where <span class="syntax"><dividend></span> is a scalar. + </ul> + Introduced in Standards Version 8. <li><b>SBIT</b>: The SBIT field type extracts one or more bits out of an input vector field, treating the result as signed. Syntax is: <div class="syntax"><field-name> <b>SBIT</b> <input> @@ -765,8 +731,8 @@ endianness-corrected signed 64-bit integer). If <span class="syntax" ><bits></span> is omitted, it is assumed to be <b>1</b>. Note: all signed integers are interpreted as two's complement numbers; - so, a one-bit-long singned integer can take the values <b>0</b> or - <b>−1</b>. + so, a single-bit signed integer can take the values <b>0</b> or + <b>−1</b>. Introduced in Standards Version 7. <li><b>STRING</b>: The STRING scalar field type is a character string fully specified in the format file metadata. Syntax is: <div class="syntax"><field-name> <b>STRING</b> <value></div> @@ -775,15 +741,15 @@ is a single token. To include whitespace in the string, enclose the value in quotation marks (<span class="syntax">""</span>), or else escape the whitespace with the backslash character - (<span class="syntax">\</span>). + (<span class="syntax">\</span>). Introduced in Standards Version 6. </ul> <h3><a name="fieldparam">Field Parameters</a></h3> <p>All input vector field parameters should be a <a - href="#fieldcode"><i>field codes</i></a>. Additionally, some of the - numerical field parameters may be either literal numbers or else the - <i>field code</i> of a <b>CONST</b> field containing the value. - Parameters for which this is possible are: + href="#fieldcode"><i>field codes</i></a>. Additionally, in Standards + Version 6 and later, some of the numerical field parameters may be + either literal numbers or else the <i>field code</i> of a <b>CONST</b> + field containing the value. Parameters for which this is possible are: <ul> <li><b>RAW</b>: <span class="syntax">spf</span> <li><b>BIT, SBIT</b>: <span class="syntax">bitnum</span>, <span @@ -794,13 +760,14 @@ <li><b>PHASE</b>: <span class="syntax">shift</span> <li><b>POLYNOM</b>: any of the <span class="syntax">a</span><sub><i>i</i></sub>. + <li><b>RECIP</b>: <span class="syntax">dividend</span> </ul> Since it is possible to create a field code which is identical to a literal number, a parameter is assumed to be the field code of a <b>CONST</b> field only if it doesn't look like a number. - <p>A literal complex number is specified as two real (floating point) - numbers separated by a semicolon (<b>;</b>) with no intervening - whitespace. So, for example, the tokens: + <p>In Standards Version 7 and later, a literal complex number is specified + as two real (floating point) numbers separated by a semicolon (<b>;</b>) + with no intervening whitespace. So, for example, the tokens: <div class="syntax">1;0 0;1 4;0 0;5 9.313e2;74.1</div> represent, respectively, the real unit, the imaginary unit, the real number four, the imaginary number 5<i>i</i>, and the complex number @@ -824,13 +791,14 @@ <ul> <li>a simple field name, indicating a vector or scalar field, ie. "<i>field</i>", - <li> a parent field name, followed by a forward slash (<b>/</b>), - followed by a metafield name, indicating a metafield, ie. + <li>starting with Standards Version 6, a parent field name, followed by + a forward slash (<b>/</b>), followed by a metafield name, indicating a + metafield, ie. "<i>parent/field</i>", - <li>either of the above, followed by a period, followed by a - <i>"representation suffix</i>, but only if the field or metafield - specified is not a <b>STRING</b> type field; ie. "<i>field.r</i>", or - "<i>parent/field.m</i>". + <li>starting with Standards Version 7, either of the above, followed by + a period, followed by a <i>"representation suffix</i>, but only if the + field or metafield specified is not a <b>STRING</b> type field; ie. + "<i>field.r</i>", or "<i>parent/field.m</i>". </ul> <p>A <i>representation suffix</i> may be used used to extract a real number from a complex value. The available suffixes and their meanings @@ -860,14 +828,23 @@ <i>re_z</i> would be.) <h2><a name="versions">Standards Versions</a></h2> - <p>The latest version of the Dirfile Standards is Version 7. + <p>The latest version of the Dirfile Standards is Version 8. + <div class="inset"> <table> - <caption><b>Table 2:</b> Dirfile Standards Version history</caption> + <caption><b>Table 3:</b> Dirfile Standards Version history</caption> <tr> <th>Version</th><th>Release Date</th><th>Notes</th> </tr> <tr> - <td>7</td><td>October 2009</td><td> Added the <b>POLYNOM</b> and + <td>8</td><td>October 2010</td><td>Added the <b>DIVIDE</b> and + <b>RECIP</b> field types, made the forward slash on reserved words + mandatory, and prohibited using the single character data type + aliases in the specification of <b>RAW</b> fields. It also + introduced the optional second (<i>arm</i>) token to the + <b>/ENDIAN</b> directive. + </tr> + <tr> + <td>7</td><td>October 2009</td><td>Added the <b>POLYNOM</b> and <b>SBIT</b> field types, and complex data types <b>COMPLEX64</b> and <b>COMPLEX128</b>. It also introduced representation suffixes to field codes, made the <span class="syntax">n_fields</span> @@ -931,7 +908,9 @@ </td> </tr> </table> - <div class="foot"><div class="copy">© 2008, 2009 D. V. Wiebe</div> + </div> + <div class="foot"><div class="copy">© 2008, 2009, 2010 + D. V. Wiebe</div> <div class="w3c"> <a href="http://validator.w3.org/check?uri=referer"><img src="valid_html.png" alt="Valid HTML 4.01 Strict" height="21" Modified: trunk/html/encoding.html =================================================================== --- trunk/html/encoding.html 2010-10-22 22:22:47 UTC (rev 464) +++ trunk/html/encoding.html 2010-10-23 19:28:25 UTC (rev 465) @@ -133,41 +133,43 @@ of encoding schemes. Functions which (potentially) make use of the encoding framework are: <ul> - <li><a href="getdata.html#get_nframes"><span - class="syntax">get_nframes()</span></a>, - <li><a href="getdata.html#getdata"><span - class="syntax">getdata()</span></a>, - <li><a href="getdata.html#putdata"><span - class="syntax">putdata()</span></a>, - <li><a href="getdata.html#get_framenum"><span - class="syntax">get_framenum()</span></a>, - <a href="getdata.html#get_framenum_subset"><span - class="syntax">get_framenum_subset()</span></a>, + <li><a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a>, + <a href="getdata.html#gd_eof"><span + class="syntax">gd_eof()</span></a>, + <li><a href="getdata.html#gd_getdata"><span + class="syntax">gd_getdata()</span></a>, + <li><a href="getdata.html#gd_putdata"><span + class="syntax">gd_putdata()</span></a>, + <li><a href="getdata.html#gd_framenum"><span + class="syntax">gd_framenum()</span></a>, + <a href="getdata.html#gd_framenum_subset"><span + class="syntax">gd_framenum_subset()</span></a>, <li>functions which add <B>RAW</B> fields: - <a href="getdata.html#dirfile_add"><span - class="syntax">dirfile_add()</span></a>, - <a href="getdata.html#dirfile_add_raw"><span - class="syntax">dirfile_add_raw()</span></a>, - <a href="getdata.html#dirfile_add_spec"><span - class="syntax">dirfile_add_spec()</span></a>, + <a href="getdata.html#gd_add"><span + class="syntax">gd_add()</span></a>, + <a href="getdata.html#gd_add_raw"><span + class="syntax">gd_add_raw()</span></a>, + <a href="getdata.html#gd_add_spec"><span + class="syntax">gd_add_spec()</span></a>, <li>functions which modify <B>RAW</B> field metadata: - <a href="getdata.html#dirfile_alter_entry"><span - class="syntax">dirfile_alter_entry()</span></a>, - <a href="getdata.html#dirfile_alter_raw"><span - class="syntax">dirfile_alter_raw()</span></a>, - <a href="getdata.html#dirfile_alter_spec"><span - class="syntax">dirfile_alter_spec()</span></a>, - <a href="getdata.html#dirfile_move"><span - class="syntax">dirfile_move()</span></a>, - <a href="getdata.html#dirfile_rename"><span - class="syntax">dirfile_rename()</span></a>, + <a href="getdata.html#gd_alter_entry"><span + class="syntax">gd_alter_entry()</span></a>, + <a href="getdata.html#gd_alter_raw"><span + class="syntax">gd_alter_raw()</span></a>, + <a href="getdata.html#gd_alter_spec"><span + class="syntax">gd_alter_spec()</span></a>, + <a href="getdata.html#gd_move"><span + class="syntax">gd_move()</span></a>, + <a href="getdata.html#gd_rename"><span + class="syntax">gd_rename()</span></a>, <li>the fragment metadata altering functions: - <a href="getdata.html#dirfile_alter_encoding"><span - class="syntax">dirfile_alter_encoding()</span></a>, - <a href="getdata.html#dirfile_alter_endianness"><span - class="syntax">dirfile_alter_endianness()</span></a>, and - <a href="getdata.html#dirfile_alter_frameoffset"><span - class="syntax">dirfile_alter_frameoffset()</span></a>, + <a href="getdata.html#gd_alter_encoding"><span + class="syntax">gd_alter_encoding()</span></a>, + <a href="getdata.html#gd_alter_endianness"><span + class="syntax">gd_alter_endianness()</span></a>, and + <a href="getdata.html#gd_alter_frameoffset"><span + class="syntax">gd_alter_frameoffset()</span></a>, since they may have to translate binary files affected by the metadata changes. </ul> @@ -223,8 +225,8 @@ developed by Julian Seward. GetData's bzip2 encoding framework currently lacks write capabilities; as a result, only <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#get_nframes"><span - class="syntax">get_nframes()</span></a> are supported by the encoding. + and <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a> are supported by the encoding. The file extension of the bzip2 encoding is <b>.bz2</b>. <h3><a name="gzip">Gzip Encoding</a></h3> @@ -234,11 +236,11 @@ Gailly and Mark Adler. GetData's gzip encoding framework currently lacks write capabilities; as a result, only <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#get_nframes"><span - class="syntax">get_nframes()</span></a> are supported by the encoding. + and <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a> are supported by the encoding. The file extension of the gzip encoding is <b>.gz</b>. - <p>To speed the operation of <a href="getdata.html#get_nframes"><span - class="syntax">get_nframes()</span></a>, the gzip compression + <p>To speed the operation of <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a>, the gzip compression scheme takes the uncompressed size of the file from the gzip footer, which contains the file's uncompressed size in bytes, modulo 2<sup>32</sup>. As a result, using a field with an (uncompressed) binary file size larger @@ -253,8 +255,8 @@ Ville Koskinen, and Igor Pavlov. GetData's lzma encoding framework currently lacks write capabilities; as a result, only <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#get_nframes"><span - class="syntax">get_nframes()</span></a> are supported by the encoding. + and <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a> are supported by the encoding. The file extension of the gzip encoding is <b>.xz</b> or <b>.lzma</b>. <h3><a name="slim">Slim Encoding</a></h3> @@ -264,14 +266,15 @@ href="http://www.physics.princeton.edu/act/">ACT</a>. GetData's slim encoding framework currently lacks write capabilities; as a result, only <a href="getdata.html#getdata"><span class="syntax">getdata()</span></a> - and <a href="getdata.html#get_nframes"><span - class="syntax">get_nframes()</span></a> are supported by the encoding. + and <a href="getdata.html#gd_nframes"><span + class="syntax">gd_nframes()</span></a> are supported by the encoding. (Slim itself is distributed with executables which can perform both reads and writes.) The file extension of the slim encoding is <b>.slm</b>. <p> Slim was written by Joseph Fowler. It has been released under the GNU Public License, and is <a href="http://slimdata.sourceforge.net/">distributed on SourceForge</a>. - <div class="foot"><div class="copy">© 2008, 2009 D. V. Wiebe</div> + <div ... [truncated message content] |
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-22 17:42:35
|
Revision: 463 http://getdata.svn.sourceforge.net/getdata/?rev=463&view=rev Author: ketiltrout Date: 2010-10-22 17:42:27 +0000 (Fri, 22 Oct 2010) Log Message: ----------- Some HTML updates. Modified Paths: -------------- trunk/html/api.html trunk/html/bindings.html trunk/html/getdata.html Modified: trunk/html/api.html =================================================================== --- trunk/html/api.html 2010-10-22 17:41:41 UTC (rev 462) +++ trunk/html/api.html 2010-10-22 17:42:27 UTC (rev 463) @@ -51,129 +51,129 @@ <li><a href="getdata.html#bindings">Language Bindings</a> <li><a href="getdata.html#dirfile">Working with Dirfiles</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_cbopen">dirfile_cbopen()</a> - <li><a href="getdata.html#dirfile_open">dirfile_open()</a> - <li><a href="getdata.html#dirfile_parser_callback">dirfile_parser_callback()</a> - <li><a href="getdata.html#dirfile_close">dirfile_close()</a> - <li><a href="getdata.html#dirfile_discard">dirfile_discard()</a> - <li><a href="getdata.html#dirfile_flush">dirfile_flush()</a> - <li><a href="getdata.html#dirfile_metaflush">dirfile_metaflush()</a> - <li><a href="getdata.html#get_error">get_error()</a> - <li><a href="getdata.html#get_error_string">get_error_string()</a> + <li><a href="getdata.html#gd_cbopen">gd_cbopen()</a> + <li><a href="getdata.html#gd_open">gd_open()</a> + <li><a href="getdata.html#gd_parser_callback">gd_parser_callback()</a> + <li><a href="getdata.html#gd_close">gd_close()</a> + <li><a href="getdata.html#gd_discard">gd_discard()</a> + <li><a href="getdata.html#gd_flush">gd_flush()</a> + <li><a href="getdata.html#gd_metaflush">gd_metaflush()</a> + <li><a href="getdata.html#gd_error">gd_error()</a> + <li><a href="getdata.html#gd_error_string">gd_error_string()</a> </ul> <li><a href="getdata.html#rmeta">Reading Metadata</a> <ul class="submenu"> - <li><a href="getdata.html#dirfilename">dirfilename()</a> - <li><a href="getdata.html#get_reference">get_reference()</a> - <li><a href="getdata.html#get_nframes">get_nframes()</a> - <li><a href="getdata.html#get_nfragments">get_nfragments()</a> - <li><a href="getdata.html#get_encoding">get_encoding()</a> - <li><a href="getdata.html#get_endianness">get_endianness()</a> - <li><a href="getdata.html#get_frameoffset">get_frameoffset()</a> - <li><a href="getdata.html#get_protection">get_protection()</a> - <li><a href="getdata.html#get_fragmentname">get_fragmentname()</a> - <li><a href="getdata.html#get_parent_fragment">get_parent_fragment()</a> - <li><a href="getdata.html#get_raw_filename">get_raw_filename()</a> - <li><a href="getdata.html#get_spf">get_spf()</a> - <li><a href="getdata.html#get_entry">get_entry()</a> - <li><a href="getdata.html#dfes">dirfile_free_entry_strings()</a> - <li><a href="getdata.html#get_entry_type">get_entry_type()</a> - <li><a href="getdata.html#get_fragment_index">get_fragment_index()</a> - <li><a href="getdata.html#get_native_type">get_native_type()</a> - <li><a href="getdata.html#dirfile_validate">dirfile_validate()</a> + <li><a href="getdata.html#gd_dirfilename">gd_dirfilename()</a> + <li><a href="getdata.html#gd_reference">gd_reference()</a> + <li><a href="getdata.html#gd_nframes">gd_nframes()</a> + <li><a href="getdata.html#gd_nfragments">gd_nfragments()</a> + <li><a href="getdata.html#gd_encoding">gd_encoding()</a> + <li><a href="getdata.html#gd_endianness">gd_endianness()</a> + <li><a href="getdata.html#gd_frameoffset">gd_frameoffset()</a> + <li><a href="getdata.html#gd_protection">gd_protection()</a> + <li><a href="getdata.html#gd_fragmentname">gd_fragmentname()</a> + <li><a href="getdata.html#gd_parent_fragment">gd_parent_fragment()</a> + <li><a href="getdata.html#gd_raw_filename">gd_raw_filename()</a> + <li><a href="getdata.html#gd_spf">gd_spf()</a> + <li><a href="getdata.html#gd_entry">gd_entry()</a> + <li><a href="getdata.html#dfes">gd_free_entry_strings()</a> + <li><a href="getdata.html#gd_entry_type">gd_entry_type()</a> + <li><a href="getdata.html#gd_fragment_index">gd_fragment_index()</a> + <li><a href="getdata.html#gd_native_type">gd_native_type()</a> + <li><a href="getdata.html#gd_validate">gd_validate()</a> </ul> <li><a href="getdata.html#count">Counting Fields</a> <ul class="submenu"> - <li><a href="getdata.html#get_nfields">get_nfields()</a> - <li><a href="getdata.html#get_nvectors">get_nvectors()</a> - <li><a href="getdata.html#get_nfields_by_type">get_nfields_by_type()</a> - <li><a href="getdata.html#get_nmfields">get_nmfields()</a> - <li><a href="getdata.html#get_nmvectors">get_nmvectors()</a> - <li><a href="getdata.html#get_nmfields_by_type">get_nmfields_by_type()</a> + <li><a href="getdata.html#gd_nfields">gd_nfields()</a> + <li><a href="getdata.html#gd_nvectors">gd_nvectors()</a> + <li><a href="getdata.html#gd_nfields_by_type">gd_nfields_by_type()</a> + <li><a href="getdata.html#gd_nmfields">gd_nmfields()</a> + <li><a href="getdata.html#gd_nmvectors">gd_nmvectors()</a> + <li><a href="getdata.html#gd_nmfields_by_type">gd_nmfields_by_type()</a> </ul> <li><a href="getdata.html#list">Listing Fields</a> <ul class="submenu"> - <li><a href="getdata.html#get_field_list">get_field_list()</a> - <li><a href="getdata.html#get_vector_list">get_vector_list()</a> - <li><a href="getdata.html#get_field_list_by_type">get_field_list_by_type()</a> - <li><a href="getdata.html#get_mfield_list">get_mfield_list()</a> - <li><a href="getdata.html#get_mvector_list">get_mvector_list()</a> - <li><a href="getdata.html#get_mfield_list_by_type">get_mfield_list_by_type()</a> + <li><a href="getdata.html#gd_field_list">gd_field_list()</a> + <li><a href="getdata.html#gd_vector_list">gd_vector_list()</a> + <li><a href="getdata.html#gd_field_list_by_type">gd_field_list_by_type()</a> + <li><a href="getdata.html#gd_mfield_list">gd_mfield_list()</a> + <li><a href="getdata.html#gd_mvector_list">gd_mvector_list()</a> + <li><a href="getdata.html#gd_mfield_list_by_type">gd_mfield_list_by_type()</a> </ul> <li><a href="getdata.html#mmeta">Modifying Metadata</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_include">dirfile_include()</a> - <li><a href="getdata.html#dirfile_uninclude">dirfile_uninclude()</a> - <li><a href="getdata.html#dirfile_reference">dirfile_reference()</a> - <li><a href="getdata.html#dirfile_alter_encoding">dirfile_alter_encoding()</a> - <li><a href="getdata.html#dirfile_alter_endianness">dirfile_alter_endianness()</a> - <li><a href="getdata.html#dirfile_alter_frameoffset">dirfile_alter_frameoffset()</a> - <li><a href="getdata.html#dirfile_protect">dirfile_protect()</a> + <li><a href="getdata.html#gd_include">gd_include()</a> + <li><a href="getdata.html#gd_uninclude">gd_uninclude()</a> + <li><a href="getdata.html#gd_reference">gd_reference()</a> + <li><a href="getdata.html#gd_alter_encoding">gd_alter_encoding()</a> + <li><a href="getdata.html#gd_alter_endianness">gd_alter_endianness()</a> + <li><a href="getdata.html#gd_alter_frameoffset">gd_alter_frameoffset()</a> + <li><a href="getdata.html#gd_protect">gd_protect()</a> </ul> <li><a href="getdata.html#add">Adding or Deleting Fields</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_add">dirfile_add()</a> - <li><a href="getdata.html#dirfile_add_spec">dirfile_add_spec()</a> - <li><a href="getdata.html#dirfile_add_bit">dirfile_add_bit()</a> - <li><a href="getdata.html#dirfile_add_const">dirfile_add_const()</a> - <li><a href="getdata.html#dirfile_add_lincom">dirfile_add_lincom()</a> - <li><a href="getdata.html#dirfile_add_clincom">dirfile_add_clincom()</a> - <li><a href="getdata.html#dirfile_add_linterp">dirfile_add_linterp()</a> - <li><a href="getdata.html#dirfile_add_multiply">dirfile_add_multiply()</a> - <li><a href="getdata.html#dirfile_add_phase">dirfile_add_phase()</a> - <li><a href="getdata.html#dirfile_add_polynom">dirfile_add_polynom()</a> - <li><a href="getdata.html#dirfile_add_cpolynom">dirfile_add_cpolynom()</a> - <li><a href="getdata.html#dirfile_add_raw">dirfile_add_raw()</a> - <li><a href="getdata.html#dirfile_add_sbit">dirfile_add_sbit()</a> - <li><a href="getdata.html#dirfile_add_string">dirfile_add_string()</a> - <li><a href="getdata.html#dirfile_madd">dirfile_madd()</a> - <li><a href="getdata.html#dirfile_madd_spec">dirfile_madd_spec()</a> - <li><a href="getdata.html#dirfile_madd_bit">dirfile_madd_bit()</a> - <li><a href="getdata.html#dirfile_madd_const">dirfile_madd_const()</a> - <li><a href="getdata.html#dirfile_madd_lincom">dirfile_madd_lincom()</a> - <li><a href="getdata.html#dirfile_madd_clincom">dirfile_madd_clincom()</a> - <li><a href="getdata.html#dirfile_madd_linterp">dirfile_madd_linterp()</a> - <li><a href="getdata.html#dirfile_madd_multiply">dirfile_madd_multiply()</a> - <li><a href="getdata.html#dirfile_madd_phase">dirfile_madd_phase()</a> - <li><a href="getdata.html#dirfile_madd_polynom">dirfile_madd_polynom()</a> - <li><a href="getdata.html#dirfile_madd_cpolynom">dirfile_madd_cpolynom()</a> - <li><a href="getdata.html#dirfile_madd_sbit">dirfile_madd_sbit()</a> - <li><a href="getdata.html#dirfile_madd_string">dirfile_madd_string()</a> - <li><a href="getdata.html#dirfile_delete">dirfile_delete()</a> + <li><a href="getdata.html#gd_add">gd_add()</a> + <li><a href="getdata.html#gd_add_spec">gd_add_spec()</a> + <li><a href="getdata.html#gd_add_bit">gd_add_bit()</a> + <li><a href="getdata.html#gd_add_const">gd_add_const()</a> + <li><a href="getdata.html#gd_add_lincom">gd_add_lincom()</a> + <li><a href="getdata.html#gd_add_clincom">gd_add_clincom()</a> + <li><a href="getdata.html#gd_add_linterp">gd_add_linterp()</a> + <li><a href="getdata.html#gd_add_multiply">gd_add_multiply()</a> + <li><a href="getdata.html#gd_add_phase">gd_add_phase()</a> + <li><a href="getdata.html#gd_add_polynom">gd_add_polynom()</a> + <li><a href="getdata.html#gd_add_cpolynom">gd_add_cpolynom()</a> + <li><a href="getdata.html#gd_add_raw">gd_add_raw()</a> + <li><a href="getdata.html#gd_add_sbit">gd_add_sbit()</a> + <li><a href="getdata.html#gd_add_string">gd_add_string()</a> + <li><a href="getdata.html#gd_madd">gd_madd()</a> + <li><a href="getdata.html#gd_madd_spec">gd_madd_spec()</a> + <li><a href="getdata.html#gd_madd_bit">gd_madd_bit()</a> + <li><a href="getdata.html#gd_madd_const">gd_madd_const()</a> + <li><a href="getdata.html#gd_madd_lincom">gd_madd_lincom()</a> + <li><a href="getdata.html#gd_madd_clincom">gd_madd_clincom()</a> + <li><a href="getdata.html#gd_madd_linterp">gd_madd_linterp()</a> + <li><a href="getdata.html#gd_madd_multiply">gd_madd_multiply()</a> + <li><a href="getdata.html#gd_madd_phase">gd_madd_phase()</a> + <li><a href="getdata.html#gd_madd_polynom">gd_madd_polynom()</a> + <li><a href="getdata.html#gd_madd_cpolynom">gd_madd_cpolynom()</a> + <li><a href="getdata.html#gd_madd_sbit">gd_madd_sbit()</a> + <li><a href="getdata.html#gd_madd_string">gd_madd_string()</a> + <li><a href="getdata.html#gd_delete">gd_delete()</a> </ul> <li><a href="getdata.html#alter">Modifying Field Metadata</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_alter_entry">dirfile_alter_entry()</a> - <li><a href="getdata.html#dirfile_alter_spec">dirfile_alter_spec()</a> - <li><a href="getdata.html#dirfile_malter_spec">dirfile_malter_spec()</a> - <li><a href="getdata.html#dirfile_alter_bit">dirfile_alter_bit()</a> - <li><a href="getdata.html#dirfile_alter_const">dirfile_alter_const()</a> - <li><a href="getdata.html#dirfile_alter_lincom">dirfile_alter_lincom()</a> - <li><a href="getdata.html#dirfile_alter_clincom">dirfile_alter_clincom()</a> - <li><a href="getdata.html#dirfile_alter_linterp">dirfile_alter_linterp()</a> - <li><a href="getdata.html#dirfile_alter_multiply">dirfile_alter_multiply()</a> - <li><a href="getdata.html#dirfile_alter_phase">dirfile_alter_phase()</a> - <li><a href="getdata.html#dirfile_alter_polynom">dirfile_alter_polynom()</a> - <li><a href="getdata.html#dirfile_alter_cpolynom">dirfile_alter_cpolynom()</a> - <li><a href="getdata.html#dirfile_alter_raw">dirfile_alter_raw()</a> - <li><a href="getdata.html#dirfile_alter_sbit">dirfile_alter_sbit()</a> - <li><a href="getdata.html#dirfile_move">dirfile_move()</a> - <li><a href="getdata.html#dirfile_rename">dirfile_rename()</a> + <li><a href="getdata.html#gd_alter_entry">gd_alter_entry()</a> + <li><a href="getdata.html#gd_alter_spec">gd_alter_spec()</a> + <li><a href="getdata.html#gd_malter_spec">gd_malter_spec()</a> + <li><a href="getdata.html#gd_alter_bit">gd_alter_bit()</a> + <li><a href="getdata.html#gd_alter_const">gd_alter_const()</a> + <li><a href="getdata.html#gd_alter_lincom">gd_alter_lincom()</a> + <li><a href="getdata.html#gd_alter_clincom">gd_alter_clincom()</a> + <li><a href="getdata.html#gd_alter_linterp">gd_alter_linterp()</a> + <li><a href="getdata.html#gd_alter_multiply">gd_alter_multiply()</a> + <li><a href="getdata.html#gd_alter_phase">gd_alter_phase()</a> + <li><a href="getdata.html#gd_alter_polynom">gd_alter_polynom()</a> + <li><a href="getdata.html#gd_alter_cpolynom">gd_alter_cpolynom()</a> + <li><a href="getdata.html#gd_alter_raw">gd_alter_raw()</a> + <li><a href="getdata.html#gd_alter_sbit">gd_alter_sbit()</a> + <li><a href="getdata.html#gd_move">gd_move()</a> + <li><a href="getdata.html#gd_rename">gd_rename()</a> </ul> <li><a href="getdata.html#data">Reading and Writing Data</a> <ul class="submenu"> - <li><a href="getdata.html#getdata">getdata()</a> - <li><a href="getdata.html#get_constant">get_constant()</a> - <li><a href="getdata.html#get_constants">get_constants()</a> - <li><a href="getdata.html#get_mconstants">get_mconstants()</a> - <li><a href="getdata.html#get_string">get_string()</a> - <li><a href="getdata.html#get_strings">get_strings()</a> - <li><a href="getdata.html#get_mstrings">get_mstrings()</a> - <li><a href="getdata.html#get_framenum_subset">get_framenum_subset()</a> - <li><a href="getdata.html#get_framenum">get_framenum()</a> - <li><a href="getdata.html#putdata">putdata()</a> - <li><a href="getdata.html#put_constant">put_constant()</a> - <li><a href="getdata.html#put_string">put_string()</a> + <li><a href="getdata.html#gd_getdata">gd_getdata()</a> + <li><a href="getdata.html#gd_get_constant">gd_get_constant()</a> + <li><a href="getdata.html#gd_constants">gd_constants()</a> + <li><a href="getdata.html#gd_mconstants">gd_mconstants()</a> + <li><a href="getdata.html#gd_string">gd_string()</a> + <li><a href="getdata.html#gd_strings">gd_strings()</a> + <li><a href="getdata.html#gd_mstrings">gd_mstrings()</a> + <li><a href="getdata.html#gd_framenum_subset">gd_framenum_subset()</a> + <li><a href="getdata.html#gd_framenum">gd_framenum()</a> + <li><a href="getdata.html#gd_putdata">gd_putdata()</a> + <li><a href="getdata.html#gd_put_constant">gd_put_constant()</a> + <li><a href="getdata.html#gd_put_string">gd_put_string()</a> </ul> <li><a href="getdata.html#callback">The Parser Callback Function</a> <li><a href="getdata.html#unclean">Unclean Database Recovery</a> @@ -257,12 +257,12 @@ <div class="syntax"><span class="keyword">DIRFILE</span> <span class="operator">*</span><span class="identifier">D</span> <span class="operator">=</span> <span - class="identifier">dirfile_open</span><span + class="identifier">gd_open</span><span class="operator">(</span><span class="string">"dirfile"</span><span class="operator">,</span> <span class="literal">GD_RDONLY</span><span class="operator">);</span><br><span class="keyword">size_t</span> <span class="identifier">n_read</span> <span class="operator">=</span> - <span class="identifier">getdata</span><span + <span class="identifier">gd_getdata</span><span class="operator">(</span><span class="identifier">D</span><span class="operator">,</span> <span class="string">"field"</span><span class="operator">,</span> <span class="literal">1</span><span @@ -287,17 +287,17 @@ by passing a pointer to a DIRFILE object. Further, where the legacy API was passed an integer pointer to store the error code, this is now stored in the DIRFILE object itself and may be accessed at any time by calling - <a href="getdata.html#get_error"><span - class="syntax">get_error()</span></a> As a side-effect of this change, + <a href="getdata.html#gd_error"><span + class="syntax">gd_error()</span></a> As a side-effect of this change, the error value itself, and 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. <p>Once a DIRFILE object has been created by a call to <span - class="syntax identifier">dirfile_open</span>, all subsequent operations + class="syntax identifier">gd_open</span>, 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: - <div class="syntax"><span class="identifier">dirfile_close</span><span + <div class="syntax"><span class="identifier">gd_close</span><span class="operator">(</span><span class="identifier">D</span><span class="operator">);</span></div> <h2><a name="datatypes">Data Types</a></h2> @@ -327,6 +327,8 @@ <span class="syntax literal">GD_INT64</span>, <span class="syntax literal">GD_FLOAT32</span>, <span class="syntax literal">GD_FLOAT62</span>, + <span class="syntax literal">GD_COMPLEX64</span>, + <span class="syntax literal">GD_COMPLEX128</span>, <span class="syntax literal">GD_UNKNOWN</span>.</p> Using a legacy API single character type specifier where this type is needed will result in the library error <span @@ -337,7 +339,7 @@ files.</p> <h2><a name="lfs">Largefile Support</a></h2> <p>When built on a platform using the GNU C Library, or another compatible - C Library, the new getdata API will respect the feature test macros + C Library, the new GetData API will respect the feature test macros <span class="syntax literal">_LARGEFILE64_SOURCE</span> and <span class="syntax literal">_FILE_OFFSET_BITS</span> affecting largefile (>2 GB) @@ -348,10 +350,10 @@ getdata.h, will enable the obsolete, transitional largefile extensions defined by the LFS. This will enable explicit support for large files by defining the 64-bit explicit type <span class="syntax - keyword">off64_t</span>, and result in getdata defining the explicitly - 64-bit interfaces <span class="syntax identifier">getdata64</span>, - <span class="syntax identifier">putdata64</span>, and <span - class="syntax identifier">get_nframes64</span>. This macro is + keyword">off64_t</span>, and result in GetData defining the explicitly + 64-bit interfaces <span class="syntax identifier">gd_getdata64</span>, + <span class="syntax identifier">gd_putdata64</span>, and <span + class="syntax identifier">gd_nframes64</span>. This macro is largely obsolete, and using <span class="syntax literal">_FILE_OFFSET_BITS</span> is preferred, if supported. <p>The second macro, <span class="syntax @@ -361,15 +363,16 @@ keyword">off_t</span> will be a 32-bit type. If, instead, this macro is defined to <span class="syntax literal">64</span>, <span class="syntax keyword">off_t</span> will be the largefile supporting 64-bit type, and - calls to <span class="syntax identifier">getdata</span>, <span - class="syntax identifier">putdata</span>, &c. will intrinsically + calls to <span class="syntax identifier">gd_getdata</span>, <span + class="syntax identifier">gd_putdata</span>, &c. will intrinsically have largefile support. On 64-bit systems this macro has no effect, since a 64-bit <span class="syntax keyword">off_t</span> is used all the time. <p>If your system uses the GNU C Library, the feature_test_macros(7) man page will provide further explanation. On systems where these macros are - unsupported, the getdata64, &c. interfaces will never be defined, and - the size of <span class="syntax keyword">off_t</span> will be system - dependent. In this case, GetData will likely lack largefile support. + unsupported, the gd_getdata64, &c. interfaces will never be defined, + and the size of <span class="syntax keyword">off_t</span> will be system + dependent. In this case, GetData will follow the default largefile + behaviour of the underlying platform. <p>If you build GetData against a C Library that lacks largefile support, the GetData library will not support large files either, no matter what you do with these macros.</p> @@ -390,7 +393,7 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#dirfile_close">dirfile_close</a> + <a href="getdata.html#gd_close">gd_close</a> </td> <td>—</td> <td>Closes a dirfile. The legacy API contained no facility to do @@ -398,7 +401,7 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#dirfile_flush">dirfile_flush</a> + <a href="getdata.html#gd_flush">gd_flush</a> </td> <td>—</td> <td>Flushes (i.e. syncs and closes binary files associated with) a @@ -412,7 +415,7 @@ <li><span class="syntax">void CloseAll(int *error_code);</span> </ul> which behaved similarly (the second of these flushed <em>all</em> - open dirfiles). Similarly, JF's getdata had: + open dirfiles). Similarly, JF's GetData had: <ul> <li><span class="syntax">int GetDataClose(const char *dirfilename, int *error_code);</span> @@ -422,7 +425,7 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#dirfile_open">dirfile_open</a> + <a href="getdata.html#gd_open">gd_open</a> </td> <td>—</td> <td>Opens or creates a dirfile. A dirfile open happened implicitly in @@ -431,7 +434,7 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#getdata">getdata</a> + <a href="getdata.html#gd_getdata">gd_getdata</a> </td> <td class="syntax">GetData</td> <td>Fetch data from a dirfile. Behaviour is the same. No facilities @@ -439,7 +442,7 @@ </tr> <tr> <td class="syntax" rowspan="2"> - <a href="getdata.html#get_error_string">get_error_string</a> + <a href="getdata.html#gd_error_string">gd_error_string</a> </td> <td class="syntax">GetDataErrorString</td> <td>Returns a descriptive error string. Behaviour is the same.</td> @@ -448,7 +451,7 @@ <td class="syntax">GD_ERROR_CODES</td> <td>In the legacy API, this was a global array of error messages. The new API supports no such array; callers should use the - <span class="syntax">get_error_string</span> function instead. + <span class="syntax">gd_error_string</span> function instead. (This is good advice for users of the legacy API as well.) Some error codes are specific to the new API. These error codes may not have a corresponding entry in this array. @@ -456,26 +459,26 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#get_entry">get_entry</a> + <a href="getdata.html#gd_entry">gd_entry</a> </td> <td class="syntax" rowspan="3">GetFormat</td> <td>Returns the metadata for one field. The legacy API returned a structure containing all the dirfile metadata. The legacy API's re-implementation of this function still returns this structure, but only those members corresponding to public members of the - <a href="getdata.html#get_entry"><span + <a href="getdata.html#gd_entry"><span class="syntax">gd_entry_t</span> object</a> will be properly - initialised. Furthermore, RAW data types INT8, UINT64, and INT64 - cannot be represented by the legacy API. The legacy API will - incorrectly report fields of these types to have the NULL - (<span class="syntax character">'n'</span>) type. Furthermore, - since the legacy API does not support <b>POLYNOM</b> nor <b>SBIT</b> - fields, these are listed in the legacy API's structure as - <b>LINCOM</b> and <b>BIT</b> fields, respectively. + initialised. Furthermore, RAW data types INT8, UINT64, INT64, + COMPLEX64, and COMPLEX128 cannot be represented by the legacy API. + The legacy API will incorrectly report fields of these types to have + the NULL (<span class="syntax character">'n'</span>) type. + Furthermore, since the legacy API does not support <b>POLYNOM</b> + nor <b>SBIT</b> fields, these are listed in the legacy API's + structure as <b>LINCOM</b> and <b>BIT</b> fields, respectively. </tr> <tr> <td class="syntax"> - <a href="getdata.html#get_field_list">get_field_list</a> + <a href="getdata.html#gd_field_list">gd_field_list</a> </td> <td>List the fields in a dirfile. The structure returned by the legacy API contained lists of the fields in the dirfile, @@ -483,7 +486,7 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#get_nfields">get_nfields</a> + <a href="getdata.html#gd_nfields">gd_nfields</a> </td> <td>Report the number of fields in a dirfile. The legacy API had no corresponding function, but the caller could calculate this from @@ -491,14 +494,14 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#get_nframes">get_nframes</a> + <a href="getdata.html#gd_nframes">gd_nframes</a> </td> <td class="syntax">GetNFrames</td> <td>Report the size of a dirfile. Behaviour is the same.</td> </tr> <tr> <td class="syntax"> - <a href="getdata.html#get_spf">get_spf</a> + <a href="getdata.html#gd_spf">gd_spf</a> </td> <td class="syntax">GetSamplesPerFrame</td> <td>Report the sample rate of a dirfile field. Behaviour is the @@ -506,7 +509,7 @@ </tr> <tr> <td class="syntax"> - <a href="getdata.html#putdata">putdata</a> + <a href="getdata.html#gd_putdata">gd_putdata</a> </td> <td class="syntax">PutData</td> <td>Store data to a dirfile. Behaviour is the same. No facilities @@ -556,12 +559,13 @@ <tr class="changed"> <td class="syntax">PD_E_OPEN_RAWFIELD</td> </tr> - <tr> - <td class="syntax span" colspan="2">GD_E_OPEN_INCLUDE</td> - <td rowspan="3">Unchanged.</td> + <tr class="changed"> + <td class="syntax">GD_E_OPEN_FRAGMENT</td> + <td class="syntax">GD_E_OPEN_INCLUDE</td><td>Renamed.</td> </tr> <tr> <td class="syntax span" colspan="2">GD_E_INTERNAL_ERROR</td> + <td rowspan="2">Unchanged.</td> </tr> <tr> <td class="syntax span" colspan="2">GD_E_ALLOC</td> @@ -665,11 +669,11 @@ <span class="keyword">int</span> <span class="identifier">first_frame</span> <span class="operator">=</span> <span class="literal">1000</span>;<br> <br> <span class="spacer"> <br> <!-- /* Open the dirfile */ --> - <br> <!-- DIRFILE *dirfile = dirfile_open(dirfile_name, GD_RDONLY); --> - </span><br><div class="indent"> <!-- if (get_error(dirfile)) { --> - <span class="spacer"> <br> <!-- /* dirfile_open() returns a pointer to a newly allocated DIRFILE object even if the open failed. This DIRFILE object should still be freed by calling dirfile_close() after checking the error state */ --> - <br> <!-- printf("GetData error: %s\n", get_error_string(dirfile, error_buffer, 1024)); --> - <br> <!-- dirfile_close(dirfile); --> + <br> <!-- DIRFILE *dirfile = gd_open(dirfile_name, GD_RDONLY); --> + </span><br><div class="indent"> <!-- if (gd_error(dirfile)) { --> + <span class="spacer"> <br> <!-- /* 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 */ --> + <br> <!-- printf("GetData error: %s\n", gd_error_string(dirfile, error_buffer, 1024)); --> + <br> <!-- gd_close(dirfile); --> </span><br> <!-- exit(1); --> </div><span class="spacer"> </span><br> <!-- } --> <br> @@ -699,8 +703,6 @@ <br> <span class="comment">/* Clean up */</span><br> <span class="identifier">free</span><span class="operator">(</span><span class="identifier">data_buffer</span><span class="operator">);</span><br> - <br> - <span class="spacer"> </span><br> <span class="spacer"> </span><br> <br> <span class="keyword">return</span> <span class="literal">0</span><span class="operator">;</span><br> @@ -722,25 +724,25 @@ <span class="keyword">off_t</span> <span class="identifier">first_frame</span> <span class="operator">=</span> <span class="literal">1000</span>;<br> <br> <span class="comment">/* Open the dirfile */</span><br> - <span class="keyword">DIRFILE</span> <span class="operator">*</span><span class="identifier">dirfile</span> <span class="operator">=</span> <span class="identifier">dirfile_open</span><span class="operator">(</span><span class="identifier">dirfile_name</span><span class="operator">,</span> <span class="literal">GD_RDONLY</span><span class="operator">);</span><br> - <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">get_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> - <span class="comment">/* dirfile_open() returns a pointer to a newly allocated DIRFILE object even if the open failed. This DIRFILE object should still be freed by calling dirfile_close() after checking the error state */</span><br> - <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">get_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> - <span class="identifier">dirfile_close</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">);</span><br> + <span class="keyword">DIRFILE</span> <span class="operator">*</span><span class="identifier">dirfile</span> <span class="operator">=</span> <span class="identifier">gd_open</span><span class="operator">(</span><span class="identifier">dirfile_name</span><span class="operator">,</span> <span class="literal">GD_RDONLY</span><span class="operator">);</span><br> + <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">gd_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> + <span class="comment">/* 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 */</span><br> + <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">gd_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> + <span class="identifier">gd_close</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">);</span><br> <span class="identifier">exit</span><span class="operator">(</span><span class="literal">1</span><span class="operator">);</span><br> </div><span class="operator">}</span><br> <br> <span class="comment">/* Get size of the database */</span><span class="spacer"> </span><br> - <span class="keyword">off_t</span> <span class="identifier">nf</span> <span class="operator">=</span> <span class="identifier">get_nframes</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">);</span> <span class="comment">/* again off_t */</span><span class="spacer"> </span><br> - <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">get_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> - <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">get_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> + <span class="keyword">off_t</span> <span class="identifier">nf</span> <span class="operator">=</span> <span class="identifier">gd_nframes</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">);</span> <span class="comment">/* again off_t */</span><span class="spacer"> </span><br> + <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">gd_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> + <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">gd_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> <span class="identifier">exit</span><span class="operator">(</span><span class="literal">1</span><span class="operator">);</span><br> </div><span class="operator">}</span><br> <br> <span class="comment">/* Get samples-per-frame */</span><br> - <span class="keyword">unsigned int</span> <span class="identifier">spf</span> <span class="operator">=</span> <span class="identifier">get_spf</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">field_name</span><span class="operator">);</span><span class="spacer"> </span><br> - <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">get_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> - <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">get_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> + <span class="keyword">unsigned int</span> <span class="identifier">spf</span> <span class="operator">=</span> <span class="identifier">gd_spf</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">field_name</span><span class="operator">);</span><span class="spacer"> </span><br> + <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">gd_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> + <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">gd_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> <span class="identifier">exit</span><span class="operator">(</span><span class="literal">1</span><span class="operator">);</span><br> </div><span class="operator">}</span><br> <br> @@ -748,18 +750,16 @@ <span class="keyword">double</span> <span class="operator">*</span><span class="identifier">data_buffer</span> <span class="operator">=</span> <span class="identifier">malloc</span><span class="operator">(</span><span class="keyword">sizeof</span><span class="operator">(</span><span class="keyword">double</span><span class="operator">) *</span> <span class="identifier">spf</span> <span class="operator">* (</span><span class="identifier">nf</span> <span class="operator">-</span> <span class="identifier">first_frame</span><span class="operator">));</span><br> <br> <span class="comment">/* Retrieve all but the first 1000 frames -- size_t is for counts of objects read */</span><br> - <span class="keyword">size_t</span> <span class="identifier">n_read</span> <span class="operator">=</span> <span class="identifier">getdata</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">field_name</span><span class="operator">,</span> <span class="identifier">first_frame</span><span class="operator">,</span> <span class="literal">0</span><span class="operator">,</span> <span class="identifier">nf</span> <span class="operator">-</span> <span class="identifier">first_frame</span><span class="operator">,</span> <span class="literal">0</span><span class="operator">,</span> <span class="literal">GD_FLOAT64</span><span class="operator">,</span> <span class="identifier">data_buffer</span><span class="operator">);</span><span class="spacer"> </span><br> - <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">get_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> - <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">get_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> + <span class="keyword">size_t</span> <span class="identifier">n_read</span> <span class="operator">=</span> <span class="identifier">gd_getdata</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">field_name</span><span class="operator">,</span> <span class="identifier">first_frame</span><span class="operator">,</span> <span class="literal">0</span><span class="operator">,</span> <span class="identifier">nf</span> <span class="operator">-</span> <span class="identifier">first_frame</span><span class="operator">,</span> <span class="literal">0</span><span class="operator">,</span> <span class="literal">GD_FLOAT64</span><span class="operator">,</span> <span class="identifier">data_buffer</span><span class="operator">);</span><span class="spacer"> </span><br> + <span class="keyword">if</span> <span class="operator">(</span><span class="identifier">gd_error</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">)) {</span><br><div class="indent"> + <span class="identifier">printf</span><span class="operator">(</span><span class="string">"GetData error: %s\n"</span><span class="operator">,</span> <span class="identifier">gd_error_string</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">,</span> <span class="identifier">error_buffer</span><span class="operator">,</span> <span class="literal">1024</span><span class="operator">));</span><br> <span class="identifier">exit</span><span class="operator">(</span><span class="literal">1</span><span class="operator">);</span><br> </div><span class="operator">}</span><br> <br> <span class="comment">/* Clean up */</span><br> <span class="identifier">free</span><span class="operator">(</span><span class="identifier">data_buffer</span><span class="operator">);</span><br> + <span class="identifier">gd_close</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">);</span><br> <br> - <span class="comment">/* not strictly necessary at the end of the program */</span><br> - <span class="identifier">dirfile_close</span><span class="operator">(</span><span class="identifier">dirfile</span><span class="operator">);</span><br> - <br> <span class="keyword">return</span> <span class="literal">0</span><span class="operator">;</span><br> </div> <span class="operator">}</span> Modified: trunk/html/bindings.html =================================================================== --- trunk/html/bindings.html 2010-10-22 17:41:41 UTC (rev 462) +++ trunk/html/bindings.html 2010-10-22 17:42:27 UTC (rev 463) @@ -115,6 +115,8 @@ package in the <code>/doc/</code> subdirectory. Additionally, all bindings include a test suite (not installed) which shows rudimentary usage of the bindings. + <p>Both the Python and IDL bindings require a C99-compatible C compiler. + If one cannot be found, these bindings will not be built. <h2><A name="fortran">Fortran Bindings</a></h2> <p>Two sets of Fortran bindings are provided. The basic bindings are Modified: trunk/html/getdata.html =================================================================== --- trunk/html/getdata.html 2010-10-22 17:41:41 UTC (rev 462) +++ trunk/html/getdata.html 2010-10-22 17:42:27 UTC (rev 463) @@ -29,129 +29,128 @@ <li><a href="getdata.html#bindings">Language Bindings</a> <li><a href="getdata.html#dirfile">Working with Dirfiles</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_cbopen">dirfile_cbopen()</a> - <li><a href="getdata.html#dirfile_open">dirfile_open()</a> - <li><a href="getdata.html#dirfile_parser_callback">dirfile_parser_callback()</a> - <li><a href="getdata.html#dirfile_close">dirfile_close()</a> - <li><a href="getdata.html#dirfile_discard">dirfile_discard()</a> - <li><a href="getdata.html#dirfile_flush">dirfile_flush()</a> - <li><a href="getdata.html#dirfile_metaflush">dirfile_metaflush()</a> - <li><a href="getdata.html#get_error">get_error()</a> - <li><a href="getdata.html#get_error_string">get_error_string()</a> + <li><a href="getdata.html#gd_cbopen">gd_cbopen()</a> + <li><a href="getdata.html#gd_open">gd_open()</a> + <li><a href="getdata.html#gd_parser_callback">gd_parser_callback()</a> + <li><a href="getdata.html#gd_close">gd_close()</a> + <li><a href="getdata.html#gd_discard">gd_discard()</a> + <li><a href="getdata.html#gd_flush">gd_flush()</a> + <li><a href="getdata.html#gd_metaflush">gd_metaflush()</a> + <li><a href="getdata.html#gd_error">gd_error()</a> + <li><a href="getdata.html#gd_error_string">gd_error_string()</a> </ul> <li><a href="getdata.html#rmeta">Reading Metadata</a> <ul class="submenu"> - <li><a href="getdata.html#dirfilename">dirfilename()</a> - <li><a href="getdata.html#get_reference">get_reference()</a> - <li><a href="getdata.html#get_nframes">get_nframes()</a> - <li><a href="getdata.html#get_nfragments">get_nfragments()</a> - <li><a href="getdata.html#get_encoding">get_encoding()</a> - <li><a href="getdata.html#get_endianness">get_endianness()</a> - <li><a href="getdata.html#get_frameoffset">get_frameoffset()</a> - <li><a href="getdata.html#get_protection">get_protection()</a> - <li><a href="getdata.html#get_fragmentname">get_fragmentname()</a> - <li><a href="getdata.html#get_parent_fragment">get_parent_fragment()</a> - <li><a href="getdata.html#get_raw_filename">get_raw_filename()</a> - <li><a href="getdata.html#get_spf">get_spf()</a> - <li><a href="getdata.html#get_entry">get_entry()</a> - <li><a href="getdata.html#dfes">dirfile_free_entry_strings()</a> - <li><a href="getdata.html#get_entry_type">get_entry_type()</a> - <li><a href="getdata.html#get_fragment_index">get_fragment_index()</a> - <li><a href="getdata.html#get_native_type">get_native_type()</a> - <li><a href="getdata.html#dirfile_validate">dirfile_validate()</a> + <li><a href="getdata.html#gd_dirfilename">gd_dirfilename()</a> + <li><a href="getdata.html#gd_nframes">gd_nframes()</a> + <li><a href="getdata.html#gd_nfragments">gd_nfragments()</a> + <li><a href="getdata.html#gd_encoding">gd_encoding()</a> + <li><a href="getdata.html#gd_endianness">gd_endianness()</a> + <li><a href="getdata.html#gd_frameoffset">gd_frameoffset()</a> + <li><a href="getdata.html#gd_protection">gd_protection()</a> + <li><a href="getdata.html#gd_fragmentname">gd_fragmentname()</a> + <li><a href="getdata.html#gd_parent_fragment">gd_parent_fragment()</a> + <li><a href="getdata.html#gd_raw_filename">gd_raw_filename()</a> + <li><a href="getdata.html#gd_spf">gd_spf()</a> + <li><a href="getdata.html#gd_entry">gd_entry()</a> + <li><a href="getdata.html#dfes">gd_free_entry_strings()</a> + <li><a href="getdata.html#gd_entry_type">gd_entry_type()</a> + <li><a href="getdata.html#gd_fragment_index">gd_fragment_index()</a> + <li><a href="getdata.html#gd_native_type">gd_native_type()</a> + <li><a href="getdata.html#gd_validate">gd_validate()</a> </ul> <li><a href="getdata.html#count">Counting Fields</a> <ul class="submenu"> - <li><a href="getdata.html#get_nfields">get_nfields()</a> - <li><a href="getdata.html#get_nvectors">get_nvectors()</a> - <li><a href="getdata.html#get_nfields_by_type">get_nfields_by_type()</a> - <li><a href="getdata.html#get_nmfields">get_nmfields()</a> - <li><a href="getdata.html#get_nmvectors">get_nmvectors()</a> - <li><a href="getdata.html#get_nmfields_by_type">get_nmfields_by_type()</a> + <li><a href="getdata.html#gd_nfields">gd_nfields()</a> + <li><a href="getdata.html#gd_nvectors">gd_nvectors()</a> + <li><a href="getdata.html#gd_nfields_by_type">gd_nfields_by_type()</a> + <li><a href="getdata.html#gd_nmfields">gd_nmfields()</a> + <li><a href="getdata.html#gd_nmvectors">gd_nmvectors()</a> + <li><a href="getdata.html#gd_nmfields_by_type">gd_nmfields_by_type()</a> </ul> <li><a href="getdata.html#list">Listing Fields</a> <ul class="submenu"> - <li><a href="getdata.html#get_field_list">get_field_list()</a> - <li><a href="getdata.html#get_vector_list">get_vector_list()</a> - <li><a href="getdata.html#get_field_list_by_type">get_field_list_by_type()</a> - <li><a href="getdata.html#get_mfield_list">get_mfield_list()</a> - <li><a href="getdata.html#get_mvector_list">get_mvector_list()</a> - <li><a href="getdata.html#get_mfield_list_by_type">get_mfield_list_by_type()</a> + <li><a href="getdata.html#gd_field_list">gd_field_list()</a> + <li><a href="getdata.html#gd_vector_list">gd_vector_list()</a> + <li><a href="getdata.html#gd_field_list_by_type">gd_field_list_by_type()</a> + <li><a href="getdata.html#gd_mfield_list">gd_mfield_list()</a> + <li><a href="getdata.html#gd_mvector_list">gd_mvector_list()</a> + <li><a href="getdata.html#gd_mfield_list_by_type">gd_mfield_list_by_type()</a> </ul> <li><a href="getdata.html#mmeta">Modifying Metadata</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_include">dirfile_include()</a> - <li><a href="getdata.html#dirfile_uninclude">dirfile_uninclude()</a> - <li><a href="getdata.html#dirfile_reference">dirfile_reference()</a> - <li><a href="getdata.html#dirfile_alter_encoding">dirfile_alter_encoding()</a> - <li><a href="getdata.html#dirfile_alter_endianness">dirfile_alter_endianness()</a> - <li><a href="getdata.html#dirfile_alter_frameoffset">dirfile_alter_frameoffset()</a> - <li><a href="getdata.html#dirfile_protect">dirfile_protect()</a> + <li><a href="getdata.html#gd_include">gd_include()</a> + <li><a href="getdata.html#gd_uninclude">gd_uninclude()</a> + <li><a href="getdata.html#gd_reference">gd_reference()</a> + <li><a href="getdata.html#gd_alter_encoding">gd_alter_encoding()</a> + <li><a href="getdata.html#gd_alter_endianness">gd_alter_endianness()</a> + <li><a href="getdata.html#gd_alter_frameoffset">gd_alter_frameoffset()</a> + <li><a href="getdata.html#gd_protect">gd_protect()</a> </ul> <li><a href="getdata.html#add">Adding or Deleting Fields</a> <ul class="submenu"> - <li><a href="getdata.html#dirfile_add">dirfile_add()</a> - <li><a href="getdata.html#dirfile_add_spec">dirfile_add_spec()</a> - <li><a href="getdata.html#dirfile_add_bit">dirfile_add_bit()</a> - <li><a href="getdata.html#dirfile_add_const">dirfile_add_const()</a> - <li><a href="getdata.html#dirfile_add_lincom">dirfile_add_lincom()</a> - <li><a href="getdata.html#dirfile_add_clincom">dirfile_add_clincom()</a> - <li><a href="getdata.html#dirfile_add_linterp">dirfile_add_linterp()</a> - <li><a href="getdata.html#dirfile_add_multiply">dirfile_add_multiply()</a> - <li><a href="getdata.html#dirfile_add_phase">dirfile_add_phase()</a> - <li><a href="getdata.html#dirfile_add_polynom">dirfile_add_polynom()</a> - <li><a href="getdata.html#dirfile_add_cpolynom">dirfile_add_cpolynom()</a> - <li><a href="getdata.html#dirfile_add_raw">dirfile_add_raw()</a> - <li><a href="getdata.html#dirfile_add_sbit">dirfile_add_sbit()</a> - <li><a href="getdata.html#dirfile_add_string">dirfile_add_string()</a> - <li><a href="getdata.html#dirfile_madd">dirfile_madd()</a> - <li><a href="getdata.html#dirfile_madd_spec">dirfile_madd_spec()</a> - <li><a href="getdata.html#dirfile_madd_bit">dirfile_madd_bit()</a> - <li><a href="getdata.html#dirfile_madd_const">dirfile_madd_const()</a> - <li><a href="getdata.html#dirfile_madd_lincom">dirfile_madd_lincom()</a> - <li><a href="g... [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 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] |