Changes from tags/4.1.0 at r1924 to tags/4.2.0 at r1924


Ignore:
Location:
tags
Files:
92 added
8 deleted
76 edited

Legend:

Unmodified
Added
Removed
  • tags/4.2.0/Makefile.am

    r1924 r1924  
    3232test: check 
    3333 
    34 SUBDIRS=include src bindings applications test scripts examples doc contrib 
     34if BUILD_CONTRIB 
     35CONTRIB=contrib 
     36endif 
     37SUBDIRS=include src bindings applications test scripts examples doc $(CONTRIB) 
    3538 
    3639EXTRA_DIST=build_rules.am nexus_spec.in nexus.spec autoversion.sh \ 
    3740                build_rpm.in README.cygwin README.WIN32 README.macosx \ 
    38                 README.MinGW make_mingw_links 
    39  
     41                README.MinGW make_mingw_links SConstruct nexus_scons_utils.py 
    4042 
    4143# Add any flags here that you want passed to configure when you do  
  • tags/4.2.0/NEWS

    r1924 r1924  
     1Version 4.2.0 
     2============= 
     3 
     4For the latest information see  
     5 
     6    http://www.nexusformat.org/Nexus_42_Release_Notes 
     7 
     8==System Requirements== 
     9'''MXML XML Parsing Library''' 
     10 
     11Version 2.2.2 or higher of mxml is required. Earlier versions have a bug and the XML API will not work. This package can be downloded in [http://www.easysw.com/~mike/mxml/software.php both source and binary rpm form] and is also available as part of [http://fedoraproject.org/wiki/Extras/UsingExtras Fedora Extras]. IMPORTANT NOTE: Debian also provides the mxml package, but it based on 2.0 and will not work properly. 
     12 
     13'''Python Interface''' 
     14You will need both the numpy and ctypes modules to be available.  These are provided in both the Fedora and EPEL repositories. 
     15 
     16==Building Notes== 
     17===NAG F90/F95 Compiler=== 
     18The NAG compiler needs the '''-mismatch''' flag to be specified or else it will not compile NXmodule.f90 This is achieve by running configure with the '''FCFLAGS''' environment variable set to contain the flag e.g. 
     19<pre> 
     20env FCFLAGS="-mismatch" ./configure --with-f90=f95 
     21</pre> 
     22===HDF4 on Intel Macs=== 
     23There is a problem with the include file, hdfi.h (normally in /usr/local/include).  See http://coastwatch.noaa.gov/helparc/software/msg00069.html for details of the modifications necessary to fix it. 
     24 
     25==New Features== 
     26===C++ Interface=== 
     27See the [http://download.nexusformat.org/doxygen/html/classNeXus_1_1File.html doxygen documentation] and 
     28[http://svn.nexusformat.org/code/branches/4.2/test/napi_test_cpp.cxx NeXus API test program] 
     29 
     30===C++ Stream Like interface=== 
     31The idea is to provide an IOSteam like interface and allow you to type  
     32<pre> 
     33    // create an entry and a data item 
     34    File nf(fname, NXACC_CREATE); 
     35    nf << Group("entry1", "NXentry") << Data("dat1", w, "int_attr", 3); 
     36    nf.close(); 
     37 
     38    File nf1(fname, NXACC_RDWR); 
     39    // add a double_attr to an existing setup 
     40    nf1 >> Group("entry1", "NXentry") >> Data("dat1") << Attr("double_attr", 6.0); 
     41    nf1.close(); 
     42 
     43    // read back data items 
     44    File nf2(fname, NXACC_READ); 
     45    nf2 >> Group("entry1", "NXentry") >> Data("dat1", w1, "int_attr", i, "double_attr", d); 
     46    // alternative way to read d1 
     47    nf2 >> Data("dat1") >> Attr("double_attr", d1); 
     48</pre> 
     49See also the [http://svn.nexusformat.org/code/branches/4.2/test/napi_test_cpp.cxx NeXus API test program] 
     50 
     51===IDL Interface=== 
     52There is a new interface to RSI's Interactive Data Language, IDL for NeXus. This  
     53interface has to be considered beta. Nevertheless it is working most of the time.  
     54Known issues include: 
     55* Compressed reading and writing do not work for HDF-4 files, probably because of a library version conflict on libz.  
     56* There is an issue using NXgetslab on 64 bit operating systems; expect a fix for this pretty soon. 
     57 
     58===Python Interface=== 
     59There is now, thanks to David Kienzle, a supported interface for the python scripting language. Arrays are stored in numpy arrays and thus allow for efficient data manipulations. 
     60 
     61==Changed Features== 
     62 
     63==Known Issues== 
     64See the comments on the IDL interface. 
     65 
     66==Miscellaneous bug fixes== 
     67The following items are bugs reported in previous releases and resolved in 
     68the 4.2 release. 
     69 
     70==Upcoming Features== 
     71 
    172Version 4.1.0 
    273============= 
  • tags/4.2.0/README.developers

    r1924 r1924  
    6161ftp://ftp.gnu.org/gnu/libtool 
    6262 
     63Most likely it will be autoconf that will need updating - NeXus 
     64now requires autoconf 2.61 or above 
     65 
    6366NeXus Developer Mailing Lists 
    6467----------------------------- 
  • tags/4.2.0/applications/Makefile.am

    r1924 r1924  
    3131LIBNEXUS90=$(top_builddir)/bindings/f90/libNeXus90.la 
    3232AM_CPPFLAGS=-I. -I$(top_srcdir)/include 
     33AM_FCFLAGS=-I$(top_builddir)/bindings/f90 
    3334 
     35EXTRA_DIST=SConscript 
     36 
     37if HAVE_XML 
     38NXINGEST = nxingest 
     39endif 
    3440if HAVE_LIBXML2 
    3541NXTRANSLATE=NXtranslate 
    3642NXSUMMARY=NXsummary 
    3743endif 
    38 SUBDIRS = NXdir $(NXTRANSLATE) $(NXSUMMARY) 
     44SUBDIRS = NXdir $(NXTRANSLATE) $(NXSUMMARY) $(NXINGEST) 
    3945#if HAVE_HDF4 
    4046#HDF4_TARGETS = NXtoNX4 
     
    4854endif 
    4955 
    50 bin_PROGRAMS = nxbrowse nx2dtd nxconvert $(F90_TARGETS) 
     56bin_PROGRAMS = nxbrowse nx2dtd nxconvert nxvalidate $(F90_TARGETS) 
    5157 
    52 nxconvert_SOURCES = nxconvert.c 
     58nxconvert_SOURCES = nxconvert.c nxconvert_common.c nxconvert_common.h 
    5359nxconvert_LDADD = $(LIBNEXUS) 
    54 nxconvert_LDFLAGS = -static $(LDFLAGS) 
     60nxconvert_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
     61 
     62nxvalidate_SOURCES = nxvalidate.c nxconvert_common.c nxconvert_common.h 
     63nxvalidate_LDADD = $(LIBNEXUS) 
     64nxvalidate_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    5565 
    5666nxbrowse_SOURCES = NXbrowse.c 
    5767nxbrowse_LDADD = $(LIBNEXUS) 
    58 nxbrowse_LDFLAGS = -static $(LDFLAGS) 
     68nxbrowse_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    5969 
    6070#NXtoXML_SOURCES = NXtoXML.c  
     
    6474nx2dtd_SOURCES = NXtoDTD.c  
    6575nx2dtd_LDADD = $(LIBNEXUS) 
    66 nx2dtd_LDFLAGS = -static $(LDFLAGS) 
     76nx2dtd_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    6777 
    6878#NXtoNX4_SOURCES = NXtoNX4.c  
     
    7585NXdump_LDADD = $(LIBNEXUS90) 
    7686NXdump_LINK = $(FCLINK) 
    77 NXdump_LDFLAGS = -static $(LDFLAGS) 
     87NXdump_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    7888 
    7989NXbrowse90_SOURCES = NXbrowse90.f90 
    8090NXbrowse90_LDADD = $(LIBNEXUS90) 
    8191NXbrowse90_LINK = $(FCLINK) 
    82 NXbrowse90_LDFLAGS = -static $(LDFLAGS) 
     92NXbrowse90_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    8393 
    8494include $(top_srcdir)/build_rules.am 
  • tags/4.2.0/applications/NXbrowse.c

    r1924 r1924  
    224224{ 
    225225   int status, dataType, dataRank, dataDimensions[NX_MAXRANK], length; 
    226    NXname name, class, nxurl; 
     226   NXname name, nxclass, nxurl; 
    227227 
    228228   if (NXinitgroupdir (fileId) != NX_OK) return NX_ERROR; 
    229229   do { 
    230       status = NXgetnextentry (fileId, name, class, &dataType); 
     230      status = NXgetnextentry (fileId, name, nxclass, &dataType); 
    231231      if (status == NX_ERROR) break; 
    232232      if (status == NX_OK) { 
    233         if (strncmp(class,"CDF",3) == 0){  
     233        if (strncmp(nxclass,"CDF",3) == 0){  
    234234            ; 
    235235        } 
    236         else if (strcmp(class,"SDS") == 0){  
     236        else if (strcmp(nxclass,"SDS") == 0){  
    237237            printf ("  NX Data  : %s", name); 
    238238            if (NXopendata (fileId, name) != NX_OK) return NX_ERROR; 
     
    245245        } else { 
    246246            length = sizeof(nxurl); 
    247             if(NXisexternalgroup(fileId, name,class,nxurl,length) == NX_OK){ 
    248               printf ("  NX external Group: %s (%s), linked to: %s \n",name,class,nxurl);  
     247            if(NXisexternalgroup(fileId, name,nxclass,nxurl,length) == NX_OK){ 
     248              printf ("  NX external Group: %s (%s), linked to: %s \n",name,nxclass,nxurl);  
    249249            } else { 
    250               printf ("  NX Group : %s (%s)\n", name, class); 
    251               if((status = NXopengroup(fileId,name,class)) != NX_OK){ 
     250              printf ("  NX Group : %s (%s)\n", name, nxclass); 
     251              if((status = NXopengroup(fileId,name,nxclass)) != NX_OK){ 
    252252                return status; 
    253253              }  
     
    354354         for(i=0; i<total_size / dataDimensions[dataRank-1]; i++) 
    355355         { 
    356              PrintData (dataBuffer + i * dataDimensions[dataRank-1], dataType, dataDimensions[dataRank-1]); 
     356             PrintData ((char*)dataBuffer + i * dataDimensions[dataRank-1], dataType, dataDimensions[dataRank-1]); 
    357357             PrintData ("\n", NX_CHAR, 1); 
    358358         } 
     
    636636void PrintData (void *data, int dataType, int numElements) 
    637637{ 
    638    WriteData (stdout, data, dataType, numElements); 
     638   WriteData (stdout, (char*)data, dataType, numElements); 
    639639} 
    640640/* Searches group for requested group and return its class */ 
     
    642642{ 
    643643   int status, dataType; 
    644    NXname name, class; 
     644   NXname name, nxclass; 
    645645 
    646646   NXinitgroupdir (fileId); 
    647647   do { 
    648       status = NXgetnextentry (fileId, name, class, &dataType); 
     648      status = NXgetnextentry (fileId, name, nxclass, &dataType); 
    649649      if (status == NX_ERROR) return NX_ERROR; 
    650650      if (status == NX_OK) { 
    651651          if (StrEq (groupName, name)) { 
    652             strcpy (groupClass, class); 
     652            strcpy (groupClass, nxclass); 
    653653            if (!strncmp(groupClass,"NX",2)) { 
    654654               return NX_OK; 
     
    672672{ 
    673673   int status, dataType; 
    674    NXname name, class; 
     674   NXname name, nxclass; 
    675675 
    676676   NXinitgroupdir (fileId); 
    677677   do { 
    678       status = NXgetnextentry (fileId, name, class, &dataType); 
     678      status = NXgetnextentry (fileId, name, nxclass, &dataType); 
    679679      if (status == NX_ERROR) return NX_ERROR; 
    680680      if (status == NX_OK) { 
    681681         if (StrEq(dataName,name)) { 
    682             if (!strncmp(class,"SDS",3)) { /* Data has class "SDS" */ 
     682            if (!strncmp(nxclass,"SDS",3)) { /* Data has class "SDS" */ 
    683683               return NX_OK; 
    684684            } 
  • tags/4.2.0/applications/NXdir/Makefile.am

    r1924 r1924  
    3636                nxdir.h nxdir_help.h 
    3737nxdir_LDADD = $(LIBNEXUS) 
    38 nxdir_LDFLAGS = -static $(LDFLAGS) 
     38nxdir_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    3939EXTRA_DIST = CHANGES LICENSE README TODO 
    4040 
  • tags/4.2.0/applications/NXdir/data.cpp

    r1924 r1924  
    2626#include <iostream> 
    2727#include "nxdir.h" 
     28#include <cstring> 
    2829#include <string> 
    2930#include <map> 
  • tags/4.2.0/applications/NXdir/main.cpp

    r1924 r1924  
    2828#include <string> 
    2929#include <vector> 
    30 #include <stdlib.h> 
     30#include <cstdlib> 
    3131#include <fstream> 
    32 #include <stdio.h> 
     32#include <cstdio> 
     33#include <cstring> 
    3334 
    3435// -------------------- begin TIMING TEST stuff 
  • tags/4.2.0/applications/NXsummary/Makefile.am

    r1924 r1924  
    3737nxsummary_SOURCES = data_util.cpp main.cpp string_util.cpp preferences.cpp output.cpp 
    3838nxsummary_LDADD = $(LIBNEXUS) 
    39 nxsummary_LDFLAGS = -static $(LDFLAGS) 
     39nxsummary_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    4040EXTRA_DIST = LICENSE tclap/AUTHORS tclap/COPYING tclap/README 
    4141include $(top_srcdir)/build_rules.am 
  • tags/4.2.0/applications/NXsummary/data_util.cpp

    r1924 r1924  
    22#include <sstream> 
    33#include <stdexcept> 
     4#include <cstring> 
    45#include "data_util.hpp" 
    56#include "nxsummary.hpp" 
  • tags/4.2.0/applications/NXsummary/main.cpp

    r1924 r1924  
    2929#include <sstream> 
    3030#include <string> 
     31#include <cstring> 
    3132#include <vector> 
    3233#include "data_util.hpp" 
  • tags/4.2.0/applications/NXtranslate/FRM2/frm2_retriever.cpp

    r1924 r1924  
    1313#include "../tree.hh" 
    1414#include <math.h> 
     15#include <cstring> 
     16#include <cstdlib> 
    1517 
    1618using std::ifstream; 
  • tags/4.2.0/applications/NXtranslate/IPNS_CPP/DetectorMap.cpp

    r1924 r1924  
     1#include <cstring> 
    12#include "DetectorMap.h" 
    23#include "RandomAccessRunfile.h" 
  • tags/4.2.0/applications/NXtranslate/IPNS_CPP/Header.cpp

    r1924 r1924  
     1#include <cstring> 
    12#include "Header.h" 
    23#include "RandomAccessRunfile.h" 
  • tags/4.2.0/applications/NXtranslate/IPNS_CPP/Runfile.cpp

    r1924 r1924  
     1#include <string> 
     2#include <cstring> 
     3#include <stdexcept> 
     4#include <algorithm> 
    15#include "Runfile.h" 
    2 #include <string> 
    3 #include <stdexcept> 
    46//#include <algorithm.h> 
    57float PI = 3.14159; 
     
    963965  } 
    964966  sort(overflows.begin(), overflows.end()); 
    965  
    966967   
    967968} 
  • tags/4.2.0/applications/NXtranslate/IPNS_CPP/TimeField.cpp

    r1924 r1924  
     1#include <cstring> 
    12#include "TimeField.h" 
    23#include "RandomAccessRunfile.h" 
  • tags/4.2.0/applications/NXtranslate/IPNS_CPP/ipns_retriever.cpp

    r1924 r1924  
    11#include <stdexcept> 
    22#include <string> 
     3#include <cstring> 
     4#include <cstdlib> 
    35#include "ipns_retriever.h" 
    46#include "../node.h" 
  • tags/4.2.0/applications/NXtranslate/Makefile.am

    r1924 r1924  
    6666        esrf_edf/libEdf.la 
    6767 
    68 nxtranslate_LDFLAGS = -static $(LDFLAGS) 
     68nxtranslate_LDFLAGS = -static @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    6969 
    7070#EXTRA_DIST = CHANGES LICENSE README TODO 
  • tags/4.2.0/applications/NXtranslate/attr.cpp

    r1924 r1924  
    11#include <napi.h> 
    2 #include <stdlib.h> 
     2#include <cstdlib> 
     3#include <cstring> 
    34#include <stdexcept> 
    45#include <vector> 
  • tags/4.2.0/applications/NXtranslate/binary/BinaryRetriever.cpp

    r1924 r1924  
    33#include <stdexcept> 
    44#include <vector> 
     5#include <cstdlib> 
     6#include <cstring> 
    57#include "napiconfig.h" 
    68#include "binary/BinaryRetriever.hpp" 
     
    1416using std::endl; 
    1517 
    16 static const string INT8("INT8"); 
    17 static const string INT16("INT16"); 
    18 static const string INT32("INT32"); 
    19 static const string UINT8("UINT8"); 
    20 static const string UINT16("UINT16"); 
    21 static const string UINT32("UINT32"); 
    22 static const string FLOAT32("FLOAT32"); 
    23 static const string FLOAT64("FLOAT64"); 
    24 static const string BYTE("BYTE"); 
    25  
    26 static const int DEFAULT_TYPE=NX_UINT32; 
     18static const string myINT8("INT8"); 
     19static const string myINT16("INT16"); 
     20static const string myINT32("INT32"); 
     21static const string myUINT8("UINT8"); 
     22static const string myUINT16("UINT16"); 
     23static const string myUINT32("UINT32"); 
     24static const string myFLOAT32("FLOAT32"); 
     25static const string myFLOAT64("FLOAT64"); 
     26static const string myBYTE("BYTE"); 
     27 
     28static const int NX_DEFAULT_TYPE=NX_UINT32; 
    2729 
    2830/** 
     
    9496static int getDataType(const string &str_type){ 
    9597  if(str_type.empty()){ 
    96     return DEFAULT_TYPE; 
    97   }else if(str_type==INT8){ 
     98    return NX_DEFAULT_TYPE; 
     99  }else if(str_type==myINT8){ 
    98100    return NX_INT8; 
    99   }else if(str_type==INT16){ 
     101  }else if(str_type==myINT16){ 
    100102    return NX_INT16; 
    101   }else if(str_type==INT32){ 
     103  }else if(str_type==myINT32){ 
    102104    return NX_INT32; 
    103   }else if(str_type==UINT8){ 
     105  }else if(str_type==myUINT8){ 
    104106    return NX_UINT8; 
    105   }else if(str_type==UINT16){ 
     107  }else if(str_type==myUINT16){ 
    106108    return NX_UINT16; 
    107   }else if(str_type==UINT32){ 
     109  }else if(str_type==myUINT32){ 
    108110    return NX_UINT32; 
    109   }else if(str_type==FLOAT32){ 
     111  }else if(str_type==myFLOAT32){ 
    110112    return NX_FLOAT32; 
    111   }else if(str_type==FLOAT64){ 
     113  }else if(str_type==myFLOAT64){ 
    112114    return NX_FLOAT64; 
    113   }else if(str_type==BYTE){ 
     115  }else if(str_type==myBYTE){ 
    114116    return NX_CHAR; 
    115117  }else{ 
  • tags/4.2.0/applications/NXtranslate/esrf_edf/edf_reader.h

    r1924 r1924  
    2727#include <map> 
    2828#include <string> 
     29#include <cstring> 
     30#include <cstdlib> 
    2931 
    3032using namespace std;  
  • tags/4.2.0/applications/NXtranslate/main.cpp

    r1924 r1924  
    44#include <map> 
    55#include <string> 
     6#include <cstring> 
    67#include "xml_parser.h" 
    78#include <napi.h> 
     
    2324  NXaccess base; 
    2425  bool append; 
     26  bool timing; 
    2527  std::map<string,string> map; 
    2628}Options; 
     
    100102  cout << "  -D <macro>   Specify a macro. The macro should be in the form of\n" 
    101103       << "               \"FILE=old_nexus.nxs\". The \"=\" is required." << endl; 
     104#ifdef USE_TIMING 
     105  cout << "  --timing     Print out timing information for the execution of the program." << endl; 
     106#endif 
    102107} 
    103108 
    104109int main(int argc, char *argv[]){ 
     110#ifdef USE_TIMING 
     111  time_t start_time = time(NULL); 
     112#endif 
    105113  Options options; 
    106114  options.base=NXACC_CREATE; 
    107115  options.append=false; 
     116  options.timing=false; 
    108117 
    109118  // parse the command line options (i=0 is the program name 
     
    152161      string key=split(arg1); 
    153162      options.map.insert(make_pair(key,arg1)); 
     163    }else if(starts_with(arg1, "--timing")) { 
     164      options.timing = true; 
    154165#ifdef HDF4 
    155166    }else if(starts_with(arg1,"--hdf4")){ 
     
    212223 
    213224  // parse the file 
    214   bool result=xml_parser::parse_xml_file(options.map,options.infile,&handle); 
     225  bool result=xml_parser::parse_xml_file(options.map,options.infile,&handle, 
     226                                         options.timing); 
    215227 
    216228  // close the output file 
     
    222234      std::perror("ERROR DELETING FILE"); 
    223235  } 
    224  
     236   
     237#ifdef USE_TIMING 
     238  if (options.timing) { 
     239    cout << print_time(start_time) << " total time" << endl; 
     240  } 
     241#endif 
    225242  return result; 
    226243} 
  • tags/4.2.0/applications/NXtranslate/nexus_retriever.cpp

    r1924 r1924  
    22#include <stdexcept> 
    33#include <string> 
     4#include <cstring> 
    45#include "nexus_retriever.h" 
    56#include "nexus_util.h" 
  • tags/4.2.0/applications/NXtranslate/nexus_util.cpp

    r1924 r1924  
    33#include <stdexcept> 
    44#include <string> 
     5#include <cstring> 
     6#include <cstdlib> 
    57#include <vector> 
    68#include "nexus_util.h" 
  • tags/4.2.0/applications/NXtranslate/node.cpp

    r1924 r1924  
    11#include <napi.h> 
    2 #include <stdlib.h> 
     2#include <cstdlib> 
     3#include <cstring> 
    34#include <stdexcept> 
    45#include <vector> 
  • tags/4.2.0/applications/NXtranslate/node_util.cpp

    r1924 r1924  
    11#include <iostream> 
    22#include <string> 
     3#include <cstring> 
    34#include <stdexcept> 
    45#include <vector> 
  • tags/4.2.0/applications/NXtranslate/retriever.cpp

    r1924 r1924  
    11#include <stdexcept> 
     2#include <map> 
    23#include "retriever.h" 
    34#include "nexus_retriever.h" 
     
    3738#endif 
    3839 
     40using std::map; 
    3941using std::string; 
    4042using std::invalid_argument; 
    4143 
    42 // Implementation of a pure virtual destructor. This makes the compiler happy. 
    43 Retriever::~Retriever(){} 
     44typedef Ptr<Retriever> RetrieverPtr; 
    4445 
    45 // factory method 
    46 Retriever::RetrieverPtr Retriever::getInstance(const string & type, const string &source){ 
     46// hold a map of retrievers that have been instantiated so it can be cached 
     47map<string, RetrieverPtr> retrievers; 
     48 
     49RetrieverPtr getNewInstance(const string & type, 
     50                            const string & source) { 
    4751  // return appropriate retriever based on type 
    4852  if(type==NexusRetriever::MIME_TYPE){ 
     
    109113  throw invalid_argument("do not understand mime_type ("+type+") in retriever_factory"); 
    110114} 
     115 
     116// Implementation of a pure virtual destructor. This makes the compiler happy. 
     117Retriever::~Retriever(){} 
     118 
     119// factory method 
     120Retriever::RetrieverPtr Retriever::getInstance(const string & type, 
     121                                               const string &source){ 
     122  map<string, RetrieverPtr>::iterator existing = retrievers.find(source); 
     123  if (existing != retrievers.end()) { 
     124    return (existing->second); 
     125  } 
     126  else { 
     127    RetrieverPtr retriever = getNewInstance(type, source); 
     128    retrievers.insert(make_pair(source, retriever)); 
     129    return retriever; 
     130  } 
     131} 
  • tags/4.2.0/applications/NXtranslate/sns_histogram/string_location_format.cpp

    r1924 r1924  
    44#include <sstream> 
    55#include <iostream> 
     6#include <algorithm> 
    67 
    78using std::string; 
  • tags/4.2.0/applications/NXtranslate/spec/SPEClib.h

    r1924 r1924  
    2525#include <cstdio> 
    2626#include <cctype> 
     27#include <cstdlib> 
    2728#include <fstream> 
    2829#include <iomanip> 
  • tags/4.2.0/applications/NXtranslate/text_collist/collist_retriever.cpp

    r1924 r1924  
    33#include <stdexcept> 
    44#include <string> 
     5#include <cstring> 
    56#include <vector> 
    67#include "collist_retriever.h" 
  • tags/4.2.0/applications/NXtranslate/xml_parser.cpp

    r1924 r1924  
    33#include <iostream> 
    44#include <string> 
     5#include <cstring> 
     6#include <algorithm> 
    57#include <stdarg.h> 
    68#include <stdexcept> 
     
    1618#include "tree.hh" 
    1719#include "nxtranslate_debug.h" 
     20#ifdef USE_TIMING 
     21#include <sstream> 
     22#endif 
    1823 
    1924// ----- start of declaring debug levels 
     
    6267  int status;             // status of parsing 
    6368  bool is_link;           // whether the current node is a link 
    64   map<string,string> map; // store macros for replacement 
     69  std::map<string,string> map; // store macros for replacement 
    6570  vector<StrVector> loc_to_source; // mapping for links 
    6671  NodeVector nodes;       // vector to current node listing 
     
    7075  vector<RetrieverPtr> retrievers; // vector of retrievers (for nesting) 
    7176}UserData; 
     77 
     78#ifdef USE_TIMING 
     79static time_t start_time = time(NULL); 
     80static time_t intermediate_time = time(NULL); 
     81extern string print_time(const time_t & start, 
     82                         const  time_t & stop) { 
     83  double seconds = difftime(stop, start); 
     84  long minutes = static_cast<long>(seconds/60.); 
     85  seconds = seconds - 60. * static_cast<double>(minutes); 
     86  std::stringstream result; 
     87  result << minutes << "m" << seconds  << "s"; 
     88  return result.str(); 
     89} 
     90#endif 
    7291 
    7392// variable so the line and column numbers can be accessed 
     
    525544extern bool xml_parser::parse_xml_file(const std::map<string,string> &map, 
    526545                                       const string &filename, 
    527                                        NXhandle *handle){ 
     546                                       NXhandle *handle, 
     547                                       const bool timing){ 
    528548#ifdef DEBUG3_XML_PARSER 
    529549  std::cout << "xml_parser::parse_xml_file" << std::endl; 
     
    551571    return true; // return generic error 
    552572 
     573#ifdef USE_TIMING 
     574  if (timing) { 
     575    cout << print_time(intermediate_time) << " to add new information" << endl; 
     576    intermediate_time = time(NULL); 
     577  } 
     578#endif 
     579 
    553580  // work on links 
    554581  try{ 
     
    559586  } 
    560587   
     588#ifdef USE_TIMING 
     589  if (timing) { 
     590    cout << print_time(intermediate_time) << " to create links" << endl; 
     591    intermediate_time = time(NULL); 
     592  } 
     593#endif 
     594 
    561595  // return that everything went well 
    562596  return false; 
  • tags/4.2.0/applications/NXtranslate/xml_parser.h

    r1924 r1924  
    66#include <map> 
    77 
     8#ifdef USE_TIMING 
     9#include <time.h> 
     10#include <string> 
     11extern std::string print_time(const time_t & start, 
     12                         const  time_t & stop = time(NULL)); 
     13#endif 
     14 
     15 
    816namespace xml_parser{ 
    917  extern bool parse_xml_file(const std::map<std::string,std::string>&map, 
    10                              const std::string &filename, NXhandle *handle); 
     18                             const std::string &filename, NXhandle *handle, 
     19                             const bool timing); 
    1120} 
    1221#endif 
  • tags/4.2.0/applications/nxconvert.c

    r1924 r1924  
    3030#include <unistd.h> 
    3131#include "napi.h" 
    32  
    33 static int WriteGroup (int write_data); 
    34 static int WriteAttributes (int write_data); 
    35  
    36 static NXhandle inId, outId; 
    37  
    38 #define NX_XML  0 
    39 #define NX_HDF4 1 
    40 #define NX_HDF5 2 
    41 #define NX_DTD  3 
     32#include "nxconvert_common.h" 
    4233 
    4334static void print_usage() 
    4435{ 
    45     printf("Usage: nxconvert [ -x | -h4 | -h5 | -o keepws ] [ infile ] [ outfile ]\n"); 
     36    printf("Usage: nxconvert [ -x | -h4 | -h5 | -d | -o keepws | -o table ] [ infile ] [ outfile ]\n"); 
    4637} 
    4738 
    4839#define NXCONVERT_EXIT_ERROR    exit(1) 
    4940 
    50 static const char* nx_formats[] = { "XML", "HDF4", "HDF5", "DTD", NULL }; 
     41static const char* definition_name = "BASE"; 
    5142 
    5243int main(int argc, char *argv[]) 
     
    5445   char inFile[256], outFile[256], *stringPtr; 
    5546   int opt, nx_format = -1, nx_write_access = 0; 
    56    int nx_write_data = 1; 
    5747   int nx_read_access = NXACC_READ; 
    5848 
     
    7363            break; 
    7464 
    75 /* 
    7665          case 'd': 
    77             nx_format = NX_DTD; 
     66            nx_format = NX_DEFINITION; 
    7867            nx_write_access |= NXACC_CREATEXML; 
    79             nx_write_data = 0;  
     68            if (optarg != NULL && *optarg != '\0') 
     69            { 
     70                definition_name = optarg; 
     71            } 
    8072            break; 
    81 */ 
    8273 
    8374          case 'h': 
     
    10596                nx_write_access |= NXACC_NOSTRIP; 
    10697                nx_read_access |= NXACC_NOSTRIP; 
     98            } 
     99            else if (!strcmp(optarg, "table")) 
     100            { 
     101                nx_write_access |= NXACC_TABLE; 
    107102            } 
    108103            else 
     
    149144   printf("Converting %s to %s NeXus file %s\n", inFile, nx_formats[nx_format], outFile); 
    150145 
    151 /* Open NeXus input file and NeXus output file */ 
    152    if (NXopen (inFile, nx_read_access, &inId) != NX_OK) { 
    153       printf ("NX_ERROR: Can't open %s\n", inFile); 
     146   if (convert_file(nx_format, inFile, nx_read_access, outFile, nx_write_access) != NX_OK) { 
    154147      NXCONVERT_EXIT_ERROR; 
    155    } 
    156  
    157    if (NXopen (outFile, nx_write_access, &outId) != NX_OK) { 
    158       printf ("NX_ERROR: Can't open %s\n", outFile); 
    159       NXCONVERT_EXIT_ERROR; 
    160    } 
    161     
    162 /* Output global attributes */ 
    163    if (WriteAttributes (nx_write_data) != NX_OK) 
    164    { 
    165         NXCONVERT_EXIT_ERROR; 
    166    } 
    167 /* Recursively cycle through the groups printing the contents */ 
    168    if (WriteGroup (nx_write_data) != NX_OK) 
    169    { 
    170         NXCONVERT_EXIT_ERROR; 
    171    } 
    172 /* Close the input and output files */ 
    173    if (NXclose (&outId) != NX_OK) 
    174    { 
    175         NXCONVERT_EXIT_ERROR; 
    176    } 
    177    if (NXclose (&inId) != NX_OK) 
    178    { 
    179         NXCONVERT_EXIT_ERROR; 
    180148   } 
    181149   printf("Convertion successful.\n"); 
     
    183151} 
    184152 
    185 /* Prints the contents of each group as XML tags and values */ 
    186 int WriteGroup (int write_data) 
    187 {  
    188    int status, dataType, dataRank, dataDimensions[NX_MAXRANK], dataLen;      
    189    NXname name, class; 
    190    void *dataBuffer; 
    191  
    192    do { 
    193       status = NXgetnextentry (inId, name, class, &dataType); 
    194       if (status == NX_ERROR) return NX_ERROR; 
    195       if (status == NX_OK) { 
    196          if (!strncmp(class,"NX",2)) { 
    197             if (NXopengroup (inId, name, class) != NX_OK) return NX_ERROR; 
    198             if (NXmakegroup (outId, name, class) != NX_OK) return NX_ERROR; 
    199             if (NXopengroup (outId, name, class) != NX_OK) return NX_ERROR; 
    200             if (WriteGroup (write_data) != NX_OK) return NX_ERROR; 
    201          } 
    202          else if (!strncmp(class,"SDS",3)) { 
    203             if (NXopendata (inId, name) != NX_OK) return NX_ERROR; 
    204             if (NXgetinfo (inId, &dataRank, dataDimensions, &dataType) != NX_OK) return NX_ERROR; 
    205             if (NXmakedata (outId, name, dataType, dataRank, dataDimensions) != NX_OK) return NX_ERROR; 
    206             if (NXopendata (outId, name) != NX_OK) return NX_ERROR; 
    207             if (WriteAttributes (write_data) != NX_OK) return NX_ERROR; 
    208             if (write_data == 1) 
    209             { 
    210                 if (NXmalloc (&dataBuffer, dataRank, dataDimensions, dataType) != NX_OK) return NX_ERROR; 
    211                 if (NXgetdata (inId, dataBuffer)  != NX_OK) return NX_ERROR; 
    212                 if (NXputdata (outId, dataBuffer) != NX_OK) return NX_ERROR; 
    213                 if (NXfree((void**)&dataBuffer) != NX_OK) return NX_ERROR; 
    214             } 
    215             if (NXclosedata (inId) != NX_OK) return NX_ERROR; 
    216             if (NXclosedata (outId) != NX_OK) return NX_ERROR; 
    217          } 
    218       } 
    219       else if (status == NX_EOD) { 
    220          if (NXclosegroup (inId) != NX_OK) return NX_ERROR; 
    221          if (NXclosegroup (outId) != NX_OK) return NX_ERROR; 
    222          return NX_OK; 
    223       } 
    224    } while (status == NX_OK); 
    225    return NX_OK; 
    226 } 
    227  
    228 int WriteAttributes (int write_data) 
    229 { 
    230    int status, i, attrLen, attrType; 
    231    NXname attrName; 
    232    void *attrBuffer; 
    233  
    234    i = 0; 
    235    do { 
    236       status = NXgetnextattr (inId, attrName, &attrLen, &attrType); 
    237       if (status == NX_ERROR) return NX_ERROR; 
    238       if (status == NX_OK) { 
    239          if (strcmp(attrName, "NeXus_version") && strcmp(attrName, "XML_version") && 
    240              strcmp(attrName, "HDF_version") && strcmp(attrName, "HDF5_Version") &&  
    241              strcmp(attrName, "file_name") && strcmp(attrName, "file_time")) { 
    242             attrLen++; /* Add space for string termination */ 
    243             if (NXmalloc((void**)&attrBuffer, 1, &attrLen, attrType) != NX_OK) return NX_ERROR; 
    244             if (NXgetattr (inId, attrName, attrBuffer, &attrLen , &attrType) != NX_OK) return NX_ERROR; 
    245             if (write_data == 1) 
    246             { 
    247                 if (NXputattr (outId, attrName, attrBuffer, attrLen , attrType) != NX_OK) return NX_ERROR; 
    248             } 
    249             else 
    250             { 
    251                 if (NXputattr (outId, attrName, attrBuffer, attrLen , attrType) != NX_OK) return NX_ERROR; 
    252             } 
    253             if (NXfree((void**)&attrBuffer) != NX_OK) return NX_ERROR; 
    254          } 
    255          i++; 
    256       } 
    257    } while (status != NX_EOD); 
    258    return NX_OK; 
    259 } 
    260  
  • tags/4.2.0/autogen.sh

    r1924 r1924  
    2727echo "Using $libtoolversion" 
    2828case $autoconfversion in 
    29     *2.5[2-79]) 
    30         ;; 
    3129    *2.6*) 
    3230        ;; 
     
    3533    *) 
    3634        echo "This autoconf version is not supported by NeXus." 
    37         echo "NeXus only supports autoconf 2.5[2-79]." 
     35        echo "NeXus only supports autoconf 2.61 and above" 
    3836        echo "You may download it from ftp://ftp.gnu.org/gnu/autoconf" 
    3937        exit 
     
    4442    *1.[4-9]*) 
    4543        ;; 
     44    *1.1[0-9]*) 
     45        ;; 
    4646    *) 
    4747        echo "This automake version is not supported by NeXus." 
    48         echo "NeXus only supports automake 1.[5-8].*." 
     48        echo "NeXus only supports automake 1.4 and above" 
    4949        echo "You may download it from ftp://ftp.gnu.org/gnu/automake" 
    5050        exit 
     
    5353 
    5454case $libtoolversion in 
    55     *1.[45]*) 
     55    *1.[456]*) 
     56        ;; 
     57    *[2-9].*) 
    5658        ;; 
    5759    *) 
    5860        echo "This libtool version is not supported by NeXus." 
    59         echo "NeXus only supports libtool 1.[45].*." 
     61        echo "NeXus only supports libtool 1.4 and above" 
    6062        echo "You may download it from ftp://ftp.gnu.org/gnu/libtool" 
    6163        exit 
  • tags/4.2.0/autoversion.sh

    r1924 r1924  
    11#!/bin/sh 
    22 
    3 for automake in automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake-1.5 automake-1.4 automake ; do 
     3for automake in automake-1.10 automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake-1.5 automake-1.4 automake ; do 
    44        AUTOMAKE=`which $automake 2>/dev/null |  grep -v '^no'` 
    55        if test "$AUTOMAKE" ; then 
     
    1616esac 
    1717         
    18 for autoconf in autoconf-2.59 autoconf-2.57 autoconf-2.53 autoconf-2.52 autoconf ; do  
     18for autoconf in autoconf-2.61 autoconf ; do  
    1919        AUTOCONF=`which $autoconf 2>/dev/null | grep -v '^no'` 
    2020        if test "$AUTOCONF" ; then 
  • tags/4.2.0/bindings/Makefile.am

    r1924 r1924  
    2727# 
    2828#==================================================================== 
     29if HAVE_CPP 
     30CPPSUB = cpp 
     31endif 
    2932if HAVE_F77 
    3033F77SUB = f77 
     
    3942SWIGSUB = swig 
    4043endif 
    41 SUBDIRS = $(F77SUB) $(F90SUB) $(JAVASUB) $(SWIGSUB) 
     44if HAVE_IDL 
     45IDLSUB = idl 
     46endif 
     47if HAVE_PYTHON 
     48PYSUB = python 
     49endif 
     50SUBDIRS = $(CPPSUB) $(F77SUB) $(F90SUB) $(JAVASUB) $(SWIGSUB) $(IDLSUB) $(PYSUB) 
  • tags/4.2.0/bindings/java/org/nexusformat/NexusFile.java

    r1924 r1924  
    3737    public final static int NXACC_CREATE5 = 5; 
    3838    public final static int NXACC_CREATEXML = 6; 
     39    public final static int NXACC_NOSTRIP = 128; 
    3940     
    4041    /** 
     
    125126      * <DD>For opening a file for reading. 
    126127      * </dl> 
     128      * <DT>NXACC_NOSTRIP 
     129      * <DD>To keep leading and trailing whitespace on strings 
     130      * </dl> 
    127131      * @exception NexusException when the file could not be found or 
    128132      * an HDF error occurred. 
     
    448452    protected native void nxputdata(int handle, byte array[]);  
    449453    protected native void nxputslab(int handle, byte array[],  
    450                                     int start[],int end[]);  
     454                                    int start[],int size[]);  
    451455    protected native void nxputattr(int handle, String name, 
    452456                                    byte array[], int type);  
     
    480484      * @param start An integer array of dimension rank which holds the 
    481485      * startcoordinates of the data subset in the larger dataset. 
    482       * @param end An integer array of dimension rank which holds the 
     486      * @param size An integer array of dimension rank which holds the 
    483487      * size in each dimension of the data subset to write. 
    484488      * @exception NexusException when an HDF error occurs. 
    485489      */  
    486     public void putslab(Object array, int start[], int end[]) throws 
     490    public void putslab(Object array, int start[], int size[]) throws 
    487491                          NexusException 
    488492    { 
     
    497501           throw new NexusException(he.getMessage()); 
    498502       } 
    499        nxputslab(handle,data,start,end); 
     503       nxputslab(handle,data,start,size); 
    500504       data = null; 
    501505    } 
  • tags/4.2.0/bindings/swig/Makefile.am

    r1924 r1924  
    2828# 
    2929#==================================================================== 
    30 AM_CPPFLAGS=-I$(top_srcdir)/include 
     30AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src 
    3131lib_LTLIBRARIES=$(LIBNXTCL) $(LIBNXSCHEME) $(LIBNXGUILE) # $(LIBNXPERL) 
    32 python_LTLIBRARIES=$(LIBNXPYTHON) 
    3332bin_PROGRAMS=$(NXINTER) $(NXGUILE) 
    3433 
    35 # python wrapper 
    36 if HAVE_SWIG 
    37 if HAVE_PYTHON 
    38 NXPYTHONWRAP=nxpython.py 
    39 nodist_python_PYTHON=$(NXPYTHONWRAP) 
    40 LIBNXPYTHON=libnxpython.la 
    41 libnxpython_la_SOURCES=$(COMMON_SRC) 
    42 nodist_libnxpython_la_SOURCES=$(PYTHONWRAP) 
    43 libnxpython_la_CFLAGS=-I$(PYTHONROOT)/include/python$(PYTHON_VERSION) -I$(PYTHONROOT)/include $(CFLAGS) 
    44 libnxpython_la_LDFLAGS=-L$(PYTHONROOT)/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) $(top_builddir)/src/libNeXus.la @SHARED_LDFLAGS@ $(LDFLAGS) 
    45 PYTHONWRAP=nxpython_wrap.c 
    46 endif 
    47 nxpython_wrap.c: nxinter.i nxdataset.i 
    48         $(SWIG) -I$(srcdir) -o $@ -python -module nxpython -interface libnxpython nxinter.i  
    49 endif 
     34# old python wrapper 
     35#python_LTLIBRARIES=$(LIBNXPYTHON) 
     36#if HAVE_SWIG 
     37#if HAVE_PYTHON 
     38#NXPYTHONWRAP=nxpython.py 
     39#nodist_python_PYTHON=$(NXPYTHONWRAP) 
     40#LIBNXPYTHON=libnxpython.la 
     41#libnxpython_la_SOURCES=$(COMMON_SRC) 
     42#nodist_libnxpython_la_SOURCES=$(PYTHONWRAP) 
     43#libnxpython_la_CFLAGS=-I$(PYTHONROOT)/include/python$(PYTHON_VERSION) -I$(PYTHONROOT)/include $(CFLAGS) 
     44#libnxpython_la_LDFLAGS=-L$(PYTHONROOT)/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) $(top_builddir)/src/libNeXus.la @SHARED_LDFLAGS@ $(LDFLAGS) 
     45#PYTHONWRAP=nxpython_wrap.c 
     46#endif 
     47#nxpython_wrap.c: nxinter.i nxdataset.i 
     48#       $(SWIG) -I$(srcdir) -o $@ -python -module nxpython -interface libnxpython nxinter.i  
     49#endif 
    5050 
    5151# perl wrapper (not working yet) 
     
    120120 
    121121DOC_SRC         = nxinter.tex 
    122 swigdocdir      = $(NXDOCDIR) 
    123 swigdoc_DATA    = $(DOC_OUTPUT) 
    124122if HAVE_LATEX 
    125123DOC_OUTPUT=nxinter.ps nxinter.pdf 
     
    128126        latex nxinter.tex 
    129127        dvips -f nxinter.dvi > nxinter.ps 
     128 
     129nxinter.pdf : nxinter.ps 
    130130        ps2pdf12 nxinter.ps nxinter.pdf 
    131131endif 
     132swigdocdir      = $(NXDOCDIR)/swig 
     133swigdoc_DATA    = $(DOC_OUTPUT) 
     134 
     135EXAMPLE_FILES = nxdstest.tcl nxexam.tcl nxintertest.tcl 
     136swigexampledir  = $(NXEXAMPLEDIR)/swig 
     137swigexample_DATA = $(EXAMPLE_FILES) 
    132138 
    133139include $(top_srcdir)/build_rules.am 
    134140 
    135 # if we have XML support, we already have nxdataset unless 
    136 # we are on windows when it is hidden 
    137 if HAVE_XML 
    138 if MINGW_MSYS 
    139 NXDATASET=nxdataset.c 
    140 endif 
    141 else 
    142 NXDATASET=nxdataset.c 
    143 endif 
     141COMMON_SRC=nxinterhelper.c 
    144142 
    145 COMMON_SRC=nxinterhelper.c $(NXDATASET) 
    146  
    147 EXTRA_DIST=nxinter.i nxdataset.i nxdataset.h nxinterhelper.h \ 
    148                 $(DOC_OUTPUT) $(DOC_SRC) nxpython_test.py 
     143EXTRA_DIST=nxinter.i nxdataset.i nxinterhelper.h \ 
     144                $(DOC_OUTPUT) $(DOC_SRC) $(EXAMPLE_FILES) 
    149145 
    150146BUILT_SOURCES=$(TCLWRAP) $(GUILEWRAP) $(PYTHONWRAP) $(SCHEMEWRAP) $(NXPYTHONWRAP) 
  • tags/4.2.0/configure.ac

    r1924 r1924  
    2929dnl 
    3030 
    31 AC_PREREQ(2.52) 
     31AC_PREREQ(2.61) 
    3232AC_REVISION($Revision$) 
    33 AC_INIT([NeXus Library], [4.1.0], [nexus-developers@nexusformat.org], [nexus]) 
    34 AC_COPYRIGHT([Copyright (C) 2004 Freddie Akeroyd  
     33AC_INIT([NeXus Library], [4.2.0], [nexus-developers@nexusformat.org], [nexus]) 
     34AC_COPYRIGHT([Copyright (C) 2004 NeXus International Advisory Committee 
    3535This software is covered by the GNU LESSER GENERAL PUBLIC LICENSE 
    3636see file COPYING for further information]) 
     
    3939AC_CONFIG_SRCDIR([src/napi.c]) 
    4040AC_CANONICAL_TARGET 
     41AC_CANONICAL_BUILD 
    4142 
    4243dnl $EGREP is used in macros included from acinclude.m4 
     
    5859 
    5960AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug],[Turn off optimisation]), [enable_debug=$enableval],[enable_debug=no]) 
     61 
     62AC_ARG_ENABLE([32bit], AC_HELP_STRING([--enable-32bit],[build 32bit binary on 64 bit computer]), [enable_32bit=$enableval],[enable_32bit=no]) 
    6063 
    6164dnl Checks for programs. 
     
    7780else 
    7881        CXX= 
     82fi 
     83 
     84AC_ARG_WITH([f77], AC_HELP_STRING([--with-f77=f77 compiler], [Specify name of FORTRAN 77 compiler]), 
     85        [with_f77=$withval], [with_f77=no]) 
     86if test x"$with_f77" != x"no" ; then 
     87        if test x"$with_f77" != x"yes" ; then F77="$with_f77"; fi 
     88        AC_PROG_F77 
     89        dnl Check FORTRAN compiler options 
     90        dnl     AC_CHECK_F77_OPTION([-Wno-globals]) 
     91        dnl     AC_CHECK_F77_OPTION([-fno-common])  # use with caution 
     92        mytop=`pwd` 
     93        dnl get right F77 include option 
     94        AC_CHECK_F77_OPTION([-I$mytop/bindings/f77],[      INCLUDE 'napif.inc']) 
     95        AC_F77_LIBRARY_LDFLAGS 
     96else 
     97        F77= 
    7998fi 
    8099 
     
    103122fi 
    104123 
    105 AC_ARG_WITH([f77], AC_HELP_STRING([--with-f77=f77 compiler], [Specify name of FORTRAN 77 compiler]), 
    106         [with_f77=$withval], [with_f77=no]) 
    107 if test x"$with_f77" != x"no" ; then 
    108         if test x"$with_f77" != x"yes" ; then F77="$with_f77"; fi 
    109         AC_PROG_F77 
    110         dnl Check FORTRAN compiler options 
    111         dnl     AC_CHECK_F77_OPTION([-Wno-globals]) 
    112         dnl     AC_CHECK_F77_OPTION([-fno-common])  # use with caution 
    113         mytop=`pwd` 
    114         dnl get right F77 include option 
    115         AC_CHECK_F77_OPTION([-I$mytop/bindings/f77],[      INCLUDE 'napif.inc']) 
    116         AC_F77_LIBRARY_LDFLAGS 
    117 else 
    118         F77= 
    119 fi 
    120  
    121124java_host="linux" 
    122 javaroot="" 
    123 with_java=no 
     125JAVAROOT="" 
    124126AC_ARG_WITH([java-home], AC_HELP_STRING([--with-java-home=JAVA SDK Home], [Specify location of top directory of JAVA SDK i.e. where the bin, lib and include directories live]), 
    125127        [], [with_java_home=$withval]) 
    126128if test -d "$with_java_home"; then 
    127         javaroot="$with_java_home" 
    128         AC_MSG_NOTICE([Java SDK home is $javaroot]) 
    129         JAVAINCLUDE="-I$javaroot/include" 
    130         AC_PATH_PROGS(JAVAC,gcj javac,,[$javaroot/bin]) 
     129        JAVAROOT="$with_java_home" 
     130        AC_MSG_NOTICE([Java SDK home is $JAVAROOT]) 
     131        JAVAINCLUDE="-I$JAVAROOT/include" 
     132        AC_PATH_PROGS(JAVAC,gcj javac,,[$JAVAROOT/bin]) 
    131133        if test `basename "$JAVAC"` = "gcj"; then 
    132134            JAVACFLAGS="-C"     # force creation of .class files 
    133135        fi 
    134         AC_PATH_PROGS(JAVA,gij java,,[$javaroot/bin]) 
    135         AC_PATH_PROGS(JAVAH,gcjh javah,,[$javaroot/bin]) 
    136         AC_PATH_PROGS(JAVADOC,javadoc,,[$javaroot/bin:$PATH]) 
    137         AC_PATH_PROGS(JAR,jar fastjar,,[$javaroot/bin:$PATH]) 
     136        AC_PATH_PROGS(JAVA,gij java,,[$JAVAROOT/bin]) 
     137        AC_PATH_PROGS(JAVAH,gcjh javah,,[$JAVAROOT/bin]) 
     138        AC_PATH_PROGS(JAVADOC,javadoc,,[$JAVAROOT/bin:$PATH]) 
     139        AC_PATH_PROGS(JAR,jar fastjar,,[$JAVAROOT/bin:$PATH]) 
    138140fi 
    139141 
     
    165167#       JAVAINCLUDE= 
    166168#fi 
     169 
     170AC_ARG_WITH([contrib], AC_HELP_STRING([--with-contrib=names_of_apps_to_build], [Specify a list of targets from the contrib directory to build]), 
     171        [CONTRIB=$withval], [CONTRIB=no]) 
     172AM_CONDITIONAL(BUILD_CONTRIB, [test "$CONTRIB" != "no"]) 
     173AC_SUBST(CBFLIBROOT) 
     174AC_ARG_WITH([cbflib], 
     175        AC_HELP_STRING([--with-cbflib=/path/to/cbflib], 
     176                       [Specify location of CBFLib files]), 
     177        [if test $withval != no; then CBFLIBROOT=$withval; fi]) 
     178AM_CONDITIONAL(HAVE_CBFLIB, [test "$CBFLIBROOT" != ""]) 
     179 
     180AC_SUBST(IDLROOT) 
     181AC_ARG_WITH([idlroot], 
     182        AC_HELP_STRING([--with-idlroot=/path/to/idlroot], 
     183                       [Specify root directory of system idl installation]), 
     184        [if test $withval != no; then IDLROOT=$withval; fi]) 
     185AM_CONDITIONAL(HAVE_IDL, [test "$IDLROOT" != ""]) 
     186 
     187IDLDLM="\${prefix}/lib" 
     188AC_SUBST(IDLDLM) 
     189AC_ARG_WITH([idldlm], 
     190        AC_HELP_STRING([--with-idldlm=/path/to/idldlm], 
     191                       [Specify location ito install idl dlm files to]), 
     192        [if test $withval != no; then IDLDLM=$withval; fi]) 
     193 
     194AC_ARG_WITH([doxygen], AC_HELP_STRING([--with-doxygen=/path/to/doxygen], [Specify path to doxygen]), [with_doxygen=$withval], [with_doxygen=no]) 
     195if test x"$with_doxygen" != x"no" ; then 
     196        if test x"$with_doxygen" != x"yes" ; then DOXYGEN="$with_doxygen"; fi 
     197        AC_CHECK_PROGS(DOXYGEN,[doxygen]) 
     198        AC_CHECK_PROGS(DOT,[dot]) 
     199        AC_CHECK_PROGS(PDFLATEX,[pdflatex]) 
     200        AC_PROG_CXX 
     201else 
     202        DOXYGEN= 
     203        PDFLATEX= 
     204        DOT= 
     205fi 
     206 
    167207AC_SUBST(FCFLAGS) 
    168208AC_SUBST(JAVACFLAGS) 
     
    180220 
    181221AM_PROG_GCJ 
     222AM_PROG_CC_C_O 
    182223 
    183224AC_PROG_LIBTOOL 
     
    198239if test x$with_python != xno; then 
    199240    AC_CHECK_ROOT([python],[PYTHONROOT],[/usr /usr/local],[bin/python]) 
    200     if test x$PYTHONROOT != x; then PYTHON=$PYTHONROOT/bin/python; fi 
     241    if test x$PYTHONROOT != x; then 
     242        if test -r "$PYTHONROOT/bin/python"; then PYTHON="$PYTHONROOT/bin/python"; fi 
     243        if test -r "$PYTHONROOT/python"; then PYTHON="$PYTHONROOT/python"; fi 
     244    fi 
    201245    AM_PATH_PYTHON(,, :) 
    202246fi 
    203247 
    204248AC_ARG_WITH([swig], AC_HELP_STRING([--with-swig=swig compiler], [Specify path of swig compiler]), [with_swig=$withval], [with_swig=]) 
    205 if test x$with_python != xno -o x$with_tcl != xno -o x$with_guile != xno; then 
     249if test x$with_tcl != xno -o x$with_guile != xno; then 
    206250    if test x$with_swig != xyes; then 
    207251        SWIG=$with_swig 
     
    217261AC_CHECK_PROGS(GUILE,[guile]) 
    218262AC_CHECK_PROGS(LATEX,[latex]) 
    219 AC_CHECK_PROGS(PDFLATEX,[pdflatex]) 
    220 AC_CHECK_PROGS(DOXYGEN,[doxygen]) 
    221 AC_CHECK_PROGS(DOT,[dot]) 
     263AC_CHECK_PROGS(WGET,[wget]) 
     264AC_CHECK_PROGS(XMLLINT,[xmllint]) 
    222265 
    223266 
     
    253296AM_CONDITIONAL(HAVE_MS_LIB, [test ! -z "$MS_LIB"]) 
    254297 
     298# strict aliasing causes issues with casts from NXmalloc() 
     299CFLAGS="-fno-strict-aliasing" 
     300CXXFLAGS="-fno-strict-aliasing" 
     301 
    255302# check for debug 
    256303if test "$enable_debug" = "yes"; then 
    257     CFLAGS="-O0 -g" 
    258     CXXFLAGS="-O0 -g" 
     304    CFLAGS="$CFLAGS -O0 -g" 
     305    CXXFLAGS="$CXXFLAGS -O0 -g" 
     306fi 
     307 
     308if test "$enable_32bit" = "yes"; then 
     309    CFLAGS="$CFLAGS -m32" 
     310    CXXFLAGS="$CXXFLAGS -m32" 
    259311fi 
    260312 
     
    296348 
    297349HDF_EXT=a # library file extent to look for with HDF libraries 
     350HDF5_EXT=so # library file extent to look for with HDF5 libraries 
    298351 
    299352AC_SUBST(LIBXML2_CFLAGS) 
    300353LIBXML2_CFLAGS='`xml2-config --cflags`' 
     354 
     355# set up for linux here - mac is covered in the case $host statement 
     356AS_CASE([$build_cpu], [x86|i386|i686], [IDLCPU=x86], [IDLCPU=$build_cpu]) 
     357if test $enable_32bit = yes; then 
     358    IDL_HOST="bin.linux.x86"    # force 32 bit on a 64 bit machine 
     359else 
     360    IDL_HOST="bin.linux.$IDLCPU" 
     361fi 
     362AC_SUBST(IDL_HOST) 
    301363 
    302364case $host in 
     
    316378        MINGW_MSYS=yes 
    317379        HDF_EXT=dll 
     380        HDF5_EXT=dll 
    318381        LIBXML2_CFLAGS=-I/usr/local/include 
    319382        java_host="win32" 
     
    330393        CFLAGS="$CFLAGS -g" 
    331394        FFLAGS="$FFLAGS -g" 
     395        HDF5_EXT=dylib 
    332396dnl This is a hack for libtool - for some reason the F77 tag 
    333397dnl does not get set with the commands to create a shared library 
     
    349413dnl           archive_cmds='$CC -dynamiclib -single_module' 
    350414dnl     fi 
     415        if test $enable_32bit = yes; then 
     416            IDL_HOST="bin.darwin.i386" # force 32bit build 
     417        else 
     418            IDL_HOST="bin.darwin.x86_64" 
     419        fi 
    351420        ;; 
    352421esac 
     
    354423if test ! -z "$JAVAINCLUDE" -a ! -z "$java_host"; then 
    355424# avoid adding /usr/include/linux to include path 
    356     if test "$javaroot" != "/usr" -a "$javaroot" != "/usr/"; then 
    357         JAVAINCLUDE="$JAVAINCLUDE -I$javaroot/include/$java_host" 
     425    if test "$JAVAROOT" != "/usr" -a "$JAVAROOT" != "/usr/"; then 
     426        JAVAINCLUDE="$JAVAINCLUDE -I$JAVAROOT/include/$java_host" 
    358427    fi 
    359428fi 
     
    375444        AC_HELP_STRING([--with-hdf4=/path/to/hdf4], 
    376445                       [Specify location of HDF4 files]), 
    377         [if test $withval != no; then H4ROOT=$withval; fi]) 
     446        [if test $withval != no -a $withval != yes; then H4ROOT=$withval; fi]) 
    378447AC_ARG_WITH([hdf5], 
    379448        AC_HELP_STRING([--with-hdf5=/path/to/hdf5], 
    380449                       [Specify location of HDF5 files]), 
    381         [if test $withval != no; then H5ROOT=$withval; fi]) 
     450        [if test $withval != no -a $withval != yes; then H5ROOT=$withval; fi]) 
    382451AC_ARG_WITH([xml], 
    383452        AC_HELP_STRING([--with-xml=/path/to/mxml], 
    384453                       [Specify location of MXML library files]), 
    385         [if test $withval != no; then MXMLROOT=$withval; fi]) 
     454        [if test $withval != no -a $withval != yes; then MXMLROOT=$withval; fi]) 
    386455dnl otherwise try and find HDF path, but not if 
    387456dnl e.g. --without-hdf4 has been specified (hence check on $with_hdf4 != no ) 
    388457dnl first HDF4 
    389 HDF4SEARCH="/usr/local/hdf4 /usr/local/hdf /usr/local /sw /usr" 
     458EXTRA_LDPATH="" 
     459EXTRA_LD_LIBRARY_PATH="" 
     460AC_SUBST(EXTRA_LD_LIBRARY_PATH) 
     461HDF4SEARCH="/usr/local/hdf4 /usr/local/hdf /usr/local /sw /opt/local /usr" 
    390462if test "$with_hdf4" != "no" -a -z "$H4ROOT"; then 
    391463    AC_MSG_CHECKING(for location of HDF4 libraries) 
     
    411483fi 
    412484if test "$H4ROOT"; then 
    413     H4VERSION=`grep LIBVER_STRING ${H4ROOT}/include/${H4INCSUBROOT}/hfile.h | cut -d '"' -f 2 | cut -d ' ' -f4,6 | tr ' ,' '. '` 
     485    H4MAJORVERSION=`grep LIBVER_MAJOR ${H4ROOT}/include/${H4INCSUBROOT}/hfile.h | awk '{ print $3}'` 
     486    H4MINORVERSION=`grep LIBVER_MINOR ${H4ROOT}/include/${H4INCSUBROOT}/hfile.h | awk '{ print $3}'` 
     487    H4RELEASE=`grep LIBVER_RELEASE ${H4ROOT}/include/${H4INCSUBROOT}/hfile.h | awk '{ print $3}'` 
     488    H4VERSION=$H4MAJORVERSION.$H4MINORVERSION.$H4RELEASE 
    414489    case $H4VERSION in 
    415490        4.[[12]]*)  
    416                 HDF4_LDFLAGS="-lmfhdf -ldf"; 
     491                HDF4_LDFLAGS=""; 
    417492                for j in lib lib64; do 
    418                     if test -d $H4ROOT/$j/$H4LIBSUBROOT; then HDF4_LDFLAGS="-L$H4ROOT/$j/$H4LIBSUBROOT $HDF4_LDFLAGS"; fi 
     493                    if test -d $H4ROOT/$j/$H4LIBSUBROOT; then  
     494                        HDF4_LDFLAGS="-L$H4ROOT/$j/$H4LIBSUBROOT $HDF4_LDFLAGS" 
     495                        EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$H4ROOT/$j/$H4LIBSUBROOT 
     496                    fi 
    419497                done 
     498                EXTRA_LDPATH="$EXTRA_LDPATH $HDF4_LDFLAGS" 
     499                HDF4_LDFLAGS="$HDF4_LDFLAGS -lmfhdf -ldf"; 
    420500                if test -z "$H4INCSUBROOT"; then 
    421501                    HDF4_CPPFLAGS="-I$H4ROOT/include -DHDF4" 
     
    433513 
    434514dnl HDF5 
    435 HDF5SEARCH="/usr/local/hdf5 /usr/local/hdf /usr/local /sw /usr" 
     515HDF5SEARCH="/usr/local/hdf5 /usr/local/hdf /usr/local /sw /opt/local /usr" 
    436516if test "$with_hdf5" != "no" -a -z "$H5ROOT"; then 
    437517    AC_MSG_CHECKING(for location of HDF5 libraries) 
    438518    for i in $HDF5SEARCH; do 
    439519        for j in lib lib64; do 
    440             if test -z "$H5ROOT" -a -r ${i}/$j/libhdf5.$HDF_EXT; then H5ROOT=$i; fi 
     520            if test -z "$H5ROOT" -a -r ${i}/$j/libhdf5.$HDF5_EXT; then H5ROOT=$i; fi 
    441521        done 
    442522    done 
     
    450530    H5VERSION=`grep H5_VERS_INFO ${H5ROOT}/include/H5public.h | cut -d '"' -f 2 | cut -d ' ' -f 4` 
    451531    case $H5VERSION in 
    452         1.[[6]]*) 
    453                 HDF5_LDFLAGS="-lhdf5 -lz" 
     532        1.[[68]]*) 
     533                HDF5_LDFLAGS="" 
    454534                for j in lib lib64; do 
    455                     if test -d $H5ROOT/$j; then HDF5_LDFLAGS="-L$H5ROOT/$j $HDF5_LDFLAGS"; fi 
     535                    if test -d $H5ROOT/$j; then  
     536                        HDF5_LDFLAGS="-L$H5ROOT/$j $HDF5_LDFLAGS" 
     537                        EXTRA_LD_LIBRARY_PATH=$EXTRA_LD_LIBRARY_PATH:$H5ROOT/$j 
     538                    fi 
    456539                done 
    457                 HDF5_CPPFLAGS="-I$H5ROOT/include -DHDF5";; 
     540                EXTRA_LDPATH="$EXTRA_LDPATH $HDF5_LDFLAGS" 
     541                HDF5_LDFLAGS="$HDF5_LDFLAGS -lhdf5 -lz" 
     542                HDF5_CPPFLAGS="-I$H5ROOT/include -DHDF5 -DH5_USE_16_API";; 
    458543        *)      AC_MSG_WARN([The HDF 5 installation has not the right version ($H5VERSION). You need at least 1.6])  
    459544                H5ROOT="";; 
     
    480565    XML_LDFLAGS="-L$MXMLROOT/lib $XML_LDFLAGS" 
    481566    XML_CPPFLAGS="-I$MXMLROOT/include -DNXXML" 
     567# meed to allow for lib64 
     568#    EXTRA_LDPATH="$EXTRA_LDPATH $XML_LDFLAGS" 
     569#    export LD_LIBRARY_PATH=$MXMLROOT/lib:$LD_LIBRARY_PATH 
    482570fi 
    483571AC_SUBST(XML_LDFLAGS) 
    484572AC_SUBST(XML_CPPFLAGS) 
     573 
     574if test ! -z "$EXTRA_LDPATH"; then 
     575    LDFLAGS="$LDFLAGS $EXTRA_LDPATH" 
     576fi 
    485577if test -d /usr/local/lib; then 
    486578    LDFLAGS="$LDFLAGS -L/usr/local/lib" 
    487579fi 
     580# for Mac/fink when hdf and hdf5 are not taken from fink, but jpeg is 
     581if test -d /sw/lib; then 
     582    LDFLAGS="$LDFLAGS -L/sw/lib" 
     583fi 
     584# for Mac/Macports when you are not using fink at all. 
     585if test -d /opt/local/lib; then 
     586    LDFLAGS="$LDFLAGS -L/opt/local/lib" 
     587fi 
     588 
     589# remove initial : 
     590if test ! -z "$EXTRA_LD_LIBRARY_PATH"; then 
     591    EXTRA_LD_LIBRARY_PATH=`expr substr "$EXTRA_LD_LIBRARY_PATH" 2 1024` 
     592fi 
     593if test ! -z "$LD_LIBRARY_PATH"; then 
     594    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${EXTRA_LD_LIBRARY_PATH} 
     595else 
     596    export LD_LIBRARY_PATH=${EXTRA_LD_LIBRARY_PATH} 
     597fi 
     598 
    488599AC_SUBST(LIBG2C) 
    489600 
     
    499610AC_CHECK_LIB(rpc, xdr_float) 
    500611AC_CHECK_LIB(dl, dlopen) 
     612AC_CHECK_LIB(pthread, pthread_create) 
    501613AC_CHECK_LIB(z, gzopen) 
    502614AC_CHECK_LIB(jpeg, jpeg_CreateCompress) 
     
    509621dnl Checks for header files. 
    510622AC_HEADER_STDC 
    511 AC_CHECK_HEADERS([stdlib.h string.h]) 
     623AC_HEADER_SYS_WAIT 
     624AC_CHECK_HEADERS([stdlib.h string.h stdint.h]) 
    512625 
    513626dnl Checks for typedefs, structures, and compiler characteristics. 
    514627AC_C_CONST 
    515628AC_TYPE_SIZE_T 
     629AC_TYPE_INT8_T 
     630AC_TYPE_UINT8_T 
     631AC_TYPE_INT16_T 
     632AC_TYPE_UINT16_T 
     633AC_TYPE_INT32_T 
     634AC_TYPE_UINT32_T 
    516635AC_TYPE_INT64_T 
    517636AC_TYPE_UINT64_T 
    518637AC_TYPE_LONG_LONG_INT 
    519638AC_TYPE_UNSIGNED_LONG_LONG_INT 
     639AC_CHECK_SIZEOF([int]) 
     640AC_CHECK_SIZEOF([long int]) 
     641AC_CHECK_SIZEOF([long long int]) 
    520642AC_STRUCT_TM 
     643 
     644AC_SYS_LARGEFILE 
     645case "$ac_cv_sys_file_offset_bits" in 
     646  "no" | "unknown" | "")  
     647    ;; 
     648  *) 
     649    CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" 
     650    CXXFLAGS="$CXXFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" 
     651    ;; 
     652esac 
    521653 
    522654if test $MINGW_MSYS = yes; then 
     
    529661 
    530662dnl Checks for library functions. 
    531 AC_FUNC_MALLOC 
    532 AC_FUNC_MEMCMP 
    533 AC_FUNC_MKTIME 
    534 AC_FUNC_STRFTIME 
    535 AC_CHECK_FUNCS([ftime memset strchr strdup strrchr strstr tzset]) 
    536  
    537 AM_CONDITIONAL(HAVE_F77, [test ! -z "$F77"]) 
    538 AM_CONDITIONAL(HAVE_F90, [test ! -z "$FC"]) 
     663#this can cause link errors with rpl_malloc undefined 
     664#AC_FUNC_MALLOC 
     665#this no needed 
     666#AC_FUNC_MEMCMP 
     667#this hangs on FC9 at the moment 
     668#AC_FUNC_MKTIME 
     669 
     670#AC_FUNC_STRFTIME 
     671 
     672AC_CHECK_FUNCS([ftime memset strchr strdup strrchr strstr tzset mkstemp]) 
     673 
     674AM_CONDITIONAL(HAVE_CPP, [test ! -z "$CXX"]) 
     675AM_CONDITIONAL(HAVE_F77, [test "$with_f77" != "no"]) 
     676AM_CONDITIONAL(HAVE_F90, [test "$with_f90" != "no"]) 
    539677AM_CONDITIONAL(HAVE_PYTHON, [test ! -z "$PYTHONROOT"]) 
    540678AM_CONDITIONAL(HAVE_TCL, [test ! -z "$TCLROOT"]) 
    541679AM_CONDITIONAL(HAVE_GUILE, [test ! -z "$GUILEROOT"]) 
    542680AM_CONDITIONAL(HAVE_SWIG, [test ! -z "$SWIG"]) 
    543 AM_CONDITIONAL(HAVE_JAVA, [test ! -z "$JAVA"]) 
    544 AM_CONDITIONAL(HAVE_JAVAC, [test ! -z "$JAVAC"]) 
    545 AM_CONDITIONAL(HAVE_JAVADOC, [test ! -z "$JAVADOC"]) 
     681AM_CONDITIONAL(HAVE_JAVA, [test ! -z "$JAVA" -a ! -z "$JAVAROOT"]) 
     682AM_CONDITIONAL(HAVE_JAVAC, [test ! -z "$JAVAC" -a ! -z "$JAVAROOT"]) 
     683AM_CONDITIONAL(HAVE_JAVADOC, [test ! -z "$JAVADOC" -a ! -z "$JAVAROOT"]) 
    546684AM_CONDITIONAL(HAVE_HDF4, [test ! -z "$H4ROOT"]) 
    547685AM_CONDITIONAL(HAVE_HDF5, [test ! -z "$H5ROOT"]) 
     
    558696AM_CONDITIONAL(HAVE_DOT, [test ! -z "$DOT"]) 
    559697 
     698AM_CONDITIONAL(HAVE_WGET, [test ! -z "$WGET"]) 
     699AM_CONDITIONAL(HAVE_XMLLINT, [test ! -z "$XMLLINT"]) 
     700 
    560701AC_CONFIG_TESTDIR(test) 
    561702AC_CONFIG_FILES(test/Makefile test/atlocal) 
     
    571712                applications/Makefile 
    572713                applications/NXdir/Makefile 
     714                applications/nxingest/Makefile 
    573715                applications/NXsummary/Makefile 
    574716                applications/NXtranslate/Makefile 
     
    593735                doc/tech_ref/Makefile 
    594736                bindings/Makefile  
     737                bindings/cpp/Makefile 
    595738                bindings/f77/Makefile 
    596739                bindings/f90/Makefile 
    597740                bindings/java/Makefile 
    598741                bindings/swig/Makefile 
     742                bindings/idl/Makefile 
     743                bindings/python/Makefile 
    599744                contrib/Makefile 
    600745                contrib/applications/Makefile 
     746                contrib/applications/CBFLib/Makefile 
    601747                contrib/bindings/Makefile 
     748                contrib/bindings/python/Makefile 
    602749                scripts/Makefile 
    603750                scripts/nexus.pc:scripts/nexus_pc.in 
     
    606753AC_OUTPUT 
    607754 
     755if test ! -z "$DOXYGEN" -a ! -z "$PDFLATEX" -a ! -z "$DOT"; then 
     756    DOXYGENDOCS="yes" 
     757else 
     758    if test x"$with_doxygen" != x"no" ; then 
     759        DOXYGENDOCS="no  - missing " 
     760        if test -z "$DOXYGEN"; then DOXYGENDOCS="$DOXYGENDOCS doxygen"; fi 
     761        if test -z "$PDFLATEX"; then DOXYGENDOCS="$DOXYGENDOCS pdflatex"; fi 
     762        if test -z "$DOT"; then DOXYGENDOCS="$DOXYGENDOCS graphviz"; fi 
     763    else 
     764        DOXYGENDOCS="no    --with-doxygen  not specified" 
     765    fi 
     766fi 
     767 
     768if test ! -z "$DOCBOOK2TXT" -a ! -z "$DOCBOOK2PDF"; then 
     769    DOCBOOKDOCS="yes" 
     770else 
     771    DOCBOOKDOCS="no  - missing " 
     772    if test -z "$DOCBOOK2TXT"; then DOCBOOKDOCS="$DOCBOOKDOCS docbook2txt"; fi 
     773    if test -z "$DOCBOOK2PDF"; then DOCBOOKDOCS="$DOCBOOKDOCS docbook2pdf"; fi 
     774fi 
     775 
    608776HDF4SUPPORT=`if test -n "$H4ROOT" ; then echo yes ; else echo no ; echo "                found version $H4VERSION"; fi` 
    609777HDF5SUPPORT=`if test -n "$H5ROOT" ; then echo yes ; else echo no ; echo "                found version $H5VERSION"; fi` 
    610778XMLSUPPORT=`if test -n "$MXMLROOT" ; then echo yes ; else echo no ; fi` 
     779CPPBINDING=`if test -n "$CXX" ; then echo yes ; else echo no ; fi` 
    611780F77BINDING=`if test -n "$F77" ; then echo yes ; else echo no ; fi` 
    612781F90BINDING=`if test -n "$FC" ; then echo yes ; else echo no ; fi` 
    613 JAVABINDING=`if test -n "$JAVAC" ; then echo yes ; else echo no ; fi`  
     782JAVABINDING=`if test -n "$JAVAROOT" ; then echo yes ; else echo no ; fi`  
     783IDLBINDING=`if test -n "$IDLROOT" ; then echo yes ; else echo no ; fi`  
     784PYTHONBINDING=`if test -n "$PYTHONROOT" ; then echo yes; else echo no ; fi`  
    614785if test -n "$SWIG" ; then  
    615786    SWIGBINDING="yes (" 
    616787    test -n "$TCLROOT" && SWIGBINDING="$SWIGBINDING tcl" 
    617788    test -n "$GUILEROOT" && SWIGBINDING="$SWIGBINDING guile" 
    618     test -n "$PYTHONROOT" && SWIGBINDING="$SWIGBINDING python" 
    619789    SWIGBINDING="$SWIGBINDING ) SWIG=${SWIG}" 
    620790else 
     
    622792fi 
    623793 
    624 if test -z "$javaroot"; then 
    625     javaroot="not specified" 
     794if test -z "$JAVAROOT"; then 
     795    JAVAROOT="not specified" 
    626796fi 
    627797AC_MSG_RESULT([ 
     
    629799Configuration (NeXus): 
    630800 
     801        Install prefix:        ${prefix} 
    631802        Source code location:  ${srcdir} 
    632803        Version:               ${VERSION} 
     
    635806build: 
    636807        NeXus with: 
    637                 HDF4 support:  ${HDF4SUPPORT}  
    638                 HDF5 support:  ${HDF5SUPPORT} 
     808                HDF4 support:  ${HDF4SUPPORT} ($H4VERSION) 
     809                HDF5 support:  ${HDF5SUPPORT} ($H5VERSION) 
    639810                XML support:   ${XMLSUPPORT} 
    640811 
    641812        bindings: 
     813                C++ :          ${CPPBINDING} (--with-cxx=${CXX}) 
    642814                F77 :          ${F77BINDING} (--with-f77=${F77}) 
    643815            F90/F95 :          ${F90BINDING} (--with-f90=${FC}) 
    644                 JAVA:          ${JAVABINDING} (--with-java-home=${javaroot}, JAVA=${JAVA}, JAVAC=${JAVAC}, JAVAH=${JAVAH}) 
     816                JAVA:          ${JAVABINDING} (--with-java-home=${JAVAROOT}, JAVA=${JAVA}, JAVAC=${JAVAC}, JAVAH=${JAVAH}) 
    645817                SWIG:          ${SWIGBINDING} 
     818                 IDL:          ${IDLBINDING} (--with-idlroot=${IDLROOT}, --with-idldlm=${IDLDLM}) 
     819              PYTHON:          ${PYTHONBINDING} (PYTHONROOT=${PYTHONROOT}) 
     820 
     821        documentation: 
     822             Doxygen:          ${DOXYGENDOCS} 
     823             Docbook:          ${DOCBOOKDOCS} 
    646824 
    647825Please check whether the configuration I detected matches what you would 
  • tags/4.2.0/contrib/applications/Makefile.am

    r1924 r1924  
    1111#endif 
    1212#SUBDIRS = NXdir $(NXTRANSLATE) 
     13if HAVE_CBFLIB 
     14CBFLIB=CBFLib 
     15endif 
     16SUBDIRS=$(CBFLIB) 
  • tags/4.2.0/contrib/bindings/Makefile.am

    r1924 r1924  
    11## Process this file with automake to produce Makefile.in 
    22#==================================================================== 
     3#  NeXus - Neutron & X-ray Common Data Format 
    34 
    4 # $Id$ 
     5#  $Id$ 
    56# 
    6 # @configure_input@ 
     7#  Makefile for coordinating the generation of language bindings 
     8 
     9#  Copyright (C) 2004 Freddie Akeroyd 
     10 
     11#  This library is free software; you can redistribute it and/or 
     12#  modify it under the terms of the GNU Lesser General Public 
     13#  License as published by the Free Software Foundation; either 
     14#  version 2 of the License, or (at your option) any later version. 
     15#  
     16#  This library is distributed in the hope that it will be useful, 
     17#  but WITHOUT ANY WARRANTY; without even the implied warranty of 
     18#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     19#  Lesser General Public License for more details. 
     20#  
     21#  You should have received a copy of the GNU Lesser General Public 
     22#  License along with this library; if not, write to the Free  
     23#  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,  
     24#  MA  02111-1307  USA 
     25#              
     26#  For further information, see <http://www.neutron.anl.gov/NeXus/> 
    727# 
    828#==================================================================== 
    9 #if HAVE_LIBXML2 
    10 #NXTRANSLATE=NXtranslate 
     29 
     30#if HAVE_JAVAC 
     31#JAVASUB = java 
    1132#endif 
    12 #if INSTALL_NXPYTHON 
    13 #NXPYTHON=nxpython 
    14 #endif 
    15 #SUBDIRS = NXdir $(NXTRANSLATE) 
    16 #SUBDIRS = $(NXPYTHON) 
     33if HAVE_PYTHON 
     34PYSUB = python 
     35endif 
     36SUBDIRS = $(JAVASUB) $(PYSUB) 
  • tags/4.2.0/doc/Makefile.am

    r1924 r1924  
    66 
    77# documenttion subdirectories 
    8 if HAVE_DOXYGEN 
    9 if HAVE_PDFLATEX 
    10 if HAVE_DOT 
    11 DOXYSUB=doxygen 
    12 endif 
    13 endif 
    14 endif 
    15 SUBDIRS=api nxdict tech_ref $(DOXYSUB) 
     8SUBDIRS=api nxdict tech_ref doxygen 
    169 
    1710nxdocdir                = $(NXDOCDIR) 
  • tags/4.2.0/doc/doxygen/Doxyfile.in

    r1924 r1924  
    407407# by doxygen. Possible values are YES and NO. If left blank NO is used. 
    408408 
    409 QUIET                  = NO 
     409QUIET                  = YES 
    410410 
    411411# The WARNINGS tag can be used to turn on/off the warning messages that are  
     
    460460# with spaces. 
    461461 
    462 INPUT                  = @top_srcdir@/src @top_srcdir@/include 
     462INPUT                  = @top_srcdir@/src @top_srcdir@/include @top_srcdir@/bindings/cpp 
    463463 
    464464# If the value of the INPUT tag contains directories, you can use the  
     
    10071007 
    10081008PREDEFINED             = \ 
    1009         HDF4 \ 
    1010         HDF5 \ 
    1011         NXXML 
     1009        HDF4=1 \ 
     1010        HDF5=1 \ 
     1011        NXXML=1 \ 
     1012        NXDLL_EXPORT= 
    10121013 
    10131014# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then  
  • tags/4.2.0/doc/doxygen/Makefile.am

    r1924 r1924  
    66 
    77# documenttion subdirectories 
    8 nxdocdir        = $(NXDOCDIR) 
     8nxdoxydir       = $(NXDOCDIR)/doxygen 
     9CLEANFILES =  doxy.remove_me_to_remake 
     10 
     11all : doxy.remove_me_to_remake 
     12 
     13doxy.remove_me_to_remake : 
     14if HAVE_DOXYGEN 
     15if HAVE_PDFLATEX 
     16if HAVE_DOT 
     17        rm -fr latex html 
     18        $(DOXYGEN) Doxyfile 
     19        ( cd latex; make pdf ) 
     20        rm -f refman.pdf 
     21        ln -s latex/refman.pdf . 
     22endif 
     23endif 
     24endif 
     25        touch doxy.remove_me_to_remake 
    926 
    1027if HAVE_DOXYGEN 
    1128if HAVE_PDFLATEX 
    1229if HAVE_DOT 
    13 DOXY_STUFF = refman.pdf # html 
     30dist-hook : 
     31        test -f $(srcdir)/refman.pdf && cp $(srcdir)/refman.pdf $(distdir) 
     32        if test -d $(srcdir)/html; then \ 
     33                cp -r $(srcdir)/html $(distdir); \ 
     34                find $(distdir)/html -depth -type d -name '.svn' -exec rm -fr {} \; ;\ 
     35        fi 
    1436 
    15 refman.pdf : 
    16         $(DOXYGEN) Doxyfile 
    17         ( cd latex; make pdf ) 
    18         cp latex/refman.pdf $@ 
     37install-data-local : 
     38        $(mkinstalldirs) $(DESTDIR)$(nxdoxydir) 
     39        test -f $(srcdir)/refman.pdf && cp $(srcdir)/refman.pdf $(DESTDIR)$(nxdoxydir) 
     40        if test -d $(srcdir)/html; then \ 
     41                cp -r $(srcdir)/html $(DESTDIR)$(nxdoxydir); \ 
     42                find $(DESTDIR)$(nxdoxydir) -type f -exec chmod 0644 {} \; ;\ 
     43                find $(DESTDIR)$(nxdoxydir) -type d -exec chmod 0755 {} \; ;\ 
     44        fi 
    1945endif 
    2046endif 
    2147endif 
    2248 
    23 nxdoc_DATA      = $(DOXY_STUFF) 
     49clean-local : 
     50        rm -fr html latex refman.pdf 
    2451 
    25 EXTRA_DIST = $(DOXY_STUFF) 
     52uninstall-local : 
     53        rm -fr $(DESTDIR)$(nxdoxydir) 
     54 
  • tags/4.2.0/doc/tech_ref/Makefile.am

    r1924 r1924  
    66IMAGES=tofnpd.jpg tofnpd.gif 
    77DOC_SRC=NeXus_definitions.docbook terminology.docbook methods.docbook base_classes.docbook tofnpd.docbook tofnref.docbook monoref.docbook tofdgs.docbook monotas.docbook 
     8DOC_OUTPUT=NeXus_definitions.pdf NeXus_definitions.txt 
    89 
    910nxtechrefdocdir         = $(NXDOCDIR)/tech_ref 
     
    1213 
    1314if HAVE_DOCBOOK 
    14 DOC_OUTPUT=NeXus_definitions.pdf NeXus_definitions.txt 
    1515NeXus_definitions.pdf: $(DOC_SRC) $(IMAGES) 
    1616        $(DOCBOOK2PDF) NeXus_definitions.docbook 
     
    1818NeXus_definitions.txt: $(DOC_SRC) 
    1919        $(DOCBOOK2TXT) NeXus_definitions.docbook 
     20else 
     21NeXus_definitions.pdf: 
     22        touch NeXus_definitions.pdf 
     23 
     24NeXus_definitions.txt: 
     25        touch NeXus_definitions.txt 
    2026endif 
  • tags/4.2.0/include/Makefile.am

    r1924 r1924  
     1# nxincludedir=$(includedir)/nexus 
     2nxincludedir=$(pkgincludedir) 
     3 
     4# CPP headers go into nxinclude. Traditionally  
     5# nexus C headers went into include so we put 
     6# them in both places for now 
     7nxinclude_HEADERS = napi.h napiu.h 
     8 
     9include_HEADERS   = napi.h napiu.h 
     10 
    111noinst_HEADERS = napi4.h napi5.h nxxml.h napiconfig.h 
    2  
    3 include_HEADERS = napi.h napiu.h 
  • tags/4.2.0/include/napi.h

    r1924 r1924  
    2525 
    2626 ----------------------------------------------------------------------------*/ 
     27/** \file  
     28 * Documentation for the NeXus-API version 4.2 
     29 * 2000-2007, the NeXus group 
     30 * \defgroup c_main C API  
     31 * \defgroup c_types Data Types 
     32 * \ingroup c_main 
     33 * \defgroup c_init General Initialisation and shutdown 
     34 * \ingroup c_main 
     35 * \defgroup c_readwrite Reading and Writing 
     36 * \ingroup c_main 
     37 * \defgroup c_metadata Meta data routines 
     38 * \ingroup c_main 
     39 * \defgroup c_linking Linking and Group hierarchy 
     40 * \ingroup c_main 
     41 * \defgroup c_memory Memory allocation 
     42 * \ingroup c_main 
     43 * \defgroup c_external External linking 
     44 * \ingroup c_main 
     45 * \defgroup cpp_main C++ API 
     46 */ 
    2747   
    2848#ifndef NEXUSAPI 
     
    3050 
    3151/* NeXus HDF45 */ 
    32 #define NEXUS_VERSION   "4.1.0"                /* major.minor.patch */ 
     52#define NEXUS_VERSION   "4.2.0"                /* major.minor.patch */ 
    3353 
    3454#define CONSTCHAR       const char 
     
    4464 
    4565/*  
    46  * Any new NXaccess options should be numbered in 2^n format  
     66 * Any new NXaccess_mode options should be numbered in 2^n format  
    4767 * (8, 16, 32, etc) so that they can be bit masked and tested easily. 
    4868 * 
     
    5878#define NXACCMASK_REMOVEFLAGS (0x7) /* bit mask to remove higher flag options */ 
    5979 
     80/** \enum NXaccess_mode  
     81 * NeXus file access codes. 
     82 * \li NXACC_READ read-only 
     83 * \li NXACC_RDWR open an existing file for reading and writing. 
     84 * \li NXACC_CREATE create a NeXus HDF-4 file 
     85 * \li NXACC_CREATE4 create a NeXus HDF-4 file 
     86 * \li NXACC_CREATE5 create a NeXus HDF-5 file. 
     87 * \li NXACC_CREATEXML create a NeXus XML file. 
     88 */ 
    6089typedef enum {NXACC_READ=1, NXACC_RDWR=2, NXACC_CREATE=3, NXACC_CREATE4=4,  
    61               NXACC_CREATE5=5, NXACC_CREATEXML=6, NXACC_NOSTRIP=128} NXaccess; 
     90              NXACC_CREATE5=5, NXACC_CREATEXML=6, NXACC_TABLE=8, NXACC_NOSTRIP=128} NXaccess_mode; 
     91 
     92/** 
     93 * A combination of options from #NXaccess_mode 
     94 */ 
     95typedef int NXaccess; 
    6296 
    6397typedef struct { 
     
    75109#define NX_MAXNAMELEN 64 
    76110 
    77 /*------------------------------------------------------------------------- 
    78                 HDF Datatype values for datatype parameters  
    79                        in the Nexus API 
    80  
    81   NX_FLOAT32     32 bit float 
    82   NX_FLOAT64     64 nit float == double 
    83   NX_INT8        8 bit integer == byte 
    84   NX_UINT8       8 bit unsigned integer 
    85   NX_INT16       16 bit integer 
    86   NX_UINT16      16 bit unsigned integer 
    87   NX_INT32       32 bit integer 
    88   NX_UINT32      32 bit unsigned integer 
    89   NX_CHAR        8 bit character 
    90   NX_BINARY      lump of binary data == NX_UINT8 
    91  
    92 --------------------------------------------------------------------------*/  
     111 
     112/** \var NeXus data types 
     113 * \ingroup c_types 
     114 * \li NX_FLOAT32     32 bit float 
     115 * \li NX_FLOAT64     64 nit float == double 
     116 * \li NX_INT8        8 bit integer == byte 
     117 * \li NX_UINT8       8 bit unsigned integer 
     118 * \li NX_INT16       16 bit integer 
     119 * \li NX_UINT16      16 bit unsigned integer 
     120 * \li NX_INT32       32 bit integer 
     121 * \li NX_UINT32      32 bit unsigned integer 
     122 * \li NX_CHAR        8 bit character 
     123 * \li NX_BINARY      lump of binary data == NX_UINT8 
     124*/ 
     125/*--------------------------------------------------------------------------*/  
    93126 
    94127/* Map NeXus to HDF types */ 
     
    112145#define NX_COMP_RLE 300 
    113146#define NX_COMP_HUF 400   
     147 
     148/* to test for these we use ((value / 100) == NX_COMP_LZW) */ 
     149#define NX_COMP_LZW_LVL0 (100*NX_COMP_LZW + 0) 
     150#define NX_COMP_LZW_LVL1 (100*NX_COMP_LZW + 1) 
     151#define NX_COMP_LZW_LVL2 (100*NX_COMP_LZW + 2) 
     152#define NX_COMP_LZW_LVL3 (100*NX_COMP_LZW + 3) 
     153#define NX_COMP_LZW_LVL4 (100*NX_COMP_LZW + 4) 
     154#define NX_COMP_LZW_LVL5 (100*NX_COMP_LZW + 5) 
     155#define NX_COMP_LZW_LVL6 (100*NX_COMP_LZW + 6) 
     156#define NX_COMP_LZW_LVL7 (100*NX_COMP_LZW + 7) 
     157#define NX_COMP_LZW_LVL8 (100*NX_COMP_LZW + 8) 
     158#define NX_COMP_LZW_LVL9 (100*NX_COMP_LZW + 9) 
    114159 
    115160typedef struct { 
     
    154199 
    155200#    define NXgetinfo           MANGLE(nxigetinfo) 
     201#    define NXgetrawinfo        MANGLE(nxigetrawinfo) 
    156202#    define NXgetnextentry      MANGLE(nxigetnextentry) 
    157203#    define NXgetdata           MANGLE(nxigetdata) 
     
    168214#    define NXsetnumberformat   MANGLE(nxisetnumberformat) 
    169215#    define NXsetcache          MANGLE(nxisetcache) 
    170 #    define NXinquirefile       MANGLE(nxiinquirefile) 
     216#    define NXinquirefile       MANGLE(nxiinquirefile)  
    171217#    define NXisexternalgroup   MANGLE(nxiisexternalgroup) 
    172218#    define NXlinkexternal      MANGLE(nxilinkexternal) 
     
    196242extern "C" { 
    197243#endif /* __cplusplus */ 
     244  /**  
     245   * Open a NeXus file. 
     246   * NXopen honours full path file names. But it also searches  
     247   * for files in all the paths given in the NX_LOAD_PATH environment variable.  
     248   * NX_LOAD_PATH is supposed to hold a list of path string separated by the platform  
     249   * specific path separator. For unix this is the : , for DOS the ; . Please note  
     250   * that crashing on an open NeXus file will result in corrupted data. Only after a NXclose  
     251   * or a NXflush will the data file be valid.  
     252   * \param filename The name of the file to open 
     253   * \param access_method The file access method. This can be: 
     254   * \li NXACC__READ read access  
     255   * \li NXACC_RDWR read write access  
     256   * \li NXACC_CREATE, NXACC_CREATE4 create a new HDF-4 NeXus file 
     257   * \li NXACC_CREATE5 create a new HDF-5 NeXus file 
     258   * \li NXACC_CREATEXML create an XML NeXus file.  
     259   * see #NXaccess_mode 
     260   * Support for HDF-4 is deprecated. 
     261   * \param pHandle A file handle which will be initialized upon successfull completeion of NXopen. 
     262   * \return NX_OK on success, NX_ERROR in the case of an error.    
     263   * \ingroup c_init 
     264   */ 
    198265extern  NXstatus  NXopen(CONSTCHAR * filename, NXaccess access_method, NXhandle* pHandle); 
     266 
     267  /** 
     268   * close a NeXus file 
     269   * \param pHandle A NeXus file handle as returned from NXopen. pHandle is invalid after this  
     270   * call. 
     271   * \return NX_OK on success, NX_ERROR in the case of an error.    
     272   * \ingroup c_init 
     273   */ 
    199274extern  NXstatus  NXclose(NXhandle* pHandle); 
     275 
     276  /** 
     277   * flush data to disk 
     278   * \param pHandle A NeXus file handle as initialized by NXopen.  
     279   * \return NX_OK on success, NX_ERROR in the case of an error.    
     280   * \ingroup c_readwrite 
     281   */ 
    200282extern  NXstatus  NXflush(NXhandle* pHandle); 
    201    
     283 
     284  /** 
     285   * NeXus groups are NeXus way of structuring information into a hierarchy.  
     286   * This function creates a group but does not open it. 
     287   * \param handle A NeXus file handle as initialized NXopen.  
     288   * \param name The name of the group 
     289   * \param NXclass the class name of the group. Should start with the prefix NX 
     290   * \return NX_OK on success, NX_ERROR in the case of an error.    
     291   * \ingroup c_init 
     292   */ 
    202293extern  NXstatus  NXmakegroup (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass); 
     294 
     295  /** 
     296   * Step into a group. All further access will be within the opened group. 
     297   * \param handle A NeXus file handle as initialized by NXopen.  
     298   * \param name The name of the group 
     299   * \param NXclass the class name of the group. Should start with the prefix NX 
     300   * \return NX_OK on success, NX_ERROR in the case of an error.    
     301   * \ingroup c_init 
     302   */ 
    203303extern  NXstatus  NXopengroup (NXhandle handle, CONSTCHAR *name, CONSTCHAR* NXclass); 
     304 
     305  /** 
     306   * Open the NeXus object with the path specified 
     307   * \param handle A NeXus file handle as returned from NXopen.  
     308   * \param path A unix like path string to a NeXus group or dataset. The path string  
     309   * is a list of group names and SDS names separated with / (slash).  
     310   * Example: /entry1/sample/name  
     311   * \return NX_OK on success, NX_ERROR in the case of an error.    
     312   * \ingroup c_init 
     313   */ 
    204314extern  NXstatus  NXopenpath (NXhandle handle, CONSTCHAR *path); 
     315 
     316  /** 
     317   * Opens the group in which the NeXus object with the specified path exists 
     318   * \param handle A NeXus file handle as initialized by NXopen.  
     319   * \param path A unix like path string to a NeXus group or dataset. The path string  
     320   * is a list of group names and SDS names separated with / (slash).  
     321   * Example: /entry1/sample/name  
     322   * \return NX_OK on success, NX_ERROR in the case of an error.    
     323   * \ingroup c_readwrite 
     324   */ 
    205325extern  NXstatus  NXopengrouppath (NXhandle handle, CONSTCHAR *path); 
    206326 
     327  /** 
     328   * Closes the currently open group and steps one step down in the NeXus file  
     329   * hierarchy. 
     330   * \return NX_OK on success, NX_ERROR in the case of an error.    
     331   * \ingroup c_init 
     332   */ 
    207333extern  NXstatus  NXclosegroup(NXhandle handle); 
    208    
     334 
     335  /** 
     336   * Create a multi dimensional data array or dataset. The dataset is NOT opened.  
     337   * \param handle A NeXus file handle as initialized by NXopen.  
     338   * \param label The name of the dataset 
     339   * \param datatype The data type of this data set.  
     340   * \param rank The number of dimensions this dataset is going to have 
     341   * \param dim An array of size rank holding the size of the dataset in each dimension. The first dimension  
     342   * can be NX_UNLIMITED. Data can be appended to such a dimension using NXputslab.  
     343   * \return NX_OK on success, NX_ERROR in the case of an error.    
     344   * \ingroup c_init 
     345   */ 
    209346extern  NXstatus  NXmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[]); 
     347 
     348  /** 
     349   * Create a compressed dataset. The dataset is NOT opened. Data from this set will automatically be compressed when  
     350   * writing and decompressed on reading.  
     351   * \param handle A NeXus file handle as initialized by NXopen.  
     352   * \param label The name of the dataset 
     353   * \param datatype The data type of this data set.  
     354   * \param rank The number of dimensions this dataset is going to have 
     355   * \param comp_typ The compression scheme to use. Possible values: 
     356   * \li NX_COMP_NONE no compression  
     357   * \li NX_COMP_LZW lossless Lempel Ziv Welch compression (recommended) 
     358   * \li NX_COMP_RLE run length encoding (only HDF-4) 
     359   * \li NX_COMP_HUF Huffmann encoding (only HDF-4) 
     360   * \param dim An array of size rank holding the size of the dataset in each dimension. The first dimension  
     361   * can be NX_UNLIMITED. Data can be appended to such a dimension using NXputslab.  
     362   * \param bufsize The dimensions of the subset of the data which usually be writen in one go.  
     363   * This is a parameter used by HDF for performance optimisations. If you write your data in one go, this  
     364   * should be the same as the data dimension. If you write it in slabs, this is your preferred slab size.  
     365   * \return NX_OK on success, NX_ERROR in the case of an error.    
     366   * \ingroup c_init 
     367   */ 
    210368extern  NXstatus  NXcompmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[], int comp_typ, int bufsize[]); 
     369 
     370  /** 
     371   * Switch compression on. This routine is superseeded by NXcompmakedata and thus  
     372   * is deprecated. 
     373   * \param handle A NeXus file handle as initialized by NXopen.  
     374   * \param compr_type The compression scheme to use. Possible values: 
     375   * \li NX_COMP_NONE no compression  
     376   * \li NX_COMP_LZW lossless Lempel Ziv Welch compression (recommended) 
     377   * \li NX_COMP_RLE run length encoding (only HDF-4) 
     378   * \li NX_COMP_HUF Huffmann encoding (only HDF-4) 
     379   * \ingroup c_init 
     380   */ 
    211381extern  NXstatus  NXcompress (NXhandle handle, int compr_type); 
     382 
     383  /** 
     384   * Open access to a dataset. After this call it is possible to write and read data or  
     385   * attributes to and from the dataset. 
     386   * \param handle A NeXus file handle as initialized by NXopen.  
     387   * \param label The name of the dataset 
     388   * \return NX_OK on success, NX_ERROR in the case of an error.    
     389   * \ingroup c_init 
     390   */ 
    212391extern  NXstatus  NXopendata (NXhandle handle, CONSTCHAR* label); 
     392 
     393  /** 
     394   * Close access to a dataset.  
     395   * \param handle A NeXus file handle as initialized by NXopen.  
     396   * \return NX_OK on success, NX_ERROR in the case of an error.    
     397   * \ingroup c_readwrite 
     398   */ 
    213399extern  NXstatus  NXclosedata(NXhandle handle); 
     400 
     401  /** 
     402   * Write data to a datset which has previouly been opened with NXopendata.  
     403   * This writes all the data in one go. Data should be a pointer to a memory  
     404   * area matching the datatype and dimensions of the dataset. 
     405   * \param handle A NeXus file handle as initialized by NXopen.  
     406   * \param data Pointer to data to write. 
     407   * \return NX_OK on success, NX_ERROR in the case of an error.    
     408   * \ingroup c_init 
     409   */ 
    214410extern  NXstatus  NXputdata(NXhandle handle, void* data); 
    215411 
     412  /** 
     413   * Write an attribute. The kind of attribute written depends on the   
     414   * poistion in the file: at root level, a global attribute is written, if  
     415   * agroup is open but no dataset, a group attribute is written, if a dataset is  
     416   * open, a dataset attribute is written. 
     417   * \param handle A NeXus file handle as initialized by NXopen.  
     418   * \param name The name of the attribute. 
     419   * \param data A pointer to the data to write for the attribute. 
     420   * \param iDataLen The length of the data in data in bytes. 
     421   * \param iType The NeXus data type of the attribute.  
     422   * \return NX_OK on success, NX_ERROR in the case of an error.    
     423   * \ingroup c_readwrite 
     424   */ 
    216425extern  NXstatus  NXputattr(NXhandle handle, CONSTCHAR* name, void* data, int iDataLen, int iType); 
     426 
     427  /** 
     428   * Write  a subset of a multi dimensional dataset. 
     429   * \param handle A NeXus file handle as initialized by NXopen.  
     430   * \param data A pointer to a memory area holding the data to write. 
     431   * \param start An array holding the start indices where to start the data subset. 
     432   * \param size An array holding the size of the data subset to write in each dimension. 
     433   * \return NX_OK on success, NX_ERROR in the case of an error.    
     434   * \ingroup c_readwrite 
     435   */ 
    217436extern  NXstatus  NXputslab(NXhandle handle, void* data, int start[], int size[]);     
    218437 
     438  /** 
     439   * Retrieve link data for a dataset. This link data can later on be used to link this  
     440   * dataset into a different group.  
     441   * \param handle A NeXus file handle as initialized by NXopen. 
     442   * \param pLink A link data structure which will be initialized with the required information 
     443   * for linking.  
     444   * \return NX_OK on success, NX_ERROR in the case of an error.    
     445   * \ingroup c_readwrite 
     446   */ 
    219447extern  NXstatus  NXgetdataID(NXhandle handle, NXlink* pLink); 
     448 
     449  /** 
     450   * Create a link to the group or dataset described by pLink in the currently open  
     451   * group.  
     452   * \param handle A NeXus file handle as initialized by NXopen. 
     453   * \param pLink A link data structure describing the object to link. This must have been initialized 
     454   * by either a call to NXgetdataID or NXgetgroupID. 
     455   * \return NX_OK on success, NX_ERROR in the case of an error.    
     456   * \ingroup c_readwrite 
     457   */ 
    220458extern  NXstatus  NXmakelink(NXhandle handle, NXlink* pLink); 
     459 
     460  /** 
     461   * Create a link to the group or dataset described by pLink in the currently open  
     462   * group. But give the linked item a new name. 
     463   * \param handle A NeXus file handle as initialized by NXopen. 
     464   * \param newname The new name of the item in the currently open group.  
     465   * \param pLink A link data structure describing the object to link. This must have been initialized 
     466   * by either a call to NXgetdataID or NXgetgroupID. 
     467   * \return NX_OK on success, NX_ERROR in the case of an error.    
     468   * \ingroup c_linking 
     469   */ 
    221470extern  NXstatus  NXmakenamedlink(NXhandle handle, CONSTCHAR* newname, NXlink* pLink); 
     471 
     472  /** 
     473   * Open the source group of a linked group or dataset. Returns an error when the item is  
     474   * not a linked item. 
     475   * \param handle A NeXus file handle as initialized by NXopen. 
     476   * \return NX_OK on success, NX_ERROR in the case of an error.    
     477   * \ingroup c_linking 
     478   */ 
    222479extern  NXstatus  NXopensourcegroup(NXhandle handle); 
    223480 
     481  /** 
     482   * Read a complete dataset from the currently open dataset into memory.  
     483   * \param handle A NeXus file handle as initialized by NXopen. 
     484   * \param data A pointer to the memory area where to read the data, too. Data must point to a memory  
     485   * area large enough to accomodate the data read. Otherwise your program may behave in unexpected 
     486   * and unwelcome ways. 
     487   * \return NX_OK on success, NX_ERROR in the case of an error.    
     488   * \ingroup c_readwrite 
     489   */ 
    224490extern  NXstatus  NXgetdata(NXhandle handle, void* data); 
     491 
     492  /** 
     493   * Retrieve information about the curretly open dataset. 
     494   * \param handle A NeXus file handle as initialized by NXopen. 
     495   * \param rank A pointer to an integer which will be filled with the rank of  
     496   * the dataset. 
     497   * \param dimension An array which will be initialized with the size of the dataset in any of its  
     498   * dimensions. The array must have at least the size of rank. 
     499   * \param datatype A pointer to an integer which be set to the NeXus data type code for this dataset. 
     500   * \return NX_OK on success, NX_ERROR in the case of an error.    
     501   * \ingroup c_metadata 
     502   */ 
    225503extern  NXstatus  NXgetinfo(NXhandle handle, int* rank, int dimension[], int* datatype); 
     504 
     505  /** 
     506   * Get the next entry in the currently open group. This is for retrieving infromation about the  
     507   * content of a NeXus group. In order to search a group NXgetnextentry is called in a loop until  
     508   * NXgetnextentry returns NX_EOD which indicates that there are no further items in the group. 
     509   * \param handle A NeXus file handle as initialized by NXopen. 
     510   * \param name The name of the object 
     511   * \param nxclass The NeXus class name for a group or the string SDS for a dataset. 
     512   * \param datatype The NeXus data type if the item is a SDS.  
     513   * \return NX_OK on success, NX_ERROR in the case of an error, NX_EOD when there are no more items.    
     514   * \ingroup c_readwrite 
     515   */ 
    226516extern  NXstatus  NXgetnextentry(NXhandle handle, NXname name, NXname nxclass, int* datatype); 
    227517 
     518  /** 
     519   * Read a subset of data from file into memory.  
     520   * \param handle A NeXus file handle as initialized by NXopen. 
     521   * \param data A pointer to the memory data where to copy the data too. The pointer must point  
     522   * to a memory area large enough to accomodate the size of the data read. 
     523   * \param start An array holding the start indices where to start reading the data subset. 
     524   * \param size An array holding the size of the data subset to read for each dimension. 
     525   * \return NX_OK on success, NX_ERROR in the case of an error.    
     526   * \ingroup c_readwrite 
     527   */ 
    228528extern  NXstatus  NXgetslab(NXhandle handle, void* data, int start[], int size[]); 
     529 
     530  /** 
     531   * Iterate over global, group or dataset attributes depending on the currently open group or  
     532   * dataset. In order to search attributes multiple calls to NXgetnextattr are performed in a loop  
     533   * until NXgentnextattr returns NX_EOD which indicates that there are no further attributes. 
     534   * \param handle A NeXus file handle as initialized by NXopen. 
     535   * \param pName The name of the attribute 
     536   * \param iLength A pointer to an integer which be set to the length of the attribute data. 
     537   * \param iType A pointer to an integer which be set to the NeXus data type of the attribute. 
     538   * \return NX_OK on success, NX_ERROR in the case of an error, NX_EOD when there are no more items.    
     539   * \ingroup c_readwrite 
     540   */ 
    229541extern  NXstatus  NXgetnextattr(NXhandle handle, NXname pName, int *iLength, int *iType); 
     542 
     543  /** 
     544   * Read an attribute. 
     545   * \param handle A NeXus file handle as initialized by NXopen. 
     546   * \param name The name of the atrribute to read. 
     547   * \param data A pointer to a memory area large enough to hold the attributes value. 
     548   * \param iDataLen The length of data in bytes. 
     549   * \param iType A pointer to an integer which will had been set to the NeXus data type of the attribute. 
     550   * \return NX_OK on success, NX_ERROR in the case of an error.    
     551   * \ingroup c_readwrite 
     552   */ 
    230553extern  NXstatus  NXgetattr(NXhandle handle, char* name, void* data, int* iDataLen, int* iType); 
     554 
     555  /** 
     556   * Get the count of attributes in the currently open dataset, group or global attributes when at root level. 
     557   * \param handle A NeXus file handle as initialized by NXopen. 
     558   * \param no_items A pointer to an integer which be set to the number of attributes available. 
     559   * \return NX_OK on success, NX_ERROR in the case of an error.    
     560   * \ingroup c_readwrite 
     561   */ 
    231562extern  NXstatus  NXgetattrinfo(NXhandle handle, int* no_items); 
     563 
     564  /** 
     565   * Retrieve link data for the currently open group. This link data can later on be used to link this  
     566   * group into a different group.  
     567   * \param handle A NeXus file handle as initialized by NXopen. 
     568   * \param pLink A link data structure which will be initialized with the required information 
     569   * for linking.  
     570   * \return NX_OK on success, NX_ERROR in the case of an error.    
     571   * \ingroup c_readwrite 
     572   */ 
    232573extern  NXstatus  NXgetgroupID(NXhandle handle, NXlink* pLink); 
     574 
     575  /** 
     576   * Retrieve information about the currently open group. 
     577   * \param handle A NeXus file handle as initialized by NXopen. 
     578   * \param no_items A pointer to an integer which will be set to the count  
     579   *   of group elements available. This is the count of other groups and  
     580   * data sets in this group.   
     581   * \param name The name of the group. 
     582   * \param nxclass The NeXus class name of the group. 
     583   * \return NX_OK on success, NX_ERROR in the case of an error.    
     584   * \ingroup c_readwrite 
     585   */ 
    233586extern  NXstatus  NXgetgroupinfo(NXhandle handle, int* no_items, NXname name, NXname nxclass); 
     587 
     588  /** 
     589   * Tests if two link data structures describe the same item. 
     590   * \param handle A NeXus file handle as initialized by NXopen. 
     591   * \param pFirstID The first link data for the test. 
     592   * \param pSecondID The second link data structure. 
     593   * \return NX_OK when both link data structures describe the same item, NX_ERROR else.    
     594   * \ingroup c_readwrite 
     595   */ 
    234596extern  NXstatus  NXsameID(NXhandle handle, NXlink* pFirstID, NXlink* pSecondID); 
    235  
     597  /** 
     598   * Resets a pending group search to the start again. To be called in a Nxgetnextentry loop when  
     599   * a group search has to be restarted. 
     600   * \param handle A NeXus file handle as initialized by NXopen. 
     601   * \return NX_OK on success, NX_ERROR in the case of an error.    
     602   * \ingroup c_readwrite 
     603   */ 
    236604extern  NXstatus  NXinitgroupdir(NXhandle handle); 
     605 
     606  /** 
     607   * Resets a pending attribute search to the start again. To be called in a Nxgetnextattr loop when  
     608   * an attribute search has to be restarted. 
     609   * \param handle A NeXus file handle as initialized by NXopen. 
     610   * \return NX_OK on success, NX_ERROR in the case of an error.    
     611   * \ingroup c_readwrite 
     612   */ 
    237613extern  NXstatus  NXinitattrdir(NXhandle handle); 
    238 extern  NXstatus  NXsetnumberformat(NXhandle handle, 
    239                                                       int type, char *format); 
    240  
     614 
     615  /** 
     616   * Sets the format for number printing. This call has only an effect when using the XML physical file  
     617   * format.  
     618   * \param handle A NeXus file handle as initialized by NXopen. 
     619   * \param type The NeXus data type to set the format for. 
     620   * \param format The C-language format string to use for this data type. 
     621   * \return NX_OK on success, NX_ERROR in the case of an error.    
     622   * \ingroup c_readwrite 
     623   */ 
     624extern  NXstatus  NXsetnumberformat(NXhandle handle, int type, char *format); 
     625 
     626  /** 
     627   * Inquire the filename of the currently open file. FilenameBufferLength of the file name  
     628   * will be copied into the filename buffer. 
     629   * \param handle A NeXus file handle as initialized by NXopen. 
     630   * \param filename The buffer to hold the filename. 
     631   * \param  filenameBufferLength The length of the filename buffer. 
     632   * \return NX_OK on success, NX_ERROR in the case of an error.    
     633   * \ingroup c_readwrite 
     634   */ 
    241635extern  NXstatus  NXinquirefile(NXhandle handle, char *filename, int filenameBufferLength); 
    242 extern  NXstatus  NXisexternalgroup(NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass, char *url, int urlLen);  
    243 extern  NXstatus  NXlinkexternal(NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass, CONSTCHAR *url); 
    244  
     636 
     637  /** 
     638   * Test if a group is actually pointing to an external file. If so, retrieve the URL of the  
     639   * external file. 
     640   * \param handle A NeXus file handle as initialized by NXopen. 
     641   * \param name The name of the group to test. 
     642   * \param nxclass The class name of the group to test. 
     643   * \param url A buffer to copy the URL too. 
     644   * \param urlLen The length of the Url buffer. At maximum urlLen bytes will be copied to url. 
     645   * \return NX_OK when the group is pointing to an external file, NX_ERROR else. 
     646   * \ingroup c_readwrite 
     647   */ 
     648extern  NXstatus  NXisexternalgroup(NXhandle handle, CONSTCHAR *name, CONSTCHAR *nxclass, char *url, int urlLen);  
     649 
     650  /** 
     651   * Create a link to an external file. This works by creating a NeXus group under the current level in  
     652   * the hierarchy which actually points to a group in  another file.  
     653   * \param handle A NeXus file handle as initialized by NXopen. 
     654   * \param name The name of the group which points to the xternal file. 
     655   * \param nxclass The class name of the group which points to the external file. 
     656   * \param url The URL of the external file. Currently only one URL format is supported: nxfile://path-tofile\#path-in-file.  
     657   * This consists of two parts: the first part is of course the path to the file. The second part, path-in-file, is the  
     658   * path to the group in the external file which appears in the first file.   
     659   * \return NX_OK on success, NX_ERROR in the case of an error.    
     660   * \ingroup c_readwrite 
     661   */ 
     662extern  NXstatus  NXlinkexternal(NXhandle handle, CONSTCHAR *name, CONSTCHAR *nxclass, CONSTCHAR *url); 
     663 
     664  /** 
     665   * Utility function which allocates a suitably sized memory area for the dataset characteristics specified. 
     666   * \param data A pointer to a pointer which will be initialized with a pointer to a suitably sized memory area. 
     667   * \param rank the rank of the data. 
     668   * \param dimensions An array holding the size of the data in each dimension. 
     669   * \param datatype The NeXus data type of the data. 
     670   * \return NX_OK when allocation succeeds, NX_ERROR in the case of an error.    
     671   * \ingroup c_memory 
     672   */  
    245673extern  NXstatus  NXmalloc(void** data, int rank, int dimensions[], int datatype); 
     674 
     675  /** 
     676   * Utility function to release the memory for data. 
     677   * \param data A pointer to a pointer to free. 
     678   * \return NX_OK on success, NX_ERROR in the case of an error.    
     679   * \ingroup c_memory 
     680   */ 
    246681extern  NXstatus  NXfree(void** data); 
    247682 
     
    250685    NAPI internals  
    251686------------------------------------------------------------------------*/ 
     687  /** 
     688   * Retrieve information about the currently open dataset. In contrast to the main function below,  
     689   * this function does not try to find out about the size of strings properly.  
     690   * \param handle A NeXus file handle as initialized by NXopen. 
     691   * \param rank A pointer to an integer which will be filled with the rank of  
     692   * the dataset. 
     693   * \param dimension An array which will be initialized with the size of the dataset in any of its  
     694   * dimensions. The array must have at least the size of rank. 
     695   * \param datatype A pointer to an integer which be set to the NeXus data type code for this dataset. 
     696   * \return NX_OK on success, NX_ERROR in the case of an error.    
     697   * \ingroup c_metadata 
     698   */ 
     699extern  NXstatus  NXgetrawinfo(NXhandle handle, int* rank, int dimension[], int* datatype); 
     700 
     701/** \typedef void (*ErrFunc)(void *data, char *text) 
     702 * All NeXus error reporting happens through this special function, the  
     703 * ErrFunc. The NeXus-API allows to replace this error reporting function 
     704 * through a user defined implementation. The default error function prints to stderr. User  
     705 * defined ones may pop up dialog boxes or whatever. 
     706 * \param data A pointer to some user defined data structure 
     707 * \param text The text of the error message to display.  
     708 */ 
    252709typedef void (*ErrFunc)(void *data, char *text); 
    253 extern  void  NXMSetError(void *pData, ErrFunc); 
     710 
     711  /** 
     712   * Set an error function. 
     713   * \param pData A pointer to a user defined data structure which be passed opaquely to  
     714   * the error display function. 
     715   * \param newErr The new error display function. 
     716   */ 
     717extern  void  NXMSetError(void *pData, ErrFunc newErr); 
     718 
     719  /** 
     720   * Retrieve the current error display function 
     721   * \return The current erro display function. 
     722   */ 
    254723extern ErrFunc NXMGetError(); 
     724 
     725  /** 
     726   * Suppress error reports from the NeXus-API 
     727   */ 
    255728extern  void  NXMDisableErrorReporting(); 
     729 
     730  /** 
     731   * Enable error reports from the NeXus-API 
     732   */ 
    256733extern  void  NXMEnableErrorReporting(); 
     734 
     735 
    257736extern void (*NXIReportError)(void *pData,char *text); 
    258737extern void *NXpData; 
     
    266745 
    267746  typedef struct { 
    268         NXhandle *pNexusData;    
     747        NXhandle pNexusData;    
    269748        int stripFlag; 
    270749        NXstatus ( *nxclose)(NXhandle* pHandle); 
  • tags/4.2.0/include/napi4.h

    r1924 r1924  
     1#ifndef NAPI4_H 
     2#define NAPI4_H 
     3 
    14#define NXSIGNATURE 959697 
    25 
     
    4750 
    4851   
     52/* 
     53 *  HDF changed from MAX_VAR_DIMS to H4_MAX_VAR_DIMS aronud 9/5/2007  
     54 *  to avoid potential conflicts with NetCDF-3 library 
     55 */ 
     56#ifndef H4_MAX_VAR_DIMS 
     57#define H4_MAX_VAR_DIMS MAX_VAR_DIMS 
     58#endif 
     59 
     60#endif /* NAPI4_H */ 
  • tags/4.2.0/include/napi5.h

    r1924 r1924  
     1#ifndef NAPI5_H 
     2#define NAPI5_H 
     3 
    14#define NX5SIGNATURE 959695 
    25 
     
    4750herr_t group_info(hid_t loc_id, const char *name, void *opdata); 
    4851 
     52#endif /* NAPI5_H */ 
  • tags/4.2.0/include/napiconfig.h

    r1924 r1924  
    11#ifndef NAPICONFIG_H 
    22#define NAPICONFIG_H 
     3 
     4#ifdef _WIN32 
     5#include <windows.h> 
     6#endif /* _WIN32 */ 
    37 
    48#include <nxconfig.h> 
    59 
    610/* 
    7  * Type definitions 
     11 * Integer type definitions 
     12 *  
     13 * int32_t etc will be defined by configure in nxconfig.h  
     14 * if they exist; otherwise include an appropriate header 
    815 */ 
    9 #ifdef HAVE_STDINT_H 
     16#if HAVE_STDINT_H 
    1017#include <stdint.h> 
    11 #else 
    12 typedef signed char             int8_t; 
    13 typedef short int               int16_t; 
    14 typedef int                     int32_t; 
    15 typedef unsigned char           uint8_t; 
    16 typedef unsigned short int      uint16_t; 
    17 typedef unsigned int            uint32_t; 
     18#endif /* HAVE_STDINT_H */ 
    1819 
    19 #endif /* HAVE_STDINT_H */ 
     20 
    2021#endif /* NAPICONFIG_H */ 
  • tags/4.2.0/nexus_spec.in

    r1924 r1924  
    2424# Prefix allows our package to be relocatable i.e. installable in  
    2525# other than just the /usr/local directory 
    26 Prefix: /usr/local 
     26#Prefix: /usr 
    2727# BuildRoot is the root for software installation 
    2828# this value will not usually be used, but something must 
    2929# be specified here to allow   rpm --buildroot   to be used later 
    3030# (it will get used for a   rpmbuild --recompile  of the the src.rpm) 
    31 BuildRoot: /tmp/@PACKAGE_TARNAME@-@PACKAGE_VERSION@ 
     31BuildRoot: %{_tmppath}/@PACKAGE_TARNAME@-@PACKAGE_VERSION@ 
    3232 
    3333%description 
     
    3737access routines, documentation, examples and a basic NeXus file browser. 
    3838 
     39#%package devel 
     40#Summary: Libraries and utilities for using NeXus format data files 
     41#Group: Development/Libraries 
     42# 
     43#%description devel 
     44#NeXus is an international standard for exchanging data files 
     45#among Neutron, Muon and X-ray science facilities. The underlying 
     46#data is stored using the HDF format from NCSA. This package provides 
     47 
    3948%prep 
    40 %setup 
     49%setup -q 
     50 
    4151%build 
    42 # RPM_BUILD_ROOT - where to install software 
    43 if ! test -z "$RPM_BUILD_ROOT"; then 
    44     ./configure --prefix=$RPM_BUILD_ROOT/usr/local $NEXUS_CONFIG_OPTIONS 
     52# RPM_INSTALL_PREFIX - where to install software 
     53if ! test -z "$RPM_INSTALL_PREFIX"; then 
     54    ./configure --prefix="$RPM_INSTALL_PREFIX" $NEXUS_CONFIG_OPTIONS 
    4555else 
    46     ./configure $NEXUS_CONFIG_OPTIONS 
     56    ./configure --prefix=%{_prefix} --libdir=%{_libdir} $NEXUS_CONFIG_OPTIONS 
    4757fi 
    4858make 
     59 
    4960%install 
    50 # may want to consider   make DESTDIR=$RPM_BUILD_ROOT install    sometime 
    51 # as automake supports it; configure --prefix is OK for now though 
    52 make install 
     61# RPM_BUILD_ROOT is where to install software to 
     62if test "$RPM_BUILD_ROOT" != "/"; then rm -fr "$RPM_BUILD_ROOT"; fi 
     63make DESTDIR="$RPM_BUILD_ROOT" install 
     64 
    5365%files 
     66%defattr(-,root,root) 
    5467%doc README NEWS ChangeLog AUTHORS COPYING INSTALL 
    5568# %docdir /usr/local/doc 
    56 /usr/local/lib 
    57 /usr/local/bin 
    58 /usr/local/include 
    59 /usr/local/share 
     69%{_libdir}/* 
     70%{_bindir}/* 
     71%{_datadir}/* 
     72%{_includedir}/* 
     73#%files devel 
     74#%{_libdir}/*.a 
     75#%{_libdir}/*.so* 
    6076 
    6177%clean 
    62 # the rm line can be dangerous - build_root might be / ! 
    63 # leave commented out for moment, but we need to implement 
    64 # some cleaning mechanism if we use alternative build roots 
    65 ###rm -fr $RPM_BUILD_ROOT 
     78if test "$RPM_BUILD_ROOT" != "/"; then rm -fr "$RPM_BUILD_ROOT"; fi 
     79 
    6680%post 
    6781if [ "$RPM_INSTALL_PREFIX" != "" ]; then 
    6882    INSTALL_PREFIX=$RPM_INSTALL_PREFIX 
    6983else 
    70     INSTALL_PREFIX=/usr/local 
     84    INSTALL_PREFIX=%{_prefix} 
    7185fi 
    7286( cd $INSTALL_PREFIX/bin; for i in nxbuild; do \ 
    73   sed -e "s|^prefix=.*|prefix=$INSTALL_PREFIX|" $i > /tmp/nexus.$$; \ 
    74   mv /tmp/nexus.$$ $i; chmod 0755 $i; done ) 
     87  sed -i -e "s|^prefix=.*|prefix=$INSTALL_PREFIX|" $i; done ) 
    7588if test `whoami` = root; then ldconfig; fi 
     89 
    7690%postun 
    7791if test `whoami` = root; then ldconfig; fi 
     92# 
    7893# %changelog date format as per  `date +"%a %d %b %Y"` 
    7994# first line should be   date  user  email 
  • tags/4.2.0/scripts/nxbuild.in

    r1924 r1924  
    3939libexecdir="@libexecdir@" 
    4040datadir="@datadir@" 
     41datarootdir="@datarootdir@" 
    4142libdir="@libdir@" 
    4243infodir="@infodir@" 
  • tags/4.2.0/src/Makefile.am

    r1924 r1924  
    4141 
    4242if HAVE_XML 
    43 XMLSRC = nxxml.c nxio.c nxio.h nxdataset.h nxdataset.c 
     43XMLSRC = nxxml.c nxio.c nxio.h 
    4444endif 
    4545##  the LIBS variable should contain all needed libs for the HDF support 
     
    7676#SUBDIRS=nxdict 
    7777 
    78 libNeXus_la_SOURCES = napi.c napiu.c nxstack.c nxstack.h stptok.c $(H4SRC) $(H5SRC) $(XMLSRC) $(MINGW_SRC) 
     78libNeXus_la_SOURCES = napi.c napiu.c nxstack.c nxstack.h stptok.c nxdataset.c nxdataset.h nx_stptok.h $(H4SRC) $(H5SRC) $(XMLSRC) $(MINGW_SRC) 
    7979libNeXus_la_LDFLAGS = -export-symbols nexus_symbols.sym @SHARED_LDFLAGS@ @HDF4_LDFLAGS@ @HDF5_LDFLAGS@ @XML_LDFLAGS@ $(LDFLAGS) 
    8080libNeXus_la_DEPENDENCIES = nexus_symbols.sym 
     
    9393## endif 
    9494 
    95 EXTRA_DIST=nexus_symbols.txt nexus_symbols_win.txt 
     95EXTRA_DIST=nexus_symbols.txt nexus_symbols_win.txt SConscript 
    9696CLEANFILES=libNeXus.def libNeXus.dll.lib libNeXus.dll.exp nexus_symbols.sym 
    9797 
  • tags/4.2.0/src/napi.c

    r1924 r1924  
    3636#include "nxstack.h" 
    3737 
     38/** 
     39 * \mainpage NeXus API documentation 
     40 * \section sec_purpose Purpose of API 
     41 * The NeXus Application Program Interface is a suite of subroutines, written in C but with wrappers in Fortran 77 and 90.  
     42 *  The subroutines call HDF routines to read and write the NeXus files with the correct structure.  
     43 * An API serves a number of useful purposes:  
     44 * - It simplifies the reading and writing of NeXus files.  
     45 * - It ensures a certain degree of compliance with the NeXus standard.  
     46 * - It allows the development of sophisticated input/output features such as automatic unit conversion. This has not been implemented yet.  
     47 * - It hides the implementation details of the format. In particular, the API can read and write HDF4,  
     48     HDF5 (and shortly XML) files using the same routines.  
     49 * For these reasons, we request that all NeXus files are written using the supplied API. We cannot be  
     50 * sure that anything written using the underlying HDF API will be recognized by NeXus-aware utilities.  
     51 * 
     52 * \section sec_core Core API 
     53 * The core API provides the basic routines for reading, writing and navigating NeXus files. It is designed to be modal;  
     54 * there is a hidden state that determines which groups and data sets are open at any given moment, and  
     55 * subsequent operations are implicitly performed on these entities. This cuts down the number of parameters  
     56 * to pass around in API calls, at the cost of forcing a certain pre-approved mode d'emploi. This mode d'emploi  
     57 * will be familiar to most: it is very similar to navigating a directory hierarchy; in our case, NeXus groups are the  
     58 * directories, which contain data sets and/or other directories.  
     59 * 
     60 * The core API comprises several functional groups which are listed on the \b Modules tab  
     61 * 
     62 * C programs that call the above routines should include the following header file:  
     63 * \code 
     64 * #include "napi.h" 
     65 * \endcode 
     66 */ 
     67 
     68 
     69 
    3870/*--------------------------------------------------------------------- 
    3971 Recognized and handled napimount URLS 
     
    5486#define PATHSEP "/" 
    5587#endif 
    56 extern char *stptok(char *s, char *tok, size_t toklen, char *brk); 
     88 
     89#include "nx_stptok.h" 
     90 
    5791/*--------------------------------------------------------------------- 
    5892 wrapper for getenv. This is a future proofing thing for porting to OS 
     
    93127  while(pPtr != NULL){ 
    94128    length = strlen(pathPrefix) + strlen(startName) + strlen(PATHSEP) + 2; 
    95     testPath = malloc(length*sizeof(char)); 
     129    testPath = (char*)malloc(length*sizeof(char)); 
    96130    if(testPath == NULL){ 
    97131      return strdup(startName); 
     
    251285  NXhandle hfile; 
    252286 
     287  *gHandle = NULL; 
    253288  fileStack = makeFileStack(); 
    254289  if(fileStack == NULL){ 
     
    275310    char error[1024]; 
    276311    char *filename = NULL; 
     312    int my_am = (am & NXACCMASK_REMOVEFLAGS); 
    277313         
    278314    /* configure fortify  
     
    297333    if(am & NXACC_NOSTRIP){ 
    298334      fHandle->stripFlag = 0; 
    299       am -= NXACC_NOSTRIP; 
    300     } 
    301  
    302     if (am==NXACC_CREATE) { 
     335      am = (NXaccess)(am & ~NXACC_NOSTRIP); 
     336    } 
     337 
     338    if (my_am==NXACC_CREATE) { 
    303339      /* HDF4 will be used ! */ 
    304340      hdf_type=1; 
    305341      filename = strdup(userfilename); 
    306     } else if (am==NXACC_CREATE4) { 
     342    } else if (my_am==NXACC_CREATE4) { 
    307343      /* HDF4 will be used ! */ 
    308344      hdf_type=1;    
    309345      filename = strdup(userfilename); 
    310     } else if (am==NXACC_CREATE5) { 
     346    } else if (my_am==NXACC_CREATE5) { 
    311347      /* HDF5 will be used ! */ 
    312348      hdf_type=2;    
    313349      filename = strdup(userfilename); 
    314     } else if (am==NXACC_CREATEXML) { 
     350    } else if (my_am==NXACC_CREATEXML) { 
    315351      /* XML will be used ! */ 
    316352      hdf_type=3;    
     
    422458    int status; 
    423459    pFileStack fileStack = NULL; 
    424     
    425460    pNexusFunction pFunc=NULL; 
     461    if (*fid == NULL) 
     462    { 
     463        return NX_OK; 
     464    } 
    426465    fileStack = (pFileStack)*fid; 
    427466    pFunc = peekFileOnStack(fileStack); 
     
    433472    if(fileStackDepth(fileStack) < 0){ 
    434473      killFileStack(fileStack); 
    435     } 
     474      *fid = NULL; 
     475    } 
     476    /* we can't set fid to NULL always as the handle points to a stack of files for external file support */ 
    436477    /*  
    437478    Fortify_CheckAllMemory(); 
    438479    */ 
     480 
    439481    return status;    
    440482  } 
     
    613655  { 
    614656    pNexusFunction pFunc = handleToNexusFunc(fid); 
    615     return pFunc->nxputattr(pFunc->pNexusData, name, data, datalen, iType); 
     657    if (datalen > 1 && iType != NX_CHAR) 
     658    { 
     659        NXIReportError(NXpData,"NXputattr: numeric arrays are not allowed as attributes - only character strings and single numbers"); 
     660        return NX_ERROR; 
     661    } 
     662    else 
     663    { 
     664        return pFunc->nxputattr(pFunc->pNexusData, name, data, datalen, iType); 
     665    } 
    616666  } 
    617667 
     
    807857    return status; 
    808858  } 
    809      
     859/*---------------------------------------------------------------------------*/ 
     860  NXstatus  NXgetrawinfo (NXhandle fid, int *rank,  
     861                                    int dimension[], int *iType) 
     862  { 
     863    int status; 
     864    char *pPtr = NULL; 
     865 
     866    pNexusFunction pFunc = handleToNexusFunc(fid); 
     867    status = pFunc->nxgetinfo(pFunc->pNexusData, rank, dimension, iType); 
     868    return status; 
     869  } 
    810870  /*-------------------------------------------------------------------------*/ 
    811871  
     
    9541014} 
    9551015/*------------------------------------------------------------------------*/ 
    956 NXstatus  NXisexternalgroup(NXhandle fid, CONSTCHAR *name, CONSTCHAR *class,  
     1016NXstatus  NXisexternalgroup(NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass,  
    9571017                            char *url, int urlLen){ 
    9581018  int status, attStatus, length = 1023, type = NX_CHAR; 
     
    9621022  pNexusFunction pFunc = handleToNexusFunc(fid); 
    9631023 
    964   status = pFunc->nxopengroup(pFunc->pNexusData, name,class); 
     1024  status = pFunc->nxopengroup(pFunc->pNexusData, name,nxclass); 
    9651025  if(status != NX_OK){ 
    9661026    return status; 
     
    9841044} 
    9851045/*------------------------------------------------------------------------*/ 
    986 NXstatus  NXlinkexternal(NXhandle fid, CONSTCHAR *name, CONSTCHAR *class,  
     1046NXstatus  NXlinkexternal(NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass,  
    9871047                         CONSTCHAR *url){ 
    9881048  int status, type = NX_CHAR, length; 
    9891049  pNexusFunction pFunc = handleToNexusFunc(fid); 
    9901050 
    991   status = pFunc->nxopengroup(pFunc->pNexusData,name,class); 
     1051  status = pFunc->nxopengroup(pFunc->pNexusData,name,nxclass); 
    9921052  if(status != NX_OK){ 
    9931053    return status; 
     
    13531413        if (gmt_offset < 0) 
    13541414        { 
    1355             time_format = "%04d-%02d-%02d %02d:%02d:%02d-%02d%02d"; 
     1415            time_format = "%04d-%02d-%02dT%02d:%02d:%02d-%02d:%02d"; 
    13561416        } 
    13571417        else 
    13581418        { 
    1359             time_format = "%04d-%02d-%02d %02d:%02d:%02d+%02d%02d"; 
     1419            time_format = "%04d-%02d-%02dT%02d:%02d:%02d+%02d:%02d"; 
    13601420        } 
    13611421        sprintf(time_buffer, time_format, 
     
    13721432    else 
    13731433    { 
    1374         strcpy(time_buffer, "1970-01-01 00:00:00+0000"); 
     1434        strcpy(time_buffer, "1970-01-01T00:00:00+00:00"); 
    13751435    } 
    13761436    return time_buffer; 
  • tags/4.2.0/src/napi4.c

    r1924 r1924  
    5353    char iAccess[2]; 
    5454  } NexusFile, *pNexusFile; 
    55  
     55   /*-------------------------------------------------------------------*/ 
     56   static void ignoreError(void *data, char *text){ 
     57   } 
    5658   /*--------------------------------------------------------------------*/ 
    5759 
     
    174176    int32 i, iN, iA, iD1, iD2; 
    175177    NXname pNam; 
    176     int32 iDim[MAX_VAR_DIMS]; 
     178    int32 iDim[H4_MAX_VAR_DIMS]; 
    177179   
    178180    self = NXIassert (fid); 
     
    292294    int iRet; 
    293295    int32 iData, iAtt, iRank, iType; 
    294     int32 iDim[MAX_VAR_DIMS]; 
     296    int32 iDim[H4_MAX_VAR_DIMS]; 
    295297    NXname pNam; 
    296298   
     
    337339  { 
    338340    int i; 
    339     int32 groupID, iA, iD1, iD2, iDim[MAX_VAR_DIMS]; 
     341    int32 groupID, iA, iD1, iD2, iDim[H4_MAX_VAR_DIMS]; 
    340342    NXname pText; 
    341343 
    342344    buffer[0] = '\0'; 
    343     for(i = 0; i < pFile->iStackPtr; i++){ 
     345    for(i = 1; i <= pFile->iStackPtr; i++){ 
    344346      strncat(buffer,"/",bufLen-strlen(buffer)); 
    345       groupID = Vattach(pFile->iVID,pFile->iStack[pFile->iStackPtr].iVref, 
    346                          "r"); 
    347       Vgetname(groupID, pText); 
    348       strncat(buffer,pText,bufLen-strlen(buffer)); 
    349       Vdetach(groupID); 
     347      groupID = Vattach(pFile->iVID,pFile->iStack[i].iVref, "r"); 
     348      if (groupID != -1) 
     349      { 
     350          if (Vgetname(groupID, pText) != -1) { 
     351              strncat(buffer,pText,bufLen-strlen(buffer)); 
     352          } else { 
     353              NXIReportError (NXpData, "ERROR: NXIbuildPath cannot get vgroup name"); 
     354          } 
     355          Vdetach(groupID); 
     356      } 
     357      else 
     358      { 
     359          NXIReportError (NXpData, "ERROR: NXIbuildPath cannot attach to vgroup"); 
     360      } 
    350361    } 
    351362    if(pFile->iCurrentSDS != 0){ 
    352       strncat(buffer,"/",bufLen-strlen(buffer)); 
    353       SDgetinfo(pFile->iCurrentSDS,pText,&iA,iDim,&iD1,&iD2); 
    354       strncat(buffer,pText,bufLen-strlen(buffer)); 
     363      if (SDgetinfo(pFile->iCurrentSDS,pText,&iA,iDim,&iD1,&iD2) != -1) { 
     364          strncat(buffer,"/",bufLen-strlen(buffer)); 
     365          strncat(buffer,pText,bufLen-strlen(buffer)); 
     366      } 
     367      else 
     368      { 
     369          NXIReportError (NXpData, "ERROR: NXIbuildPath cannot read SDS"); 
     370      } 
    355371    } 
    356372  }  
     
    374390   
    375391    *pHandle = NULL; 
     392 
     393    /* mask off any options for now */ 
     394    am = (NXaccess)(am & NXACCMASK_REMOVEFLAGS); 
    376395    /* map Nexus NXaccess types to HDF4 types */ 
    377396    if (am == NXACC_CREATE) { 
     
    651670    char pBuffer[256]; 
    652671    int i, iRet, type; 
    653     int32 myDim[MAX_VAR_DIMS];   
     672    int32 myDim[H4_MAX_VAR_DIMS];   
    654673 
    655674    pFile = NXIassert (fid); 
     
    780799    int32 iNew, iRet, type; 
    781800    char pBuffer[256]; 
    782     int i; 
    783     int32 myDim[MAX_VAR_DIMS];   
     801    int i, compress_level; 
     802    int32 myDim[H4_MAX_VAR_DIMS];   
    784803    comp_info compstruct; 
    785804 
     
    891910      
    892911    /* compress SD data set */ 
     912    compress_level = 6; 
     913    if( (compress_type / 100) == NX_COMP_LZW ) 
     914    { 
     915        compress_level = compress_type % 100; 
     916        compress_type = NX_COMP_LZW; 
     917    } 
    893918 
    894919    if(compress_type == NX_COMP_LZW) 
    895920    { 
    896       compstruct.deflate.level = 6;  
     921      compstruct.deflate.level = compress_level;  
    897922      iRet = SDsetcompress(iNew, COMP_CODE_DEFLATE, &compstruct); 
    898923      if (iRet < 0)  
     
    950975    pNexusFile pFile; 
    951976    int32 iRank, iAtt, iType, iRet; 
    952     int32 iSize[MAX_VAR_DIMS]; 
    953     int compress_typei = COMP_CODE_NONE; 
     977    int32 iSize[H4_MAX_VAR_DIMS]; 
     978    comp_coder_t compress_typei = COMP_CODE_NONE; 
    954979    NXname pBuffer; 
    955980    char pError[512]; 
    956981    comp_info compstruct;   
     982    int compress_level = 6; 
    957983    
    958984    pFile = NXIassert (fid); 
     
    971997      { 
    972998        compress_typei = COMP_CODE_DEFLATE; 
     999      } 
     1000      else if ( (compress_type / 100) == NX_COMP_LZW ) 
     1001      { 
     1002        compress_typei = COMP_CODE_DEFLATE; 
     1003        compress_level = compress_type % 100; 
     1004        compress_type = NX_COMP_LZW; 
    9731005      } 
    9741006      else if (compress_type == NX_COMP_RLE) 
     
    9911023    if(compress_type == NX_COMP_LZW) 
    9921024    { 
    993          compstruct.deflate.level = 6; 
     1025         compstruct.deflate.level = compress_level; 
    9941026    } 
    9951027    else if(compress_type == NX_COMP_HUF) 
     
    10891121  { 
    10901122    pNexusFile pFile; 
    1091     int32 iStart[MAX_VAR_DIMS], iSize[MAX_VAR_DIMS], iStride[MAX_VAR_DIMS]; 
     1123    int32 iStart[H4_MAX_VAR_DIMS], iSize[H4_MAX_VAR_DIMS], iStride[H4_MAX_VAR_DIMS]; 
    10921124    NXname pBuffer; 
    10931125    int32 iRank, iAtt, iType, iRet, i; 
     
    11021134    } 
    11031135    /* first read dimension information */ 
    1104     memset (iStart, 0, MAX_VAR_DIMS * sizeof (int32)); 
     1136    memset (iStart, 0, H4_MAX_VAR_DIMS * sizeof (int32)); 
    11051137    SDgetinfo (pFile->iCurrentSDS, pBuffer, &iRank, iSize, &iType, &iAtt); 
    11061138   
     
    11131145    iRet = SDwritedata (pFile->iCurrentSDS, iStart, iStride, iSize, data); 
    11141146    if (iRet < 0) { 
     1147      /* HEprint(stdout,0); */ 
    11151148      sprintf (pError, "ERROR: failure to write data to %s", pBuffer); 
    11161149      NXIReportError (NXpData, pError); 
     
    12001233    pNexusFile pFile; 
    12011234    int iRet; 
    1202     int32 iStride[MAX_VAR_DIMS]; 
    1203     int32 myStart[MAX_VAR_DIMS], mySize[MAX_VAR_DIMS]; 
     1235    int32 iStride[H4_MAX_VAR_DIMS]; 
     1236    int32 myStart[H4_MAX_VAR_DIMS], mySize[H4_MAX_VAR_DIMS]; 
    12041237    int32 i, iRank, iType, iAtt; 
    12051238    NXname pBuffer;   
     
    12141247    } 
    12151248    /* initialise stride to 1 */ 
    1216     for (i = 0; i < MAX_VAR_DIMS; i++) { 
     1249    for (i = 0; i < H4_MAX_VAR_DIMS; i++) { 
    12171250      iStride[i] = 1; 
    12181251    } 
     
    12561289  { 
    12571290    pNexusFile pFile; 
    1258    
     1291    ErrFunc oldErr; 
     1292    int datalen, type = NX_CHAR; 
     1293 
    12591294    pFile = NXIassert (fid); 
    12601295   
     
    12651300      sRes->iTag = DFTAG_NDG; 
    12661301      sRes->iRef = SDidtoref (pFile->iCurrentSDS); 
    1267       NXIbuildPath(pFile,sRes->targetPath,1024); 
     1302      oldErr = NXMGetError(); 
     1303      NXMSetError(NXpData, ignoreError); 
     1304      datalen = 1024; 
     1305      memset(&sRes->targetPath,0,1024); 
     1306      if(NX4getattr(fid,"target",&sRes->targetPath,&datalen,&type) != NX_OK) 
     1307      { 
     1308        NXIbuildPath(pFile,sRes->targetPath,1024); 
     1309      } 
     1310      NXMSetError(NXpData,oldErr); 
    12681311      return NX_OK; 
    12691312    } 
     
    14531496    int iRet, iStackPtr, iCurDir; 
    14541497    int32 iTemp, iD1, iD2, iA; 
    1455     int32 iDim[MAX_VAR_DIMS]; 
     1498    int32 iDim[H4_MAX_VAR_DIMS]; 
    14561499   
    14571500    pFile = NXIassert (fid); 
     
    15361579  { 
    15371580    pNexusFile pFile; 
    1538     int32 iStart[MAX_VAR_DIMS], iSize[MAX_VAR_DIMS]; 
     1581    int32 iStart[H4_MAX_VAR_DIMS], iSize[H4_MAX_VAR_DIMS]; 
    15391582    NXname pBuffer; 
    15401583    int32 iRank, iAtt, iType; 
     
    15481591    } 
    15491592    /* first read dimension information */ 
    1550     memset (iStart, 0, MAX_VAR_DIMS * sizeof (int32)); 
     1593    memset (iStart, 0, H4_MAX_VAR_DIMS * sizeof (int32)); 
    15511594    SDgetinfo (pFile->iCurrentSDS, pBuffer, &iRank, iSize, &iType, &iAtt); 
    15521595    /* actually read */ 
     
    15631606    pNexusFile pFile; 
    15641607    NXname pBuffer; 
    1565     int32 iAtt, myDim[MAX_VAR_DIMS], i, iRank, mType; 
     1608    int32 iAtt, myDim[H4_MAX_VAR_DIMS], i, iRank, mType; 
    15661609   
    15671610    pFile = NXIassert (fid); 
     
    15931636  { 
    15941637    pNexusFile pFile; 
    1595     int32 myStart[MAX_VAR_DIMS], mySize[MAX_VAR_DIMS]; 
     1638    int32 myStart[H4_MAX_VAR_DIMS], mySize[H4_MAX_VAR_DIMS]; 
    15961639    int32 i, iRank, iType, iAtt; 
    15971640    NXname pBuffer;   
     
    17961839    if ((*datalen <= iLen) &&  
    17971840     (*iType == DFNT_UINT8 || *iType == DFNT_CHAR8 || *iType == DFNT_UCHAR8)) { 
    1798       iLen = *datalen - 1; 
     1841      iLen = *datalen - 1; /* this enforces NULL termination regardless of size of datalen */ 
    17991842    } 
    18001843    memcpy (data, pData, iLen); 
     
    18121855    int iRet; 
    18131856    int32 iData, iAtt, iRank, iType; 
    1814     int32 iDim[MAX_VAR_DIMS]; 
     1857    int32 iDim[H4_MAX_VAR_DIMS]; 
    18151858    NXname pNam; 
    18161859   
     
    19041947     
    19051948    pFile = NXIassert (fid); 
    1906     NXIKillAttDir (fid); 
     1949    NXIKillAttDir (pFile); 
    19071950    iRet = NXIInitAttDir (pFile); 
    19081951    if (iRet == NX_ERROR) 
     
    19211964     
    19221965    pFile = NXIassert (fid); 
    1923     NXIKillDir (fid); 
     1966    NXIKillDir (pFile); 
    19241967    iRet = NXIInitDir (pFile); 
    19251968    if (iRet < 0) { 
  • tags/4.2.0/src/napi5.c

    r1924 r1924  
    135135  size_t rdcc_nbytes; 
    136136  double rdcc_w0; 
     137 
     138  /* mask of any options for now */ 
     139  am = (NXaccess)(am & NXACCMASK_REMOVEFLAGS); 
    137140 
    138141  /* turn off the automatic HDF error handling */   
     
    378381    } 
    379382    iVID = iRet; 
    380     strncpy(pFile->name_ref,pBuffer,1023); 
    381383    aid2 = H5Screate(H5S_SCALAR); 
    382384    aid1 = H5Tcopy(H5T_C_S1); 
     
    460462        } 
    461463        atype=H5Tcopy(H5T_C_S1); 
    462         H5Tset_size(atype,128);   
     464        H5Tset_size(atype,sizeof(data));   
    463465        iRet = H5Aread(attr1, atype, data); 
    464466        if (strcmp(data, nxclass) == 0) { 
     
    616618    hsize_t size[H5S_MAX_RANK]; 
    617619    hsize_t maxdims[H5S_MAX_RANK]; 
     620    int compress_level; 
    618621 
    619622    pFile = NXI5assert (fid); 
     
    652655/*  
    653656 *  This assumes string lenght is in the last dimensions and 
    654  *  the logic must be the same as used in NX5getglab and NX5getinfo 
     657 *  the logic must be the same as used in NX5getslab and NX5getinfo 
    655658 * 
    656659 *  search for tests on H5T_STRING 
    657660 */ 
    658661      byte_zahl=dimensions[rank-1];  
    659       dimensions[rank-1]=1; 
    660662      for(i = 0; i < rank; i++) 
    661663         { 
    662664         mydim1[i] = dimensions[i]; 
    663665         } 
    664       dimensions[rank-1] = byte_zahl; 
    665          dataspace=H5Screate_simple(rank,mydim1,NULL); 
     666       mydim1[rank-1] = 1; 
     667       if (dimensions[rank-1] > 1) 
     668       { 
     669           mydim[rank-1] = maxdims[rank-1] = size[rank-1] = 1; 
     670       } 
     671       if (chunkdims[rank-1] > 1)  
     672       {  
     673            chunkdims[rank-1] = 1;  
     674       } 
     675       if (dimensions[0] == NX_UNLIMITED) 
     676       { 
     677          mydim1[0] = 1; 
     678          maxdims[0] = H5S_UNLIMITED; 
     679       } 
     680         dataspace=H5Screate_simple(rank,mydim1,maxdims); 
    666681    } else { 
    667682      if (dimensions[0] == NX_UNLIMITED) 
     
    681696/*       H5Tset_strpad(H5T_STR_SPACEPAD); */ 
    682697    } 
     698    compress_level = 6; 
     699    if ( (compress_type / 100) ==  NX_COMP_LZW ) 
     700    { 
     701        compress_level = compress_type % 100; 
     702        compress_type = NX_COMP_LZW; 
     703    } 
    683704    if(compress_type == NX_COMP_LZW) 
    684705    { 
     
    689710        return NX_ERROR; 
    690711      } 
    691       H5Pset_deflate(cparms,6);  
     712      H5Pset_deflate(cparms,compress_level);  
    692713      iRet = H5Dcreate (pFile->iCurrentG, (char*)name, datatype1,  
    693714                        dataspace, cparms);    
     
    886907 
    887908  NXstatus  NX5putattr (NXhandle fid, CONSTCHAR *name, void *data,  
    888                                   int datalen, int iType) 
     909 
     910                        int datalen, int iType) 
    889911  { 
    890912    pNexusFile5 pFile; 
     
    910932      iRet=H5Adelete(vid,name); 
    911933      if (iRet<0) { 
    912         NXIReportError (NXpData, "ERROR: Old attribute cannot removed! "); 
     934        NXIReportError (NXpData, "ERROR: Old attribute cannot be removed! "); 
    913935        killAttVID(pFile,vid); 
    914936        return NX_ERROR; 
     
    944966    hsize_t myStart[H5S_MAX_RANK]; 
    945967    hsize_t mySize[H5S_MAX_RANK]; 
    946     hsize_t size[1],maxdims[H5S_MAX_RANK]; 
     968    hsize_t size[H5S_MAX_RANK],maxdims[H5S_MAX_RANK]; 
    947969    hid_t   filespace,dataspace;  
    948970   
     
    954976    } 
    955977    rank = H5Sget_simple_extent_ndims(pFile->iCurrentS);     
     978    iRet = H5Sget_simple_extent_dims(pFile->iCurrentS, NULL, maxdims); 
    956979    for(i = 0; i < rank; i++) 
    957980    { 
    958981       myStart[i] = iStart[i]; 
    959982       mySize[i]  = iSize[i]; 
    960     } 
    961     iRet = H5Sget_simple_extent_dims(pFile->iCurrentS, NULL, maxdims); 
     983       size[i]    = iSize[i]; 
     984    } 
     985    if (H5Tget_class(pFile->iCurrentT) == H5T_STRING) 
     986    { 
     987        mySize[rank - 1] = 1; 
     988        size[rank - 1] = 1; 
     989        myStart[rank - 1] = 0; 
     990    } 
    962991    dataspace = H5Screate_simple (rank, mySize, NULL); 
    963992    if (maxdims[0] == NX_UNLIMITED) 
     
    965994       size[0]=iStart[0] + iSize[0]; 
    966995       iRet = H5Dextend(pFile->iCurrentD, size); 
     996       if (iRet < 0)  
     997       { 
     998           NXIReportError (NXpData, "ERROR: extend slab failed"); 
     999           return NX_ERROR; 
     1000       } 
     1001 
    9671002       filespace = H5Dget_space(pFile->iCurrentD); 
    9681003        
     
    9791014       iRet = H5Dwrite(pFile->iCurrentD, pFile->iCurrentT, dataspace,  
    9801015                    filespace, H5P_DEFAULT,data); 
     1016       if (iRet < 0) 
     1017       { 
     1018           NXIReportError (NXpData, "ERROR: writing slab failed"); 
     1019       } 
    9811020       iRet = H5Sclose(filespace);              
    9821021   } else { 
     
    9931032       iRet = H5Dwrite(pFile->iCurrentD, pFile->iCurrentT, dataspace,  
    9941033                    pFile->iCurrentS, H5P_DEFAULT,data); 
     1034       if (iRet < 0) 
     1035       { 
     1036           NXIReportError (NXpData, "ERROR: writing slab failed"); 
     1037       } 
    9951038   } 
    9961039   /* deal with HDF errors */ 
     
    9981041   if (iRet < 0)  
    9991042   { 
    1000       NXIReportError (NXpData, "ERROR: writing slab failed"); 
     1043      NXIReportError (NXpData, "ERROR: closing slab failed"); 
    10011044      return NX_ERROR; 
    10021045   } 
     
    12851328      } else { 
    12861329        atype=H5Tcopy(H5T_C_S1); 
    1287         H5Tset_size(atype,64);   
     1330        H5Tset_size(atype,sizeof(data));   
    12881331        H5Aread(attr_id, atype, data); 
    12891332        strcpy(pClass,data); 
     
    15061549               type=H5T_C_S1; 
    15071550               atype=H5Tcopy(type); 
    1508                H5Tset_size(atype,128);   
     1551               H5Tset_size(atype,sizeof(data));   
    15091552               iRet = H5Aread(attr1, atype, data); 
    15101553               strcpy(nxclass,data); 
     
    17131756                     H5S_ALL, H5P_DEFAULT,tmp_data); 
    17141757          data1 = tmp_data + myStart[0]; 
    1715           strncpy(data,data1,(hsize_t)iSize[0]); 
     1758          strncpy((char*)data,data1,(hsize_t)iSize[0]); 
    17161759          free(tmp_data);            
    17171760      } else {     
     
    17551798     vid = getAttVID(pFile); 
    17561799 
     1800     pName[0] = '\0'; 
    17571801     idx=pFile->iAtt5.iCurrentIDX; 
    17581802     iRet=0; 
     
    17841828       } 
    17851829       strcpy(pName, iname); 
     1830       free(iname); 
    17861831       iname = NULL; 
    1787        free(iname); 
    17881832     } else { 
    17891833       strcpy(pName,"What is this?"); 
     
    18191863   { 
    18201864     pNexusFile5 pFile; 
    1821      int iNew, iRet, vid; 
     1865     int iNew, iRet, vid, asize; 
    18221866     hid_t type, atype = -1, glob; 
    18231867     char pBuffer[256]; 
     
    18411885     if (type==H5T_C_S1) 
    18421886     { 
     1887        atype = H5Aget_type(pFile->iCurrentA); 
     1888        asize = H5Tget_size(atype); 
     1889        H5Tclose(atype); 
    18431890        atype=H5Tcopy(type); 
    18441891        H5Tset_size(atype,*datalen);   
     1892        // use these two lines and remove the strlen one to not force NULL termination 
     1893        // H5Tset_strpad(atype, H5T_STR_NULLPAD); 
     1894        // *datalen = asize; 
    18451895        iRet = H5Aread(pFile->iCurrentA, atype, data); 
    1846         *datalen=strlen(data); 
     1896        *datalen = strlen((char*)data); 
    18471897     } else { 
    18481898       iRet = H5Aread(pFile->iCurrentA, type, data); 
     
    19512001         
    19522002    pFile = NXI5assert (fid); 
    1953     NXI5KillAttDir (fid); 
     2003    NXI5KillAttDir (pFile); 
    19542004    return NX_OK; 
    19552005  } 
     
    19622012         
    19632013    pFile = NXI5assert (fid); 
    1964     NXI5KillDir (fid); 
     2014    NXI5KillDir (pFile); 
    19652015    return NX_OK; 
    19662016  } 
  • tags/4.2.0/src/napi_exports.c

    r1924 r1924  
    88 
    99#define CALL_MODE       __stdcall 
     10 
     11#ifdef __cplusplus 
     12extern "C" { 
     13#endif /* __cplusplus */ 
     14 
    1015#include "napi_exports.h" 
     16 
     17#ifdef __cplusplus 
     18} 
     19#endif /* __cplusplus */ 
  • tags/4.2.0/src/napi_exports.h

    r1924 r1924  
    256256    return NXmakenamedlink(fid, newname, pLink); 
    257257} 
     258 
     259NXstatus CALL_MODE NXIGETRAWINFO(NXhandle handle, int* rank, int dimension[], int* datatype) 
     260{ 
     261    return NXgetrawinfo(handle, rank, dimension, datatype); 
     262} 
     263 
  • tags/4.2.0/src/napi_exports2.c

    r1924 r1924  
    88 
    99#define CALL_MODE       __cdecl 
     10 
     11#ifdef __cplusplus 
     12extern "C" { 
     13#endif /* __cplusplus */ 
     14 
    1015#include "napi_exports.h" 
     16 
     17#ifdef __cplusplus 
     18} 
     19#endif /* __cplusplus */ 
     20 
  • tags/4.2.0/src/nexus_symbols.txt

    r1924 r1924  
    5454NXMEnableErrorReporting 
    5555nximakenamedlink_ 
     56createNXDataset 
     57createTextNXDataset 
     58dropNXDataset 
     59getNXDatasetByteLength 
     60getNXDatasetDim 
     61getNXDatasetLength 
     62getNXDatasetRank 
     63getNXDatasetText 
     64getNXDatasetType 
     65getNXDatasetValue 
     66getNXDatasetValueAt 
     67putNXDatasetValue 
     68putNXDatasetValueAt 
     69nxigetrawinfo_ 
  • tags/4.2.0/src/nexus_symbols_win.txt

    r1924 r1924  
    2222NXIGETNEXTATTR@16 
    2323NXIGETNEXTENTRY@16 
     24NXIGETRAWINFO@16 
    2425NXIGETSLAB@16 
    2526NXIINITATTRDIR@4 
  • tags/4.2.0/src/nxdataset.c

    r1924 r1924  
    4747    length *= dim[i]; 
    4848  } 
    49   pNew->u.ptr = malloc(length*getTypeSize(typecode)); 
     49  /* add +1 in case of string NULL termination */ 
     50  pNew->u.ptr = malloc(length*getTypeSize(typecode)+1); 
    5051 
    5152  if(pNew->dim == NULL || pNew->u.ptr == NULL){ 
     
    6061  } 
    6162  pNew->magic = MAGIC; 
    62   memset(pNew->u.ptr,0,length*getTypeSize(typecode)); 
     63  /* add +1 in case of string NULL termination  - see above */ 
     64  memset(pNew->u.ptr,0,length*getTypeSize(typecode)+1); 
    6365  return pNew; 
    6466} 
  • tags/4.2.0/src/nxio.c

    r1924 r1924  
    228228 actual stuff for implementing the callback functions 
    229229 =====================================================================*/ 
     230 
     231/* 
     232 * if passed NX_CHAR, then returns dimension of -1 and the caller 
     233 * needs to do a strlen() or equivalent  
     234 */ 
    230235void analyzeDim(const char *typeString, int *rank,  
    231236                            int *iDim, int *type){ 
    232237  char dimString[132]; 
    233238  char dim[20]; 
    234   char *dimStart, *dimEnd; 
     239  const char *dimStart, *dimEnd; 
     240  char* dimTemp; 
    235241  int myRank; 
    236242 
    237243  if(strchr(typeString,(int)'[') == NULL){ 
     244    *rank = 1; 
    238245    switch(*type){ 
    239246    case NX_INT8: 
     
    250257      break; 
    251258    case NX_CHAR: 
    252       iDim[0] = -1; 
     259      iDim[0] = -1;     /* length unknown, caller needs to determine later */ 
     260      break; 
     261    default: 
     262      mxml_error("ERROR: (analyzeDim) unknown type code %d for typeString %s", *type, typeString); 
    253263      break; 
    254264    } 
     
    270280    memset(dimString,0,132); 
    271281    memcpy(dimString,dimStart,(dimEnd-dimStart)*sizeof(char)); 
    272     dimStart = stptok(dimString,dim,19,","); 
     282    dimTemp = stptok(dimString,dim,19,","); 
    273283    myRank = 0; 
    274     while(dimStart != NULL){ 
     284    while(dimTemp != NULL){ 
    275285      iDim[myRank] = atoi(dim); 
    276       dimStart = stptok(dimStart,dim,19,","); 
     286      dimTemp = stptok(dimTemp,dim,19,","); 
    277287      myRank++; 
    278288    } 
     
    281291} 
    282292/*--------------------------------------------------------------------*/ 
    283 int translateTypeCode(char *code){ 
     293int translateTypeCode(const char *code){ 
    284294  int i, result = -1; 
    285295   
     
    292302  return result; 
    293303} 
     304 
     305/*  
     306 * This is used to locate an Idims node from the new style table data layout 
     307 */ 
     308static mxml_node_t* findDimsNode(mxml_node_t *node) 
     309{ 
     310    mxml_node_t *tnode = NULL; 
     311    const char* name = node->value.element.name; 
     312    if ( (node->parent != NULL) && !strcmp(node->parent->value.element.name, DATA_NODE_NAME) ) 
     313    { 
     314        tnode = mxmlFindElement(node->parent->parent, node->parent->parent, DIMS_NODE_NAME, NULL, NULL, MXML_DESCEND_FIRST); 
     315        if (tnode != NULL) 
     316        { 
     317            tnode = mxmlFindElement(tnode,tnode,name,NULL,NULL,MXML_DESCEND_FIRST); 
     318        } 
     319    } 
     320    return tnode; 
     321} 
     322 
    294323/*---------------------------------------------------------------------*/ 
    295 static void analyzeDataType(mxml_node_t *parent, int *rank, int *type, 
     324/*return 1 if in table mode , 0 if not */ 
     325static int analyzeDataType(mxml_node_t *parent, int *rank, int *type, 
    296326                            int *iDim){ 
    297327  const char *typeString; 
     328  mxml_node_t* tnode; 
    298329  mxml_type_t myType; 
    299330  int i, nx_type = -1; 
     331  int table_mode = 0; 
    300332 
    301333  *rank = 1; 
     
    306338    get the type attribute. No attribute means: plain text 
    307339  */  
     340  tnode = findDimsNode(parent); 
     341  if (tnode != NULL) 
     342  { 
     343        table_mode = 1; 
     344        parent = tnode; 
     345  } 
    308346  typeString = mxmlElementGetAttr(parent,TYPENAME); 
    309347  if(typeString == NULL){ 
    310     return; 
     348    return table_mode; 
    311349  } 
    312350 
     
    321359     typeString); 
    322360    *type =NX_CHAR; 
    323     return; 
     361    return table_mode; 
    324362  } 
    325363 
     
    327365   
    328366  analyzeDim(typeString, rank, iDim, type); 
     367  if (table_mode) 
     368  { 
     369        *rank = 1; 
     370        iDim[0] = 1; 
     371  } 
     372  return table_mode; 
    329373} 
    330374/*-------------------------------------------------------------------*/ 
     
    359403mxml_type_t nexusTypeCallback(mxml_node_t *parent){ 
    360404  const char *typeString; 
     405  mxml_node_t * tnode; 
    361406 
    362407  if(strstr(parent->value.element.name,"?xml") != NULL || 
    363      strstr(parent->value.element.name,"NX") != NULL){ 
     408     !strncmp(parent->value.element.name,"NX",2) || 
     409     !strcmp(parent->value.element.name,DATA_NODE_NAME) || 
     410     !strcmp(parent->value.element.name,DIMS_NODE_NAME)){ 
    364411    return MXML_ELEMENT; 
    365412  } else { 
     413    /* data nodes do not habe TYPENAME in table style but are always CUSTOM */ 
     414    if (parent->parent != NULL && !strcmp(parent->parent->value.element.name, DATA_NODE_NAME)) 
     415    { 
     416        return MXML_CUSTOM; 
     417    } 
     418    if (parent->parent != NULL && !strcmp(parent->parent->value.element.name, DIMS_NODE_NAME)) 
     419    { 
     420        return MXML_OPAQUE; 
     421    } 
    366422    typeString = mxmlElementGetAttr(parent,TYPENAME); 
    367423    if(typeString == NULL){ 
     
    387443  long address, maxAddress; 
    388444  pNXDS dataset = NULL; 
    389   int i; 
     445  int i, table_mode; 
    390446 
    391447  parent = node->parent; 
    392   analyzeDataType(parent,&rank,&type,iDim); 
    393   if(iDim[0] == -1){ 
     448  table_mode = analyzeDataType(parent,&rank,&type,iDim); 
     449  if(iDim[0] == -1 || !strcmp(parent->parent->value.element.name, DIMS_NODE_NAME)){ 
    394450    iDim[0] = strlen(buffer); 
    395451    node->value.custom.data = strdup(buffer); 
     
    476532  char *buffer, *bufPtr; 
    477533  pNXDS dataset; 
    478   int bufsize, i, length, currentLen;  
    479  
     534  int bufsize, i, length, currentLen, table_style = 0;  
     535  int is_definition = 0; 
     536  /* this is set by nxconvert when making a definiton */ 
     537  is_definition = (getenv("NX_IS_DEFINITION") != NULL); 
     538 
     539  if (!strcmp(node->parent->parent->value.element.name, DATA_NODE_NAME)) 
     540  { 
     541        table_style = 1; 
     542  } 
    480543  /* 
    481544    allocate output buffer 
     
    505568  */ 
    506569  type = getNXDatasetType(dataset); 
    507   length = getNXDatasetLength(dataset); 
     570  if (is_definition) { 
     571    length = 1; 
     572  } else { 
     573    length = getNXDatasetLength(dataset); 
     574  } 
    508575  if(dataset->format != NULL){ 
    509576    strcpy(format,dataset->format); 
     
    515582    actually get the data out 
    516583  */ 
    517   currentLen = col; 
    518   myxml_add_char('\n',&bufPtr,&buffer,&bufsize); 
    519   stringIntoBuffer(&buffer,&bufPtr,&bufsize,indent); 
    520   for(i = 0; i < length; i++){ 
    521     formatNumber(getNXDatasetValueAt(dataset,i),pNumber,79,format,type); 
    522     if(currentLen + strlen(pNumber) > MXML_WRAP){ 
    523       /* 
    524         wrap line 
    525       */ 
     584  if (table_style) 
     585  { 
     586      for(i = 0; i < length; i++){ 
     587        formatNumber(getNXDatasetValueAt(dataset,i),pNumber,79,format,type); 
     588        stringIntoBuffer(&buffer,&bufPtr,&bufsize,pNumber); 
     589      } 
     590  } 
     591  else 
     592  { 
     593      currentLen = col; 
    526594      myxml_add_char('\n',&bufPtr,&buffer,&bufsize); 
    527595      stringIntoBuffer(&buffer,&bufPtr,&bufsize,indent); 
    528       currentLen = col; 
    529     } 
    530     stringIntoBuffer(&buffer,&bufPtr,&bufsize,pNumber); 
    531     myxml_add_char(' ',&bufPtr,&buffer,&bufsize); 
    532     currentLen += strlen(pNumber) + 1; 
     596      for(i = 0; i < length; i++){ 
     597        formatNumber(getNXDatasetValueAt(dataset,i),pNumber,79,format,type); 
     598        if(currentLen + strlen(pNumber) > MXML_WRAP){ 
     599          /* 
     600            wrap line 
     601          */ 
     602          myxml_add_char('\n',&bufPtr,&buffer,&bufsize); 
     603          stringIntoBuffer(&buffer,&bufPtr,&bufsize,indent); 
     604          currentLen = col; 
     605        } 
     606        stringIntoBuffer(&buffer,&bufPtr,&bufsize,pNumber); 
     607        myxml_add_char(' ',&bufPtr,&buffer,&bufsize); 
     608        currentLen += strlen(pNumber) + 1; 
     609      } 
    533610  } 
    534611  myxml_add_char('\0',&bufPtr,&buffer,&bufsize); 
     
    543620    return 0; 
    544621  } 
     622  if(strcmp(node->value.element.name,DIMS_NODE_NAME) == 0){ 
     623    return 0; 
     624  } 
     625  if(strcmp(node->value.element.name,DATA_NODE_NAME) == 0){ 
     626    return 0; 
     627  } 
    545628  if(strcmp(node->value.element.name,"NAPIlink") == 0){ 
    546629    return 0; 
     
    551634static int isTextData(mxml_node_t *node){ 
    552635  const char *attr = NULL; 
    553   int rank, type = 0, iDim[NX_MAXRANK]; 
    554636 
    555637  if(!isDataNode(node)){ 
     
    563645    return 1; 
    564646  } 
    565   analyzeDim(attr,&rank,iDim,&type); 
    566   if(type == NX_CHAR){ 
     647  if(strstr(attr,"NX_CHAR") != NULL){ 
    567648    return 1; 
    568649  } else { 
     
    580661 
    581662  if(strstr(node->value.element.name,"?xml") != NULL){ 
     663    return NULL; 
     664  } 
     665  if (node->parent != NULL && !strcmp(node->parent->value.element.name, DATA_NODE_NAME)) 
     666  { 
     667    return NULL; 
     668  } 
     669  if (where == MXML_WS_BEFORE_CLOSE && !strcmp(node->value.element.name, DATA_NODE_NAME)) 
     670  { 
    582671    return NULL; 
    583672  } 
  • tags/4.2.0/src/nxio.h

    r1924 r1924  
    3030#define TYPENAME "NAPItype" 
    3131 
     32#define DIMS_NODE_NAME "columns" 
     33#define DATA_NODE_NAME "row" 
     34 
    3235mxml_type_t nexusTypeCallback(mxml_node_t *parent); 
    3336const char *NXwhitespaceCallback(mxml_node_t *node, int where); 
     
    3942void getNumberText(int nx_type, char *typestring, int typeLen); 
    4043void destroyDataset(void *data); 
    41 int translateTypeCode(char *code); 
     44int translateTypeCode(const char *code); 
    4245int isDataNode(mxml_node_t *node); 
    4346void analyzeDim(const char *typeString, int *rank,  
  • tags/4.2.0/src/nxstack.c

    r1924 r1924  
    4545  pFileStack pNew = NULL; 
    4646   
    47   pNew = malloc(sizeof(fileStack)); 
     47  pNew = (pFileStack)malloc(sizeof(fileStack)); 
    4848  if(pNew == NULL){ 
    4949    return NULL; 
  • tags/4.2.0/src/nxxml.c

    r1924 r1924  
    5050    mxml_node_t *currentChild; 
    5151    int currentAttribute; 
     52    int options; /**< additional information about the node */ 
    5253}xmlStack; 
     54 
     55/* 
     56 * Freddie Akeroyd, 19/03/2008 
     57 * 
     58 * Add in support for table style data writing - this is  
     59 * indicated internally via the XMLSTACK_OPTION_TABLE flag 
     60 * and separates the dimensions and data into separate nodes contained 
     61 * in DIMS_NODE_NAME and DATA_NODE_NAME. This is a first commit and  
     62 * involves some code duplication that will need to be cleaned up later. 
     63 * Also writing in table style is only enabled for 1D arrays as 
     64 * I haven't done slab writing yet which the nexus test program uses 
     65 * for writing 2D arrays.  
     66 * 
     67 * Table output is enabled by opening a file with (NXACC_CREATEXML | NXACC_TABLE) 
     68 * 
     69 * See http://trac.nexusformat.org/code/ticket/111 for further details 
     70 */ 
     71#define XMLSTACK_OPTION_TABLE           0x1 /**< indicates table option in xmlStack */ 
     72 
     73/** 
     74 * Freddie Akeroyd 14/7/2008 
     75 * Add NeXus schema support - this uses BASE.xsd as the initial file 
     76 */ 
     77#define NEXUS_SCHEMA_VERSION    "3.0"   /**< version of NeXus definition schema */ 
     78#define NEXUS_SCHEMA_NAMESPACE  "http://definition.nexusformat.org/schema/" NEXUS_SCHEMA_VERSION        /**< XML schema namespace specified by xmlns */ 
     79#define NEXUS_SCHEMA_FILE       NEXUS_SCHEMA_NAMESPACE "/BASE.xsd" /**< location of default schema file for namespace */ 
     80 
    5381/*---------------------------------------------------------------------*/ 
    5482typedef struct { 
    5583  mxml_node_t *root;           /* root node */ 
    5684  int readOnly;                /* read only flag */ 
     85  int tableStyle;              /**< whether to output data in XML table style */ 
    5786  int stackPointer;            /* stack pointer */ 
    5887  char filename[1024];         /* file name, for NXflush, NXclose */ 
     
    118147  mxmlSetErrorCallback(errorCallbackForMxml); 
    119148 
     149  xmlHandle->tableStyle = ((am & NXACC_TABLE) ? 1 : 0); 
    120150  /* 
    121151    open file 
    122152  */ 
    123153  strncpy(xmlHandle->filename,filename,1023); 
    124   switch(am){ 
     154  switch(am & NXACCMASK_REMOVEFLAGS){ 
    125155  case NXACC_READ: 
    126156    xmlHandle->readOnly = 1; 
     
    141171    xmlHandle->stack[0].currentChild = NULL; 
    142172    xmlHandle->stack[0].currentAttribute = 0; 
     173    xmlHandle->stack[0].options = 0; 
    143174    fclose(fp); 
    144175    break; 
     
    150181    mxmlElementSetAttr(current,"XML_version","mxml"); 
    151182    mxmlElementSetAttr(current,"file_name",filename); 
     183    mxmlElementSetAttr(current,"xmlns", NEXUS_SCHEMA_NAMESPACE); 
     184    mxmlElementSetAttr(current,"xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance"); 
     185    mxmlElementSetAttr(current,"xsi:schemaLocation", 
     186        NEXUS_SCHEMA_NAMESPACE " " NEXUS_SCHEMA_FILE); 
    152187    time_buffer = NXIformatNeXusTime(); 
    153188    if(time_buffer != NULL){ 
     
    158193    xmlHandle->stack[0].currentChild = NULL; 
    159194    xmlHandle->stack[0].currentAttribute = 0; 
     195    xmlHandle->stack[0].options = 0; 
    160196    break; 
    161197  default: 
     
    306342  xmlHandle->stack[xmlHandle->stackPointer].currentChild = NULL; 
    307343  xmlHandle->stack[xmlHandle->stackPointer].currentAttribute = 0; 
     344  xmlHandle->stack[xmlHandle->stackPointer].options = 0; 
    308345  return NX_OK; 
    309346} 
     
    370407  return typestring; 
    371408} 
     409 
    372410/*------------------------------------------------------------------------*/ 
     411NXstatus  NXXmakedatatable (NXhandle fid,  
     412                                    CONSTCHAR *name, int datatype,  
     413                                    int rank, int dimensions[]){ 
     414  pXMLNexus xmlHandle = NULL; 
     415  mxml_node_t *dataNode = NULL, *dataNodeRoot = NULL, *dimsNode = NULL, *dimsNodeRoot = NULL; 
     416  mxml_node_t *newData = NULL; 
     417  mxml_node_t *current; 
     418  char *typestring; 
     419  int i, ndata;  
     420  static int one = 1; 
     421 
     422  xmlHandle = (pXMLNexus)fid; 
     423  assert(xmlHandle); 
     424 
     425  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     426    NXIReportError(NXpData,"Close dataset before trying to create a dataset"); 
     427    return NX_ERROR; 
     428  } 
     429  if(dimensions[0] < 0){ 
     430    dimensions[0] = 1; 
     431  } 
     432 
     433  current = xmlHandle->stack[xmlHandle->stackPointer].current; 
     434 
     435  dimsNodeRoot = mxmlFindElement(current, current, DIMS_NODE_NAME, NULL, NULL, MXML_DESCEND_FIRST); 
     436  if (dimsNodeRoot == NULL) 
     437  { 
     438      dimsNodeRoot = mxmlNewElement(current, DIMS_NODE_NAME); 
     439  } 
     440  dimsNode = mxmlNewElement(dimsNodeRoot, name); 
     441  mxmlNewOpaque(dimsNode, ""); 
     442  typestring = buildTypeString(datatype,rank,dimensions); 
     443  if(typestring != NULL){ 
     444    mxmlElementSetAttr(dimsNode,TYPENAME,typestring); 
     445    free(typestring); 
     446  } else { 
     447    NXIReportError(NXpData,"Failed to allocate typestring"); 
     448    return NX_ERROR; 
     449  } 
     450  ndata = 1; 
     451  for(i=0; i<rank; i++) 
     452  { 
     453     ndata *= dimensions[i]; 
     454  } 
     455  dataNodeRoot = current; 
     456  for(i=0; i<ndata; i++) 
     457  { 
     458      dataNodeRoot = mxmlFindElement(dataNodeRoot, current, DATA_NODE_NAME, NULL, NULL, (i == 0 ? MXML_DESCEND_FIRST : MXML_NO_DESCEND) ); 
     459      if (dataNodeRoot == NULL) 
     460      { 
     461          dataNodeRoot = mxmlNewElement(current, DATA_NODE_NAME); 
     462      } 
     463      dataNode = mxmlNewElement(dataNodeRoot,name); 
     464      newData = (mxml_node_t *)malloc(sizeof(mxml_node_t)); 
     465      if(!newData){ 
     466        NXIReportError(NXpData,"Failed to allocate space for dataset"); 
     467        return NX_ERROR; 
     468      } 
     469      memset(newData,0,sizeof(mxml_node_t)); 
     470      mxmlAdd(dataNode, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, newData); 
     471      newData->type = MXML_CUSTOM; 
     472/*        newData->value.custom.data = createNXDataset(rank,datatype,dimensions); */ 
     473      newData->value.custom.data = createNXDataset(1,datatype,&one); 
     474      if(!newData->value.custom.data){ 
     475        NXIReportError(NXpData,"Failed to allocate space for dataset"); 
     476        return NX_ERROR; 
     477      } 
     478      newData->value.custom.destroy = destroyDataset; 
     479  } 
     480  return NX_OK; 
     481} 
     482 
    373483NXstatus  NXXmakedata (NXhandle fid,  
    374484                                    CONSTCHAR *name, int datatype,  
     
    380490  char *typestring; 
    381491 
    382   xmlHandle = (pXMLNexus)fid; 
    383   assert(xmlHandle); 
     492 
     493  xmlHandle = (pXMLNexus)fid; 
     494  assert(xmlHandle); 
     495 
     496  if (xmlHandle->tableStyle && datatype != NX_CHAR && dimensions[0] != NX_UNLIMITED && rank == 1) 
     497  { 
     498      return NXXmakedatatable(fid,name,datatype,rank,dimensions); 
     499  } 
    384500 
    385501  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     
    389505  if(dimensions[0] < 0){ 
    390506    dimensions[0] = 1; 
    391   } 
    392   if ((datatype == NX_CHAR) && (rank > 1)) { 
    393     NXIReportError(NXpData,"NeXus XML-API does not yet support multi-dimensional character arrays"); 
    394     return NX_ERROR; 
    395507  } 
    396508 
     
    461573} 
    462574/*-----------------------------------------------------------------------*/ 
     575NXstatus  NXXopendatatable (NXhandle fid, CONSTCHAR *name){ 
     576  pXMLNexus xmlHandle = NULL; 
     577  mxml_node_t *dataNode = NULL, *dimsNode = NULL; 
     578  char error[1024]; 
     579 
     580  xmlHandle = (pXMLNexus)fid; 
     581  assert(xmlHandle); 
     582 
     583 
     584  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     585    /* 
     586      silently fix this 
     587    */ 
     588    xmlHandle->stackPointer--; 
     589    if(xmlHandle->stackPointer < 0){ 
     590      xmlHandle->stackPointer = 0; 
     591    } 
     592  } 
     593   
     594  dimsNode = mxmlFindElement(xmlHandle->stack[xmlHandle->stackPointer].current, 
     595                             xmlHandle->stack[xmlHandle->stackPointer].current, 
     596                             DIMS_NODE_NAME, 
     597                             NULL, 
     598                             NULL, 
     599                             MXML_DESCEND_FIRST); 
     600 
     601  if(!dimsNode){ 
     602    snprintf(error,1023,"Failed to open dataset %s",name); 
     603    NXIReportError(NXpData,error); 
     604    return NX_ERROR; 
     605  } 
     606 
     607  dataNode = mxmlFindElement(dimsNode, 
     608                             dimsNode, 
     609                             name, 
     610                             NULL, 
     611                             NULL, 
     612                             MXML_DESCEND_FIRST); 
     613  if(dataNode == NULL){ 
     614    dataNode = searchSDSLinks(xmlHandle,name); 
     615  } 
     616  if(!dataNode){ 
     617    snprintf(error,1023,"Failed to open dataset %s",name); 
     618    NXIReportError(NXpData,error); 
     619    return NX_ERROR; 
     620  } 
     621  xmlHandle->stackPointer++; 
     622  xmlHandle->stack[xmlHandle->stackPointer].current = dataNode; 
     623  xmlHandle->stack[xmlHandle->stackPointer].currentChild = NULL; 
     624  xmlHandle->stack[xmlHandle->stackPointer].currentAttribute = 0; 
     625  xmlHandle->stack[xmlHandle->stackPointer].options = XMLSTACK_OPTION_TABLE; 
     626  return NX_OK; 
     627} 
     628 
     629 
    463630NXstatus  NXXopendata (NXhandle fid, CONSTCHAR *name){ 
    464631  pXMLNexus xmlHandle = NULL; 
    465   mxml_node_t *dataNode = NULL; 
     632  mxml_node_t *dataNode = NULL, *current = NULL; 
    466633  char error[1024]; 
    467634 
    468635  xmlHandle = (pXMLNexus)fid; 
    469636  assert(xmlHandle); 
     637 
     638  /* is this a table style node ? */ 
     639  current = xmlHandle->stack[xmlHandle->stackPointer].current; 
     640  dataNode = mxmlFindElement(current, 
     641                             current, 
     642                             DATA_NODE_NAME, 
     643                             NULL, 
     644                             NULL, 
     645                             MXML_DESCEND_FIRST); 
     646  if (dataNode != NULL) 
     647  { 
     648      dataNode = mxmlFindElement(dataNode, 
     649                             dataNode, 
     650                             name, 
     651                             NULL, 
     652                             NULL, 
     653                             MXML_DESCEND_FIRST); 
     654  } 
     655  if (dataNode != NULL) 
     656  { 
     657        return NXXopendatatable(fid, name); 
     658  } 
    470659 
    471660  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     
    497686  xmlHandle->stack[xmlHandle->stackPointer].currentChild = NULL; 
    498687  xmlHandle->stack[xmlHandle->stackPointer].currentAttribute = 0; 
     688  xmlHandle->stack[xmlHandle->stackPointer].options = 0; 
    499689  return NX_OK; 
    500690} 
    501691/*----------------------------------------------------------------------*/ 
     692 
    502693NXstatus  NXXclosedata (NXhandle fid){ 
    503694  pXMLNexus xmlHandle = NULL; 
     
    525716  return NULL; 
    526717} 
     718 
     719/* we only havv to deal with non-character data here */ 
     720NXstatus  NXXputdatatable (NXhandle fid, void *data){ 
     721  pXMLNexus xmlHandle = NULL; 
     722  mxml_node_t *userData = NULL; 
     723  mxml_node_t *current = NULL; 
     724  mxml_node_t *nodeRoot = NULL; 
     725  mxml_node_t *dataNodeRoot = NULL; 
     726  mxml_node_t *dataNode = NULL; 
     727  const char* name; 
     728  pNXDS dataset; 
     729  int i, offset, length, type, rank, dim[NX_MAXRANK]; 
     730  char *pPtr = NULL; 
     731  xmlHandle = (pXMLNexus)fid; 
     732  assert(xmlHandle); 
     733  /* current points at the Idims node as done in NXXopendatatable */ 
     734  current = xmlHandle->stack[xmlHandle->stackPointer].current; 
     735  name = current->value.element.name; 
     736  /* we want to walk all Idata nodes and set name */ 
     737  nodeRoot =  current->parent->parent; 
     738  dataNodeRoot = nodeRoot; 
     739  offset = 0; 
     740  for(i=0; dataNodeRoot != NULL; i++) 
     741  { 
     742      dataNodeRoot = mxmlFindElement(dataNodeRoot, nodeRoot, DATA_NODE_NAME, NULL, NULL, (i == 0 ? MXML_DESCEND_FIRST : MXML_NO_DESCEND) ); 
     743      if (dataNodeRoot != NULL) 
     744      { 
     745        dataNode = mxmlFindElement(dataNodeRoot,dataNodeRoot,name,NULL,NULL,MXML_DESCEND_FIRST); 
     746        if (dataNode != NULL) 
     747        { 
     748            userData = findData(dataNode); 
     749            assert(userData != NULL); 
     750            dataset = (pNXDS)userData->value.custom.data; 
     751            assert(dataset); 
     752            length = getNXDatasetByteLength(dataset); 
     753            memcpy(dataset->u.ptr,(char*)data + offset,length); 
     754            offset += length; 
     755        } 
     756      } 
     757    }  
     758    return NX_OK; 
     759} 
     760 
    527761/*------------------------------------------------------------------------*/ 
    528762NXstatus  NXXputdata (NXhandle fid, void *data){ 
     
    531765  mxml_node_t *current = NULL; 
    532766  pNXDS dataset; 
    533   int length, type, rank, dim[NX_MAXRANK]; 
     767  int i, length, type, rank, dim[NX_MAXRANK]; 
    534768  char *pPtr = NULL; 
    535769 
    536770  xmlHandle = (pXMLNexus)fid; 
    537771  assert(xmlHandle); 
     772 
     773  if (xmlHandle->stack[xmlHandle->stackPointer].options & XMLSTACK_OPTION_TABLE) 
     774  { 
     775      return NXXputdatatable(fid,data); 
     776  } 
    538777 
    539778  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     
    551790    */ 
    552791    if(NXXgetinfo(fid,&rank, dim, &type) == NX_OK){ 
    553       pPtr = (char *)malloc((dim[0]+1)*sizeof(char)); 
     792      length = 1; 
     793      for(i=0; i<rank; i++) 
     794      { 
     795        length *= dim[i]; 
     796      } 
     797      pPtr = (char *)malloc((length+1)*sizeof(char)); 
    554798      if(pPtr != NULL){ 
    555         memcpy(pPtr,data,dim[0]); 
    556         pPtr[dim[0]] = '\0'; 
     799        memcpy(pPtr,data,length); 
     800        pPtr[length] = '\0'; 
    557801        mxmlSetOpaque(userData,(const char *)pPtr); 
    558802        free(pPtr); 
    559803      } 
    560804    } 
    561     mxmlSetOpaque(userData,(const char *)data); 
     805    else 
     806    { 
     807        NXIReportError(NXpData,"Unable to determine size of character dataset"); 
     808        return NX_ERROR; 
     809    } 
    562810  } else { 
    563811    dataset = (pNXDS)userData->value.custom.data; 
     
    568816  return NX_OK; 
    569817} 
     818 
     819NXstatus  NXXgetdatatable (NXhandle fid, void *data){ 
     820  pXMLNexus xmlHandle = NULL; 
     821  mxml_node_t *userData = NULL; 
     822  mxml_node_t *current = NULL; 
     823  mxml_node_t *nodeRoot = NULL; 
     824  mxml_node_t *dataNodeRoot = NULL; 
     825  mxml_node_t *dataNode = NULL; 
     826  const char* name; 
     827  pNXDS dataset; 
     828  int i, offset, length, type, rank, dim[NX_MAXRANK]; 
     829  xmlHandle = (pXMLNexus)fid; 
     830  assert(xmlHandle); 
     831 
     832  /* current points at the Idims node as done in NXXopendatatable */ 
     833  current = xmlHandle->stack[xmlHandle->stackPointer].current; 
     834  name = current->value.element.name; 
     835  /* we want to walk all Idata nodes and set name */ 
     836  nodeRoot =  current->parent->parent; 
     837  dataNodeRoot = nodeRoot; 
     838  offset = 0; 
     839  for(i=0; dataNodeRoot != NULL; i++) 
     840  { 
     841      dataNodeRoot = mxmlFindElement(dataNodeRoot, nodeRoot, DATA_NODE_NAME, NULL, NULL, (i == 0 ? MXML_DESCEND_FIRST : MXML_NO_DESCEND) ); 
     842      if (dataNodeRoot != NULL) 
     843      { 
     844        dataNode = mxmlFindElement(dataNodeRoot,dataNodeRoot,name,NULL,NULL,MXML_DESCEND_FIRST); 
     845        if (dataNode != NULL) 
     846        { 
     847            userData = findData(dataNode); 
     848            assert(userData != NULL); 
     849            dataset = (pNXDS)userData->value.custom.data; 
     850            assert(dataset); 
     851            length = getNXDatasetByteLength(dataset); 
     852            memcpy((char*)data + offset, dataset->u.ptr, length); 
     853            offset += length; 
     854        } 
     855      } 
     856    }  
     857    return NX_OK; 
     858} 
     859 
     860 
    570861/*------------------------------------------------------------------------*/ 
    571862NXstatus  NXXgetdata (NXhandle fid, void *data){ 
     
    574865  mxml_node_t *current = NULL; 
    575866  pNXDS dataset; 
    576   int length, type, rank, dim[NX_MAXRANK]; 
    577  
    578   xmlHandle = (pXMLNexus)fid; 
    579   assert(xmlHandle); 
     867  int i, length, type, rank, dim[NX_MAXRANK]; 
     868 
     869  xmlHandle = (pXMLNexus)fid; 
     870  assert(xmlHandle); 
     871 
     872  if (xmlHandle->stack[xmlHandle->stackPointer].options & XMLSTACK_OPTION_TABLE) 
     873  { 
     874      return NXXgetdatatable(fid,data); 
     875  } 
    580876 
    581877  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     
    592888    */ 
    593889    if(NXXgetinfo(fid,&rank, dim, &type) == NX_OK){ 
    594       strncpy((char *)data,userData->value.opaque,dim[0]); 
     890      length = 1; 
     891      for(i=0; i<rank; i++) 
     892      { 
     893          length *= dim[i]; 
     894      } 
     895      strncpy((char *)data,userData->value.opaque,length); 
    595896    } else { 
    596897      strcpy((char *)data,nxitrim(userData->value.opaque)); 
     
    636937      dimension[0]= strlen(userData->value.opaque); 
    637938    } else { 
     939      *iType = translateTypeCode(attr); 
    638940      analyzeDim(attr,rank,dimension,iType); 
    639       *rank = 1; 
    640       *iType = NX_CHAR; 
     941      if (dimension[0] == -1) /* 1D strings are NX_CHAR not NX_CHAR[] so length will not be correct */ 
     942      { 
     943        dimension[0] = strlen(userData->value.opaque); 
     944      } 
     945       
    641946    } 
    642947  } else {  
     
    7341039  return 1; 
    7351040} 
     1041 
     1042NXstatus  NXXputslabtable (NXhandle fid, void *data,  
     1043                                   int iStart[], int iSize[]){ 
     1044    return NX_OK; 
     1045} 
    7361046/*----------------------------------------------------------------------*/ 
    7371047NXstatus  NXXputslab (NXhandle fid, void *data,  
     
    7461056  xmlHandle = (pXMLNexus)fid; 
    7471057  assert(xmlHandle); 
     1058 
     1059  if (xmlHandle->stack[xmlHandle->stackPointer].options & XMLSTACK_OPTION_TABLE) 
     1060  { 
     1061      return NXXputslabtable(fid,data,iStart,iSize); 
     1062  } 
    7481063 
    7491064  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
     
    9841299  const char *attribute = NULL; 
    9851300  char error[1024]; 
    986   char *attData = NULL; 
     1301  const char *attData = NULL; 
    9871302  int iValue, nx_type; 
    9881303  float fValue; 
     
    10241339  switch(nx_type){ 
    10251340  case NX_CHAR: 
    1026     strncpy((char *)data, attribute, *datalen); 
    1027     *datalen = strlen(attribute); 
     1341    /* enforce NULL termination regardless of length of datalen */ 
     1342    strncpy((char *)data, attribute, *datalen-1); 
     1343    ((char*)data)[*datalen-1] = '\0'; 
     1344    /* *datalen = strlen(attribute); */ 
     1345    *datalen = strlen((char*)data); 
    10281346    *iType = NX_CHAR; 
    10291347    break; 
     
    10641382  return NX_OK; 
    10651383} 
     1384 
     1385/* find the next node, ignoring Idata */ 
     1386static mxml_node_t* find_node(mxml_node_t* node, int next) 
     1387{ 
     1388  int done = 0; 
     1389  mxml_node_t* parent_next = NULL; /* parent to use if we are in an Idims  search */ 
     1390   if (node == NULL) 
     1391   { 
     1392        return NULL; 
     1393   } 
     1394   if ( (node->parent != NULL)  && !strcmp(node->parent->value.element.name, DIMS_NODE_NAME) ) 
     1395   { 
     1396        parent_next = node->parent->next; 
     1397   } 
     1398   else 
     1399   { 
     1400        parent_next = NULL; 
     1401   } 
     1402   if (next) 
     1403   { 
     1404       if (node->next != NULL) 
     1405       { 
     1406            node = node->next; 
     1407       } 
     1408       else 
     1409       { 
     1410            node = parent_next; 
     1411       } 
     1412   } 
     1413   while(node != NULL && !done) 
     1414   { 
     1415     if ( (node->parent != NULL)  && !strcmp(node->parent->value.element.name, DIMS_NODE_NAME) ) 
     1416     { 
     1417        parent_next = node->parent->next; 
     1418     } 
     1419     else 
     1420     { 
     1421        parent_next = NULL; 
     1422     } 
     1423     if ( (node->type != MXML_ELEMENT) || !strcmp(node->value.element.name, DATA_NODE_NAME) ) 
     1424     { 
     1425        if (node->next != NULL) 
     1426        { 
     1427            node = node->next; 
     1428        } 
     1429        else 
     1430        { 
     1431            node = parent_next; 
     1432        } 
     1433        continue; 
     1434     } 
     1435     if (!strcmp(node->value.element.name, DIMS_NODE_NAME)) 
     1436     { 
     1437        node = node->child; 
     1438        continue; 
     1439     } 
     1440     done = 1; 
     1441  } 
     1442  return node; 
     1443} 
     1444 
    10661445/*====================== search functions =================================*/ 
    10671446NXstatus  NXXgetnextentry (NXhandle fid,NXname name,  
    10681447                                        NXname nxclass, int *datatype){ 
    10691448  pXMLNexus xmlHandle = NULL; 
    1070   mxml_node_t *next = NULL, *userData; 
     1449  mxml_node_t *next = NULL, *userData, *node = NULL; 
    10711450  int stackPtr; 
    10721451  const char *target = NULL, *attname = NULL; 
     
    10901469      initialization of search 
    10911470    */ 
    1092     xmlHandle->stack[stackPtr].currentChild =  
    1093       xmlHandle->stack[stackPtr].current->child; 
     1471      node = find_node(xmlHandle->stack[stackPtr].current->child, 0); 
    10941472  } else { 
    10951473    /* 
    10961474      proceed 
    10971475    */ 
    1098     xmlHandle->stack[stackPtr].currentChild =  
    1099       xmlHandle->stack[stackPtr].currentChild->next; 
    1100   } 
    1101   next = xmlHandle->stack[stackPtr].currentChild; 
     1476    node = find_node(xmlHandle->stack[stackPtr].currentChild, 1); 
     1477  } 
     1478  xmlHandle->stack[stackPtr].currentChild = node; 
     1479  next = node; 
    11021480  if(next == NULL){ 
    11031481    return NX_EOD; 
     
    12361614                                        NXname pName, NXname pClass){ 
    12371615  pXMLNexus xmlHandle = NULL; 
    1238   mxml_node_t *child = NULL; 
     1616  mxml_node_t *node = NULL, *child = NULL; 
    12391617  mxml_node_t *current = NULL; 
    12401618  const char *nameAtt = NULL; 
     
    12561634  strcpy(pClass,current->value.element.name); 
    12571635 
     1636/* count all child nodes, but need to ignore DATA_NODE_NAME and 
     1637 * descend into DIMS_NODE_NAME  
     1638 */ 
    12581639  childCount = 0; 
    1259   child = current->child; 
    1260   while(child != NULL){ 
    1261     childCount++; 
    1262     child = child->next; 
     1640  node = current->child; 
     1641  while(node != NULL) 
     1642  { 
     1643        if (!strcmp(node->value.element.name, DATA_NODE_NAME)) 
     1644        { 
     1645            ;   /* names also exist in DIMS_NODE_NAME so do nothing here */ 
     1646        } 
     1647        else if (!strcmp(node->value.element.name, DIMS_NODE_NAME)) 
     1648        { 
     1649            child = node->child; 
     1650            while(child != NULL) 
     1651            { 
     1652                /* not sure why this check is needed, but you double count otherwise */ 
     1653                if (child->type == MXML_ELEMENT)  
     1654                { 
     1655                    childCount++; 
     1656                } 
     1657                child = child->next; 
     1658            } 
     1659        } 
     1660        else 
     1661        { 
     1662            childCount++; 
     1663        } 
     1664        node = node->next; 
    12631665  } 
    12641666  *iN = childCount; 
     
    12691671  pXMLNexus xmlHandle = NULL; 
    12701672  mxml_node_t *current = NULL; 
    1271   int stackPtr, currentAtt; 
     1673  int stackPtr, currentAtt, skip; 
    12721674 
    12731675  xmlHandle = (pXMLNexus)fid; 
     
    12811683    hide type and group name attributes 
    12821684  */ 
    1283   if(!isDataNode(current)) { 
    1284     *iN = current->value.element.num_attrs -1; 
    1285     return NX_OK; 
    1286   } 
    1287   if(mxmlElementGetAttr(current,TYPENAME) != NULL){ 
    1288     *iN = current->value.element.num_attrs -1; 
     1685  skip=0; 
     1686  if(isDataNode(current)) { 
     1687    /* data nodes may have type */ 
     1688    if(mxmlElementGetAttr(current,TYPENAME) != NULL) skip=1; 
    12891689  } else { 
    1290     *iN = current->value.element.num_attrs; 
    1291   } 
     1690    /* group nodes (except root) have name */ 
     1691    if(mxmlElementGetAttr(current,"name") != NULL) skip=1; 
     1692  } 
     1693  *iN = current->value.element.num_attrs - skip; 
    12921694  return NX_OK; 
    12931695} 
  • tags/4.2.0/src/stptok.c

    r1924 r1924  
    1313#include <string.h> 
    1414#include <stdlib.h> 
     15#include "nx_stptok.h" 
    1516 
    1617char *stptok(const char *s, char *tok, size_t toklen, char *brk) 
     
    3839} 
    3940/*---------------------------------------------------------------------------*/ 
    40  char *SkipSpace(char *pText) 
     41 static char *SkipSpace(char *pText) 
    4142 { 
    4243   char *pRes; 
  • tags/4.2.0/test/Makefile.am

    r1924 r1924  
    3434LIBNEXUS77=$(top_builddir)/bindings/f77/libNeXus77.la 
    3535LIBNEXUS90=$(top_builddir)/bindings/f90/libNeXus90.la 
    36  
    37 AM_CPPFLAGS=-I. -I$(top_srcdir)/include 
     36LIBNEXUSCPP=$(top_builddir)/bindings/cpp/libNeXusCPP.la 
     37 
     38AM_CPPFLAGS=-I. -I$(top_srcdir)/include -I$(top_srcdir)/bindings/cpp 
    3839AM_FFLAGS=-I$(top_srcdir)/bindings/f77 
    39 CLEANFILES=NXtest.nx4 NXtest.nx5 NXtest.nxs NXtest.xml \ 
     40AM_FCFLAGS=-I$(top_builddir)/bindings/f90 
     41CLEANFILES=NXtest.nx4 NXtest.nx5 NXtest.nxs NXtest.xml NXtest-table.xml \ 
    4042        leak_test.nxs leak_test1.nxs leak_test2_*.nxs \ 
    41         nxtranslate nxsummary nxconvert nxdir nxbrowse 
     43        nxtranslate nxsummary nxconvert nxvalidate nxdir nxbrowse \ 
     44        NXtest.h4 NXtest.h5 
    4245 
    4346 
    4447## testdir=$(prefix)/nexus/test 
    4548 
    46 HDF4_TARGETS = napi_test-hdf4 napi_test-hdf4-static  
    47  
    48 HDF5_TARGETS = napi_test-hdf5 napi_test-hdf5-static 
    49  
    50 XML_TARGETS = napi_test-xml napi_test-xml-static 
     49HDF4_TARGETS = napi_test-hdf4 napi_test-hdf4-static napi_test_cpp-hdf4 
     50 
     51HDF5_TARGETS = napi_test-hdf5 napi_test-hdf5-static napi_test_cpp-hdf5 
     52 
     53XML_TARGETS = napi_test-xml napi_test-xml-static \ 
     54                napi_test-xml-table-static \ 
     55                napi_test_cpp-xml napi_test_cpp-xml-table 
    5156 
    5257F77_TARGETS = napif_test-hdf4 napif_test-hdf5 
    5358 
    5459F90_TARGETS = NXtest 
     60 
     61if HAVE_CPP 
     62CPP_TARGETS = leak_test2 leak_test3 
     63endif 
    5564 
    5665EXTRA_DIST      = testsuite.at $(TESTSUITE_AT) testsuite package.m4 \ 
     
    5867                        napi_test.c napif4_test.f napif5_test.f \ 
    5968                        setup_test $(srcdir)/data/dmc* \ 
    60                         nxbrowse.txt 
     69                        nxbrowse.txt napi_test_cpp.cxx 
    6170 
    6271TESTSUITE       = $(srcdir)/testsuite 
     
    6675AUTOTEST        = $(AUTOM4TE) --language=autotest 
    6776 
    68 check_PROGRAMS = run_test skip_test $(HDF4_TARGETS) $(HDF5_TARGETS) $(F77_TARGETS) $(F90_TARGETS) $(XML_TARGETS) leak_test1 leak_test2 leak_test3 
     77check_PROGRAMS = run_test skip_test $(HDF4_TARGETS) $(HDF5_TARGETS) $(F77_TARGETS) $(F90_TARGETS) $(XML_TARGETS) $(CPP_TARGETS) leak_test1 
    6978 
    7079#nxtestdir=$(NXTESTDIR) 
     
    7382 
    7483nxexampledir=$(NXEXAMPLEDIR) 
    75 nxexample_DATA = napi_test.c napif4_test.f napif5_test.f napif_test.f NXtest.f90 
     84nxexample_DATA = napi_test.c napif4_test.f napif5_test.f napif_test.f \ 
     85        NXtest.f90 napi_test_cpp.cxx 
    7686 
    7787nxsummary: 
     
    8595        ln -s ../applications/$@$(EXEEXT) $@ 
    8696 
     97nxvalidate: 
     98        rm -f $@ 
     99        ln -s ../applications/$@$(EXEEXT) $@ 
     100 
    87101nxbrowse: 
    88102        rm -f $@ 
     
    105119# this sets the test running environment - in case we 
    106120# have got built with shared HDF libraries we need to set LD_LIBRARY_PATH 
    107 TESTS_ENVIRONMENT=env LD_LIBRARY_PATH=$${LD_LIBRARY_PATH}:$(H4ROOT)/lib:$(H5ROOT)/lib:/usr/local/lib DYLD_LIBRARY_PATH=$${DYLD_LIBRARY_PATH}:$(H4ROOT)/lib:$(H5ROOT)/lib:/usr/local/lib 
     121TESTS_ENVIRONMENT=env PYTHON=$(PYTHON) IDL_PATH="@abs_top_srcdir@/bindings/idl:<IDL_DEFAULT>" IDL_DLM_PATH="@abs_top_builddir@/bindings/idl:<IDL_DEFAULT>" LD_LIBRARY_PATH=@abs_top_builddir@/src/.libs:@abs_top_builddir@/bindings/cpp/.libs:@abs_top_builddir@/bindings/idl:$${LD_LIBRARY_PATH}:@EXTRA_LD_LIBRARY_PATH@:/usr/local/lib DYLD_LIBRARY_PATH=@abs_top_builddir@/src/.libs:@abs_top_builddir@/bindings/cpp/.libs:@abs_top_builddir@/bindings/idl:$${DYLD_LIBRARY_PATH}:@EXTRA_LD_LIBRARY_PATH@:/usr/local/lib 
    108122 
    109123run_test_SOURCES=run_test.c 
    110 run_test_LDFLAGS=-static $(LDFLAGS) 
     124run_test_LDFLAGS=-static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    111125 
    112126skip_test_SOURCES=skip_test.c 
    113 skip_test_LDFLAGS=-static $(LDFLAGS) 
     127skip_test_LDFLAGS=-static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    114128 
    115129leak_test1_SOURCES=leak_test1.c 
    116130leak_test1_LDADD=$(LIBNEXUS) 
    117 leak_test1_LDFLAGS=-static $(LDFLAGS) 
     131leak_test1_LDFLAGS=-static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    118132 
    119133leak_test2_SOURCES=leak_test2.cxx 
    120134leak_test2_LDADD=$(LIBNEXUS) 
    121 leak_test2_LDFLAGS=-static $(LDFLAGS) 
     135leak_test2_LDFLAGS=-static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    122136 
    123137leak_test3_SOURCES=leak_test3.cxx 
    124138leak_test3_LDADD=$(LIBNEXUS) 
    125 leak_test3_LDFLAGS=-static $(LDFLAGS) 
     139leak_test3_LDFLAGS=-static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
     140 
    126141 
    127142if HAVE_XML 
     
    132147napi_test_xml_static_CPPFLAGS = -I$(top_srcdir)/include @XML_CPPFLAGS@ 
    133148napi_test_xml_static_LDADD = $(LIBNEXUS) @XML_LDFLAGS@ 
    134 napi_test_xml_static_LDFLAGS = -static $(LDFLAGS) 
     149napi_test_xml_static_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
     150napi_test_xml_table_static_SOURCES = napi_test.c 
     151napi_test_xml_table_static_CPPFLAGS = -I$(top_srcdir)/include @XML_CPPFLAGS@ 
     152napi_test_xml_table_static_LDADD = $(LIBNEXUS) @XML_LDFLAGS@ 
     153napi_test_xml_table_static_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
     154napi_test_cpp_xml_SOURCES = napi_test_cpp.cxx 
     155napi_test_cpp_xml_LDADD = $(LIBNEXUSCPP) 
     156napi_test_cpp_xml_table_SOURCES = napi_test_cpp.cxx 
     157napi_test_cpp_xml_table_LDADD = $(LIBNEXUSCPP) 
    135158else 
    136159napi_test_xml_SOURCES = dummy.c 
    137160napi_test_xml_static_SOURCES = dummy.c 
     161napi_test_xml_table_static_SOURCES = dummy.c 
    138162napi_test_xml_static_LDFLAGS = $(LDFLAGS) 
     163napi_test_cpp_xml_SOURCES = dummy.c 
     164napi_test_cpp_xml_table_SOURCES = dummy.c 
    139165endif 
    140166 
     
    146172napi_test_hdf4_static_CPPFLAGS = -I$(top_srcdir)/include @HDF4_CPPFLAGS@ 
    147173napi_test_hdf4_static_LDADD = $(LIBNEXUS) @HDF4_LDFLAGS@ 
    148 napi_test_hdf4_static_LDFLAGS = -static $(LDFLAGS) 
     174napi_test_hdf4_static_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
     175napi_test_cpp_hdf4_SOURCES = napi_test_cpp.cxx 
     176napi_test_cpp_hdf4_LDADD = $(LIBNEXUSCPP) 
    149177if HAVE_F77 
    150178napif_test_hdf4_SOURCES = napif4_test.f 
    151179napif_test_hdf4_LDADD = $(LIBNEXUS77) # $(FLIBS) 
    152180napif_test_hdf4_LINK = $(F77LINK) 
    153 napif_test_hdf4_LDFLAGS = -static $(LDFLAGS) 
     181napif_test_hdf4_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    154182else 
    155183napif_test_hdf4_SOURCES = dummy.c 
     
    162190napif_test_hdf4_SOURCES = dummy.c 
    163191napif_test_hdf4_LINK = $(LINK) 
     192napi_test_cpp_hdf4_SOURCES = dummy.c 
    164193endif 
    165194 
     
    171200napi_test_hdf5_static_CPPFLAGS = -I$(top_srcdir)/include @HDF5_CPPFLAGS@ 
    172201napi_test_hdf5_static_LDADD = $(LIBNEXUS) @HDF5_LDFLAGS@ 
    173 napi_test_hdf5_static_LDFLAGS = -static $(LDFLAGS) 
     202napi_test_hdf5_static_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
     203napi_test_cpp_hdf5_SOURCES = napi_test_cpp.cxx 
     204napi_test_cpp_hdf5_LDADD=$(LIBNEXUSCPP) 
    174205if HAVE_F77 
    175206napif_test_hdf5_SOURCES = napif5_test.f 
    176207napif_test_hdf5_LDADD = $(LIBNEXUS77) # $(FLIBS) 
    177208napif_test_hdf5_LINK = $(F77LINK) 
    178 napif_test_hdf5_LDFLAGS = -static $(LDFLAGS) 
     209napif_test_hdf5_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    179210else 
    180211napif_test_hdf5_SOURCES = dummy.c 
     
    187218napif_test_hdf5_SOURCES = dummy.c 
    188219napif_test_hdf5_LINK = $(LINK) 
     220napi_test_cpp_hdf5_SOURCES = dummy.c 
    189221endif 
    190222 
     
    193225NXtest_LDADD = $(LIBNEXUS90) 
    194226NXtest_LINK = $(FCLINK) 
    195 NXtest_LDFLAGS = -static $(LDFLAGS) 
     227NXtest_LDFLAGS = -static $(HDF4_LDFLAGS) $(HDF5_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS) 
    196228else 
    197229NXtest_SOURCES = dummy.c 
     
    211243        } > $(srcdir)/package.m4 
    212244 
    213 check-local: atconfig atlocal nxconvert nxsummary nxdir nxbrowse nxtranslate $(TESTSUITE)  
     245check-local: atconfig atlocal nxconvert nxvalidate nxsummary nxdir nxbrowse nxtranslate $(TESTSUITE)  
    214246        $(TESTS_ENVIRONMENT) $(SHELL) $(TESTSUITE) 
    215247 
  • tags/4.2.0/test/atlocal.in

    r1924 r1924  
    5757export HAVE_NXTRANSLATE 
    5858# 
     59if test ! -z "@WGET@"; then 
     60    HAVE_WGET=run_test 
     61else 
     62    HAVE_WGET=skip_test 
     63fi 
     64export HAVE_WGET 
     65# 
     66if test ! -z "@XMLLINT@"; then 
     67    HAVE_XMLLINT=run_test 
     68else 
     69    HAVE_XMLLINT=skip_test 
     70fi 
     71export HAVE_XMLLINT 
     72# 
     73if test ! -z "@PYTHONROOT@"; then 
     74    HAVE_PYTHON=run_test 
     75else 
     76    HAVE_PYTHON=skip_test 
     77fi 
     78export HAVE_PYTHON 
     79# 
     80if test ! -z "@IDLROOT@"; then 
     81    HAVE_IDL=run_test 
     82else 
     83    HAVE_IDL=skip_test 
     84fi 
     85export HAVE_IDL 
     86# 
  • tags/4.2.0/test/leak_test2.cxx

    r1924 r1924  
    11#include <sstream> 
     2#include <cstdlib> 
    23#include <napi.h> 
    34#include <unistd.h> 
  • tags/4.2.0/test/napi_test.c

    r1924 r1924  
    3737int main (int argc, char *argv[]) 
    3838{ 
    39   int i, j, NXrank, NXdims[32], NXtype, NXlen, entry_status, attr_status; 
     39  int i, j, k, n, NXrank, NXdims[32], NXtype, NXlen, entry_status, attr_status; 
    4040  float r; 
    4141  void *data_buffer; 
     
    5353  char name[64], char_class[64], char_buffer[128]; 
    5454  char group_name[64], class_name[64]; 
     55  char c1_array[5][4] = {{'a', 'b', 'c' ,'d'}, {'e', 'f', 'g' ,'h'},  
     56     {'i', 'j', 'k', 'l'}, {'m', 'n', 'o', 'p'}, {'q', 'r', 's' , 't'}}; 
     57  int unlimited_cdims[2] = {NX_UNLIMITED, 4}; 
    5558  NXhandle fileid; 
    5659  NXlink glink, dlink, blink; 
     
    6265  char filename[256]; 
    6366  int64_t grossezahl[4]; 
     67  const char* ch_test_data = "NeXus ><}&{'\\&\" Data"; 
    6468 
    6569  grossezahl[0] = 12; 
     
    7680    nx_creation_code = NXACC_CREATE5; 
    7781    strcpy(nxFile,"NXtest.h5"); 
     82  }else if(strstr(argv[0],"napi_test-xml-table") != NULL){ 
     83    nx_creation_code = NXACC_CREATEXML | NXACC_TABLE; 
     84    strcpy(nxFile,"NXtest-table.xml"); 
    7885  }else if(strstr(argv[0],"napi_test-xml") != NULL){ 
    7986    nx_creation_code = NXACC_CREATEXML; 
     
    9198  if(NXputattr(fileid,"hugo","namenlos",strlen("namenlos"), NX_CHAR) != NX_OK) return 1; 
    9299  if(NXputattr(fileid,"cucumber","passion",strlen("passion"), NX_CHAR) != NX_OK) return 1; 
    93      NXlen = 10; 
     100     NXlen = strlen(ch_test_data); 
    94101     if (NXmakedata (fileid, "ch_data", NX_CHAR, 1, &NXlen) != NX_OK) return 1; 
    95102     if (NXopendata (fileid, "ch_data") != NX_OK) return 1; 
    96         if (NXputdata (fileid, "NeXus data") != NX_OK) return 1; 
     103        if (NXputdata (fileid, ch_test_data) != NX_OK) return 1; 
     104     if (NXclosedata (fileid) != NX_OK) return 1; 
     105     if (NXmakedata (fileid, "c1_data", NX_CHAR, 2, array_dims) != NX_OK) return 1; 
     106     if (NXopendata (fileid, "c1_data") != NX_OK) return 1; 
     107        if (NXputdata (fileid, c1_array) != NX_OK) return 1; 
    97108     if (NXclosedata (fileid) != NX_OK) return 1; 
    98109     if (NXmakedata (fileid, "i1_data", NX_INT8, 1, &array_dims[1]) != NX_OK) return 1; 
     
    118129        slab_start[0] = 0; slab_start[1] = 0; slab_size[0] = 4; slab_size[1] = 4; 
    119130        if (NXputslab (fileid, r8_array, slab_start, slab_size) != NX_OK) return 1; 
    120         if (NXputattr (fileid, "ch_attribute", "NeXus", strlen ("NeXus"), NX_CHAR) != NX_OK) return 1; 
     131        if (NXputattr (fileid, "ch_attribute", ch_test_data, strlen (ch_test_data), NX_CHAR) != NX_OK) return 1; 
    121132        i = 42; 
    122133        if (NXputattr (fileid, "i4_attribute", &i, 1, NX_INT32) != NX_OK) return 1; 
     
    171182        if (NXclosedata (fileid) != NX_OK) return 1; 
    172183        if (NXgetgroupID (fileid, &glink) != NX_OK) return 1; 
     184        if (nx_creation_code & NXACC_CREATEXML == 0) { 
     185            if (NXmakedata (fileid, "cdata_unlimited", NX_CHAR, 2, unlimited_cdims) != NX_OK) return 1; 
     186            if (NXopendata (fileid, "cdata_unlimited") != NX_OK) return 1; 
     187            slab_size[0] = 1; 
     188            slab_size[1] = 4; 
     189            slab_start[1] = 0; 
     190            for (i = 0; i < 5; i++) 
     191            { 
     192               slab_start[0] = i; 
     193               if (NXputslab (fileid, &(c1_array[i][0]), slab_start, slab_size) != NX_OK) return 1; 
     194            } 
     195            if (NXclosedata (fileid) != NX_OK) return 1; 
     196        } 
    173197     if (NXclosegroup (fileid) != NX_OK) return 1; 
    174198  if (NXclosegroup (fileid) != NX_OK) return 1; 
     
    249273                 printf ("   %s(%d)", name, NXtype); 
    250274              if (NXmalloc ((void **) &data_buffer, NXrank, NXdims, NXtype) != NX_OK) return 1; 
     275              n = 1; 
     276              for(k=0; k<NXrank; k++) 
     277              { 
     278                  n *= NXdims[k]; 
     279              } 
    251280              if (NXtype == NX_CHAR) { 
    252281                 if (NXgetdata (fileid, data_buffer) != NX_OK) return 1; 
    253                     print_data (" = ", data_buffer, NXtype, 10); 
     282                    print_data (" = ", data_buffer, NXtype, n); 
    254283              } else if (NXtype != NX_FLOAT32 && NXtype != NX_FLOAT64) { 
    255284                 if (NXgetdata (fileid, data_buffer) != NX_OK) return 1; 
    256                     print_data (" = ", data_buffer, NXtype, 4); 
     285                    print_data (" = ", data_buffer, NXtype, n); 
    257286              } else { 
    258287                 slab_start[0] = 0; 
  • tags/4.2.0/test/testsuite.at

    r1924 r1924  
    3131[[NXinquirefile found: NXtest.hdf 
    3232Number of global attributes: 4 
    33    NeXus_version = 4.1.0 
     33   NeXus_version = 4.2.0 
    3434   file_name = NXtest.hdf 
    3535Number of group attributes: 2 
    3636   hugo = namenlos 
    3737   cucumber = passion 
    38 Group: entry(NXentry) contains 8 items 
    39    ch_data(4) = NeXus data 
     38Group: entry(NXentry) contains 9 items 
     39   ch_data(4) = NeXus ><}&{'\&" Data 
     40   c1_data(4) = abcdefghijklmnopqrst 
    4041   i1_data(20) =  1 2 3 4 
    4142   i2_data(22) =  1000 2000 3000 4000 
     
    5455       17.000000 18.000000 19.000000 20.000000 
    5556      Number of attributes : 4 
    56          ch_attribute : NeXus 
     57         ch_attribute : NeXus ><}&{'\&" Data 
    5758         i4_attribute : 42 
    5859         r4_attribute : 3.141593 
     
    7677[[NXinquirefile found: NXtest.h5 
    7778Number of global attributes: 4 
    78    NeXus_version = 4.1.0 
     79   NeXus_version = 4.2.0 
    7980   file_name = NXtest.h5 
    8081Number of group attributes: 2 
    8182   hugo = namenlos 
    8283   cucumber = passion 
    83 Group: entry(NXentry) contains 9 items 
    84    ch_data(4) = NeXus data 
     84Group: entry(NXentry) contains 10 items 
     85   c1_data(4) = abcdefghijklmnopqrst 
     86   ch_data(4) = NeXus ><}&{'\&" Data 
    8587   Subgroup: data(NXdata) 
    8688   grosse_zahl(26) =  12 555555555555 23 777777777777 
     
    101103       17.000000 18.000000 19.000000 20.000000 
    102104      Number of attributes : 4 
    103          ch_attribute : NeXus 
     105         ch_attribute : NeXus ><}&{'\&" Data 
    104106         i4_attribute : 42 
    105107         r4_attribute : 3.141593 
     
    122124[[NXinquirefile found: NXtest.hdf 
    123125Number of global attributes: 4 
    124    NeXus_version = 4.1.0 
     126   NeXus_version = 4.2.0 
    125127   file_name = NXtest.hdf 
    126128Number of group attributes: 2 
    127129   hugo = namenlos 
    128130   cucumber = passion 
    129 Group: entry(NXentry) contains 8 items 
    130    ch_data(4) = NeXus data 
     131Group: entry(NXentry) contains 9 items 
     132   ch_data(4) = NeXus ><}&{'\&" Data 
     133   c1_data(4) = abcdefghijklmnopqrst 
    131134   i1_data(20) =  1 2 3 4 
    132135   i2_data(22) =  1000 2000 3000 4000 
     
    145148       17.000000 18.000000 19.000000 20.000000 
    146149      Number of attributes : 4 
    147          ch_attribute : NeXus 
     150         ch_attribute : NeXus ><}&{'\&" Data 
    148151         i4_attribute : 42 
    149152         r4_attribute : 3.141593 
     
    167170[[NXinquirefile found: NXtest.h5 
    168171Number of global attributes: 4 
    169    NeXus_version = 4.1.0 
     172   NeXus_version = 4.2.0 
    170173   file_name = NXtest.h5 
    171174Number of group attributes: 2 
    172175   hugo = namenlos 
    173176   cucumber = passion 
    174 Group: entry(NXentry) contains 9 items 
    175    ch_data(4) = NeXus data 
     177Group: entry(NXentry) contains 10 items 
     178   c1_data(4) = abcdefghijklmnopqrst 
     179   ch_data(4) = NeXus ><}&{'\&" Data 
    176180   Subgroup: data(NXdata) 
    177181   grosse_zahl(26) =  12 555555555555 23 777777777777 
     
    192196       17.000000 18.000000 19.000000 20.000000 
    193197      Number of attributes : 4 
    194          ch_attribute : NeXus 
     198         ch_attribute : NeXus ><}&{'\&" Data 
    195199         i4_attribute : 42 
    196200         r4_attribute : 3.141593 
     
    212216AT_CHECK([ $HAVE_XML && $SETUP_TEST && napi_test-xml | sed -e 's/\r$//' ], [],  
    213217[[NXinquirefile found: NXtest.xml 
    214 Number of global attributes: 3 
    215    NeXus_version = 4.1.0 
     218Number of global attributes: 7 
     219   NeXus_version = 4.2.0 
    216220   file_name = NXtest.xml 
     221   xmlns = http://definition.nexusformat.org/schema/3.0 
     222   xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance 
     223   xsi:schemaLocation = http://definition.nexusformat.org/schema/3.0 http://definition.nexusformat.org/schema/3.0/BASE.xsd 
    217224Number of group attributes: 2 
    218225   hugo = namenlos 
    219226   cucumber = passion 
    220 Group: entry(NXentry) contains 9 items 
    221    ch_data(4) = NeXus data 
     227Group: entry(NXentry) contains 10 items 
     228   ch_data(4) = NeXus ><}&{'\&" Data 
     229   c1_data(4) = abcdefghijklmnopqrst 
    222230   i1_data(20) =  1 2 3 4 
    223231   i2_data(22) =  1000 2000 3000 4000 
     
    236244       17.000000 18.000000 19.000000 20.000000 
    237245      Number of attributes : 4 
    238          ch_attribute : NeXus 
     246         ch_attribute : NeXus ><}&{'\&" Data 
    239247         i4_attribute : 42 
    240248         r4_attribute : 3.141593 
     
    258266AT_CHECK([ $HAVE_XML && $SETUP_TEST && napi_test-xml-static | sed -e 's/\r$//' ], [],  
    259267[[NXinquirefile found: NXtest.xml 
    260 Number of global attributes: 3 
    261    NeXus_version = 4.1.0 
     268Number of global attributes: 7 
     269   NeXus_version = 4.2.0 
    262270   file_name = NXtest.xml 
     271   xmlns = http://definition.nexusformat.org/schema/3.0 
     272   xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance 
     273   xsi:schemaLocation = http://definition.nexusformat.org/schema/3.0 http://definition.nexusformat.org/schema/3.0/BASE.xsd 
    263274Number of group attributes: 2 
    264275   hugo = namenlos 
    265276   cucumber = passion 
    266 Group: entry(NXentry) contains 9 items 
    267    ch_data(4) = NeXus data 
     277Group: entry(NXentry) contains 10 items 
     278   ch_data(4) = NeXus ><}&{'\&" Data 
     279   c1_data(4) = abcdefghijklmnopqrst 
    268280   i1_data(20) =  1 2 3 4 
    269281   i2_data(22) =  1000 2000 3000 4000 
     
    282294       17.000000 18.000000 19.000000 20.000000 
    283295      Number of attributes : 4 
    284          ch_attribute : NeXus 
     296         ch_attribute : NeXus ><}&{'\&" Data 
    285297         i4_attribute : 42 
    286298         r4_attribute : 3.141593 
     
    301313AT_CLEANUP 
    302314 
    303 AT_BANNER([Check the FORTRAN 77 binding.]) 
     315AT_SETUP([Check the XML table binding (static library)]) 
     316AT_CHECK([ $HAVE_XML && $SETUP_TEST && napi_test-xml-table-static | sed -e 's/\r$//' ], [],  
     317[[NXinquirefile found: NXtest-table.xml 
     318Number of global attributes: 7 
     319   NeXus_version = 4.2.0 
     320   file_name = NXtest-table.xml 
     321   xmlns = http://definition.nexusformat.org/schema/3.0 
     322   xmlns:xsi = http://www.w3.org/2001/XMLSchema-instance 
     323   xsi:schemaLocation = http://definition.nexusformat.org/schema/3.0 http://definition.nexusformat.org/schema/3.0/BASE.xsd 
     324Number of group attributes: 2 
     325   hugo = namenlos 
     326   cucumber = passion 
     327Group: entry(NXentry) contains 10 items 
     328   ch_data(4) = NeXus ><}&{'\&" Data 
     329   c1_data(4) = abcdefghijklmnopqrst 
     330   i1_data(20) =  1 2 3 4 
     331   i2_data(22) =  1000 2000 3000 4000 
     332   i4_data(24) =  1000000 2000000 3000000 4000000 
     333   grosse_zahl(26) =  12 555555555555 23 777777777777 
     334   r4_data(5) 
     335       1.000000 2.000000 3.000000 4.000000 
     336       5.000000 6.000000 7.000000 8.000000 
     337       9.000000 10.000000 11.000000 12.000000 
     338       13.000000 14.000000 15.000000 16.000000 
     339       17.000000 18.000000 19.000000 20.000000 
     340   r8_data(6) 
     341       1.000000 2.000000 3.000000 4.000000 
     342       5.000000 6.000000 7.000000 8.000000 
     343       9.000000 10.000000 11.000000 12.000000 
     344       13.000000 14.000000 15.000000 16.000000 
     345       17.000000 18.000000 19.000000 20.000000 
     346      Number of attributes : 4 
     347         ch_attribute : NeXus ><}&{'\&" Data 
     348         i4_attribute : 42 
     349         r4_attribute : 3.141593 
     350         target : /entry/r8_data 
     351   Subgroup: data(NXdata) 
     352   Subgroup: sample(NXsample) 
     353Link check OK 
     354NXopenpath checks OK 
     355First file time: 2005-05-27 05:44:13 
     356NXinquirefile found: data/dmc01.xml 
     357Second file sample: Ga0.94Mn0.04Sb_8mm 
     358NXinquirefile found: data/dmc02.xml 
     359Second file time: 2005-05-27 05:48:56 
     360entry1 external URL = nxfile://data/dmc01.xml#/entry1 
     361External File Linking tested OK 
     362]]) 
     363AT_CLEANUP 
     364 
     365AT_BANNER([Check the FORTRAN binding.]) 
    304366 
    305367AT_SETUP([Check the F77 binding using HDF4.]) 
    306368AT_CHECK([ $HAVE_F77 && $HAVE_HDF4 && $SETUP_TEST && napif_test-hdf4 | sed -e 's/\r$//' ], [],  
    307369[[ Number of global attributes:  4 
    308     NeXus_version = 4.1.0 
     370    NeXus_version = 4.2.0 
    309371    file_name = NXtest.nxs 
    310372 Group: entry(NXentry) contains  8 items 
     
    342404AT_CHECK([ $HAVE_F77 && $HAVE_HDF5 && $SETUP_TEST && napif_test-hdf5 | sed -e 's/\r$//' ], [],  
    343405[[ Number of global attributes:  4 
    344     NeXus_version = 4.1.0 
     406    NeXus_version = 4.2.0 
    345407    file_name = NXtest.nxs 
    346408 Group: entry(NXentry) contains  8 items 
     
    379441[[Writing character data 
    380442Number of global attributes:        4 
    381    NeXus_version = 4.1.0 
     443   NeXus_version = 4.2.0 
    382444   file_name = NXtest.nxs 
    383445Group: entry(NXentry) contains        8 items 
     
    412474AT_CLEANUP 
    413475 
     476AT_BANNER([Check the C++ binding.]) 
     477AT_SETUP([Check the C++ binding with HDF4.]) 
     478AT_CHECK([ $HAVE_HDF4 && $SETUP_TEST && napi_test_cpp-hdf4 | sed -e 's/\r$//' ], [],  
     479[[NXinquirefile found: napi_test_cpp.hdf 
     480Number of global attributes: 4 
     481   NeXus_version = 4.2.0 
     482   file_name = napi_test_cpp.hdf 
     483Number of group attributes: 2 
     484   hugo = namenlos 
     485   cucumber = passion 
     486Group contains 9 items 
     487   c1_data[5,4] = 2d character array 
     488   ch_data[10] = NeXus_data 
     489   data:NXdata 
     490   i1_data[4] = [,,,] 
     491   i2_data[4] = [1000,2000,3000,4000] 
     492   i4_data[4] = [1000000,2000000,3000000,4000000] 
     493   r4_data[5,4] = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] 
     494   r8_data[5,4] = [20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39] 
     495   sample:NXsample 
     496Link check OK 
     497NXopenpath checks OK 
     498First file time: 2005-05-27 05:44:13 
     499NXinquirefile found: data/dmc01.hdf 
     500Second file sample: Ga0.94Mn0.04Sb_8mm 
     501NXinquirefile found: data/dmc02.hdf 
     502Second file time: 2005-05-27 05:48:56 
     503entry1 external URL = nxfile://data/dmc01.hdf#entry1 
     504]]) 
     505AT_CLEANUP 
     506AT_SETUP([Check the C++ binding with HDF5.]) 
     507AT_CHECK([ $HAVE_HDF5 && $SETUP_TEST && napi_test_cpp-hdf5 | sed -e 's/\r$//' ], [],  
     508[[NXinquirefile found: napi_test_cpp.h5 
     509Number of global attributes: 4 
     <