- TDC histogram memory driver sort of working
- New class for scripting datafiles - SANS-II almost complete initialization file
This commit is contained in:
52
napi4.c
52
napi4.c
@@ -1,3 +1,27 @@
|
||||
/*---------------------------------------------------------------------------
|
||||
NeXus - Neutron & X-ray Common Data Format
|
||||
|
||||
Application Program Interface (HDF4) Routines
|
||||
|
||||
Copyright (C) 1997-2002 Mark Koennecke, Przemek Klosowski
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
For further information, see <http://www.neutron.anl.gov/NeXus/>
|
||||
|
||||
----------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@@ -290,6 +314,8 @@
|
||||
/* map Nexus NXaccess types to HDF4 types */
|
||||
if (am == NXACC_CREATE) {
|
||||
am1 = DFACC_CREATE;
|
||||
} else if (am == NXACC_CREATE4) {
|
||||
am1 = DFACC_CREATE;
|
||||
} else if (am == NXACC_READ) {
|
||||
am1 = DFACC_READ;
|
||||
} else if (am == NXACC_RDWR) {
|
||||
@@ -318,7 +344,7 @@
|
||||
#else
|
||||
time_info = gmtime(&timer);
|
||||
if (time_info != NULL) {
|
||||
gmt_offset = difftime(timer, mktime(time_info));
|
||||
gmt_offset = (long)difftime(timer, mktime(time_info));
|
||||
} else {
|
||||
NXIReportError(NXpData, "Your gmtime() function does not work ... timezone information will be incorrect\n");
|
||||
gmt_offset = 0;
|
||||
@@ -350,7 +376,7 @@
|
||||
* write something that can be used by OLE
|
||||
*/
|
||||
|
||||
if (am == NXACC_CREATE) {
|
||||
if (am == NXACC_CREATE || am == NXACC_CREATE4) {
|
||||
if ( (file_id = Hopen(filename, am1, 0)) == -1 ) {
|
||||
sprintf (pBuffer, "ERROR: cannot open file_a: %s", filename);
|
||||
NXIReportError (NXpData, pBuffer);
|
||||
@@ -395,7 +421,7 @@
|
||||
return NX_ERROR;
|
||||
}
|
||||
}
|
||||
if (am == NXACC_CREATE) {
|
||||
if (am == NXACC_CREATE || am == NXACC_CREATE4) {
|
||||
if (SDsetattr(pNew->iSID, "file_name", DFNT_CHAR8, strlen(filename), (char*)filename) < 0) {
|
||||
NXIReportError (NXpData, "ERROR: HDF failed to store file_name attribute ");
|
||||
return NX_ERROR;
|
||||
@@ -410,7 +436,7 @@
|
||||
* Otherwise we try to create the file two times which makes HDF
|
||||
* Throw up on us.
|
||||
*/
|
||||
if (am == NXACC_CREATE) {
|
||||
if (am == NXACC_CREATE || am == NXACC_CREATE4) {
|
||||
am = NXACC_RDWR;
|
||||
am1 = DFACC_RDWR;
|
||||
}
|
||||
@@ -424,7 +450,7 @@
|
||||
|
||||
/* start Vgroup API */
|
||||
|
||||
pNew->iVID = Hopen (filename, am1, 100);
|
||||
pNew->iVID = Hopen(filename, am1, 100);
|
||||
if (pNew->iVID <= 0) {
|
||||
sprintf (pBuffer, "ERROR: cannot open file_c: %s", filename);
|
||||
NXIReportError (NXpData, pBuffer);
|
||||
@@ -1644,7 +1670,7 @@
|
||||
return NX_ERROR;
|
||||
}
|
||||
*iN = iAtt;
|
||||
return iRet;
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -1690,6 +1716,20 @@
|
||||
return NX_OK;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
NXstatus CALLING_STYLE NX4sameID (NXhandle fileid, NXlink* pFirstID, NXlink* pSecondID)
|
||||
{
|
||||
pNexusFile pFile;
|
||||
|
||||
pFile = NXIassert (fileid);
|
||||
if ((pFirstID->iTag == pSecondID->iTag) & (pFirstID->iRef == pSecondID->iRef)) {
|
||||
return NX_OK;
|
||||
} else {
|
||||
return NX_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user