Changeset 1548
- Timestamp:
- 06/10/10 19:57:35 (20 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
bindings/swig/nxinterhelper.c (modified) (3 diffs)
-
include/napi.h (modified) (1 diff)
-
src/napi.c (modified) (27 diffs)
-
src/napi4.c (modified) (69 diffs)
-
src/napi5.c (modified) (63 diffs)
-
src/napiu.c (modified) (1 diff)
-
src/nexus_symbols.txt (modified) (1 diff)
-
src/nxxml.c (modified) (53 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/swig/nxinterhelper.c
r1375 r1548 208 208 dimData = (pNXDS)dimPtr; 209 209 if(dimData->type != NX_INT32){ 210 NX IReportError(NULL,"ERROR: dimension data not integer");210 NXReportError("ERROR: dimension data not integer"); 211 211 return 0; 212 212 } … … 229 229 dimData = (pNXDS)dimPtr; 230 230 if(dimData->type != NX_INT32){ 231 NX IReportError(NULL,"ERROR: dimension data not integer");231 NXReportError("ERROR: dimension data not integer"); 232 232 return 0; 233 233 } … … 416 416 417 417 if(data == NULL){ 418 NX IReportError(NULL,"ERROR: NULL data pointer in nx_putdata");418 NXReportError("ERROR: NULL data pointer in nx_putdata"); 419 419 return 0; 420 420 } -
trunk/include/napi.h
r1542 r1548 787 787 extern void NXMEnableErrorReporting(); 788 788 789 789 /** 790 * Dispatches the error message to the error function defined by NXMSetTError 791 */ 792 extern void NXReportError(char *text); 793 794 /** 795 * Do not use, first parameter should be set by NXMSetTError 796 */ 790 797 extern void NXIReportError(void *pData,char *text); 791 extern void *NXpData; 798 /* extern void *NXpData; */ 792 799 extern char *NXIformatNeXusTime(); 793 800 extern NXstatus NXIprintlink(NXhandle fid, NXlink* link); -
trunk/src/napi.c
r1545 r1548 196 196 197 197 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) { 199 203 if (NXEHIReportTError) { 200 204 (*NXEHIReportTError)(NXEHpTData, string); … … 331 335 fileStack = makeFileStack(); 332 336 if(fileStack == NULL){ 333 NX IReportError (NXpData,"ERROR: no memory to create filestack");337 NXReportError("ERROR: no memory to create filestack"); 334 338 return NX_ERROR; 335 339 } … … 365 369 fHandle = (pNexusFunction)malloc(sizeof(NexusFunction)); 366 370 if (fHandle == NULL) { 367 NX IReportError (NXpData,"ERROR: no memory to create Function structure");371 NXReportError("ERROR: no memory to create Function structure"); 368 372 return NX_ERROR; 369 373 } … … 398 402 filename = locateNexusFileInPath((char *)userfilename); 399 403 if(filename == NULL){ 400 NX IReportError(NXpData,"Out of memory in NeXus-API");404 NXReportError("Out of memory in NeXus-API"); 401 405 free(fHandle); 402 406 return NX_ERROR; … … 407 411 snprintf(error,1023,"failed to open %s for reading", 408 412 filename); 409 NX IReportError(NXpData,error);413 NXReportError(error); 410 414 free(filename); 411 415 return NX_ERROR; … … 414 418 snprintf(error,1023,"failed to determine filetype for %s ", 415 419 filename); 416 NX IReportError(NXpData,error);420 NXReportError(error); 417 421 free(filename); 418 422 free(fHandle); … … 422 426 } 423 427 if(filename == NULL){ 424 NX IReportError(NXpData,"Out of memory in NeXus-API");428 NXReportError("Out of memory in NeXus-API"); 425 429 return NX_ERROR; 426 430 } … … 439 443 pushFileStack(fileStack,fHandle,filename); 440 444 #else 441 NX IReportError (NXpData,445 NXReportError( 442 446 "ERROR: Attempt to create HDF4 file when not linked with HDF4"); 443 447 retstat = NX_ERROR; … … 458 462 pushFileStack(fileStack,fHandle, filename); 459 463 #else 460 NX IReportError (NXpData,464 NXReportError( 461 465 "ERROR: Attempt to create HDF5 file when not linked with HDF5"); 462 466 retstat = NX_ERROR; … … 479 483 pushFileStack(fileStack,fHandle, filename); 480 484 #else 481 NX IReportError (NXpData,485 NXReportError( 482 486 "ERROR: Attempt to create XML file when not linked with XML"); 483 487 retstat = NX_ERROR; 484 488 #endif 485 489 } else { 486 NX IReportError (NXpData,490 NXReportError( 487 491 "ERROR: Format not readable by this NeXus library"); 488 492 retstat = NX_ERROR; … … 548 552 length = strlen(napiMount) - 9; 549 553 if(length > extFileLen){ 550 NX IReportError(NXpData,"ERROR: internal errro with external linking");554 NXReportError("ERROR: internal errro with external linking"); 551 555 return NXBADURL; 552 556 } … … 558 562 length = path - pPtr; 559 563 if(length > extFileLen){ 560 NX IReportError(NXpData,"ERROR: internal errro with external linking");564 NXReportError("ERROR: internal errro with external linking"); 561 565 return NXBADURL; 562 566 } … … 564 568 length = strlen(path-1); 565 569 if(length > extPathLen){ 566 NX IReportError(NXpData,"ERROR: internal error with external linking");570 NXReportError("ERROR: internal error with external linking"); 567 571 return NXBADURL; 568 572 } … … 726 730 if (datalen > 1 && iType != NX_CHAR) 727 731 { 728 NX IReportError(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"); 729 733 return NX_ERROR; 730 734 } … … 775 779 if(status != NX_OK) 776 780 { 777 NX IReportError(NXpData,"ERROR: item not linked");781 NXReportError("ERROR: item not linked"); 778 782 return NX_ERROR; 779 783 } … … 827 831 } 828 832 else { 829 NX IReportError (NXpData,833 NXReportError( 830 834 "ERROR: NXmalloc - unknown data type in array"); 831 835 return NX_ERROR; … … 841 845 { 842 846 if (data == NULL) { 843 NX IReportError (NXpData,"ERROR: passing NULL to NXfree");847 NXReportError( "ERROR: passing NULL to NXfree"); 844 848 return NX_ERROR; 845 849 } 846 850 if (*data == NULL) { 847 NX IReportError (NXpData,"ERROR: passing already freed pointer to NXfree");851 NXReportError("ERROR: passing already freed pointer to NXfree"); 848 852 return NX_ERROR; 849 853 } … … 1312 1316 } 1313 1317 snprintf(pBueffel,255,"ERROR: NXopenpath cannot step into %s",name); 1314 NX IReportError (NXpData,pBueffel);1318 NXReportError( pBueffel); 1315 1319 return NX_ERROR; 1316 1320 } … … 1348 1352 } 1349 1353 snprintf(pBueffel,255,"ERROR: NXopenpath cannot step into %s",name); 1350 NX IReportError (NXpData,pBueffel);1354 NXReportError( pBueffel); 1351 1355 return NX_ERROR; 1352 1356 } … … 1360 1364 if(hfil == NULL || path == NULL) 1361 1365 { 1362 NX IReportError(NXpData,1366 NXReportError( 1363 1367 "ERROR: NXopendata needs both a file handle and a path string"); 1364 1368 return NX_ERROR; … … 1368 1372 if(status != NX_OK) 1369 1373 { 1370 NX IReportError (NXpData,1374 NXReportError( 1371 1375 "ERROR: NXopendata failed to move down in hierarchy"); 1372 1376 return status; … … 1397 1401 if(hfil == NULL || path == NULL) 1398 1402 { 1399 NX IReportError(NXpData,1403 NXReportError( 1400 1404 "ERROR: NXopendata needs both a file handle and a path string"); 1401 1405 return NX_ERROR; … … 1405 1409 if(status != NX_OK) 1406 1410 { 1407 NX IReportError (NXpData,1411 NXReportError( 1408 1412 "ERROR: NXopendata failed to move down in hierarchy"); 1409 1413 return status; … … 1459 1463 time_buffer = (char *)malloc(64*sizeof(char)); 1460 1464 if(!time_buffer){ 1461 NX IReportError(NXpData,"Failed to allocate buffer for time data");1465 NXReportError("Failed to allocate buffer for time data"); 1462 1466 return NULL; 1463 1467 } … … 1482 1486 else 1483 1487 { 1484 NX IReportError (NXpData,1488 NXReportError( 1485 1489 "Your gmtime() function does not work ... timezone information will be incorrect\n"); 1486 1490 gmt_offset = 0; … … 1584 1588 "ERROR: Cannot allocate space for array rank of %d in NXfmakedata", 1585 1589 *pRank); 1586 NX IReportError (NXpData,buffer);1590 NXReportError( buffer); 1587 1591 return NX_ERROR; 1588 1592 } … … 1615 1619 "ERROR: Cannot allocate space for array rank of %d in NXfcompmakedata", 1616 1620 *pRank); 1617 NX IReportError (NXpData,buffer);1621 NXReportError( buffer); 1618 1622 return NX_ERROR; 1619 1623 } -
trunk/src/napi4.c
r1546 r1548 127 127 pArray = (int32 *) malloc (iN * sizeof (int32)); 128 128 if (!pArray) { 129 NX IReportError (NXpData,"ERROR: out of memory in NXIFindVgroup");129 NXReportError( "ERROR: out of memory in NXIFindVgroup"); 130 130 return NX_EOD; 131 131 } … … 187 187 i = SDfileinfo (self->iSID, &iN, &iA); 188 188 if (i < 0) { 189 NX IReportError (NXpData,"ERROR: failure to read file information");189 NXReportError( "ERROR: failure to read file information"); 190 190 return NX_EOD; 191 191 } … … 246 246 (int32 *) malloc (self->iStack[iStackPtr].iNDir * sizeof (int32) + 1); 247 247 if (!self->iStack[iStackPtr].iRefDir) { 248 NX IReportError (NXpData,"ERROR: out of memory in NXIInitDir");248 NXReportError( "ERROR: out of memory in NXIInitDir"); 249 249 return NX_EOD; 250 250 } … … 261 261 if ((!self->iStack[iStackPtr].iRefDir) || 262 262 (!self->iStack[iStackPtr].iTagDir)) { 263 NX IReportError (NXpData,"ERROR: out of memory in NXIInitDir");263 NXReportError( "ERROR: out of memory in NXIInitDir"); 264 264 return NX_EOD; 265 265 } … … 315 315 } 316 316 if (iRet < 0) { 317 NX IReportError (NXpData,"ERROR: HDF cannot read attribute numbers");317 NXReportError( "ERROR: HDF cannot read attribute numbers"); 318 318 pFile->iAtt.iNDir = 0; 319 319 return NX_ERROR; … … 354 354 strncat(buffer,pText,bufLen-strlen(buffer)); 355 355 } else { 356 NX IReportError (NXpData,"ERROR: NXIbuildPath cannot get vgroup name");356 NXReportError( "ERROR: NXIbuildPath cannot get vgroup name"); 357 357 } 358 358 Vdetach(groupID); … … 360 360 else 361 361 { 362 NX IReportError (NXpData,"ERROR: NXIbuildPath cannot attach to vgroup");362 NXReportError( "ERROR: NXIbuildPath cannot attach to vgroup"); 363 363 } 364 364 } … … 370 370 else 371 371 { 372 NX IReportError (NXpData,"ERROR: NXIbuildPath cannot read SDS");372 NXReportError( "ERROR: NXIbuildPath cannot read SDS"); 373 373 } 374 374 } … … 409 409 pNew = (pNexusFile) malloc (sizeof (NexusFile)); 410 410 if (!pNew) { 411 NX IReportError (NXpData,"ERROR: no memory to create File datastructure");411 NXReportError( "ERROR: no memory to create File datastructure"); 412 412 return NX_ERROR; 413 413 } … … 422 422 if ( (file_id = Hopen(filename, am1, 0)) == -1 ) { 423 423 sprintf (pBuffer, "ERROR: cannot open file_a: %s", filename); 424 NX IReportError (NXpData,pBuffer);424 NXReportError( pBuffer); 425 425 free (pNew); 426 426 return NX_ERROR; … … 433 433 if (Hclose(file_id) == -1) { 434 434 sprintf (pBuffer, "ERROR: cannot close file: %s", filename); 435 NX IReportError (NXpData,pBuffer);435 NXReportError( pBuffer); 436 436 free (pNew); 437 437 return NX_ERROR; … … 445 445 if (pNew->iSID <= 0) { 446 446 sprintf (pBuffer, "ERROR: cannot open file_b: %s", filename); 447 NX IReportError (NXpData,pBuffer);447 NXReportError( pBuffer); 448 448 free (pNew); 449 449 return NX_ERROR; … … 455 455 if (am != NXACC_READ) { 456 456 if (SDsetattr(pNew->iSID, "NeXus_version", DFNT_CHAR8, strlen(NEXUS_VERSION), NEXUS_VERSION) < 0) { 457 NX IReportError (NXpData,"ERROR: HDF failed to store NeXus_version attribute ");457 NXReportError( "ERROR: HDF failed to store NeXus_version attribute "); 458 458 return NX_ERROR; 459 459 } 460 460 Hgetlibversion(&lmajor, &lminor, &lrelease, HDF_VERSION); 461 461 if (SDsetattr(pNew->iSID, "HDF_version", DFNT_CHAR8, strlen(HDF_VERSION), HDF_VERSION) < 0) { 462 NX IReportError (NXpData,"ERROR: HDF failed to store HDF_version attribute ");462 NXReportError( "ERROR: HDF failed to store HDF_version attribute "); 463 463 return NX_ERROR; 464 464 } … … 468 468 if (am == NXACC_CREATE || am == NXACC_CREATE4) { 469 469 if (SDsetattr(pNew->iSID, "file_name", DFNT_CHAR8, strlen(filename), (char*)filename) < 0) { 470 NX IReportError (NXpData,"ERROR: HDF failed to store file_name attribute ");470 NXReportError( "ERROR: HDF failed to store file_name attribute "); 471 471 return NX_ERROR; 472 472 } … … 474 474 if (SDsetattr(pNew->iSID, "file_time", DFNT_CHAR8, 475 475 strlen(time_puffer), time_puffer) < 0) { 476 NX IReportError (NXpData,476 NXReportError( 477 477 "ERROR: HDF failed to store file_time attribute "); 478 478 free(time_puffer); … … 506 506 if (pNew->iVID <= 0) { 507 507 sprintf (pBuffer, "ERROR: cannot open file_c: %s", filename); 508 NX IReportError (NXpData,pBuffer);508 NXReportError( pBuffer); 509 509 free (pNew); 510 510 return NX_ERROR; … … 535 535 } 536 536 if (iRet < 0) { 537 NX IReportError (NXpData,"ERROR: ending access to SDS");537 NXReportError( "ERROR: ending access to SDS"); 538 538 } 539 539 /* close the SDS and Vgroup API's */ … … 541 541 iRet = SDend (pFile->iSID); 542 542 if (iRet < 0) { 543 NX IReportError (NXpData,"ERROR: HDF cannot close SDS interface");543 NXReportError( "ERROR: HDF cannot close SDS interface"); 544 544 } 545 545 iRet = Hclose (pFile->iVID); 546 546 if (iRet < 0) { 547 NX IReportError (NXpData,"ERROR: HDF cannot close HDF file");547 NXReportError( "ERROR: HDF cannot close HDF file"); 548 548 } 549 549 /* release memory */ … … 572 572 sprintf (pBuffer, "ERROR: Vgroup %s, class %s already exists", 573 573 name, nxclass); 574 NX IReportError (NXpData,pBuffer);574 NXReportError( pBuffer); 575 575 return NX_ERROR; 576 576 } … … 579 579 iNew = Vattach (pFile->iVID, -1, "w"); 580 580 if (iNew < 0) { 581 NX IReportError (NXpData,"ERROR: HDF could not create Vgroup");581 NXReportError( "ERROR: HDF could not create Vgroup"); 582 582 return NX_ERROR; 583 583 } … … 592 592 Vdetach (iNew); 593 593 if (iRet < 0) { 594 NX IReportError (NXpData,"ERROR: HDF failed to insert Vgroup");594 NXReportError( "ERROR: HDF failed to insert Vgroup"); 595 595 return NX_ERROR; 596 596 } … … 611 611 if (iRef < 0) { 612 612 sprintf (pBuffer, "ERROR: Vgroup %s, class %s NOT found", name, nxclass); 613 NX IReportError (NXpData,pBuffer);613 NXReportError( pBuffer); 614 614 return NX_ERROR; 615 615 } … … 684 684 if ((iNew = NXIFindSDS (fid, name))>=0) { 685 685 sprintf (pBuffer, "ERROR: SDS %s already exists at this level", name); 686 NX IReportError (NXpData,pBuffer);686 NXReportError( pBuffer); 687 687 return NX_ERROR; 688 688 } … … 726 726 else 727 727 { 728 NX IReportError (NXpData,"ERROR: invalid type in NX4makedata");728 NXReportError( "ERROR: invalid type in NX4makedata"); 729 729 return NX_ERROR; 730 730 } … … 733 733 sprintf (pBuffer, "ERROR: invalid rank specified for SDS %s", 734 734 name); 735 NX IReportError (NXpData,pBuffer);735 NXReportError( pBuffer); 736 736 return NX_ERROR; 737 737 } … … 746 746 "ERROR: invalid dimension %d, value %d given for SDS %s", 747 747 i, dimensions[i], name); 748 NX IReportError (NXpData,pBuffer);748 NXReportError( pBuffer); 749 749 return NX_ERROR; 750 750 } … … 767 767 if (pFile->iCurrentVG == 0) { 768 768 sprintf(pBuffer, "ERROR: SDS creation at root level is not permitted"); 769 NX IReportError(NXpData,pBuffer);769 NXReportError( pBuffer); 770 770 return NX_ERROR; 771 771 } … … 777 777 sprintf (pBuffer, "ERROR: cannot create SDS %s, check arguments", 778 778 name); 779 NX IReportError (NXpData,pBuffer);779 NXReportError( pBuffer); 780 780 return NX_ERROR; 781 781 } … … 786 786 iRet = SDendaccess (iNew); 787 787 if (iRet < 0) { 788 NX IReportError (NXpData,"ERROR: HDF cannot end access to SDS");788 NXReportError( "ERROR: HDF cannot end access to SDS"); 789 789 return NX_ERROR; 790 790 } … … 815 815 if ((iNew = NXIFindSDS (fid, name))>=0) { 816 816 sprintf (pBuffer, "ERROR: SDS %s already exists at this level", name); 817 NX IReportError (NXpData,pBuffer);817 NXReportError( pBuffer); 818 818 return NX_ERROR; 819 819 } … … 857 857 else 858 858 { 859 NX IReportError (NXpData,"ERROR: invalid datatype in NX4compmakedata");859 NXReportError( "ERROR: invalid datatype in NX4compmakedata"); 860 860 return NX_ERROR; 861 861 } … … 864 864 sprintf (pBuffer, "ERROR: invalid rank specified for SDS %s", 865 865 name); 866 NX IReportError (NXpData,pBuffer);866 NXReportError( pBuffer); 867 867 return NX_ERROR; 868 868 } … … 877 877 "ERROR: invalid dimension %d, value %d given for SDS %s", 878 878 i, dimensions[i], name); 879 NX IReportError (NXpData,pBuffer);879 NXReportError( pBuffer); 880 880 return NX_ERROR; 881 881 } … … 898 898 if (pFile->iCurrentVG == 0) { 899 899 sprintf(pBuffer, "ERROR: SDS creation at root level is not permitted"); 900 NX IReportError(NXpData,pBuffer);900 NXReportError( pBuffer); 901 901 return NX_ERROR; 902 902 } … … 908 908 sprintf (pBuffer, "ERROR: cannot create SDS %s, check arguments", 909 909 name); 910 NX IReportError (NXpData,pBuffer);910 NXReportError( pBuffer); 911 911 return NX_ERROR; 912 912 } … … 926 926 if (iRet < 0) 927 927 { 928 NX IReportError (NXpData,"LZW-Compression failure!");928 NXReportError( "LZW-Compression failure!"); 929 929 return NX_ERROR; 930 930 } … … 935 935 if (iRet < 0) 936 936 { 937 NX IReportError (NXpData,"RLE-Compression failure!");937 NXReportError( "RLE-Compression failure!"); 938 938 return NX_ERROR; 939 939 } … … 945 945 if (iRet < 0) 946 946 { 947 NX IReportError (NXpData,"HUF-Compression failure!");947 NXReportError( "HUF-Compression failure!"); 948 948 return NX_ERROR; 949 949 } … … 955 955 else 956 956 { 957 NX IReportError (NXpData,"Unknown compression method!");957 NXReportError( "Unknown compression method!"); 958 958 return NX_ERROR; 959 959 } … … 964 964 iRet = SDendaccess (iNew); 965 965 if (iRet < 0) { 966 NX IReportError (NXpData,"ERROR: HDF cannot end access to SDS");966 NXReportError( "ERROR: HDF cannot end access to SDS"); 967 967 return NX_ERROR; 968 968 } … … 989 989 /* check if there is an SDS open */ 990 990 if (pFile->iCurrentSDS == 0) { 991 NX IReportError (NXpData,"ERROR: no SDS open");991 NXReportError( "ERROR: no SDS open"); 992 992 return NX_ERROR; 993 993 } … … 1036 1036 if (iRet < 0) { 1037 1037 sprintf (pError, "ERROR: failure to compress data to %s", pBuffer); 1038 NX IReportError (NXpData,pError);1038 NXReportError( pError); 1039 1039 return NX_ERROR; 1040 1040 } … … 1058 1058 if (iNew < 0) { 1059 1059 sprintf (pBuffer, "ERROR: SDS %s not found at this level", name); 1060 NX IReportError (NXpData,pBuffer);1060 NXReportError( pBuffer); 1061 1061 return NX_ERROR; 1062 1062 } … … 1067 1067 iRet = SDendaccess (pFile->iCurrentSDS); 1068 1068 if (iRet < 0) { 1069 NX IReportError (NXpData,"ERROR: HDF cannot end access to SDS");1069 NXReportError( "ERROR: HDF cannot end access to SDS"); 1070 1070 } 1071 1071 } … … 1086 1086 1087 1087 if (pFile->iCurrentSDS < 0) { 1088 NX IReportError (NXpData,"ERROR: HDF error opening SDS");1088 NXReportError( "ERROR: HDF error opening SDS"); 1089 1089 pFile->iCurrentSDS = 0; 1090 1090 return NX_ERROR; … … 1107 1107 pFile->iCurrentSDS = 0; 1108 1108 if (iRet < 0) { 1109 NX IReportError (NXpData,"ERROR: HDF cannot end access to SDS");1109 NXReportError( "ERROR: HDF cannot end access to SDS"); 1110 1110 return NX_ERROR; 1111 1111 } 1112 1112 } else { 1113 NX IReportError (NXpData,"ERROR: no SDS open --> nothing to do");1113 NXReportError( "ERROR: no SDS open --> nothing to do"); 1114 1114 return NX_ERROR; 1115 1115 } … … 1133 1133 /* check if there is an SDS open */ 1134 1134 if (pFile->iCurrentSDS == 0) { 1135 NX IReportError (NXpData,"ERROR: no SDS open");1135 NXReportError( "ERROR: no SDS open"); 1136 1136 return NX_ERROR; 1137 1137 } … … 1150 1150 /* HEprint(stdout,0); */ 1151 1151 sprintf (pError, "ERROR: failure to write data to %s", pBuffer); 1152 NX IReportError (NXpData,pError);1152 NXReportError( pError); 1153 1153 return NX_ERROR; 1154 1154 } … … 1203 1203 else 1204 1204 { 1205 NX IReportError (NXpData,"ERROR: Invalid data type for HDF attribute");1205 NXReportError( "ERROR: Invalid data type for HDF attribute"); 1206 1206 return NX_ERROR; 1207 1207 } … … 1223 1223 iType = type; 1224 1224 if (iRet < 0) { 1225 NX IReportError (NXpData,"ERROR: HDF failed to store attribute ");1225 NXReportError( "ERROR: HDF failed to store attribute "); 1226 1226 return NX_ERROR; 1227 1227 } … … 1246 1246 /* check if there is an SDS open */ 1247 1247 if (pFile->iCurrentSDS == 0) { 1248 NX IReportError (NXpData,"ERROR: no SDS open");1248 NXReportError( "ERROR: no SDS open"); 1249 1249 return NX_ERROR; 1250 1250 } … … 1280 1280 /* deal with HDF errors */ 1281 1281 if (iRet < 0) { 1282 NX IReportError (NXpData,"ERROR: writing slab failed");1282 NXReportError( "ERROR: writing slab failed"); 1283 1283 return NX_ERROR; 1284 1284 } … … 1428 1428 iRet = Hfidinquire(pFile->iVID,&pFileName,&access,&dummy); 1429 1429 if (iRet < 0) { 1430 NX IReportError (NXpData,1430 NXReportError( 1431 1431 "ERROR: Failed to inquire file name for HDF file"); 1432 1432 return NX_ERROR; … … 1437 1437 ac = NXACC_RDWR; 1438 1438 } else { 1439 NX IReportError (NXpData,1439 NXReportError( 1440 1440 "ERROR: NX4flush failed to determine file access mode"); 1441 1441 return NX_ERROR; … … 1443 1443 pCopy = (char *)malloc((strlen(pFileName)+10)*sizeof(char)); 1444 1444 if(!pCopy) { 1445 NX IReportError (NXpData,1445 NXReportError( 1446 1446 "ERROR: Failed to allocate data for filename copy"); 1447 1447 return NX_ERROR; … … 1456 1456 iRefs = (int *)malloc(iStack*sizeof(int)); 1457 1457 if(!iRefs){ 1458 NX IReportError (NXpData,1458 NXReportError( 1459 1459 "ERROR: Failed to allocate data for hierarchy copy"); 1460 1460 return NX_ERROR; … … 1508 1508 iRet = NXIInitDir (pFile); 1509 1509 if (iRet < 0) { 1510 NX IReportError (NXpData,1510 NXReportError( 1511 1511 "ERROR: no memory to store directory info"); 1512 1512 return NX_EOD; … … 1525 1525 pFile->iStack[iStackPtr].iRefDir[iCurDir], "r"); 1526 1526 if (iTemp < 0) { 1527 NX IReportError (NXpData,"ERROR: HDF cannot attach to Vgroup");1527 NXReportError( "ERROR: HDF cannot attach to Vgroup"); 1528 1528 return NX_ERROR; 1529 1529 } … … 1539 1539 pFile->iStack[iStackPtr].iRefDir[iCurDir], "r"); 1540 1540 if (iTemp < 0) { 1541 NX IReportError (NXpData,"ERROR: HDF cannot attach to Vgroup");1541 NXReportError( "ERROR: HDF cannot attach to Vgroup"); 1542 1542 return NX_ERROR; 1543 1543 } … … 1588 1588 /* check if there is an SDS open */ 1589 1589 if (pFile->iCurrentSDS == 0) { 1590 NX IReportError (NXpData,"ERROR: no SDS open");1590 NXReportError( "ERROR: no SDS open"); 1591 1591 return NX_ERROR; 1592 1592 } … … 1613 1613 /* check if there is an SDS open */ 1614 1614 if (pFile->iCurrentSDS == 0) { 1615 NX IReportError (NXpData,"ERROR: no SDS open");1615 NXReportError( "ERROR: no SDS open"); 1616 1616 return NX_ERROR; 1617 1617 } … … 1645 1645 /* check if there is an SDS open */ 1646 1646 if (pFile->iCurrentSDS == 0) { 1647 NX IReportError (NXpData,"ERROR: no SDS open");1647 NXReportError( "ERROR: no SDS open"); 1648 1648 return NX_ERROR; 1649 1649 } … … 1714 1714 } 1715 1715 if (iRet < 0) { 1716 NX IReportError (NXpData,"ERROR: HDF cannot read attribute info");1716 NXReportError( "ERROR: HDF cannot read attribute info"); 1717 1717 return NX_ERROR; 1718 1718 } … … 1792 1792 if (iNew < 0) { 1793 1793 sprintf (pBuffer, "ERROR: attribute %s not found", name); 1794 NX IReportError (NXpData,pBuffer);1794 NXReportError( pBuffer); 1795 1795 return NX_ERROR; 1796 1796 } … … 1809 1809 if (iRet < 0) { 1810 1810 sprintf (pBuffer, "ERROR: HDF could not read attribute info"); 1811 NX IReportError (NXpData,pBuffer);1811 NXReportError( pBuffer); 1812 1812 return NX_ERROR; 1813 1813 } … … 1819 1819 pData = (void *) malloc (iLen); 1820 1820 if (!pData) { 1821 NX IReportError (NXpData,"ERROR: allocating memory in NXgetattr");1821 NXReportError( "ERROR: allocating memory in NXgetattr"); 1822 1822 return NX_ERROR; 1823 1823 } … … 1836 1836 if (iRet < 0) { 1837 1837 sprintf (pBuffer, "ERROR: HDF could not read attribute data"); 1838 NX IReportError (NXpData,pBuffer);1838 NXReportError( pBuffer); 1839 1839 return NX_ERROR; 1840 1840 } … … 1876 1876 } 1877 1877 if (iRet < 0) { 1878 NX IReportError (NXpData,"NX_ERROR: HDF cannot read attribute numbers");1878 NXReportError( "NX_ERROR: HDF cannot read attribute numbers"); 1879 1879 *iN = 0; 1880 1880 return NX_ERROR; … … 1971 1971 iRet = NXIInitDir (pFile); 1972 1972 if (iRet < 0) { 1973 NX IReportError (NXpData,"NX_ERROR: no memory to store directory info");1973 NXReportError("NX_ERROR: no memory to store directory info"); 1974 1974 return NX_EOD; 1975 1975 } -
trunk/src/napi5.c
r1546 r1548 151 151 pNew = (pNexusFile5) malloc (sizeof (NexusFile5)); 152 152 if (!pNew) { 153 NX IReportError (NXpData,"ERROR: no memory to create File datastructure");153 NXReportError("ERROR: no memory to create File datastructure"); 154 154 return NX_ERROR; 155 155 } … … 183 183 if (pNew->iFID <= 0) { 184 184 sprintf (pBuffer, "ERROR: cannot open file: %s", filename); 185 NX IReportError (NXpData,pBuffer);185 NXReportError( pBuffer); 186 186 free (pNew); 187 187 return NX_ERROR; … … 208 208 if (attr1<0) 209 209 { 210 NX IReportError (NXpData,210 NXReportError( 211 211 "ERROR: HDF failed to store NeXus_version attribute "); 212 212 return NX_ERROR; … … 214 214 if (H5Awrite(attr1, aid1,NEXUS_VERSION)<0) 215 215 { 216 NX IReportError (NXpData,216 NXReportError( 217 217 "ERROR: HDF failed to store NeXus_version attribute "); 218 218 return NX_ERROR; … … 234 234 if (attr1 < 0) 235 235 { 236 NX IReportError (NXpData,236 NXReportError( 237 237 "ERROR: HDF failed to store file_name attribute "); 238 238 return NX_ERROR; … … 240 240 if (H5Awrite(attr1, aid1, (char*)filename) < 0) 241 241 { 242 NX IReportError (NXpData,242 NXReportError( 243 243 "ERROR: HDF failed to store file_name attribute "); 244 244 return NX_ERROR; … … 256 256 if (attr1 < 0) 257 257 { 258 NX IReportError (NXpData,258 NXReportError( 259 259 "ERROR: HDF failed to store file_name attribute "); 260 260 return NX_ERROR; … … 262 262 if (H5Awrite(attr1, aid1, (char*)version_nr) < 0) 263 263 { 264 NX IReportError (NXpData,264 NXReportError( 265 265 "ERROR: HDF failed to store file_name attribute "); 266 266 return NX_ERROR; … … 278 278 if (attr1 < 0) 279 279 { 280 NX IReportError (NXpData,280 NXReportError( 281 281 "ERROR: HDF failed to store file_time attribute "); 282 282 free(time_buffer); … … 285 285 if (H5Awrite(attr1, aid1, time_buffer) < 0) 286 286 { 287 NX IReportError (NXpData,287 NXReportError( 288 288 "ERROR: HDF failed to store file_time attribute "); 289 289 free(time_buffer); … … 342 342 343 343 if (iRet < 0) { 344 NX IReportError (NXpData,"ERROR: HDF cannot close HDF file");344 NXReportError( "ERROR: HDF cannot close HDF file"); 345 345 } 346 346 /* release memory */ … … 380 380 } 381 381 if (iRet < 0) { 382 NX IReportError (NXpData,"ERROR: HDF could not create Group");382 NXReportError( "ERROR: HDF could not create Group"); 383 383 return NX_ERROR; 384 384 } … … 390 390 if (attr1 < 0) 391 391 { 392 NX IReportError (NXpData,"ERROR: HDF failed to store class name!");392 NXReportError( "ERROR: HDF failed to store class name!"); 393 393 return NX_ERROR; 394 394 } 395 395 if (H5Awrite(attr1, aid1, (char*)nxclass) < 0) 396 396 { 397 NX IReportError (NXpData,"ERROR: HDF failed to store class name!");397 NXReportError( "ERROR: HDF failed to store class name!"); 398 398 return NX_ERROR; 399 399 } … … 437 437 if (iRet < 0) { 438 438 sprintf (pBuffer, "ERROR: Group %s does not exist!", pFile->name_tmp); 439 NX IReportError (NXpData,pBuffer);439 NXReportError( pBuffer); 440 440 return NX_ERROR; 441 441 } … … 449 449 iRet=H5Aiterate(pFile->iCurrentG,NULL,attr_check,NULL); 450 450 if (iRet < 0) { 451 NX IReportError (NXpData,"ERROR iterating through group!");451 NXReportError( "ERROR iterating through group!"); 452 452 return NX_ERROR; 453 453 } else if (iRet == 1) { … … 455 455 } else { 456 456 /* no group attribute available */ 457 NX IReportError (NXpData,"No group attribute available");457 NXReportError( "No group attribute available"); 458 458 return NX_ERROR; 459 459 } … … 462 462 if (attr1 < 0) 463 463 { 464 NX IReportError (NXpData,"Error opening NX_class group attribute!");464 NXReportError( "Error opening NX_class group attribute!"); 465 465 return NX_ERROR; 466 466 } … … 471 471 /* test OK */ 472 472 } else { 473 NX IReportError (NXpData,"Group class is not identical!");473 NXReportError( "Group class is not identical!"); 474 474 iRet = H5Tclose(atype); 475 475 iRet = H5Aclose(attr1); … … 600 600 else 601 601 { 602 NX IReportError (NXpData,"ERROR: nxToHDF5Type: unknown type");602 NXReportError( "ERROR: nxToHDF5Type: unknown type"); 603 603 type = -1; 604 604 } … … 630 630 sprintf (pBuffer, "ERROR: no group open for makedata on %s", 631 631 name); 632 NX IReportError (NXpData,pBuffer);632 NXReportError( pBuffer); 633 633 return NX_ERROR; 634 634 } … … 648 648 sprintf (pBuffer, "ERROR: invalid rank specified %s", 649 649 name); 650 NX IReportError (NXpData,pBuffer);650 NXReportError( pBuffer); 651 651 return NX_ERROR; 652 652 } … … 662 662 "ERROR: invalid dimension %d, value %d given for Dataset %s", 663 663 i, dimensions[i], name); 664 NX IReportError (NXpData,pBuffer);664 NXReportError( pBuffer); 665 665 return NX_ERROR; 666 666 } … … 727 727 if (iNew < 0) 728 728 { 729 NX IReportError (NXpData,"ERROR: Size of chunks could not be set!");729 NXReportError( "ERROR: Size of chunks could not be set!"); 730 730 return NX_ERROR; 731 731 } … … 741 741 if (iNew < 0) 742 742 { 743 NX IReportError (NXpData,"ERROR: Size of chunks could not be set!");743 NXReportError( "ERROR: Size of chunks could not be set!"); 744 744 return NX_ERROR; 745 745 } … … 757 757 if (iNew < 0) 758 758 { 759 NX IReportError (NXpData,"ERROR: Size of chunks could not be set!");759 NXReportError( "ERROR: Size of chunks could not be set!"); 760 760 return NX_ERROR; 761 761 } … … 765 765 else 766 766 { 767 NX IReportError (NXpData,767 NXReportError( 768 768 "HDF5 doesn't support selected compression method! Dataset was saved without compression"); 769 769 iRet = H5Dcreate (pFile->iCurrentG, (char*)name, datatype1, dataspace, H5P_DEFAULT); … … 771 771 if (iRet < 0) 772 772 { 773 NX IReportError (NXpData,"ERROR: Creating chunked dataset failed!");773 NXReportError( "ERROR: Creating chunked dataset failed!"); 774 774 return NX_ERROR; 775 775 } … … 786 786 sprintf (pBuffer, "ERROR: cannot create Dataset %s, check arguments", 787 787 name); 788 NX IReportError (NXpData,pBuffer);788 NXReportError( pBuffer); 789 789 return NX_ERROR; 790 790 } … … 800 800 if (iRet < 0) 801 801 { 802 NX IReportError (NXpData,"ERROR: HDF cannot close Dataset");802 NXReportError( "ERROR: HDF cannot close Dataset"); 803 803 return NX_ERROR; 804 804 } … … 854 854 if (pFile->iCurrentD < 0) { 855 855 sprintf (pBuffer, "ERROR: Dataset %s not found at this level", name); 856 NX IReportError (NXpData,pBuffer);856 NXReportError( pBuffer); 857 857 return NX_ERROR; 858 858 } … … 860 860 pFile->iCurrentT = H5Dget_type(pFile->iCurrentD); 861 861 if (pFile->iCurrentT < 0) { 862 NX IReportError (NXpData,"ERROR:HDF error opening Dataset");862 NXReportError( "ERROR:HDF error opening Dataset"); 863 863 pFile->iCurrentT=0; 864 864 return NX_ERROR; … … 867 867 pFile->iCurrentS = H5Dget_space(pFile->iCurrentD); 868 868 if (pFile->iCurrentS < 0) { 869 NX IReportError (NXpData,"ERROR:HDF error opening Dataset");869 NXReportError( "ERROR:HDF error opening Dataset"); 870 870 pFile->iCurrentS=0; 871 871 return NX_ERROR; … … 890 890 iRet = H5Dclose(pFile->iCurrentD); 891 891 if (iRet < 0) { 892 NX IReportError (NXpData,"ERROR: HDF cannot end access to Dataset");892 NXReportError( "ERROR: HDF cannot end access to Dataset"); 893 893 return NX_ERROR; 894 894 } … … 915 915 if (iRet < 0) { 916 916 snprintf (pError,511, "ERROR: failure to write data"); 917 NX IReportError (NXpData,pError);917 NXReportError( pError); 918 918 return NX_ERROR; 919 919 } … … 969 969 iRet=H5Adelete(vid,name); 970 970 if (iRet<0) { 971 NX IReportError (NXpData,"ERROR: Old attribute cannot be removed! ");971 NXReportError( "ERROR: Old attribute cannot be removed! "); 972 972 killAttVID(pFile,vid); 973 973 return NX_ERROR; … … 976 976 attr1 = H5Acreate(vid, name, aid1, aid2, H5P_DEFAULT); 977 977 if (attr1 < 0) { 978 NX IReportError (NXpData,"ERROR: Attribute cannot created! ");978 NXReportError( "ERROR: Attribute cannot created! "); 979 979 killAttVID(pFile,vid); 980 980 return NX_ERROR; 981 981 } 982 982 if (H5Awrite(attr1,aid1,data) < 0) { 983 NX IReportError (NXpData,"ERROR: HDF failed to store attribute ");983 NXReportError( "ERROR: HDF failed to store attribute "); 984 984 killAttVID(pFile,vid); 985 985 return NX_ERROR; … … 1009 1009 /* check if there is an Dataset open */ 1010 1010 if (pFile->iCurrentD == 0) { 1011 NX IReportError (NXpData,"ERROR: no dataset open");1011 NXReportError( "ERROR: no dataset open"); 1012 1012 return NX_ERROR; 1013 1013 } … … 1033 1033 if (iRet < 0) 1034 1034 { 1035 NX IReportError (NXpData,"ERROR: extend slab failed");1035 NXReportError( "ERROR: extend slab failed"); 1036 1036 return NX_ERROR; 1037 1037 } … … 1045 1045 if (iRet < 0) 1046 1046 { 1047 NX IReportError (NXpData,"ERROR: selecting slab failed");1047 NXReportError( "ERROR: selecting slab failed"); 1048 1048 return NX_ERROR; 1049 1049 } … … 1053 1053 if (iRet < 0) 1054 1054 { 1055 NX IReportError (NXpData,"ERROR: writing slab failed");1055 NXReportError( "ERROR: writing slab failed"); 1056 1056 } 1057 1057 iRet = H5Sclose(filespace); … … 1063 1063 if (iRet < 0) 1064 1064 { 1065 NX IReportError (NXpData,"ERROR: selecting slab failed");1065 NXReportError( "ERROR: selecting slab failed"); 1066 1066 return NX_ERROR; 1067 1067 } … … 1071 1071 if (iRet < 0) 1072 1072 { 1073 NX IReportError (NXpData,"ERROR: writing slab failed");1073 NXReportError( "ERROR: writing slab failed"); 1074 1074 } 1075 1075 } … … 1078 1078 if (iRet < 0) 1079 1079 { 1080 NX IReportError (NXpData,"ERROR: closing slab failed");1080 NXReportError( "ERROR: closing slab failed"); 1081 1081 return NX_ERROR; 1082 1082 } … … 1146 1146 if(dataID < 0) 1147 1147 { 1148 NX IReportError(NXpData,"Internal error, path to link does not exist");1148 NXReportError("Internal error, path to link does not exist"); 1149 1149 return NX_ERROR; 1150 1150 } … … 1204 1204 else 1205 1205 { 1206 NX IReportError(NXpData,"Path string to long");1206 NXReportError("Path string to long"); 1207 1207 return NX_ERROR; 1208 1208 } … … 1232 1232 itemName = strrchr(sLink->targetPath,'/'); 1233 1233 if(itemName == NULL){ 1234 NX IReportError(NXpData,"Bad link structure");1234 NXReportError("Bad link structure"); 1235 1235 return NX_ERROR; 1236 1236 } … … 1250 1250 else 1251 1251 { 1252 NX IReportError(NXpData,"Path string to long");1252 NXReportError("Path string to long"); 1253 1253 return NX_ERROR; 1254 1254 } … … 1280 1280 } 1281 1281 if (iRet < 0){ 1282 NX IReportError (NXpData,"ERROR: The object cannot be flushed");1282 NXReportError( "ERROR: The object cannot be flushed"); 1283 1283 return NX_ERROR; 1284 1284 } … … 1385 1385 status = H5Gget_num_objs(loc_id, &numobj); 1386 1386 if(status < 0) { 1387 NX IReportError(NXpData,"Internal error, failed to retrive no of objects");1387 NXReportError("Internal error, failed to retrive no of objects"); 1388 1388 return 0; 1389 1389 } … … 1509 1509 if (iPtype == -1) 1510 1510 { 1511 NX IReportError (NXpData,"ERROR: hdf5ToNXtype: invalid type");1511 NXReportError( "ERROR: hdf5ToNXtype: invalid type"); 1512 1512 } 1513 1513 … … 1576 1576 if (memtype_id == -1) 1577 1577 { 1578 NX IReportError (NXpData,"ERROR: h5MemType: invalid type");1578 NXReportError( "ERROR: h5MemType: invalid type"); 1579 1579 } 1580 1580 return memtype_id; … … 1650 1650 if (grp < 0) { 1651 1651 sprintf (pBuffer, "ERROR: Group %s does not exist!", ph_name); 1652 NX IReportError (NXpData,pBuffer);1652 NXReportError( pBuffer); 1653 1653 return NX_ERROR; 1654 1654 } … … 1700 1700 free(op_data.iname); 1701 1701 } 1702 NX IReportError (NXpData,1702 NXReportError( 1703 1703 "ERROR: Iteration (directory) was not successful"); 1704 1704 return NX_ERROR; … … 1720 1720 if (pFile->iCurrentD == 0) 1721 1721 { 1722 NX IReportError (NXpData,"ERROR: no Dataset open");1722 NXReportError( "ERROR: no Dataset open"); 1723 1723 return NX_ERROR; 1724 1724 } … … 1746 1746 if(status < 0) 1747 1747 { 1748 NX IReportError (NXpData,"ERROR: failed to transfer dataset");1748 NXReportError( "ERROR: failed to transfer dataset"); 1749 1749 return NX_ERROR; 1750 1750 … … 1765 1765 /* check if there is an Dataset open */ 1766 1766 if (pFile->iCurrentD == 0) { 1767 NX IReportError (NXpData,"ERROR: no Dataset open");1767 NXReportError( "ERROR: no Dataset open"); 1768 1768 return NX_ERROR; 1769 1769 } … … 1806 1806 if (pFile->iCurrentD == 0) 1807 1807 { 1808 NX IReportError (NXpData,"ERROR: no Dataset open");1808 NXReportError( "ERROR: no Dataset open"); 1809 1809 return NX_ERROR; 1810 1810 } … … 1839 1839 if (iRet < 0) 1840 1840 { 1841 NX IReportError (NXpData,"ERROR: selecting slab failed");1841 NXReportError( "ERROR: selecting slab failed"); 1842 1842 return NX_ERROR; 1843 1843 } … … 1848 1848 if (iRet < 0) 1849 1849 { 1850 NX IReportError (NXpData,"ERROR: Select memspace failed");1850 NXReportError( "ERROR: Select memspace failed"); 1851 1851 return NX_ERROR; 1852 1852 } … … 1883 1883 1884 1884 { 1885 NX IReportError (NXpData,"ERROR: Reading slab failed");1885 NXReportError( "ERROR: Reading slab failed"); 1886 1886 return NX_ERROR; 1887 1887 } … … 1933 1933 intern_idx=-1; 1934 1934 if (iRet < 0) { 1935 NX IReportError (NXpData,"ERROR iterating through attribute list!");1935 NXReportError( "ERROR iterating through attribute list!"); 1936 1936 killAttVID(pFile,vid); 1937 1937 return NX_ERROR; … … 1998 1998 sprintf (pBuffer, "ERROR: attribute %s not found", name); 1999 1999 killAttVID(pFile,vid); 2000 NX IReportError (NXpData,pBuffer);2000 NXReportError( pBuffer); 2001 2001 return NX_ERROR; 2002 2002 } … … 2022 2022 if (iRet < 0) { 2023 2023 sprintf (pBuffer, "ERROR: HDF could not read attribute data"); 2024 NX IReportError (NXpData,pBuffer);2024 NXReportError( pBuffer); 2025 2025 killAttVID(pFile,vid); 2026 2026 return NX_ERROR; -
trunk/src/napiu.c
r671 r1548 104 104 else 105 105 { 106 NX IReportError(NXpData,"Invalid compression option");106 NXReportError( "Invalid compression option"); 107 107 status = NX_ERROR; 108 108 } -
trunk/src/nexus_symbols.txt
r1542 r1548 48 48 NXMSetError 49 49 NXMSetTError 50 NXReportError 50 51 NXIReportError 51 52 NXIprintlink -
trunk/src/nxxml.c
r1544 r1548 107 107 } 108 108 if(testNode == NULL){ 109 NX IReportError(NXpData,"Cannot follow broken link");109 NXReportError("Cannot follow broken link"); 110 110 return NULL; 111 111 } else { … … 117 117 /*==================== file functions ===================================*/ 118 118 static void errorCallbackForMxml(const char *txt){ 119 NX IReportError(NXpData,(char *)txt);119 NXReportError((char *)txt); 120 120 } 121 121 /*-----------------------------------------------------------------------*/ … … 132 132 xmlHandle = (pXMLNexus)malloc(sizeof(XMLNexus)); 133 133 if(!xmlHandle){ 134 NX IReportError(NXpData,"Out of memory allocating XML file handle");134 NXReportError( "Out of memory allocating XML file handle"); 135 135 return NX_ERROR; 136 136 } … … 155 155 fp = fopen(filename,"r"); 156 156 if(fp == NULL){ 157 NX IReportError(NXpData,"Failed to open file:");158 NX IReportError(NXpData,(char *)filename);157 NXReportError("Failed to open file:"); 158 NXReportError((char *)filename); 159 159 free(xmlHandle); 160 160 return NX_ERROR; … … 193 193 break; 194 194 default: 195 NX IReportError(NXpData,"Bad access parameter specified in NXXopen");195 NXReportError("Bad access parameter specified in NXXopen"); 196 196 return NX_ERROR; 197 197 } 198 198 if(xmlHandle->stack[0].current == NULL){ 199 NX IReportError(NXpData,199 NXReportError( 200 200 "No NXroot element in XML-file, no NeXus-XML file"); 201 201 return NX_ERROR; … … 216 216 fp = fopen(xmlHandle->filename,"w"); 217 217 if(fp == NULL){ 218 NX IReportError(NXpData,"Failed to open NeXus XML file for writing");218 NXReportError("Failed to open NeXus XML file for writing"); 219 219 return NX_ERROR; 220 220 } … … 238 238 fp = fopen(xmlHandle->filename,"w"); 239 239 if(fp == NULL){ 240 NX IReportError(NXpData,"Failed to open NeXus XML file for writing");240 NXReportError("Failed to open NeXus XML file for writing"); 241 241 return NX_ERROR; 242 242 } … … 258 258 259 259 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 260 NX IReportError(NXpData,"Close dataset before trying to create a group");260 NXReportError("Close dataset before trying to create a group"); 261 261 return NX_ERROR; 262 262 } … … 265 265 nxclass); 266 266 if(!newGroup){ 267 NX IReportError(NXpData,"failed to allocate new group");267 NXReportError("failed to allocate new group"); 268 268 return NX_ERROR; 269 269 } … … 318 318 319 319 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 320 NX IReportError(NXpData,"Close dataset before trying to open a group");320 NXReportError("Close dataset before trying to open a group"); 321 321 return NX_ERROR; 322 322 } … … 332 332 if(!newGroup){ 333 333 snprintf(error,1023,"Failed to open %s, %s",name,nxclass); 334 NX IReportError(NXpData,error);334 NXReportError(error); 335 335 return NX_ERROR; 336 336 } … … 385 385 typestring = (char *)malloc(132*sizeof(char)); 386 386 if(!typestring){ 387 NX IReportError(NXpData,"Failed to allocate typestring");387 NXReportError("Failed to allocate typestring"); 388 388 return NULL; 389 389 } … … 420 420 421 421 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 422 NX IReportError(NXpData,"Close dataset before trying to create a dataset");422 NXReportError("Close dataset before trying to create a dataset"); 423 423 return NX_ERROR; 424 424 } … … 441 441 free(typestring); 442 442 } else { 443 NX IReportError(NXpData,"Failed to allocate typestring");443 NXReportError("Failed to allocate typestring"); 444 444 return NX_ERROR; 445 445 } … … 460 460 newData = (mxml_node_t *)malloc(sizeof(mxml_node_t)); 461 461 if(!newData){ 462 NX IReportError(NXpData,"Failed to allocate space for dataset");462 NXReportError("Failed to allocate space for dataset"); 463 463 return NX_ERROR; 464 464 } … … 469 469 newData->value.custom.data = createNXDataset(1,datatype,&one); 470 470 if(!newData->value.custom.data){ 471 NX IReportError(NXpData,"Failed to allocate space for dataset");471 NXReportError("Failed to allocate space for dataset"); 472 472 return NX_ERROR; 473 473 } … … 496 496 497 497 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 498 NX IReportError(NXpData,"Close dataset before trying to create a dataset");498 NXReportError("Close dataset before trying to create a dataset"); 499 499 return NX_ERROR; 500 500 } … … 510 510 free(typestring); 511 511 } else { 512 NX IReportError(NXpData,"Failed to allocate typestring");512 NXReportError("Failed to allocate typestring"); 513 513 return NX_ERROR; 514 514 } … … 522 522 newData = (mxml_node_t *)malloc(sizeof(mxml_node_t)); 523 523 if(!newData){ 524 NX IReportError(NXpData,"Failed to allocate space for dataset");524 NXReportError("Failed to allocate space for dataset"); 525 525 return NX_ERROR; 526 526 } … … 530 530 newData->value.custom.data = createNXDataset(rank,datatype,dimensions); 531 531 if(!newData->value.custom.data){ 532 NX IReportError(NXpData,"Failed to allocate space for dataset");532 NXReportError("Failed to allocate space for dataset"); 533 533 return NX_ERROR; 534 534 } … … 597 597 if(!dimsNode){ 598 598 snprintf(error,1023,"Failed to open dataset %s",name); 599 NX IReportError(NXpData,error);599 NXReportError(error); 600 600 return NX_ERROR; 601 601 } … … 612 612 if(!dataNode){ 613 613 snprintf(error,1023,"Failed to open dataset %s",name); 614 NX IReportError(NXpData,error);614 NXReportError(error); 615 615 return NX_ERROR; 616 616 } … … 675 675 if(!dataNode){ 676 676 snprintf(error,1023,"Failed to open dataset %s",name); 677 NX IReportError(NXpData,error);677 NXReportError(error); 678 678 return NX_ERROR; 679 679 } … … 773 773 774 774 if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 775 NX IReportError(NXpData,"No dataset open");775 NXReportError("No dataset open"); 776 776 return NX_ERROR; 777 777 } … … 801 801 else 802 802 { 803 NX IReportError(NXpData,"Unable to determine size of character dataset");803 NXReportError("Unable to determine size of character dataset"); 804 804 return NX_ERROR; 805 805 } … … 872 872 873 873 if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 874 NX IReportError(NXpData,"No dataset open");874 NXReportError("No dataset open"); 875 875 return NX_ERROR; 876 876 } … … 916 916 917 917 if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 918 NX IReportError(NXpData,"No dataset open");918 NXReportError("No dataset open"); 919 919 return NX_ERROR; 920 920 } … … 1029 1029 free(typestring); 1030 1030 } else { 1031 NX IReportError(NXpData,"Failed to allocate typestring");1031 NXReportError("Failed to allocate typestring"); 1032 1032 return 0; 1033 1033 } … … 1059 1059 1060 1060 if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1061 NX IReportError(NXpData,"No dataset open");1061 NXReportError("No dataset open"); 1062 1062 return NX_ERROR; 1063 1063 } … … 1067 1067 assert(userData != NULL); 1068 1068 if(userData->type == MXML_OPAQUE){ 1069 NX IReportError(NXpData,"This API does not support slabs on text data");1069 NXReportError("This API does not support slabs on text data"); 1070 1070 return NX_ERROR; 1071 1071 } … … 1075 1075 status = checkAndExtendDataset(current,dataset,iStart,iSize); 1076 1076 if(status == 0){ 1077 NX IReportError(NXpData,"Out of memory extending dataset");1077 NXReportError("Out of memory extending dataset"); 1078 1078 return NX_ERROR; 1079 1079 } … … 1081 1081 slabData = makeSlabData(dataset, data, iSize); 1082 1082 if(slabData == NULL){ 1083 NX IReportError(NXpData,"Failed to allocate slab data");1083 NXReportError("Failed to allocate slab data"); 1084 1084 return NX_ERROR; 1085 1085 } … … 1131 1131 1132 1132 if(!isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1133 NX IReportError(NXpData,"No dataset open");1133 NXReportError("No dataset open"); 1134 1134 return NX_ERROR; 1135 1135 } … … 1139 1139 assert(userData != NULL); 1140 1140 if(userData->type == MXML_OPAQUE){ 1141 NX IReportError(NXpData,"This API does not support slabs on text data");1141 NXReportError("This API does not support slabs on text data"); 1142 1142 return NX_ERROR; 1143 1143 } … … 1146 1146 slabData = makeSlabData(dataset, data, iSize); 1147 1147 if(slabData == NULL){ 1148 NX IReportError(NXpData,"Failed to allocate slab data");1148 NXReportError("Failed to allocate slab data"); 1149 1149 return NX_ERROR; 1150 1150 } … … 1203 1203 number = (char *)malloc(132*sizeof(char)); 1204 1204 if(!number){ 1205 NX IReportError(NXpData,"Failed to allocate attribute number buffer");1205 NXReportError("Failed to allocate attribute number buffer"); 1206 1206 return NULL; 1207 1207 } … … 1273 1273 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1274 1274 if(strcmp(name,TYPENAME) == 0){ 1275 NX IReportError(NXpData,"type is a reserved attribute name, rejected");1275 NXReportError("type is a reserved attribute name, rejected"); 1276 1276 return NX_ERROR; 1277 1277 } … … 1280 1280 numberData = formatAttributeData(data,datalen,iType); 1281 1281 if(numberData == NULL){ 1282 NX IReportError(NXpData,"This API does not support non number arrays");1282 NXReportError("This API does not support non number arrays"); 1283 1283 return NX_ERROR; 1284 1284 } else { … … 1306 1306 if(!attribute){ 1307 1307 snprintf(error,1023,"Attribute %s not found", name); 1308 NX IReportError(NXpData,error);1308 NXReportError(error); 1309 1309 return NX_ERROR; 1310 1310 } … … 1325 1325 attData = strchr(attribute,(int)':'); 1326 1326 if(attData == NULL){ 1327 NX IReportError(NXpData,"ERROR: bad attribute string, : missing");1327 NXReportError("ERROR: bad attribute string, : missing"); 1328 1328 return NX_ERROR; 1329 1329 } … … 1480 1480 linkName = mxmlElementGetAttr(next,"name"); 1481 1481 if(target == NULL){ 1482 NX IReportError(NXpData,"Corrupted file, NAPIlink without target");1482 NXReportError("Corrupted file, NAPIlink without target"); 1483 1483 return NX_ERROR; 1484 1484 } 1485 1485 next = getLinkTarget(xmlHandle,target); 1486 1486 if(next == NULL){ 1487 NX IReportError(NXpData,"Corrupted file, broken link");1487 NXReportError("Corrupted file, broken link"); 1488 1488 return NX_ERROR; 1489 1489 } … … 1497 1497 snprintf(pBueffel,255,"Corrupted file, userData for %s not found", 1498 1498 name); 1499 NX IReportError(NXpData,pBueffel);1499 NXReportError(pBueffel); 1500 1500 return NX_ERROR; 1501 1501 } … … 1529 1529 1530 1530 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1531 NX IReportError(NXpData,"Cannot search datasets");1531 NXReportError("Cannot search datasets"); 1532 1532 return NX_ERROR; 1533 1533 } … … 1618 1618 1619 1619 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1620 NX IReportError(NXpData,"No group open");1620 NXReportError("No group open"); 1621 1621 return NX_ERROR; 1622 1622 } … … 1745 1745 path = (mxml_node_t **)malloc(NXMAXSTACK*sizeof(mxml_node_t *)); 1746 1746 if(path == NULL){ 1747 NX IReportError(NXpData,"ERROR: out of memory following link path");1747 NXReportError("ERROR: out of memory following link path"); 1748 1748 return NULL; 1749 1749 } … … 1787 1787 linkPath = findLinkPath(current); 1788 1788 if(!linkPath){ 1789 NX IReportError(NXpData,"Failed to allocate link path string");1789 NXReportError("Failed to allocate link path string"); 1790 1790 return NX_ERROR; 1791 1791 } … … 1804 1804 1805 1805 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1806 NX IReportError(NXpData,"No group open");1806 NXReportError("No group open"); 1807 1807 return NX_ERROR; 1808 1808 } … … 1815 1815 linkPath = findLinkPath(current); 1816 1816 if(!linkPath){ 1817 NX IReportError(NXpData,"Failed to allocate link path string");1817 NXReportError("Failed to allocate link path string"); 1818 1818 return NX_ERROR; 1819 1819 } … … 1844 1844 1845 1845 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1846 NX IReportError(NXpData,"No group to link to open");1846 NXReportError("No group to link to open"); 1847 1847 return NX_ERROR; 1848 1848 } … … 1850 1850 linkNode = mxmlNewElement(current,"NAPIlink"); 1851 1851 if(!linkNode){ 1852 NX IReportError(NXpData,"Failed to allocate new link element");1852 NXReportError("Failed to allocate new link element"); 1853 1853 return NX_ERROR; 1854 1854 } … … 1871 1871 1872 1872 if(isDataNode(xmlHandle->stack[xmlHandle->stackPointer].current)){ 1873 NX IReportError(NXpData,"No group to link to open");1873 NXReportError("No group to link to open"); 1874 1874 return NX_ERROR; 1875 1875 } … … 1877 1877 linkNode = mxmlNewElement(current,"NAPIlink"); 1878 1878 if(!linkNode){ 1879 NX IReportError(NXpData,"Failed to allocate new link element");1879 NXReportError("Failed to allocate new link element"); 1880 1880 return NX_ERROR; 1881 1881 } … … 1900 1900 int NXXcompress(NXhandle fid, int comp){ 1901 1901 /* that will throw an exception in the Java API, errors have to be fatal */ 1902 /* NX IReportError(NXpData,"NXcompress is deprecated, IGNORED"); */1902 /* NXReportError("NXcompress is deprecated, IGNORED"); */ 1903 1903 return NX_OK; 1904 1904 }
Note: See TracChangeset
for help on using the changeset viewer.
