[Nexus-developers] Handling of C-string null characters

Peterson, Peter F. petersonpf at ornl.gov
Wed Jul 6 18:22:29 BST 2005


Freddie,

I agree with both suggestions. "EXTERIOR" just didn't come to mind. The
idea of setting options may useful for other features (setting how
numbers are written to file for XML, for example). 

P^2 

-----Original Message-----
From: nexus-developers-bounces at anl.gov
[mailto:nexus-developers-bounces at anl.gov] On Behalf Of Akeroyd, FA
(Freddie)
Sent: Wednesday, July 06, 2005 10:13 AM
To: nexus-developers at anl.gov
Subject: RE: [Nexus-developers] Handling of C-string null characters

> 
> 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  





_______________________________________________
NeXus-developers mailing list
NeXus-developers at anl.gov
http://www.neutron.anl.gov/mailman/listinfo/nexus-developers





More information about the NeXus-developers mailing list