Version numbers

Freddie Akeroyd faa at isise.rl.ac.uk
Thu Apr 16 07:12:52 BST 1998


>
> Before finalizing on version 1.0, I would like to raise one issue again. 
> When I was at NIST recently, Przemek showed me some of his NeXus code, which
> contained a subroutine to automatically perform the NXmakedata, NXopendata
> and NXputdata trilogy.  Jon Tischler's example had a similar subroutine.  I
> really think that we should provide a standard one as part of NAPI to save
> this endless typing.  To hurry this process along, I wrote one possible
> version of this, with the hope that the C code is so bad that someone
> quickly corrects it (installing the correction in NAPI.C using CVS).  
> 
> Here is my code which creates two new routines, NXwritedata and NXreaddata,
> to perform the multiple functions:
> 
>   NXstatus NXwritedata (NXhandle fid, char *name, int datatype, int rank,
>               int dimensions[], void *data, char *units)
>   {
>   
>     if (NXmakedata(fid, name, datatype, rank, dimensions) != NX_OK) return
> NX_ERROR;
>     if (NXopendata(fid, name) != NX_OK) return NX_ERROR;
>     if (NXputdata(fid, data) != NX_OK) return NX_ERROR;
>     if (NXputattr(fid, "units", units, strlen(units), NX_CHAR) != NX_OK)
> return NX_ERROR;
> 
>     return NX_OK;
>   }
>   
>   NXstatus NXreaddata (NXhandle fid, char *name, int *datatype, int *rank,
>               int dimensions[], void *data, char *units)
>   {
>     int32 attr_len;
>     int32 attr_type;
> 
>     if (NXopendata(fid, name) != NX_OK) return NX_ERROR;
>     if (NXgetinfo(fid, rank, dimension, datatype) != NX_OK) return NX_ERROR;
>     if (NXgetdata(fid, data) != NX_OK) return NX_ERROR;
>     if (NXgetattr(fid, "units", units, attr_len, attr_type) != NX_OK) return
> NX_ERROR;
>     
>     return NX_OK;
>   }
> 
> Please find the deliberate mistakes and correct them.  Of course, if Mark
> wants to rewrite them using the underlying HDF routines, that's fine by me. 
> 
Ray, there is a function

   NXstatus NXUenterdata (NXhandle fileid, char* label, int datatype,
                          int rank, int dim[], char *pUnits);

included as a "NeXus utility function" with the NXdict API which
does the equivalent of the NXwritedata() above; however no equivalent to 
NXreaddata is currently defined, so the questions are:

(1) Do we define an "NXUretrievedata" to complement "NXUenterdata", or should we
    use the names NXUwritedata and NXUreaddata instead?
(2) The NXU* routines are currently part of Mark's NXdict - is that ready to ship now,
    or should we move the NXU routines into the general NeXus API instead (which
    may be more logical as the NXU* do not rely on any of the dictionary concepts)

What is the final word on NX_CHAR? Currently the NAPI code writes
NX_CHAR as DFNT_CHAR8, but treats attributes read in as DFNT_UINT8,
DFNT_CHAR8 or DFNT_UCHAR8 as character types (for backward
compatability) and NULL terminates them; however it looks like the
current NXdict API uses DFNT_INT8 as the character type.  This may not
be a problem if we don't allow 8 bit values to be anything other than
strings when they are in attributes - proper 8 bit numbers should be
part of an SDS and not an attribute? Of course, do we then allow SDS's
of characters?

Freddie

P.S. I assume we should write a global attribute "NeXus_version" containing the 
     API version when we create a new file - i don't believe we do at the moment

-- 
Freddie Akeroyd                        Email:  Freddie.Akeroyd at rl.ac.uk
ISIS Facility                          Tel:    +44 1235 445457
Rutherford Appleton Laboratory         Fax:    +44 1235 445720
Chilton, DIDCOT, OX11 OQX, GB          WWW:    http://www.isis.rl.ac.uk/



More information about the NeXus-developers mailing list