[Nexus-developers] Handling of C-string null characters
Akeroyd, FA (Freddie)
F.A.Akeroyd at rl.ac.uk
Wed Jul 6 15:13:22 BST 2005
>
> There should be four options (note that I call whitespace to be \n,
\t,
> ^M, and " "):
> NXACC_NOSTRIP - leave all whitespace as discovered in the file
> NXACC_STRIP_LEAD - remove leading and trailing whitespace, leave
> intererior whitespace unchanged
> NXACC_STRIP_INTERIOR - collapse all interior whitespace into a
single
> " " for each set encountered
> NXACC_STRIP_ALL - the oposite of NXACC_NOSTRIP
>
> These should be present reguardless of what the default behaviour is
so
> the user can declare what they want if they care (much like what file
> base is default for NX_CREATE). Also, this should be setable for HDF4
> and HDF5 files as well for consistency of interface. As for the
default,
> I prefer NXACC_STRIP_ALL.
>
> P^2
>
Sounds a reasonable set of options. Additionally a user may want to
change the way spaces are interpreted while reading a file so I think it
would be better to have these options enabled/disabled via a new
NXsetoptions() function rather than being passed as arguments to NXopen.
NXsetoptions() could be called while a file was open and would modify
the stripping behaviour of subsequent commands - the parameters would
now be prefixed NXOPT_* rather than NXACC_*. I think NXsetoptions should
store its information in the NXhandle structure returned by NXopen
rather than set them globally - that way you could have several files
open at once with different space interpretation if you desired.
As for naming options, would "STRIP_EXTERIOR" be better than
"STRIP_LEAD" as we are removing both leading and trailing spaces?
Freddie
More information about the NeXus-developers
mailing list