Changeset 1548


Ignore:
Timestamp:
06/10/10 19:57:35 (20 months ago)
Author:
Tobias Richter
Message:

create new error reporting function that only takes a message as parameter
and use that throughout the api
refs #219

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bindings/swig/nxinterhelper.c

    r1375 r1548  
    208208  dimData = (pNXDS)dimPtr; 
    209209  if(dimData->type != NX_INT32){ 
    210     NXIReportError(NULL,"ERROR: dimension data not integer"); 
     210    NXReportError("ERROR: dimension data not integer"); 
    211211    return 0; 
    212212  } 
     
    229229  dimData = (pNXDS)dimPtr; 
    230230  if(dimData->type != NX_INT32){ 
    231     NXIReportError(NULL,"ERROR: dimension data not integer"); 
     231    NXReportError("ERROR: dimension data not integer"); 
    232232    return 0; 
    233233  } 
     
    416416 
    417417  if(data == NULL){ 
    418     NXIReportError(NULL,"ERROR: NULL data pointer in nx_putdata"); 
     418    NXReportError("ERROR: NULL data pointer in nx_putdata"); 
    419419    return 0; 
    420420  } 
  • trunk/include/napi.h

    r1542 r1548  
    787787extern  void  NXMEnableErrorReporting(); 
    788788 
    789  
     789 /** 
     790  * Dispatches the error message to the error function defined by NXMSetTError 
     791  */ 
     792extern void NXReportError(char *text); 
     793 
     794 /** 
     795  * Do not use, first parameter should be set by NXMSetTError 
     796  */ 
    790797extern void NXIReportError(void *pData,char *text); 
    791 extern void *NXpData; 
     798/* extern void *NXpData; */ 
    792799extern char *NXIformatNeXusTime(); 
    793800extern  NXstatus  NXIprintlink(NXhandle fid, NXlink* link); 
  • trunk/src/napi.c

    r1545 r1548  
    196196 
    197197  void NXIReportError(void *pData, char *string) { 
    198  
     198        fprintf(stderr, "Your application uses NXIReportError, but its first parameter is ignored now."); 
     199        NXReportError(string); 
     200  } 
     201 
     202  void NXReportError(char *string) { 
    199203        if (NXEHIReportTError) { 
    200204                (*NXEHIReportTError)(NXEHpTData, string); 
     
    331335  fileStack = makeFileStack(); 
    332336  if(fileStack == NULL){ 
    333     NXIReportError (NXpData,"ERROR: no memory to create filestack"); 
     337    NXReportError("ERROR: no memory to create filestack"); 
    334338      return NX_ERROR; 
    335339  } 
     
    365369    fHandle = (pNexusFunction)malloc(sizeof(NexusFunction)); 
    366370    if (fHandle == NULL) { 
    367       NXIReportError (NXpData,"ERROR: no memory to create Function structure"); 
     371      NXReportError("ERROR: no memory to create Function structure"); 
    368372      return NX_ERROR; 
    369373    } 
     
    398402      filename = locateNexusFileInPath((char *)userfilename); 
    399403      if(filename == NULL){ 
    400         NXIReportError(NXpData,"Out of memory in NeXus-API"); 
     404        NXReportError("Out of memory in NeXus-API"); 
    401405        free(fHandle); 
    402406        return NX_ERROR; 
     
    407411        snprintf(error,1023,"failed to open %s for reading", 
    408412                 filename); 
    409         NXIReportError(NXpData,error); 
     413        NXReportError(error); 
    410414        free(filename); 
    411415        return NX_ERROR; 
     
    414418        snprintf(error,1023,"failed to determine filetype for %s ", 
    415419                 filename); 
    416         NXIReportError(NXpData,error); 
     420        NXReportError(error); 
    417421        free(filename); 
    418422        free(fHandle); 
     
    422426    } 
    423427    if(filename == NULL){ 
    424         NXIReportError(NXpData,"Out of memory in NeXus-API"); 
     428        NXReportError("Out of memory in NeXus-API"); 
    425429        return NX_ERROR; 
    426430    } 
     
    439443      pushFileStack(fileStack,fHandle,filename); 
    440444#else 
    441       NXIReportError (NXpData, 
     445      NXReportError( 
    442446         "ERROR: Attempt to create HDF4 file when not linked with HDF4"); 
    443447      retstat = NX_ERROR; 
     
    458462      pushFileStack(fileStack,fHandle, filename); 
    459463#else 
    460       NXIReportError (NXpData, 
     464      NXReportError( 
    461465         "ERROR: Attempt to create HDF5 file when not linked with HDF5"); 
    462466      retstat = NX_ERROR; 
     
    479483      pushFileStack(fileStack,fHandle, filename); 
    480484#else 
    481       NXIReportError (NXpData, 
     485      NXReportError( 
    482486         "ERROR: Attempt to create XML file when not linked with XML"); 
    483487      retstat = NX_ERROR; 
    484488#endif 
    485489    } else { 
    486       NXIReportError (NXpData, 
     490      NXReportError( 
    487491          "ERROR: Format not readable by this NeXus library"); 
    488492      retstat = NX_ERROR; 
     
    548552    length = strlen(napiMount) - 9; 
    549553    if(length > extFileLen){ 
    550       NXIReportError(NXpData,"ERROR: internal errro with external linking"); 
     554      NXReportError("ERROR: internal errro with external linking"); 
    551555      return NXBADURL; 
    552556    } 
     
    558562    length = path - pPtr; 
    559563    if(length > extFileLen){ 
    560       NXIReportError(NXpData,"ERROR: internal errro with external linking"); 
     564      NXReportError("ERROR: internal errro with external linking"); 
    561565      return NXBADURL; 
    562566    } 
     
    564568    length = strlen(path-1); 
    565569    if(length > extPathLen){ 
    566       NXIReportError(NXpData,"ERROR: internal error with external linking"); 
     570      NXReportError("ERROR: internal error with external linking"); 
    567571      return NXBADURL; 
    568572    } 
     
    726730    if (datalen > 1 && iType != NX_CHAR) 
    727731    { 
    728         NXIReportError(NXpData,"NXputattr: numeric arrays are not allowed as attributes - only character strings and single numbers"); 
     732        NXReportError("NXputattr: numeric arrays are not allowed as attributes - only character strings and single numbers"); 
    729733        return NX_ERROR; 
    730734    } 
     
    775779    if(status != NX_OK) 
    776780    { 
    777       NXIReportError(NXpData,"ERROR: item not linked"); 
     781      NXReportError("ERROR: item not linked"); 
    778782      return NX_ERROR; 
    779783    } 
     
    827831      } 
    828832      else { 
    829         NXIReportError (NXpData, 
     833        NXReportError( 
    830834                        "ERROR: NXmalloc - unknown data type in array"); 
    831835        return NX_ERROR; 
     
    841845  { 
    842846    if (data == NULL) { 
    843        NXIReportError (NXpData, "ERROR: passing NULL to NXfree"); 
     847       NXReportError( "ERROR: passing NULL to NXfree"); 
    844848       return NX_ERROR; 
    845849    } 
    846850    if (*data == NULL) { 
    847        NXIReportError (NXpData,"ERROR: passing already freed pointer to NXfree"); 
     851       NXReportError("ERROR: passing already freed pointer to NXfree"); 
    848852       return NX_ERROR; 
    849853    } 
     
    13121316  } 
    13131317  snprintf(pBueffel,255,"ERROR: NXopenpath cannot step into %s",name); 
    1314   NXIReportError (NXpData, pBueffel); 
     1318  NXReportError( pBueffel); 
    13151319  return NX_ERROR;               
    13161320} 
     
    13481352  } 
    13491353  snprintf(pBueffel,255,"ERROR: NXopenpath cannot step into %s",name); 
    1350   NXIReportError (NXpData, pBueffel); 
     1354  NXReportError( pBueffel); 
    13511355  return NX_ERROR;               
    13521356} 
     
    13601364  if(hfil == NULL || path == NULL) 
    13611365  { 
    1362     NXIReportError(NXpData, 
     1366    NXReportError( 
    13631367     "ERROR: NXopendata needs both a file handle and a path string"); 
    13641368    return NX_ERROR; 
     
    13681372  if(status != NX_OK) 
    13691373  { 
    1370     NXIReportError (NXpData,  
     1374    NXReportError(  
    13711375                    "ERROR: NXopendata failed to move down in hierarchy"); 
    13721376    return status; 
     
    13971401  if(hfil == NULL || path == NULL) 
    13981402  { 
    1399     NXIReportError(NXpData, 
     1403    NXReportError( 
    14001404     "ERROR: NXopendata needs both a file handle and a path string"); 
    14011405    return NX_ERROR; 
     
    14051409  if(status != NX_OK) 
    14061410  { 
    1407     NXIReportError (NXpData,  
     1411    NXReportError(  
    14081412                    "ERROR: NXopendata failed to move down in hierarchy"); 
    14091413    return status; 
     
    14591463    time_buffer = (char *)malloc(64*sizeof(char)); 
    14601464    if(!time_buffer){ 
    1461       NXIReportError(NXpData,"Failed to allocate buffer for time data"); 
     1465      NXReportError("Failed to allocate buffer for time data"); 
    14621466      return NULL; 
    14631467    } 
     
    14821486    else 
    14831487    { 
    1484         NXIReportError (NXpData,  
     1488        NXReportError(  
    14851489        "Your gmtime() function does not work ... timezone information will be incorrect\n"); 
    14861490        gmt_offset = 0; 
     
    15841588        "ERROR: Cannot allocate space for array rank of %d in NXfmakedata",  
    15851589                *pRank); 
    1586         NXIReportError (NXpData, buffer); 
     1590        NXReportError( buffer); 
    15871591        return NX_ERROR; 
    15881592    } 
     
    16151619      "ERROR: Cannot allocate space for array rank of %d in NXfcompmakedata",  
    16161620         *pRank); 
    1617         NXIReportError (NXpData, buffer); 
     1621        NXReportError( buffer); 
    16181622        return NX_ERROR; 
    16191623    } 
  • trunk/src/napi4.c

    r1546 r1548  
    127127      pArray = (int32 *) malloc (iN * sizeof (int32)); 
    128128      if (!pArray) { 
    129         NXIReportError (NXpData, "ERROR: out of memory in NXIFindVgroup"); 
     129        NXReportError( "ERROR: out of memory in NXIFindVgroup"); 
    130130        return NX_EOD; 
    131131      } 
     
    187187      i = SDfileinfo (self->iSID, &iN, &iA); 
    188188      if (i < 0) { 
    189         NXIReportError (NXpData, "ERROR: failure to read file information"); 
     189        NXReportError( "ERROR: failure to read file information"); 
    190190        return NX_EOD; 
    191191      } 
     
    246246          (int32 *) malloc (self->iStack[iStackPtr].iNDir * sizeof (int32) + 1); 
    247247      if (!self->iStack[iStackPtr].iRefDir) { 
    248         NXIReportError (NXpData, "ERROR: out of memory in NXIInitDir"); 
     248        NXReportError( "ERROR: out of memory in NXIInitDir"); 
    249249        return NX_EOD; 
    250250      } 
     
    261261      if ((!self->iStack[iStackPtr].iRefDir) || 
    262262          (!self->iStack[iStackPtr].iTagDir)) { 
    263         NXIReportError (NXpData, "ERROR: out of memory in NXIInitDir"); 
     263        NXReportError( "ERROR: out of memory in NXIInitDir"); 
    264264        return NX_EOD; 
    265265      } 
     
    315315    } 
    316316    if (iRet < 0) { 
    317       NXIReportError (NXpData, "ERROR: HDF cannot read attribute numbers"); 
     317      NXReportError( "ERROR: HDF cannot read attribute numbers"); 
    318318      pFile->iAtt.iNDir = 0; 
    319319      return NX_ERROR; 
     
    354354              strncat(buffer,pText,bufLen-strlen(buffer)); 
    355355          } else { 
    356               NXIReportError (NXpData, "ERROR: NXIbuildPath cannot get vgroup name"); 
     356              NXReportError( "ERROR: NXIbuildPath cannot get vgroup name"); 
    357357          } 
    358358          Vdetach(groupID); 
     
    360360      else 
    361361      { 
    362           NXIReportError (NXpData, "ERROR: NXIbuildPath cannot attach to vgroup"); 
     362          NXReportError( "ERROR: NXIbuildPath cannot attach to vgroup"); 
    363363      } 
    364364    } 
     
    370370      else 
    371371      { 
    372           NXIReportError (NXpData, "ERROR: NXIbuildPath cannot read SDS"); 
     372          NXReportError( "ERROR: NXIbuildPath cannot read SDS"); 
    373373      } 
    374374    } 
     
    409409    pNew = (pNexusFile) malloc (sizeof (NexusFile)); 
    410410    if (!pNew) { 
    411       NXIReportError (NXpData, "ERROR: no memory to create File datastructure"); 
     411      NXReportError( "ERROR: no memory to create File datastructure"); 
    412412      return NX_ERROR; 
    413413    } 
     
    422422      if ( (file_id = Hopen(filename, am1, 0)) == -1 ) { 
    423423        sprintf (pBuffer, "ERROR: cannot open file_a: %s", filename); 
    424         NXIReportError (NXpData, pBuffer); 
     424        NXReportError( pBuffer); 
    425425        free (pNew); 
    426426        return NX_ERROR; 
     
    433433      if (Hclose(file_id) == -1) { 
    434434        sprintf (pBuffer, "ERROR: cannot close file: %s", filename); 
    435         NXIReportError (NXpData, pBuffer); 
     435        NXReportError( pBuffer); 
    436436        free (pNew); 
    437437        return NX_ERROR; 
     
    445445    if (pNew->iSID <= 0) { 
    446446      sprintf (pBuffer, "ERROR: cannot open file_b: %s", filename); 
    447       NXIReportError (NXpData, pBuffer); 
     447      NXReportError( pBuffer); 
    448448      free (pNew); 
    449449      return NX_ERROR; 
     
    455455    if (am != NXACC_READ) { 
    456456      if (SDsetattr(pNew->iSID, "NeXus_version", DFNT_CHAR8, strlen(NEXUS_VERSION), NEXUS_VERSION) < 0) { 
    457           NXIReportError (NXpData, "ERROR: HDF failed to store NeXus_version attribute "); 
     457          NXReportError( "ERROR: HDF failed to store NeXus_version attribute "); 
    458458          return NX_ERROR; 
    459459      } 
    460460      Hgetlibversion(&lmajor, &lminor, &lrelease, HDF_VERSION);  
    461461      if (SDsetattr(pNew->iSID, "HDF_version", DFNT_CHAR8, strlen(HDF_VERSION), HDF_VERSION) < 0) { 
    462           NXIReportError (NXpData, "ERROR: HDF failed to store HDF_version attribute "); 
     462          NXReportError( "ERROR: HDF failed to store HDF_version attribute "); 
    463463          return NX_ERROR; 
    464464      } 
     
    468468    if (am == NXACC_CREATE || am == NXACC_CREATE4) { 
    469469      if (SDsetattr(pNew->iSID, "file_name", DFNT_CHAR8, strlen(filename), (char*)filename) < 0) { 
    470         NXIReportError (NXpData, "ERROR: HDF failed to store file_name attribute "); 
     470        NXReportError( "ERROR: HDF failed to store file_name attribute "); 
    471471        return NX_ERROR; 
    472472      } 
     
    474474        if (SDsetattr(pNew->iSID, "file_time", DFNT_CHAR8,  
    475475                      strlen(time_puffer), time_puffer) < 0) { 
    476           NXIReportError (NXpData,  
     476          NXReportError(  
    477477                          "ERROR: HDF failed to store file_time attribute "); 
    478478          free(time_puffer); 
     
    506506    if (pNew->iVID <= 0) { 
    507507      sprintf (pBuffer, "ERROR: cannot open file_c: %s", filename); 
    508       NXIReportError (NXpData, pBuffer); 
     508      NXReportError( pBuffer); 
    509509      free (pNew); 
    510510      return NX_ERROR; 
     
    535535    } 
    536536    if (iRet < 0) { 
    537       NXIReportError (NXpData, "ERROR: ending access to SDS"); 
     537      NXReportError( "ERROR: ending access to SDS"); 
    538538    } 
    539539    /* close the SDS and Vgroup API's */ 
     
    541541    iRet = SDend (pFile->iSID); 
    542542    if (iRet < 0) { 
    543       NXIReportError (NXpData, "ERROR: HDF cannot close SDS interface"); 
     543      NXReportError( "ERROR: HDF cannot close SDS interface"); 
    544544    } 
    545545    iRet = Hclose (pFile->iVID); 
    546546    if (iRet < 0) { 
    547       NXIReportError (NXpData, "ERROR: HDF cannot close HDF file"); 
     547      NXReportError( "ERROR: HDF cannot close HDF file"); 
    548548    } 
    549549    /* release memory */ 
     
    572572      sprintf (pBuffer, "ERROR: Vgroup %s, class %s already exists",  
    573573                        name, nxclass); 
    574       NXIReportError (NXpData, pBuffer); 
     574      NXReportError( pBuffer); 
    575575      return NX_ERROR; 
    576576    } 
     
    579579    iNew = Vattach (pFile->iVID, -1, "w"); 
    580580    if (iNew < 0) { 
    581       NXIReportError (NXpData, "ERROR: HDF could not create Vgroup"); 
     581      NXReportError( "ERROR: HDF could not create Vgroup"); 
    582582      return NX_ERROR; 
    583583    } 
     
    592592    Vdetach (iNew); 
    593593    if (iRet < 0) { 
    594       NXIReportError (NXpData, "ERROR: HDF failed to insert Vgroup"); 
     594      NXReportError( "ERROR: HDF failed to insert Vgroup"); 
    595595      return NX_ERROR; 
    596596    } 
     
    611611    if (iRef < 0) { 
    612612      sprintf (pBuffer, "ERROR: Vgroup %s, class %s NOT found", name, nxclass); 
    613       NXIReportError (NXpData, pBuffer); 
     613      NXReportError( pBuffer); 
    614614      return NX_ERROR; 
    615615    } 
     
    684684    if ((iNew = NXIFindSDS (fid, name))>=0) { 
    685685      sprintf (pBuffer, "ERROR: SDS %s already exists at this level", name); 
    686       NXIReportError (NXpData, pBuffer); 
     686      NXReportError( pBuffer); 
    687687      return NX_ERROR; 
    688688    } 
     
    726726    else 
    727727    { 
    728       NXIReportError (NXpData, "ERROR: invalid type in NX4makedata"); 
     728      NXReportError( "ERROR: invalid type in NX4makedata"); 
    729729      return NX_ERROR; 
    730730    } 
     
    733733      sprintf (pBuffer, "ERROR: invalid rank specified for SDS %s", 
    734734               name); 
    735       NXIReportError (NXpData, pBuffer); 
     735      NXReportError( pBuffer); 
    736736      return NX_ERROR; 
    737737    } 
     
    746746                 "ERROR: invalid dimension %d, value %d given for SDS %s", 
    747747                 i, dimensions[i], name); 
    748         NXIReportError (NXpData, pBuffer); 
     748        NXReportError( pBuffer); 
    749749        return NX_ERROR; 
    750750      } 
     
    767767    if (pFile->iCurrentVG == 0) { 
    768768      sprintf(pBuffer, "ERROR: SDS creation at root level is not permitted"); 
    769       NXIReportError(NXpData, pBuffer); 
     769      NXReportError( pBuffer); 
    770770      return NX_ERROR; 
    771771    } 
     
    777777      sprintf (pBuffer, "ERROR: cannot create SDS %s, check arguments", 
    778778               name); 
    779       NXIReportError (NXpData, pBuffer); 
     779      NXReportError( pBuffer); 
    780780      return NX_ERROR; 
    781781    } 
     
    786786    iRet = SDendaccess (iNew); 
    787787    if (iRet < 0) { 
    788       NXIReportError (NXpData, "ERROR: HDF cannot end access to SDS"); 
     788      NXReportError( "ERROR: HDF cannot end access to SDS"); 
    789789      return NX_ERROR; 
    790790    } 
     
    815815    if ((iNew = NXIFindSDS (fid, name))>=0) { 
    816816      sprintf (pBuffer, "ERROR: SDS %s already exists at this level", name); 
    817       NXIReportError (NXpData, pBuffer); 
     817      NXReportError( pBuffer); 
    818818      return NX_ERROR; 
    819819    } 
     
    857857    else 
    858858    { 
    859       NXIReportError (NXpData, "ERROR: invalid datatype in NX4compmakedata"); 
     859      NXReportError( "ERROR: invalid datatype in NX4compmakedata"); 
    860860      return NX_ERROR; 
    861861    } 
     
    864864      sprintf (pBuffer, "ERROR: invalid rank specified for SDS %s", 
    865865               name); 
    866       NXIReportError (NXpData, pBuffer); 
     866      NXReportError( pBuffer); 
    867867      return NX_ERROR; 
    868868    } 
     
    877877                 "ERROR: invalid dimension %d, value %d given for SDS %s", 
    878878                 i, dimensions[i], name); 
    879         NXIReportError (NXpData, pBuffer); 
     879        NXReportError( pBuffer); 
    880880        return NX_ERROR; 
    881881      } 
     
    898898    if (pFile->iCurrentVG == 0) { 
    899899      sprintf(pBuffer, "ERROR: SDS creation at root level is not permitted"); 
    900       NXIReportError(NXpData, pBuffer); 
     900      NXReportError( pBuffer); 
    901901      return NX_ERROR; 
    902902    } 
     
    908908      sprintf (pBuffer, "ERROR: cannot create SDS %s, check arguments", 
    909909               name); 
    910       NXIReportError (NXpData, pBuffer); 
     910      NXReportError( pBuffer); 
    911911      return NX_ERROR; 
    912912    } 
     
    926926      if (iRet < 0)  
    927927      { 
    928         NXIReportError (NXpData, "LZW-Compression failure!"); 
     928        NXReportError( "LZW-Compression failure!"); 
    929929        return NX_ERROR; 
    930930      }  
     
    935935      if (iRet < 0)  
    936936        { 
    937           NXIReportError (NXpData, "RLE-Compression failure!"); 
     937          NXReportError( "RLE-Compression failure!"); 
    938938          return NX_ERROR; 
    939939        }    
     
    945945      if (iRet < 0)  
    946946        { 
    947           NXIReportError (NXpData, "HUF-Compression failure!"); 
     947          NXReportError( "HUF-Compression failure!"); 
    948948          return NX_ERROR; 
    949949        }   
     
    955955    else  
    956956    { 
    957       NXIReportError (NXpData, "Unknown compression method!"); 
     957      NXReportError( "Unknown compression method!"); 
    958958      return NX_ERROR;  
    959959    } 
     
    964964    iRet = SDendaccess (iNew); 
    965965    if (iRet < 0) { 
    966       NXIReportError (NXpData, "ERROR: HDF cannot end access to SDS"); 
     966      NXReportError( "ERROR: HDF cannot end access to SDS"); 
    967967      return NX_ERROR; 
    968968    } 
     
    989989    /* check if there is an SDS open */ 
    990990    if (pFile->iCurrentSDS == 0) { 
    991       NXIReportError (NXpData, "ERROR: no SDS open"); 
     991      NXReportError( "ERROR: no SDS open"); 
    992992      return NX_ERROR; 
    993993    } 
     
    10361036    if (iRet < 0) { 
    10371037      sprintf (pError, "ERROR: failure to compress data to %s", pBuffer); 
    1038       NXIReportError (NXpData, pError); 
     1038      NXReportError( pError); 
    10391039      return NX_ERROR; 
    10401040    } 
     
    10581058    if (iNew < 0) { 
    10591059      sprintf (pBuffer, "ERROR: SDS %s not found at this level", name); 
    1060       NXIReportError (NXpData, pBuffer); 
     1060      NXReportError( pBuffer); 
    10611061      return NX_ERROR; 
    10621062    } 
     
    10671067      iRet = SDendaccess (pFile->iCurrentSDS); 
    10681068      if (iRet < 0) { 
    1069         NXIReportError (NXpData, "ERROR: HDF cannot end access to SDS"); 
     1069        NXReportError( "ERROR: HDF cannot end access to SDS"); 
    10701070      } 
    10711071    } 
     
    10861086 
    10871087    if (pFile->iCurrentSDS < 0) { 
    1088       NXIReportError (NXpData, "ERROR: HDF error opening SDS"); 
     1088      NXReportError( "ERROR: HDF error opening SDS"); 
    10891089      pFile->iCurrentSDS = 0; 
    10901090      return NX_ERROR; 
     
    11071107      pFile->iCurrentSDS = 0; 
    11081108      if (iRet < 0) { 
    1109         NXIReportError (NXpData, "ERROR: HDF cannot end access to SDS"); 
     1109        NXReportError( "ERROR: HDF cannot end access to SDS"); 
    11101110        return NX_ERROR; 
    11111111      } 
    11121112    } else { 
    1113       NXIReportError (NXpData, "ERROR: no SDS open --> nothing to do"); 
     1113      NXReportError( "ERROR: no SDS open --> nothing to do"); 
    11141114      return NX_ERROR; 
    11151115    } 
     
    11331133    /* check if there is an SDS open */ 
    11341134    if (pFile->iCurrentSDS == 0) { 
    1135       NXIReportError (NXpData, "ERROR: no SDS open"); 
     1135      NXReportError( "ERROR: no SDS open"); 
    11361136      return NX_ERROR; 
    11371137    } 
     
    11501150      /* HEprint(stdout,0); */ 
    11511151      sprintf (pError, "ERROR: failure to write data to %s", pBuffer); 
    1152       NXIReportError (NXpData, pError); 
     1152      NXReportError( pError); 
    11531153      return NX_ERROR; 
    11541154    } 
     
    12031203    else 
    12041204    { 
    1205       NXIReportError (NXpData, "ERROR: Invalid data type for HDF attribute"); 
     1205      NXReportError( "ERROR: Invalid data type for HDF attribute"); 
    12061206      return NX_ERROR; 
    12071207    } 
     
    12231223    iType = type; 
    12241224    if (iRet < 0) { 
    1225       NXIReportError (NXpData, "ERROR: HDF failed to store attribute "); 
     1225      NXReportError( "ERROR: HDF failed to store attribute "); 
    12261226      return NX_ERROR; 
    12271227    } 
     
    12461246    /* check if there is an SDS open */ 
    12471247    if (pFile->iCurrentSDS == 0) { 
    1248       NXIReportError (NXpData, "ERROR: no SDS open"); 
     1248      NXReportError( "ERROR: no SDS open"); 
    12491249      return NX_ERROR; 
    12501250    } 
     
    12801280    /* deal with HDF errors */ 
    12811281    if (iRet < 0) { 
    1282       NXIReportError (NXpData, "ERROR: writing slab failed"); 
     1282      NXReportError( "ERROR: writing slab failed"); 
    12831283      return NX_ERROR; 
    12841284    } 
     
    14281428    iRet = Hfidinquire(pFile->iVID,&pFileName,&access,&dummy); 
    14291429    if (iRet < 0) { 
    1430       NXIReportError (NXpData,  
     1430      NXReportError(  
    14311431        "ERROR: Failed to inquire file name for HDF file"); 
    14321432      return NX_ERROR; 
     
    14371437      ac = NXACC_RDWR; 
    14381438    } else { 
    1439       NXIReportError (NXpData,  
     1439      NXReportError(  
    14401440        "ERROR: NX4flush failed to determine file access mode"); 
    14411441      return NX_ERROR; 
     
    14431443    pCopy = (char *)malloc((strlen(pFileName)+10)*sizeof(char)); 
    14441444    if(!pCopy) { 
    1445       NXIReportError (NXpData,  
     1445      NXReportError(  
    14461446        "ERROR: Failed to allocate data for filename copy"); 
    14471447      return NX_ERROR; 
     
    14561456      iRefs = (int *)malloc(iStack*sizeof(int)); 
    14571457      if(!iRefs){ 
    1458         NXIReportError (NXpData,  
     1458        NXReportError(  
    14591459        "ERROR: Failed to allocate data for hierarchy copy"); 
    14601460        return NX_ERROR; 
     
    15081508      iRet = NXIInitDir (pFile); 
    15091509      if (iRet < 0) { 
    1510         NXIReportError (NXpData, 
     1510        NXReportError( 
    15111511                        "ERROR: no memory to store directory info"); 
    15121512        return NX_EOD; 
     
    15251525                       pFile->iStack[iStackPtr].iRefDir[iCurDir], "r"); 
    15261526      if (iTemp < 0) { 
    1527         NXIReportError (NXpData, "ERROR: HDF cannot attach to Vgroup"); 
     1527        NXReportError( "ERROR: HDF cannot attach to Vgroup"); 
    15281528        return NX_ERROR; 
    15291529      } 
     
    15391539                         pFile->iStack[iStackPtr].iRefDir[iCurDir], "r"); 
    15401540        if (iTemp < 0) { 
    1541           NXIReportError (NXpData, "ERROR: HDF cannot attach to Vgroup"); 
     1541          NXReportError( "ERROR: HDF cannot attach to Vgroup"); 
    15421542          return NX_ERROR; 
    15431543        } 
     
    15881588    /* check if there is an SDS open */ 
    15891589    if (pFile->iCurrentSDS == 0) { 
    1590       NXIReportError (NXpData, "ERROR: no SDS open"); 
     1590      NXReportError( "ERROR: no SDS open"); 
    15911591      return NX_ERROR; 
    15921592    } 
     
    16131613    /* check if there is an SDS open */ 
    16141614    if (pFile->iCurrentSDS == 0) { 
    1615       NXIReportError (NXpData, "ERROR: no SDS open"); 
     1615      NXReportError( "ERROR: no SDS open"); 
    16161616      return NX_ERROR; 
    16171617    } 
     
    16451645    /* check if there is an SDS open */ 
    16461646    if (pFile->iCurrentSDS == 0) { 
    1647       NXIReportError (NXpData, "ERROR: no SDS open"); 
     1647      NXReportError( "ERROR: no SDS open"); 
    16481648      return NX_ERROR; 
    16491649    } 
     
    17141714    } 
    17151715    if (iRet < 0) { 
    1716       NXIReportError (NXpData, "ERROR: HDF cannot read attribute info"); 
     1716      NXReportError( "ERROR: HDF cannot read attribute info"); 
    17171717      return NX_ERROR; 
    17181718    } 
     
    17921792    if (iNew < 0) { 
    17931793      sprintf (pBuffer, "ERROR: attribute %s not found", name); 
    1794       NXIReportError (NXpData, pBuffer); 
     1794      NXReportError( pBuffer); 
    17951795      return NX_ERROR; 
    17961796    } 
     
    18091809    if (iRet < 0) { 
    18101810      sprintf (pBuffer, "ERROR: HDF could not read attribute info"); 
    1811       NXIReportError (NXpData, pBuffer); 
     1811      NXReportError( pBuffer); 
    18121812      return NX_ERROR; 
    18131813    } 
     
    18191819    pData = (void *) malloc (iLen); 
    18201820    if (!pData) { 
    1821       NXIReportError (NXpData, "ERROR: allocating memory in NXgetattr"); 
     1821      NXReportError( "ERROR: allocating memory in NXgetattr"); 
    18221822      return NX_ERROR; 
    18231823    } 
     
    18361836    if (iRet < 0) { 
    18371837      sprintf (pBuffer, "ERROR: HDF could not read attribute data"); 
    1838       NXIReportError (NXpData, pBuffer); 
     1838      NXReportError( pBuffer); 
    18391839      return NX_ERROR; 
    18401840    } 
     
    18761876    } 
    18771877    if (iRet < 0) { 
    1878       NXIReportError (NXpData, "NX_ERROR: HDF cannot read attribute numbers"); 
     1878      NXReportError( "NX_ERROR: HDF cannot read attribute numbers"); 
    18791879      *iN = 0; 
    18801880      return NX_ERROR; 
     
    19711971    iRet = NXIInitDir (pFile); 
    19721972    if (iRet < 0) { 
    1973       NXIReportError (NXpData,"NX_ERROR: no memory to store directory info"); 
     1973      NXReportError("NX_ERROR: no memory to store directory info"); 
    19741974      return NX_EOD; 
    19751975    } 
  • trunk/src/napi5.c

    r1546 r1548  
    151151    pNew = (pNexusFile5) malloc (sizeof (NexusFile5)); 
    152152    if (!pNew) { 
    153       NXIReportError (NXpData,"ERROR: no memory to create File datastructure"); 
     153      NXReportError("ERROR: no memory to create File datastructure"); 
    154154      return NX_ERROR; 
    155155    } 
     
    183183    if (pNew->iFID <= 0) { 
    184184      sprintf (pBuffer, "ERROR: cannot open file: %s", filename); 
    185       NXIReportError (NXpData, pBuffer); 
     185      NXReportError( pBuffer); 
    186186      free (pNew); 
    187187      return NX_ERROR; 
     
    208208        if (attr1<0) 
    209209        { 
    210           NXIReportError (NXpData,  
     210          NXReportError(  
    211211                         "ERROR: HDF failed to store NeXus_version attribute "); 
    212212          return NX_ERROR; 
     
    214214        if (H5Awrite(attr1, aid1,NEXUS_VERSION)<0) 
    215215        { 
    216           NXIReportError (NXpData,  
     216          NXReportError(  
    217217                         "ERROR: HDF failed to store NeXus_version attribute "); 
    218218          return NX_ERROR; 
     
    234234        if (attr1 < 0) 
    235235        { 
    236           NXIReportError (NXpData,  
     236          NXReportError(  
    237237                          "ERROR: HDF failed to store file_name attribute "); 
    238238          return NX_ERROR; 
     
    240240        if (H5Awrite(attr1, aid1, (char*)filename) < 0) 
    241241        { 
    242           NXIReportError (NXpData,  
     242          NXReportError(  
    243243                          "ERROR: HDF failed to store file_name attribute "); 
    244244          return NX_ERROR; 
     
    256256        if (attr1 < 0) 
    257257        { 
    258           NXIReportError (NXpData,  
     258          NXReportError(  
    259259                          "ERROR: HDF failed to store file_name attribute "); 
    260260          return NX_ERROR; 
     
    262262        if (H5Awrite(attr1, aid1, (char*)version_nr) < 0) 
    263263        { 
    264           NXIReportError (NXpData,  
     264          NXReportError(  
    265265                          "ERROR: HDF failed to store file_name attribute "); 
    266266          return NX_ERROR; 
     
    278278          if (attr1 < 0) 
    279279          { 
    280               NXIReportError (NXpData,  
     280              NXReportError(  
    281281                          "ERROR: HDF failed to store file_time attribute "); 
    282282              free(time_buffer); 
     
    285285          if (H5Awrite(attr1, aid1, time_buffer) < 0) 
    286286          { 
    287               NXIReportError (NXpData,  
     287              NXReportError(  
    288288                          "ERROR: HDF failed to store file_time attribute "); 
    289289              free(time_buffer); 
     
    342342 
    343343    if (iRet < 0) { 
    344       NXIReportError (NXpData, "ERROR: HDF cannot close HDF file"); 
     344      NXReportError( "ERROR: HDF cannot close HDF file"); 
    345345    } 
    346346    /* release memory */ 
     
    380380    }    
    381381    if (iRet < 0) { 
    382       NXIReportError (NXpData, "ERROR: HDF could not create Group"); 
     382      NXReportError( "ERROR: HDF could not create Group"); 
    383383      return NX_ERROR; 
    384384    } 
     
    390390    if (attr1 < 0) 
    391391       { 
    392        NXIReportError (NXpData, "ERROR: HDF failed to store class name!"); 
     392       NXReportError( "ERROR: HDF failed to store class name!"); 
    393393       return NX_ERROR; 
    394394       } 
    395395    if (H5Awrite(attr1, aid1, (char*)nxclass) < 0) 
    396396      { 
    397       NXIReportError (NXpData, "ERROR: HDF failed to store class name!"); 
     397      NXReportError( "ERROR: HDF failed to store class name!"); 
    398398      return NX_ERROR; 
    399399      } 
     
    437437    if (iRet < 0) { 
    438438      sprintf (pBuffer, "ERROR: Group %s does not exist!", pFile->name_tmp); 
    439       NXIReportError (NXpData, pBuffer); 
     439      NXReportError( pBuffer); 
    440440      return NX_ERROR;   
    441441    } 
     
    449449        iRet=H5Aiterate(pFile->iCurrentG,NULL,attr_check,NULL); 
    450450        if (iRet < 0) { 
    451           NXIReportError (NXpData, "ERROR iterating through group!"); 
     451          NXReportError( "ERROR iterating through group!"); 
    452452          return NX_ERROR;   
    453453        } else if (iRet == 1) { 
     
    455455        } else { 
    456456         /* no group attribute available */ 
    457          NXIReportError (NXpData, "No group attribute available"); 
     457         NXReportError( "No group attribute available"); 
    458458         return NX_ERROR; 
    459459        } 
     
    462462        if (attr1 < 0) 
    463463        { 
    464               NXIReportError (NXpData, "Error opening NX_class group attribute!"); 
     464              NXReportError( "Error opening NX_class group attribute!"); 
    465465              return NX_ERROR;  
    466466        } 
     
    471471              /* test OK */ 
    472472        } else { 
    473               NXIReportError (NXpData, "Group class is not identical!"); 
     473              NXReportError( "Group class is not identical!"); 
    474474              iRet = H5Tclose(atype); 
    475475              iRet = H5Aclose(attr1);  
     
    600600    else 
    601601    { 
    602       NXIReportError (NXpData, "ERROR: nxToHDF5Type: unknown type"); 
     602      NXReportError( "ERROR: nxToHDF5Type: unknown type"); 
    603603      type = -1; 
    604604    } 
     
    630630          sprintf (pBuffer, "ERROR: no group open for makedata on %s", 
    631631              name); 
    632           NXIReportError (NXpData, pBuffer); 
     632          NXReportError( pBuffer); 
    633633          return NX_ERROR; 
    634634      } 
     
    648648          sprintf (pBuffer, "ERROR: invalid rank specified %s", 
    649649              name); 
    650           NXIReportError (NXpData, pBuffer); 
     650          NXReportError( pBuffer); 
    651651          return NX_ERROR; 
    652652      } 
     
    662662                  "ERROR: invalid dimension %d, value %d given for Dataset %s", 
    663663                  i, dimensions[i], name); 
    664               NXIReportError (NXpData, pBuffer); 
     664              NXReportError( pBuffer); 
    665665              return NX_ERROR; 
    666666          } 
     
    727727          if (iNew < 0)  
    728728          { 
    729               NXIReportError (NXpData, "ERROR: Size of chunks could not be set!"); 
     729              NXReportError( "ERROR: Size of chunks could not be set!"); 
    730730              return NX_ERROR; 
    731731          } 
     
    741741              if (iNew < 0)  
    742742              { 
    743                   NXIReportError (NXpData, "ERROR: Size of chunks could not be set!"); 
     743                  NXReportError( "ERROR: Size of chunks could not be set!"); 
    744744                  return NX_ERROR; 
    745745              } 
     
    757757          if (iNew < 0)  
    758758          { 
    759               NXIReportError (NXpData, "ERROR: Size of chunks could not be set!"); 
     759              NXReportError( "ERROR: Size of chunks could not be set!"); 
    760760              return NX_ERROR; 
    761761          } 
     
    765765      else  
    766766      { 
    767           NXIReportError (NXpData,  
     767          NXReportError(  
    768768              "HDF5 doesn't support selected compression method! Dataset was saved without compression"); 
    769769          iRet = H5Dcreate (pFile->iCurrentG, (char*)name, datatype1, dataspace, H5P_DEFAULT);  
     
    771771      if (iRet < 0)  
    772772      { 
    773           NXIReportError (NXpData, "ERROR: Creating chunked dataset failed!"); 
     773          NXReportError( "ERROR: Creating chunked dataset failed!"); 
    774774          return NX_ERROR; 
    775775      }  
     
    786786              sprintf (pBuffer, "ERROR: cannot create Dataset %s, check arguments", 
    787787                  name); 
    788               NXIReportError (NXpData, pBuffer); 
     788              NXReportError( pBuffer); 
    789789              return NX_ERROR; 
    790790          } 
     
    800800      if (iRet < 0) 
    801801      { 
    802           NXIReportError (NXpData, "ERROR: HDF cannot close Dataset"); 
     802          NXReportError( "ERROR: HDF cannot close Dataset"); 
    803803          return NX_ERROR; 
    804804      } 
     
    854854    if (pFile->iCurrentD < 0) { 
    855855      sprintf (pBuffer, "ERROR: Dataset %s not found at this level", name); 
    856       NXIReportError (NXpData, pBuffer); 
     856      NXReportError( pBuffer); 
    857857      return NX_ERROR; 
    858858    } 
     
    860860    pFile->iCurrentT = H5Dget_type(pFile->iCurrentD); 
    861861    if (pFile->iCurrentT < 0) { 
    862       NXIReportError (NXpData, "ERROR:HDF error opening Dataset"); 
     862      NXReportError( "ERROR:HDF error opening Dataset"); 
    863863      pFile->iCurrentT=0; 
    864864      return NX_ERROR; 
     
    867867    pFile->iCurrentS = H5Dget_space(pFile->iCurrentD); 
    868868    if (pFile->iCurrentS < 0) { 
    869       NXIReportError (NXpData, "ERROR:HDF error opening Dataset"); 
     869      NXReportError( "ERROR:HDF error opening Dataset"); 
    870870      pFile->iCurrentS=0; 
    871871      return NX_ERROR; 
     
    890890    iRet = H5Dclose(pFile->iCurrentD); 
    891891    if (iRet < 0) { 
    892         NXIReportError (NXpData, "ERROR: HDF cannot end access to Dataset"); 
     892        NXReportError( "ERROR: HDF cannot end access to Dataset"); 
    893893        return NX_ERROR; 
    894894     } 
     
    915915    if (iRet < 0) { 
    916916      snprintf (pError,511, "ERROR: failure to write data"); 
    917       NXIReportError (NXpData, pError); 
     917      NXReportError( pError); 
    918918      return NX_ERROR; 
    919919    } 
     
    969969      iRet=H5Adelete(vid,name); 
    970970      if (iRet<0) { 
    971         NXIReportError (NXpData, "ERROR: Old attribute cannot be removed! "); 
     971        NXReportError( "ERROR: Old attribute cannot be removed! "); 
    972972        killAttVID(pFile,vid); 
    973973        return NX_ERROR; 
     
    976976    attr1 = H5Acreate(vid, name, aid1, aid2, H5P_DEFAULT); 
    977977    if (attr1 < 0) { 
    978       NXIReportError (NXpData, "ERROR: Attribute cannot created! "); 
     978      NXReportError( "ERROR: Attribute cannot created! "); 
    979979      killAttVID(pFile,vid); 
    980980      return NX_ERROR; 
    981981    }    
    982982    if (H5Awrite(attr1,aid1,data) < 0) { 
    983       NXIReportError (NXpData, "ERROR: HDF failed to store attribute "); 
     983      NXReportError( "ERROR: HDF failed to store attribute "); 
    984984      killAttVID(pFile,vid); 
    985985      return NX_ERROR; 
     
    10091009     /* check if there is an Dataset open */ 
    10101010    if (pFile->iCurrentD == 0) { 
    1011       NXIReportError (NXpData, "ERROR: no dataset open"); 
     1011      NXReportError( "ERROR: no dataset open"); 
    10121012      return NX_ERROR; 
    10131013    } 
     
    10331033       if (iRet < 0)  
    10341034       { 
    1035            NXIReportError (NXpData, "ERROR: extend slab failed"); 
     1035           NXReportError( "ERROR: extend slab failed"); 
    10361036           return NX_ERROR; 
    10371037       } 
     
    10451045       if (iRet < 0)  
    10461046       { 
    1047        NXIReportError (NXpData, "ERROR: selecting slab failed"); 
     1047       NXReportError( "ERROR: selecting slab failed"); 
    10481048       return NX_ERROR; 
    10491049       } 
     
    10531053       if (iRet < 0) 
    10541054       { 
    1055            NXIReportError (NXpData, "ERROR: writing slab failed"); 
     1055           NXReportError( "ERROR: writing slab failed"); 
    10561056       } 
    10571057       iRet = H5Sclose(filespace);              
     
    10631063       if (iRet < 0)  
    10641064       { 
    1065        NXIReportError (NXpData, "ERROR: selecting slab failed"); 
     1065       NXReportError( "ERROR: selecting slab failed"); 
    10661066       return NX_ERROR; 
    10671067       } 
     
    10711071       if (iRet < 0) 
    10721072       { 
    1073            NXIReportError (NXpData, "ERROR: writing slab failed"); 
     1073           NXReportError( "ERROR: writing slab failed"); 
    10741074       } 
    10751075   } 
     
    10781078   if (iRet < 0)  
    10791079   { 
    1080       NXIReportError (NXpData, "ERROR: closing slab failed"); 
     1080      NXReportError( "ERROR: closing slab failed"); 
    10811081      return NX_ERROR; 
    10821082   } 
     
    11461146    if(dataID < 0) 
    11471147    { 
    1148       NXIReportError(NXpData,"Internal error, path to link does not exist"); 
     1148      NXReportError("Internal error, path to link does not exist"); 
    11491149      return NX_ERROR; 
    11501150    } 
     
    12041204    else  
    12051205    { 
    1206       NXIReportError(NXpData,"Path string to long"); 
     1206      NXReportError("Path string to long"); 
    12071207      return NX_ERROR; 
    12081208    }  
     
    12321232    itemName = strrchr(sLink->targetPath,'/'); 
    12331233    if(itemName == NULL){ 
    1234       NXIReportError(NXpData,"Bad link structure"); 
     1234      NXReportError("Bad link structure"); 
    12351235      return NX_ERROR; 
    12361236    } 
     
    12501250    else  
    12511251    { 
    1252       NXIReportError(NXpData,"Path string to long"); 
     1252      NXReportError("Path string to long"); 
    12531253      return NX_ERROR; 
    12541254    }  
     
    12801280    } 
    12811281    if (iRet < 0){ 
    1282       NXIReportError (NXpData, "ERROR: The object cannot be flushed"); 
     1282      NXReportError( "ERROR: The object cannot be flushed"); 
    12831283      return NX_ERROR;  
    12841284    } 
     
    13851385  status = H5Gget_num_objs(loc_id, &numobj); 
    13861386  if(status < 0) { 
    1387     NXIReportError(NXpData,"Internal error, failed to retrive no of objects"); 
     1387    NXReportError("Internal error, failed to retrive no of objects"); 
    13881388    return 0; 
    13891389  } 
     
    15091509      if (iPtype == -1) 
    15101510      { 
    1511           NXIReportError (NXpData, "ERROR: hdf5ToNXtype: invalid type"); 
     1511          NXReportError( "ERROR: hdf5ToNXtype: invalid type"); 
    15121512      } 
    15131513 
     
    15761576      if (memtype_id == -1) 
    15771577      { 
    1578           NXIReportError (NXpData, "ERROR: h5MemType: invalid type"); 
     1578          NXReportError( "ERROR: h5MemType: invalid type"); 
    15791579      } 
    15801580      return memtype_id; 
     
    16501650           if (grp < 0) { 
    16511651              sprintf (pBuffer, "ERROR: Group %s does not exist!", ph_name); 
    1652               NXIReportError (NXpData, pBuffer); 
     1652              NXReportError( pBuffer); 
    16531653              return NX_ERROR;   
    16541654           } 
     
    17001700            free(op_data.iname); 
    17011701         }  
    1702          NXIReportError (NXpData,  
     1702         NXReportError(  
    17031703                            "ERROR: Iteration (directory) was not successful"); 
    17041704         return NX_ERROR;               
     
    17201720     if (pFile->iCurrentD == 0)  
    17211721     { 
    1722         NXIReportError (NXpData, "ERROR: no Dataset open"); 
     1722        NXReportError( "ERROR: no Dataset open"); 
    17231723        return NX_ERROR; 
    17241724     } 
     
    17461746     if(status < 0) 
    17471747     { 
    1748         NXIReportError (NXpData, "ERROR: failed to transfer dataset"); 
     1748        NXReportError( "ERROR: failed to transfer dataset"); 
    17491749        return NX_ERROR; 
    17501750 
     
    17651765     /* check if there is an Dataset open */ 
    17661766     if (pFile->iCurrentD == 0) { 
    1767        NXIReportError (NXpData, "ERROR: no Dataset open"); 
     1767       NXReportError( "ERROR: no Dataset open"); 
    17681768       return NX_ERROR; 
    17691769     } 
     
    18061806     if (pFile->iCurrentD == 0)  
    18071807       { 
    1808          NXIReportError (NXpData, "ERROR: no Dataset open"); 
     1808         NXReportError( "ERROR: no Dataset open"); 
    18091809         return NX_ERROR; 
    18101810       } 
     
    18391839      if (iRet < 0)  
    18401840        { 
    1841           NXIReportError (NXpData, "ERROR: selecting slab failed"); 
     1841          NXReportError( "ERROR: selecting slab failed"); 
    18421842          return NX_ERROR; 
    18431843        } 
     
    18481848      if (iRet < 0)  
    18491849        { 
    1850           NXIReportError (NXpData, "ERROR: Select memspace failed"); 
     1850          NXReportError( "ERROR: Select memspace failed"); 
    18511851          return NX_ERROR; 
    18521852        } 
     
    18831883 
    18841884        { 
    1885           NXIReportError (NXpData, "ERROR: Reading slab failed"); 
     1885          NXReportError( "ERROR: Reading slab failed"); 
    18861886          return NX_ERROR; 
    18871887        } 
     
    19331933     intern_idx=-1; 
    19341934     if (iRet < 0) { 
    1935            NXIReportError (NXpData, "ERROR iterating through attribute list!"); 
     1935           NXReportError( "ERROR iterating through attribute list!"); 
    19361936           killAttVID(pFile,vid); 
    19371937           return NX_ERROR;   
     
    19981998       sprintf (pBuffer, "ERROR: attribute %s not found", name); 
    19991999       killAttVID(pFile,vid); 
    2000        NXIReportError (NXpData, pBuffer); 
     2000       NXReportError( pBuffer); 
    20012001       return NX_ERROR; 
    20022002     } 
     
    20222022     if (iRet < 0) { 
    20232023       sprintf (pBuffer, "ERROR: HDF could not read attribute data"); 
    2024        NXIReportError (NXpData, pBuffer); 
     2024       NXReportError( pBuffer); 
    20252025       killAttVID(pFile,vid); 
    20262026       return NX_ERROR; 
  • trunk/src/napiu.c

    r671 r1548  
    104104         else 
    105105         { 
    106                  NXIReportError(NXpData, "Invalid compression option"); 
     106                 NXReportError( "Invalid compression option"); 
    107107         status = NX_ERROR; 
    108108         } 
  • trunk/src/nexus_symbols.txt

    r1542 r1548  
    4848NXMSetError 
    4949NXMSetTError 
     50NXReportError 
    5051NXIReportError 
    5152NXIprintlink 
  • trunk/src/nxxml.c

    r1544 r1548  
    107107    } 
    108108    if(testNode == NULL){ 
    109       NXIReportError(NXpData,"Cannot follow broken link"); 
     109      NXReportError("Cannot follow broken link"); 
    110110      return NULL; 
    111111    } else { 
     
    117117/*==================== file functions ===================================*/ 
    118118static void errorCallbackForMxml(const char *txt){ 
    119   NXIReportError(NXpData,(char *)txt); 
     119  NXReportError((char *)txt); 
    120120} 
    121121/*-----------------------------------------------------------------------*/ 
     
    132132  xmlHandle = (pXMLNexus)malloc(sizeof(XMLNexus)); 
    133133  if(!xmlHandle){ 
    134     NXIReportError(NXpData, "Out of memory allocating XML file handle"); 
     134    NXReportError( "Out of memory allocating XML file handle"); 
    135135    return NX_ERROR; 
    136136  } 
     
    155155    fp = fopen(filename,"r"); 
    156156    if(fp == NULL){ 
    157       NXIReportError(NXpData,"Failed to open file:"); 
    158       NXIReportError(NXpData,(char *)filename); 
     157      NXReportError("Failed to open file:"); 
     158      NXReportError((char *)filename); 
    159159      free(xmlHandle); 
    160160      return NX_ERROR; 
     
    193193    break; 
    194194  default: 
    195     NXIReportError(NXpData,"Bad access parameter specified in NXXopen"); 
     195    NXReportError("Bad access parameter specified in NXXopen"); 
    196196    return NX_ERROR; 
    197197  } 
    198198  if(xmlHandle->stack[0].current == NULL){ 
    199       NXIReportError(NXpData, 
     199      NXReportError( 
    200200                     "No NXroot element in XML-file, no NeXus-XML file"); 
    201201      return NX_ERROR; 
     
    216216    fp = fopen(xmlHandle->filename,"w"); 
    217217    if(fp == NULL){ 
    218       NXIReportError(NXpData,"Failed to open NeXus XML file for writing"); 
     218      NXReportError("Failed to open NeXus XML file for writing"); 
    219219      return NX_ERROR; 
    220220    } 
     
    238238    fp = fopen(xmlHandle->filename,"w"); 
    239239    if(fp == NULL){ 
    240       NXIReportError(NXpData,"Failed to open NeXus XML file for writing"); 
     240      NXReportError("Failed to open NeXus XML file for writing"); 
    241241      return NX_ERROR; 
    242242    } 
     
    258258 
    259259  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    260     NXIReportError(NXpData,"Close dataset before trying to create a group"); 
     260    NXReportError("Close dataset before trying to create a group"); 
    261261    return NX_ERROR; 
    262262  } 
     
    265265                            nxclass); 
    266266  if(!newGroup){ 
    267     NXIReportError(NXpData,"failed to allocate new group"); 
     267    NXReportError("failed to allocate new group"); 
    268268    return NX_ERROR; 
    269269  } 
     
    318318 
    319319  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    320     NXIReportError(NXpData,"Close dataset before trying to open a group"); 
     320    NXReportError("Close dataset before trying to open a group"); 
    321321    return NX_ERROR; 
    322322  } 
     
    332332  if(!newGroup){ 
    333333    snprintf(error,1023,"Failed to open %s, %s",name,nxclass); 
    334     NXIReportError(NXpData,error); 
     334    NXReportError(error); 
    335335    return NX_ERROR; 
    336336  } 
     
    385385  typestring = (char *)malloc(132*sizeof(char)); 
    386386  if(!typestring){ 
    387     NXIReportError(NXpData,"Failed to allocate typestring"); 
     387    NXReportError("Failed to allocate typestring"); 
    388388    return NULL; 
    389389  } 
     
    420420 
    421421  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    422     NXIReportError(NXpData,"Close dataset before trying to create a dataset"); 
     422    NXReportError("Close dataset before trying to create a dataset"); 
    423423    return NX_ERROR; 
    424424  } 
     
    441441    free(typestring); 
    442442  } else { 
    443     NXIReportError(NXpData,"Failed to allocate typestring"); 
     443    NXReportError("Failed to allocate typestring"); 
    444444    return NX_ERROR; 
    445445  } 
     
    460460      newData = (mxml_node_t *)malloc(sizeof(mxml_node_t)); 
    461461      if(!newData){ 
    462         NXIReportError(NXpData,"Failed to allocate space for dataset"); 
     462        NXReportError("Failed to allocate space for dataset"); 
    463463        return NX_ERROR; 
    464464      } 
     
    469469      newData->value.custom.data = createNXDataset(1,datatype,&one); 
    470470      if(!newData->value.custom.data){ 
    471         NXIReportError(NXpData,"Failed to allocate space for dataset"); 
     471        NXReportError("Failed to allocate space for dataset"); 
    472472        return NX_ERROR; 
    473473      } 
     
    496496 
    497497  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    498     NXIReportError(NXpData,"Close dataset before trying to create a dataset"); 
     498    NXReportError("Close dataset before trying to create a dataset"); 
    499499    return NX_ERROR; 
    500500  } 
     
    510510    free(typestring); 
    511511  } else { 
    512     NXIReportError(NXpData,"Failed to allocate typestring"); 
     512    NXReportError("Failed to allocate typestring"); 
    513513    return NX_ERROR; 
    514514  } 
     
    522522    newData = (mxml_node_t *)malloc(sizeof(mxml_node_t)); 
    523523    if(!newData){ 
    524       NXIReportError(NXpData,"Failed to allocate space for dataset"); 
     524      NXReportError("Failed to allocate space for dataset"); 
    525525      return NX_ERROR; 
    526526    } 
     
    530530    newData->value.custom.data = createNXDataset(rank,datatype,dimensions); 
    531531    if(!newData->value.custom.data){ 
    532       NXIReportError(NXpData,"Failed to allocate space for dataset"); 
     532      NXReportError("Failed to allocate space for dataset"); 
    533533      return NX_ERROR; 
    534534    } 
     
    597597  if(!dimsNode){ 
    598598    snprintf(error,1023,"Failed to open dataset %s",name); 
    599     NXIReportError(NXpData,error); 
     599    NXReportError(error); 
    600600    return NX_ERROR; 
    601601  } 
     
    612612  if(!dataNode){ 
    613613    snprintf(error,1023,"Failed to open dataset %s",name); 
    614     NXIReportError(NXpData,error); 
     614    NXReportError(error); 
    615615    return NX_ERROR; 
    616616  } 
     
    675675  if(!dataNode){ 
    676676    snprintf(error,1023,"Failed to open dataset %s",name); 
    677     NXIReportError(NXpData,error); 
     677    NXReportError(error); 
    678678    return NX_ERROR; 
    679679  } 
     
    773773 
    774774  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    775     NXIReportError(NXpData,"No dataset open"); 
     775    NXReportError("No dataset open"); 
    776776    return NX_ERROR; 
    777777  } 
     
    801801    else 
    802802    { 
    803         NXIReportError(NXpData,"Unable to determine size of character dataset"); 
     803        NXReportError("Unable to determine size of character dataset"); 
    804804        return NX_ERROR; 
    805805    } 
     
    872872 
    873873  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    874     NXIReportError(NXpData,"No dataset open"); 
     874    NXReportError("No dataset open"); 
    875875    return NX_ERROR; 
    876876  } 
     
    916916 
    917917  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    918     NXIReportError(NXpData,"No dataset open"); 
     918    NXReportError("No dataset open"); 
    919919    return NX_ERROR; 
    920920  } 
     
    10291029      free(typestring); 
    10301030    } else { 
    1031       NXIReportError(NXpData,"Failed to allocate typestring"); 
     1031      NXReportError("Failed to allocate typestring"); 
    10321032      return 0; 
    10331033    } 
     
    10591059 
    10601060  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1061     NXIReportError(NXpData,"No dataset open"); 
     1061    NXReportError("No dataset open"); 
    10621062    return NX_ERROR; 
    10631063  } 
     
    10671067  assert(userData != NULL); 
    10681068  if(userData->type == MXML_OPAQUE){ 
    1069     NXIReportError(NXpData,"This API does not support slabs on text data"); 
     1069    NXReportError("This API does not support slabs on text data"); 
    10701070    return NX_ERROR; 
    10711071  } 
     
    10751075  status = checkAndExtendDataset(current,dataset,iStart,iSize); 
    10761076  if(status == 0){ 
    1077     NXIReportError(NXpData,"Out of memory extending dataset"); 
     1077    NXReportError("Out of memory extending dataset"); 
    10781078    return NX_ERROR; 
    10791079  } 
     
    10811081  slabData = makeSlabData(dataset, data, iSize); 
    10821082  if(slabData == NULL){ 
    1083     NXIReportError(NXpData,"Failed to allocate slab data"); 
     1083    NXReportError("Failed to allocate slab data"); 
    10841084    return NX_ERROR; 
    10851085  } 
     
    11311131 
    11321132  if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1133     NXIReportError(NXpData,"No dataset open"); 
     1133    NXReportError("No dataset open"); 
    11341134    return NX_ERROR; 
    11351135  } 
     
    11391139  assert(userData != NULL); 
    11401140  if(userData->type == MXML_OPAQUE){ 
    1141     NXIReportError(NXpData,"This API does not support slabs on text data"); 
     1141    NXReportError("This API does not support slabs on text data"); 
    11421142    return NX_ERROR; 
    11431143  } 
     
    11461146  slabData = makeSlabData(dataset, data, iSize); 
    11471147  if(slabData == NULL){ 
    1148     NXIReportError(NXpData,"Failed to allocate slab data"); 
     1148    NXReportError("Failed to allocate slab data"); 
    11491149    return NX_ERROR; 
    11501150  } 
     
    12031203  number = (char *)malloc(132*sizeof(char)); 
    12041204  if(!number){ 
    1205     NXIReportError(NXpData,"Failed to allocate attribute number buffer"); 
     1205    NXReportError("Failed to allocate attribute number buffer"); 
    12061206    return NULL; 
    12071207  } 
     
    12731273  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    12741274    if(strcmp(name,TYPENAME) == 0){ 
    1275       NXIReportError(NXpData,"type is a reserved attribute name, rejected"); 
     1275      NXReportError("type is a reserved attribute name, rejected"); 
    12761276      return  NX_ERROR; 
    12771277    } 
     
    12801280  numberData = formatAttributeData(data,datalen,iType); 
    12811281  if(numberData == NULL){ 
    1282     NXIReportError(NXpData,"This API does not support non number arrays"); 
     1282    NXReportError("This API does not support non number arrays"); 
    12831283    return NX_ERROR; 
    12841284  } else { 
     
    13061306  if(!attribute){ 
    13071307    snprintf(error,1023,"Attribute %s not found", name); 
    1308     NXIReportError(NXpData,error); 
     1308    NXReportError(error); 
    13091309    return NX_ERROR; 
    13101310  } 
     
    13251325      attData = strchr(attribute,(int)':'); 
    13261326      if(attData == NULL){ 
    1327         NXIReportError(NXpData,"ERROR: bad attribute string, : missing"); 
     1327        NXReportError("ERROR: bad attribute string, : missing"); 
    13281328        return NX_ERROR; 
    13291329      } 
     
    14801480    linkName = mxmlElementGetAttr(next,"name"); 
    14811481    if(target == NULL){ 
    1482       NXIReportError(NXpData,"Corrupted file, NAPIlink without target"); 
     1482      NXReportError("Corrupted file, NAPIlink without target"); 
    14831483      return NX_ERROR; 
    14841484    } 
    14851485    next = getLinkTarget(xmlHandle,target); 
    14861486    if(next == NULL){ 
    1487       NXIReportError(NXpData,"Corrupted file, broken link"); 
     1487      NXReportError("Corrupted file, broken link"); 
    14881488      return NX_ERROR; 
    14891489    } 
     
    14971497        snprintf(pBueffel,255,"Corrupted file, userData for %s not found", 
    14981498                 name); 
    1499       NXIReportError(NXpData,pBueffel); 
     1499      NXReportError(pBueffel); 
    15001500      return NX_ERROR; 
    15011501    } 
     
    15291529 
    15301530  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1531     NXIReportError(NXpData,"Cannot search datasets"); 
     1531    NXReportError("Cannot search datasets"); 
    15321532    return NX_ERROR; 
    15331533  } 
     
    16181618 
    16191619  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1620     NXIReportError(NXpData,"No group open"); 
     1620    NXReportError("No group open"); 
    16211621    return NX_ERROR; 
    16221622  }  
     
    17451745  path = (mxml_node_t **)malloc(NXMAXSTACK*sizeof(mxml_node_t *)); 
    17461746  if(path == NULL){ 
    1747     NXIReportError(NXpData,"ERROR: out of memory following link path"); 
     1747    NXReportError("ERROR: out of memory following link path"); 
    17481748    return NULL; 
    17491749  } 
     
    17871787  linkPath = findLinkPath(current); 
    17881788  if(!linkPath){ 
    1789     NXIReportError(NXpData,"Failed to allocate link path string"); 
     1789    NXReportError("Failed to allocate link path string"); 
    17901790    return NX_ERROR; 
    17911791  } 
     
    18041804 
    18051805  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1806     NXIReportError(NXpData,"No group open"); 
     1806    NXReportError("No group open"); 
    18071807    return NX_ERROR; 
    18081808  }  
     
    18151815  linkPath = findLinkPath(current); 
    18161816  if(!linkPath){ 
    1817     NXIReportError(NXpData,"Failed to allocate link path string"); 
     1817    NXReportError("Failed to allocate link path string"); 
    18181818    return NX_ERROR; 
    18191819  } 
     
    18441844 
    18451845  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1846     NXIReportError(NXpData,"No group to link to open"); 
     1846    NXReportError("No group to link to open"); 
    18471847    return NX_ERROR; 
    18481848  }  
     
    18501850  linkNode = mxmlNewElement(current,"NAPIlink"); 
    18511851  if(!linkNode){ 
    1852     NXIReportError(NXpData,"Failed to allocate new link element"); 
     1852    NXReportError("Failed to allocate new link element"); 
    18531853    return NX_ERROR; 
    18541854  } 
     
    18711871 
    18721872  if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 
    1873     NXIReportError(NXpData,"No group to link to open"); 
     1873    NXReportError("No group to link to open"); 
    18741874    return NX_ERROR; 
    18751875  }  
     
    18771877  linkNode = mxmlNewElement(current,"NAPIlink"); 
    18781878  if(!linkNode){ 
    1879     NXIReportError(NXpData,"Failed to allocate new link element"); 
     1879    NXReportError("Failed to allocate new link element"); 
    18801880    return NX_ERROR; 
    18811881  } 
     
    19001900int  NXXcompress(NXhandle fid, int comp){ 
    19011901  /* that will throw an exception in the Java API, errors have to be fatal */ 
    1902   /* NXIReportError(NXpData,"NXcompress is deprecated, IGNORED"); */ 
     1902  /* NXReportError("NXcompress is deprecated, IGNORED"); */ 
    19031903  return NX_OK; 
    19041904} 
Note: See TracChangeset for help on using the changeset viewer.