Proposed rearrangement of "struct NeXusFile"

Ray Osborn ROsborn at anl.gov
Mon Oct 11 16:44:07 BST 1999


Ironically, the SEQUENCE command in the F90 derived type was inserted to 
improve portability.  The internal details of the NXhandle structure are
only used in the NXU F90 routines to reset the index in certain directory
searches, so unfortunately, the standard test routines won't show them up.
They only test the core NX routines.  However, NXbrowse does make use of
them, so it can provide the test.

If you are convinced that the natural alignment will make work, I certainly
have no objection.  Do you want me to update NXmodule.f90 or should I leave
that to you?

Regards,
Ray
--
Dr Ray Osborn                Tel: +1 (630) 252-9011
Materials Science Division   Fax: +1 (630) 252-7777
Argonne National Laboratory  E-mail: ROsborn at anl.gov
Argonne, IL 60439-4845


> The order of elements in the definition of "struct NexusFile" are such that
> the
> structure is not naturally aligned, and this has caused a problem with Ray's
>
> F90 NXbrowse as the F90 definition did not match up with the C one. I
> propose
> that we rearrange the structure to make it "naturally aligned" as far as
> possible.
> This would only break code that relied on a structure member being at a
> given
> byte offset, which i don't believe exists. The rearranged structure would
> look something
> like this:
>
>    typedef struct __NexusFile {
>     struct iStack {
>       int32 *iRefDir;
>       int32 *iTagDir;
>       int32 iVref;
>       int32 __iStack_pad;               /* for 64 bit alignment */
>       int iNDir;
>       int iCurDir;
>     } iStack[NXMAXSTACK];
>     struct iStack iAtt;
>     int32 iVID;
>     int32 iSID;
>     int32 iCurrentVG;
>     int32 iCurrentSDS;
>     int iNXID;
>     int iStackPtr;
>     char iAccess[2];
>   } NexusFile, *pNexusFile;
>
> Anybody any thoughs?
>
> Freddie




More information about the NeXus-developers mailing list