Changeset 1375


Ignore:
Timestamp:
29/10/09 10:59:48 (3 years ago)
Author:
Mark Koennecke
Message:
  • Implemented NXgetpath for C, C++, Java, SWIG and F77, refs #199
  • Python still needs to be done but I think python has an own implementation.
  • I added to the test code: now as they are based on text comparison all of them fail :-(
Location:
trunk
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/bindings/cpp/NeXusFile.cpp

    r1264 r1375  
    230230    throw Exception(msg.str(), status); 
    231231  } 
     232} 
     233 
     234std::string File::getPath(){ 
     235  char cPath[1024]; 
     236 
     237  memset(cPath,0,1024*sizeof(char)); 
     238  NXstatus status = NXgetpath(this->m_file_id,cPath, 1024); 
     239  if (status != NX_OK) { 
     240    stringstream msg; 
     241    msg << "NXgetpath() failed"; 
     242    throw Exception(msg.str(), status); 
     243  } 
     244  return std::string(cPath); 
    232245} 
    233246 
  • trunk/bindings/cpp/NeXusFile.hpp

    r1263 r1375  
    191191     */ 
    192192    void openGroupPath(const std::string& path); 
     193    /** 
     194     * Get the path into the current file 
     195     * \return A unix like path string pointing to the current  
     196     *         position in the file 
     197     */ 
     198    std::string  getPath(); 
    193199 
    194200    /** 
  • trunk/bindings/f77/napif.f

    r848 r1375  
    121121      CALL EXTRACT_STRING(IPATH, 256, PATH) 
    122122      NXOPENPATH = NXIOPENPATH(FILEID, IPATH) 
     123      END 
     124 
     125      INTEGER FUNCTION NXGETPATH(FILEID, PATH) 
     126      INTEGER FILEID(*),NXIGETPATH, NXIFGETPATH 
     127      CHARACTER*(*) PATH 
     128      INTEGER*1 IPATH(1024) 
     129      INTEGER PLEN 
     130      EXTERNAL NXIFGETPATH 
     131      PLEN = 1024 
     132      NXGETPATH = NXIFGETPATH(FILEID,IPATH,PLEN) 
     133      CALL REPLACE_STRING(PATH,IPATH) 
    123134      END 
    124135 
  • trunk/bindings/f77/napif.inc

    r952 r1375  
    3636C *** large enough to hold an NXhandle structure 
    3737      INTEGER NXHANDLESIZE 
    38       PARAMETER(NXHANDLESIZE=5120) 
     38C      PARAMETER(NXHANDLESIZE=5120) 
     39      PARAMETER(NXHANDLESIZE=9058) 
    3940C *** NXLINKSIZE is (at least) the size of an INTEGER*4 array that can hold 
    4041C *** an NXlink structure: we'll assume 64bit alignment of structure members for safety 
     
    7980     +       NXINITATTRDIR, NXFLUSH, NXCOMPMAKEDATA, NXOPENPATH, 
    8081     +       NXSETNUMBERFORMAT, NXOPENGROUPPATH, NXOPENSOURCEGROUP, 
    81      +       NXMAKENAMEDLINK 
     82     +       NXMAKENAMEDLINK, NXGETPATH 
    8283      LOGICAL NXSAMEID 
    8384      EXTERNAL NXOPEN, NXCLOSE, NXMAKEGROUP, NXOPENGROUP, NXCLOSEGROUP, 
     
    9192     +       NXOPENPATH,NXSETNUMBERFORMAT, NXOPENGROUPPATH, 
    9293     +       NXOPENSOURCEGROUP, NXINQUIREFILE, NXISEXTERNALGROUP,  
    93      +       NXLINKEXTERNAL, NXMAKENAMEDLINK 
     94     +       NXLINKEXTERNAL, NXMAKENAMEDLINK, NXGETPATH 
  • trunk/bindings/idl/NeXusIDL-API.c

    r1224 r1375  
    217217 
    218218  return IDL_GettmpInt(status); 
     219} 
     220/*====================================================================== 
     221 * NXgetpath 
     222 * string = NXgetpath(file_id) 
     223 *======================================================================*/ 
     224static IDL_VPTR NXgetpath_this(int argc, IDL_VPTR *argv) 
     225{ 
     226  int fileid; 
     227  NXhandle hHandle; 
     228  int iHandle, status; 
     229  char path[1024]; 
     230 
     231  if (argc != 1) { 
     232        IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_INFO, "One argument expected"); 
     233        return IDL_StrToSTRING("One argument expected"); 
     234        } 
     235 
     236  IDL_ENSURE_SCALAR(argv[0]); 
     237 
     238  fileid = (int)IDL_LongScalar(argv[0]); 
     239 
     240  if(HHCheckIfHandleExists(fileid) == -1) { 
     241        IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_INFO, "Unknown file id"); 
     242        return IDL_StrToSTRING("ERROR: Unknown file ID"); 
     243        } 
     244 
     245  hHandle = HHGetPointer(fileid); 
     246  NXMSetError(NULL,idlError); 
     247 
     248  status = NXgetpath(hHandle,path,1024); 
     249  if(status == NX_ERROR){ 
     250        IDL_Message(IDL_M_NAMED_GENERIC, IDL_MSG_INFO, nexusError); 
     251        return IDL_StrToSTRING(nexusError); 
     252  } 
     253   return IDL_StrToSTRING(path); 
    219254} 
    220255 
     
    25492584    { NXsetnumberformat_this, "NXSETNUMBERFORMAT", 0, IDL_MAXPARAMS, 0, 0}, 
    25502585    { NXopenpath_this, "NXOPENPATH", 0, IDL_MAXPARAMS, 0, 0}, 
    2551         { NXopengrouppath_this, "NXOPENGROUPPATH", 0, IDL_MAXPARAMS, 0, 0}, 
     2586    { NXopengrouppath_this, "NXOPENGROUPPATH", 0, IDL_MAXPARAMS, 0, 0}, 
     2587    { NXgetpath_this, "NXGETPATH", 0, IDL_MAXPARAMS, 0, 0}, 
    25522588    { NXmakegroup_this, "NXMAKEGROUP", 0, IDL_MAXPARAMS, 0, 0}, 
    25532589    { NXopengroup_this, "NXOPENGROUP", 0, IDL_MAXPARAMS, 0, 0}, 
  • trunk/bindings/idl/NeXusIDL-API.dlm

    r1153 r1375  
    88FUNCTION        NXOPENPATH 0    IDL_MAXPARAMS 
    99FUNCTION        NXOPENGROUPPATH 0       IDL_MAXPARAMS 
     10FUNCTION        NXGETPATH       0       IDL_MAXPARAMS 
    1011FUNCTION        NXMAKEGROUP 0   IDL_MAXPARAMS 
    1112FUNCTION        NXCLOSEGROUP 0  IDL_MAXPARAMS 
  • trunk/bindings/java/native/NexusFile.c

    r1282 r1375  
    2323 
    2424   Added NXinitattrdir and NXinitgroupdir, Mark Koennecke, October 2009 
     25 
     26   Added NXgetpath, Mark Koennecke, October 2009 
    2527 
    2628   IMPLEMENTATION NOTES 
     
    307309    (*env)->ReleaseStringUTFChars(env,path, nxpath); 
    308310} 
     311/*-----------------------------------------------------------------------*/ 
     312JNIEXPORT jstring JNICALL Java_org_nexusformat_NexusFile_nxgetpath 
     313  (JNIEnv *env, jobject obj, jint handle) 
     314{ 
     315    NXhandle nxhandle; 
     316    int iRet; 
     317    char path[1024]; 
     318 
     319    /* set error handler */ 
     320    NXMSetError(env,JapiError); 
     321 
     322    /* exchange the Java handler to a NXhandle */ 
     323    nxhandle =  (NXhandle)HHGetPointer(handle); 
     324 
     325    iRet = NXgetpath(nxhandle, path,1024); 
     326     
     327    return (*env)->NewStringUTF(env,path); 
     328} 
     329 
    309330/*------------------------------------------------------------------------ 
    310331                     nxclosegroup 
  • trunk/bindings/java/org/nexusformat/NeXusFileInterface.java

    r848 r1375  
    8989    public void opengrouppath(String path) throws  
    9090                           NexusException; 
     91    /** 
     92     * return the current path into the NeXus file in the  
     93     * form of a Unix path string. 
     94     * @return A unix path string 
     95     */ 
     96    public String getpath() throws NexusException; 
    9197    /** 
    9298      * closegroup closes access to the current group and steps down one 
  • trunk/bindings/java/org/nexusformat/NexusFile.java

    r1282 r1375  
    186186    protected native void nxopengrouppath(int handle, String path); 
    187187    protected native void nxclosegroup(int handle); 
     188    protected native String nxgetpath(int handle); 
    188189 
    189190    /**  
     
    246247        nxopengrouppath(handle,path); 
    247248    } 
    248  
     249    /** 
     250     * return the current path into the NeXus file in the  
     251     * form of a Unix path string. 
     252     * @return A unix path string 
     253     */ 
     254    public String getpath() throws NexusException  
     255    { 
     256        if(handle < 0) throw new NexusException("NAPI-ERROR: File not open"); 
     257        return nxgetpath(handle); 
     258    } 
    249259    /** 
    250260      * closegroup closes access to the current group and steps down one 
  • trunk/bindings/swig/nxinter.i

    r952 r1375  
    5757extern int nx_openpath(void *handle, char *path); 
    5858extern int nx_opengrouppath(void *handle, char *path); 
     59extern char *nx_getpath(void *handle); 
    5960extern int nx_closegroup(void *handle); 
    6061extern char *nx_getnextentry(void *handle, char separator); 
  • trunk/bindings/swig/nxinterhelper.c

    r942 r1375  
    114114} 
    115115/*--------------------------------------------------------------------*/ 
     116char *nx_getpath(void *handle){ 
     117  int status; 
     118  NXhandle hfil; 
     119  char path[1024]; 
     120 
     121  hfil = (NXhandle)handle; 
     122  status = NXgetpath(hfil,path,1024); 
     123  if(status == NX_OK){ 
     124    return strdup(path); 
     125  } else { 
     126    return strdup("Error in NXgetpath"); 
     127  } 
     128} 
     129/*--------------------------------------------------------------------*/ 
    116130int nx_closegroup(void *handle){ 
    117131  int status; 
  • trunk/bindings/swig/nxinterhelper.h

    r942 r1375  
    2323int nx_opengrouppath(void *handle, char *path); 
    2424int nx_openpath(void *handle, char *path); 
     25extern char *nx_getpath(void *handle); 
    2526int nx_closegroup(void *handle); 
    2627char *nx_getnextentry(void *handle, char separator); 
  • trunk/include/napi.h

    r1277 r1375  
    180180#    define NXopengroup         MANGLE(nxiopengroup) 
    181181#    define NXopenpath          MANGLE(nxiopenpath) 
     182#    define NXgetpath           MANGLE(nxigetpath) 
    182183#    define NXopengrouppath     MANGLE(nxiopengrouppath) 
    183184#    define NXclosegroup        MANGLE(nxiclosegroup) 
     
    228229#    define NXfcompress         MANGLE(nxifcompress) 
    229230#    define NXfputattr          MANGLE(nxifputattr) 
    230  
     231#    define NXfgetpath          MANGLE(nxifgetpath) 
    231232 
    232233/*  
     
    324325   */ 
    325326extern  NXstatus  NXopengrouppath (NXhandle handle, CONSTCHAR *path); 
     327  /** 
     328   * Retrieve the current path in the NeXus file 
     329   * \param handle a NeXus file handle 
     330   * \param path A buffer to copy the path too 
     331   * \parm  pathlen The maximum number of characters to copy into path 
     332   * \return NX_OK or NX_ERROR 
     333   */ 
     334extern NXstatus NXgetpath(NXhandle handle, char *path, int pathlen); 
    326335 
    327336  /** 
     
    784793 
    785794  extern NXstatus  NXfopen(char * filename, NXaccess* am,  
    786                                         NexusFunction* pHandle); 
    787   extern NXstatus  NXfclose (NexusFunction* pHandle); 
     795                                        NXhandle pHandle); 
     796  extern NXstatus  NXfclose (NXhandle pHandle); 
    788797  extern NXstatus  NXfputattr(NXhandle fid, char *name, void *data,  
    789798                                   int *pDatalen, int *pIType); 
     
    795804  extern NXstatus  NXfmakedata(NXhandle fid, char *name, int *pDatatype, 
    796805                int *pRank, int dimensions[]); 
    797   extern NXstatus  NXfflush(NexusFunction* pHandle); 
    798  
     806  extern NXstatus  NXfflush(NXhandle pHandle); 
     807  extern NXstatus  NXfgetpath(NXhandle fid, char *path, int *pathlen); 
    799808#ifdef __cplusplus 
    800809} 
  • trunk/src/Makefile.am

    r1105 r1375  
    7676#SUBDIRS=nxdict 
    7777 
    78 libNeXus_la_SOURCES = napi.c napiu.c nxstack.c nxstack.h stptok.c nxdataset.c nxdataset.h nx_stptok.h $(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 
  • trunk/src/napi.c

    r1220 r1375  
    545545 
    546546    status = pFunc->nxopengroup(pFunc->pNexusData, name, nxclass);   
     547    if(status == NX_OK){ 
     548      pushPath(fileStack,name); 
     549    } 
    547550    oldError = NXMGetError(); 
    548551    NXIReportError = NXNXNoReport; 
     
    580583    fileStack = (pFileStack)fid; 
    581584    if(fileStackDepth(fileStack) == 0){ 
    582       return pFunc->nxclosegroup(pFunc->pNexusData);   
     585      status = pFunc->nxclosegroup(pFunc->pNexusData);   
     586      if(status == NX_OK){ 
     587        popPath(fileStack); 
     588      } 
     589      return status; 
    583590    } else { 
    584591      /* we have to check for leaving an external file */ 
     
    590597      } else { 
    591598        status = pFunc->nxclosegroup(pFunc->pNexusData); 
     599        if(status == NX_OK){ 
     600          popPath(fileStack); 
     601        } 
    592602      } 
    593603      return status; 
     
    628638  NXstatus  NXopendata (NXhandle fid, CONSTCHAR *name) 
    629639  { 
     640    int status; 
     641    pFileStack fileStack = NULL; 
     642 
    630643    pNexusFunction pFunc = handleToNexusFunc(fid);  
    631     return pFunc->nxopendata(pFunc->pNexusData, name);  
     644    fileStack = (pFileStack)fid; 
     645    status = pFunc->nxopendata(pFunc->pNexusData, name);  
     646    if(status == NX_OK){ 
     647      pushPath(fileStack,name); 
     648    } 
     649    return status; 
    632650  }  
    633651 
     
    637655  NXstatus  NXclosedata (NXhandle fid) 
    638656  {  
    639     pNexusFunction pFunc = handleToNexusFunc(fid); 
    640     return pFunc->nxclosedata(pFunc->pNexusData); 
     657    int status; 
     658    pFileStack fileStack = NULL; 
     659 
     660    pNexusFunction pFunc = handleToNexusFunc(fid); 
     661    fileStack = (pFileStack)fid; 
     662    status = pFunc->nxclosedata(pFunc->pNexusData); 
     663    if(status == NX_OK){ 
     664      popPath(fileStack); 
     665    } 
     666    return status; 
    641667  } 
    642668 
     
    10621088} 
    10631089/*------------------------------------------------------------------------ 
    1064   Implementation of NXopenpath.  
     1090  Implementation of NXopenpath  
    10651091  --------------------------------------------------------------------------*/ 
    10661092static int isDataSetOpen(NXhandle hfil) 
     
    13571383  return NX_OK; 
    13581384} 
    1359  
     1385/*---------------------------------------------------------------------*/ 
    13601386NXstatus NXIprintlink(NXhandle fid, NXlink* link) 
    13611387{ 
    13621388     pNexusFunction pFunc = handleToNexusFunc(fid); 
    13631389     return pFunc->nxprintlink(pFunc->pNexusData, link);    
     1390} 
     1391/*----------------------------------------------------------------------*/ 
     1392NXstatus NXgetpath(NXhandle fid, char *path, int pathlen){ 
     1393  int status; 
     1394  pFileStack fileStack = NULL; 
     1395 
     1396  fileStack = (pFileStack)fid; 
     1397  status = buildPath(fileStack,path,pathlen); 
     1398  if(status != 1){ 
     1399    return NX_ERROR; 
     1400  }  
     1401  return NX_OK; 
    13641402} 
    13651403 
     
    14461484   */ 
    14471485  NXstatus  NXfopen(char * filename, NXaccess* am,  
    1448                                  NexusFunction* pHandle) 
     1486                                 NXhandle pHandle) 
    14491487  { 
    14501488        NXstatus ret; 
     
    14531491        if (ret == NX_OK) 
    14541492        { 
    1455             memcpy(pHandle, fileid, sizeof(NexusFunction)); 
     1493          memcpy(pHandle, fileid, getFileStackSize()); 
    14561494        } 
    14571495        else 
    14581496        { 
    1459             memset(pHandle, 0, sizeof(NexusFunction)); 
     1497          memset(pHandle, 0, getFileStackSize()); 
    14601498        } 
    14611499        if (fileid != NULL) 
     
    14701508 * a temporary copy as NXclose will try to free() this 
    14711509 */ 
    1472   NXstatus  NXfclose (NexusFunction* pHandle) 
     1510  NXstatus  NXfclose (NXhandle pHandle) 
    14731511  { 
    14741512    NXhandle h; 
    14751513    NXstatus ret; 
    1476     h = (NXhandle)malloc(sizeof(NexusFunction)); 
    1477     memcpy(h, pHandle, sizeof(NexusFunction)); 
     1514    h = (NXhandle)malloc(getFileStackSize()); 
     1515    memcpy(h, pHandle, getFileStackSize()); 
    14781516    ret = NXclose(&h);          /* does free(h) */ 
    1479     memset(pHandle, 0, sizeof(NexusFunction)); 
     1517    memset(pHandle, 0, getFileStackSize()); 
    14801518    return ret; 
    14811519  } 
    14821520   
    14831521/*---------------------------------------------------------------------*/   
    1484   NXstatus  NXfflush(NexusFunction* pHandle) 
     1522  NXstatus  NXfflush(NXhandle pHandle) 
    14851523  { 
    14861524    NXhandle h; 
    14871525    NXstatus ret; 
    1488     h = (NXhandle)malloc(sizeof(NexusFunction)); 
    1489     memcpy(h, pHandle, sizeof(NexusFunction)); 
     1526    h = (NXhandle)malloc(getFileStackSize()); 
     1527    memcpy(h, pHandle, getFileStackSize()); 
    14901528    ret = NXflush(&h);          /* modifies and reallocates h */ 
    1491     memcpy(pHandle, h, sizeof(NexusFunction)); 
     1529    memcpy(pHandle, h, getFileStackSize()); 
    14921530    return ret; 
    14931531  } 
     
    15201558  } 
    15211559 
    1522  
     1560/*-----------------------------------------------------------------------*/ 
    15231561  NXstatus  NXfcompmakedata(NXhandle fid, char *name,  
    15241562                int *pDatatype, 
     
    15791617  } 
    15801618 
     1619/*--------------------------------------------------------------------------*/ 
     1620NXstatus NXfgetpath(NXhandle fid, char *path, int *pathlen) 
     1621{ 
     1622  return NXgetpath(fid,path,*pathlen); 
     1623} 
  • trunk/src/nexus_symbols.txt

    r1236 r1375  
    1313nxifputattr_ 
    1414nxifree_ 
     15nxifgetpath_ 
    1516nxigetattr_ 
    1617nxigetattrinfo_ 
     
    3435nxiopengrouppath_ 
    3536nxiopenpath_ 
     37nxigetpath_ 
    3638nxiopensourcegroup_ 
    3739nxiputattr_ 
  • trunk/src/nxstack.c

    r996 r1375  
    2020  
    2121  For further information, see <http://www.neutron.anl.gov/NeXus/> 
     22 
     23  Added code to support the path stack for NXgetpath,  
     24        Mark Koennecke, October 2009 
    2225*/ 
    2326#include <stdlib.h> 
     
    4043  int fileStackPointer; 
    4144  fileStackEntry fileStack[MAXEXTERNALDEPTH]; 
     45  int pathPointer; 
     46  char pathStack[NXMAXSTACK][NX_MAXNAMELEN]; 
    4247}fileStack; 
    4348/*---------------------------------------------------------------------*/ 
     
    5156  memset(pNew,0,sizeof(fileStack)); 
    5257  pNew->fileStackPointer = -1; 
     58  pNew->pathPointer = -1; 
    5359  return pNew; 
    5460} 
     
    5864    free(self); 
    5965  } 
     66} 
     67/*---------------------------------------------------------------------*/ 
     68int getFileStackSize(){ 
     69  return sizeof(fileStack); 
    6070} 
    6171/*----------------------------------------------------------------------*/ 
     
    99109  return self->fileStackPointer; 
    100110} 
     111/*----------------------------------------------------------------------*/ 
     112void pushPath(pFileStack self, char *name){ 
     113  self->pathPointer++; 
     114  strncpy(self->pathStack[self->pathPointer],name,NX_MAXNAMELEN-1); 
     115} 
     116/*-----------------------------------------------------------------------*/ 
     117void popPath(pFileStack self){ 
     118  self->pathPointer--; 
     119  if(self->pathPointer < -1){ 
     120    self->pathPointer = -1; 
     121  } 
     122} 
     123/*-----------------------------------------------------------------------*/ 
     124int buildPath(pFileStack self, char *path, int pathlen){ 
     125  int i, totalPathLength; 
     126  char *totalPath; 
     127 
     128  for(i = 0, totalPathLength = 5; i <= self->pathPointer; i++){ 
     129    totalPathLength += strlen(self->pathStack[i]) + 1; 
     130  } 
     131  totalPath = malloc(totalPathLength*sizeof(char)); 
     132  if(totalPath == NULL){ 
     133    return 0; 
     134  } 
     135  memset(totalPath,0,totalPathLength*sizeof(char)); 
     136  for(i = 0; i <= self->pathPointer; i++){ 
     137    strcat(totalPath,"/"); 
     138    strcat(totalPath,self->pathStack[i]); 
     139  } 
     140   
     141  strncpy(path,totalPath,pathlen-1); 
     142  free(totalPath); 
     143  return 1; 
     144} 
  • trunk/src/nxstack.h

    r742 r1375  
    2020  
    2121  For further information, see <http://www.neutron.anl.gov/NeXus/> 
     22 
     23  Added functions to deal with the path stack for NXgetpath 
     24  Mark Koennecke, October 2009 
     25 
    2226*/ 
    2327#ifndef NEXUSFILESTACK 
     
    2933pFileStack makeFileStack(); 
    3034void killFileStack(pFileStack self); 
     35int getFileStackSize(); 
    3136 
    3237void pushFileStack(pFileStack self, pNexusFunction pDriv, char *filename); 
     
    4045int fileStackDepth(pFileStack self); 
    4146 
     47void pushPath(pFileStack self, char *name); 
     48void popPath(pFileStack self); 
     49int buildPath(pFileStack self, char *path, int pathlen); 
     50 
    4251#endif 
    4352 
  • trunk/test/napi_test.c

    r1178 r1375  
    6666  int64_t grossezahl[4]; 
    6767  const char* ch_test_data = "NeXus ><}&{'\\&\" Data"; 
     68  char path[512]; 
    6869 
    6970  grossezahl[0] = 12; 
     
    244245  NXgetattrinfo(fileid,&i); 
    245246  printf("Number of group attributes: %d\n", i); 
     247  if(NXgetpath(fileid,path,512) != NX_OK)return 1; 
     248  printf("NXentry path %s\n", path); 
    246249  do {  
    247250     attr_status = NXgetnextattr (fileid, name, NXdims, &NXtype); 
     
    270273        if (entry_status == NX_OK) { 
    271274           if (NXopendata (fileid, name) != NX_OK) return 1; 
    272               if (NXgetinfo (fileid, &NXrank, NXdims, &NXtype) != NX_OK) return 1; 
     275            if(NXgetpath(fileid,path,512) != NX_OK)return 1; 
     276            printf("Data path %s\n", path); 
     277            if (NXgetinfo (fileid, &NXrank, NXdims, &NXtype) != NX_OK) return 1; 
    273278                 printf ("   %s(%d)", name, NXtype); 
    274279              if (NXmalloc ((void **) &data_buffer, NXrank, NXdims, NXtype) != NX_OK) return 1; 
     
    365370  if (NXopengroup (fileid, "link", "NXentry") != NX_OK) return 1; 
    366371    if (NXopengroup (fileid, "sample", "NXsample") != NX_OK) return 1; 
     372    if(NXgetpath(fileid,path,512) != NX_OK)return 1; 
     373    printf("Group path %s\n", path); 
    367374      if (NXgetgroupID (fileid, &blink) != NX_OK) return 1; 
    368375        if (NXsameID(fileid, &glink, &blink) != NX_OK) 
  • trunk/test/napi_test_cpp.cxx

    r1266 r1375  
    275275        cout << toString(result); 
    276276      } 
     277      cout <<  endl; 
     278      cout << "   Path = " << file.getPath() << endl; 
     279      file.closeData(); 
    277280    } 
    278281    else { 
    279       cout << ":" << it->second; 
    280     } 
    281     cout <<  endl; 
     282      cout << ":" << it->second << endl; 
     283    } 
    282284  } 
    283285  file.closeGroup(); 
  • trunk/test/napif4_test.f

    r835 r1375  
    2727      INCLUDE 'napif.inc' 
    2828      INTEGER NXRANK, NXDIMS(NX_MAXRANK), NXTYPE, NXLEN 
    29       INTEGER ENTRY_STATUS, ATTR_STATUS 
     29      INTEGER ENTRY_STATUS, ATTR_STATUS, STAT 
    3030      INTEGER*4 I, J 
    3131      REAL*4 R 
     
    4141      CHARACTER*128 CHAR_BUFFER 
    4242      INTEGER*1 CHAR_BUFFER_B(128) 
    43       CHARACTER*64 GROUP_NAME, CLASS_NAME 
     43      CHARACTER*64 GROUP_NAME, CLASS_NAME, PATH 
    4444      INTEGER FILEID(NXHANDLESIZE) 
    4545      INTEGER GLINK(NXLINKSIZE), DLINK(NXLINKSIZE), BLINK(NXLINKSIZE) 
     
    141141                     IF (NXPUTSLAB(FILEID, U_BUFFER(I), SLAB_START,  
    142142     +                 SLAB_SIZE) .NE. NX_OK) STOP 
     143                     STAT = NXCLOSEDATA(FILEID) 
    143144                     IF (NXFLUSH(FILEID) .NE. NX_OK) STOP 
    144145               END DO 
     
    196197      ELSE IF (ENTRY_STATUS .EQ. NX_OK) THEN 
    197198         IF (NXOPENDATA(FILEID,NAME) .NE. NX_OK) STOP 
     199         IF(NXGETPATH(FILEID,PATH) .NE. NX_OK) STOP 
     200         WRITE(*,*),' Path = ', PATH 
    198201         IF (NXGETINFO(FILEID,NXRANK,NXDIMS,NXTYPE) .NE. NX_OK) STOP 
    199202         WRITE(*,FMT='(4X,A,I2,A)') NAME(1:LEN_TRIM(NAME))//'(',  
  • trunk/test/napif5_test.f

    r835 r1375  
    2727      INCLUDE 'napif.inc' 
    2828      INTEGER NXRANK, NXDIMS(NX_MAXRANK), NXTYPE, NXLEN 
    29       INTEGER ENTRY_STATUS, ATTR_STATUS 
     29      INTEGER ENTRY_STATUS, ATTR_STATUS, STAT 
    3030      INTEGER*4 I, J 
    3131      REAL*4 R 
     
    4242      INTEGER*1 CHAR_BUFFER_B(128) 
    4343      CHARACTER*64 GROUP_NAME, CLASS_NAME 
     44      CHARACTER*70 PATH 
    4445      INTEGER FILEID(NXHANDLESIZE) 
    4546      INTEGER GLINK(NXLINKSIZE), DLINK(NXLINKSIZE), BLINK(NXLINKSIZE) 
     
    141142                     IF (NXPUTSLAB(FILEID, U_BUFFER(I), SLAB_START,  
    142143     +                 SLAB_SIZE) .NE. NX_OK) STOP 
     144                     STAT = NXCLOSEDATA(FILEID) 
    143145                     IF (NXFLUSH(FILEID) .NE. NX_OK) STOP 
    144146               END DO 
     
    196198      ELSE IF (ENTRY_STATUS .EQ. NX_OK) THEN 
    197199         IF (NXOPENDATA(FILEID,NAME) .NE. NX_OK) STOP 
     200         IF(NXGETPATH(FILEID,PATH) .NE. NX_OK) STOP 
     201         WRITE(*,*)'Path = ', PATH 
    198202         IF (NXGETINFO(FILEID,NXRANK,NXDIMS,NXTYPE) .NE. NX_OK) STOP 
    199203         WRITE(*,FMT='(4X,A,I2,A)') NAME(1:LEN_TRIM(NAME))//'(',  
  • trunk/test/napif_test.f

    r808 r1375  
    4242      INTEGER*1 CHAR_BUFFER_B(128) 
    4343      CHARACTER*64 GROUP_NAME, CLASS_NAME 
     44      CHARACTER*70 PATH 
    4445      INTEGER FILEID(NXHANDLESIZE) 
    4546      INTEGER GLINK(NXLINKSIZE), DLINK(NXLINKSIZE), BLINK(NXLINKSIZE) 
     
    196197      ELSE IF (ENTRY_STATUS .EQ. NX_OK) THEN 
    197198         IF (NXOPENDATA(FILEID,NAME) .NE. NX_OK) STOP 
     199         IF (NXGETPATH(FILEID,PATH) .NE. NX_OK)STOP 
     200         WRITE(*,*)'Path = ', PATH 
    198201         IF (NXGETINFO(FILEID,NXRANK,NXDIMS,NXTYPE) .NE. NX_OK) STOP 
    199202         WRITE(*,FMT='(4X,A,I2,A)') NAME(1:LEN_TRIM(NAME))//'(',  
Note: See TracChangeset for help on using the changeset viewer.