From 73f7dfbcfd47abe04d246923c58fe81bc56f394e Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 28 Oct 2014 19:44:39 -0700 Subject: [PATCH] hds: Add more debugging to the wrapper The file can still be auto-generated. --- libraries/hds/hds_select.c | 2027 ++++++++++++++++++++------ libraries/hds/helper/mkhdswrapper.py | 144 +- 2 files changed, 1721 insertions(+), 450 deletions(-) diff --git a/libraries/hds/hds_select.c b/libraries/hds/hds_select.c index cf9a271915d..9af7dde9bfb 100644 --- a/libraries/hds/hds_select.c +++ b/libraries/hds/hds_select.c @@ -3,8 +3,8 @@ #define STAR_HDS_H_INCLUDED #include "dat1.h" -#include "dat_par.h" #include "hds_types.h" +#include "dat_par.h" #include #include @@ -15,6 +15,13 @@ #include "star/hds_v4.h" #include "star/hds_v5.h" #define ISHDSv5(loc) ((loc) && (loc)->hds_version >= 5) +#if DEBUG_HDS +#define HDS_CHECK_STATUS(func,txt) if (*status != instat && *status != SAI__OK) { emsRepf("wrap_" func, func ": Error in call to HDS %s", status, txt); printf("Bad status from %s: %d\n", func, *status);} +static void EnterCheck( const char * func, int status ) { printf("Enter HDS routine: %s [%d]\n", func,status); } +#else +# define HDS_CHECK_STATUS(func,txt) if (*status != instat && *status != SAI__OK) { emsRepf("wrap_" func, func ": Error in call to HDS %s", status, txt);} +# define EnterCheck(A,B) ; +#endif /*=================================*/ /* datAlter - Alter size of object */ @@ -23,9 +30,17 @@ int datAlter(const HDSLoc *locator, int ndim, const hdsdim dims[], int *status) { - if (ISHDSv5(locator)) return datAlter_v5(locator, ndim, dims, status); - return datAlter_v4(locator, ndim, dims, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datAlter",*status); + if (isv5) { + retval = datAlter_v5(locator, ndim, dims, status); + } else { + retval = datAlter_v4(locator, ndim, dims, status); + } + HDS_CHECK_STATUS("datAlter",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==========================*/ @@ -35,9 +50,17 @@ datAlter(const HDSLoc *locator, int ndim, const hdsdim dims[], int *status) { int datAnnul(HDSLoc **locator, int *status) { - if (ISHDSv5(*locator)) return datAnnul_v5(locator, status); - return datAnnul_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(*locator); + EnterCheck("datAnnul",*status); + if (isv5) { + retval = datAnnul_v5(locator, status); + } else { + retval = datAnnul_v4(locator, status); + } + HDS_CHECK_STATUS("datAnnul",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==============================================*/ @@ -47,9 +70,17 @@ datAnnul(HDSLoc **locator, int *status) { int datBasic(const HDSLoc *locator, const char *mode_c, unsigned char **pntr, size_t *len, int *status) { - if (ISHDSv5(locator)) return datBasic_v5(locator, mode_c, pntr, len, status); - return datBasic_v4(locator, mode_c, pntr, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datBasic",*status); + if (isv5) { + retval = datBasic_v5(locator, mode_c, pntr, len, status); + } else { + retval = datBasic_v4(locator, mode_c, pntr, len, status); + } + HDS_CHECK_STATUS("datBasic",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -59,15 +90,22 @@ datBasic(const HDSLoc *locator, const char *mode_c, unsigned char **pntr, size_t int datCcopy(const HDSLoc *locator1, const HDSLoc *locator2, const char *name, HDSLoc **locator3, int *status) { /* Requires special code */ + int instat = *status; + int isv5 = 0; + EnterCheck("datCcopy",*status); + if (*status != SAI__OK) return *status; if (ISHDSv5(locator1) && ISHDSv5(locator2)) { /* Just call the v5 code */ - datCcopy_v5( locator1, locator2, name, locator3, status ); + isv5 = 1; + datCcopy_v5(locator1, locator2, name, locator3, status); } else if ( !ISHDSv5(locator1) && !ISHDSv5(locator2) ) { - datCcopy_v4( locator1, locator2, name, locator3, status ); + isv5 = 0; + datCcopy_v4(locator1, locator2, name, locator3, status); } else { printf("Aborting. datCcopy: Special code required for copy across different versions of files.\n"); abort(); } + HDS_CHECK_STATUS("datCcopy",(isv5 ? "(v5)" : "(v4)")); return *status; } @@ -77,7 +115,9 @@ datCcopy(const HDSLoc *locator1, const HDSLoc *locator2, const char *name, HDSLo void datCctyp(size_t size, char type[DAT__SZTYP+1]) { - return datCctyp_v5(size, type); + EnterCheck("datCctyp",-1); + datCctyp_v5(size, type); + return; } @@ -88,9 +128,17 @@ datCctyp(size_t size, char type[DAT__SZTYP+1]) { int datCell(const HDSLoc *locator1, int ndim, const hdsdim subs[], HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datCell_v5(locator1, ndim, subs, locator2, status); - return datCell_v4(locator1, ndim, subs, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datCell",*status); + if (isv5) { + retval = datCell_v5(locator1, ndim, subs, locator2, status); + } else { + retval = datCell_v4(locator1, ndim, subs, locator2, status); + } + HDS_CHECK_STATUS("datCell",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=================================================*/ @@ -99,7 +147,13 @@ datCell(const HDSLoc *locator1, int ndim, const hdsdim subs[], HDSLoc **locator2 int datChscn(const char * name, int *status) { - return datChscn_v5(name, status); + int retval = 0; + int instat = *status; + EnterCheck("datChscn",*status); + if (*status != SAI__OK) return *status; + retval = datChscn_v5(name, status); + HDS_CHECK_STATUS("datChscn","(v5)"); + return retval; } /*==========================================*/ @@ -109,9 +163,17 @@ datChscn(const char * name, int *status) { int datClen(const HDSLoc *locator, size_t *clen, int *status) { - if (ISHDSv5(locator)) return datClen_v5(locator, clen, status); - return datClen_v4(locator, clen, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datClen",*status); + if (isv5) { + retval = datClen_v5(locator, clen, status); + } else { + retval = datClen_v4(locator, clen, status); + } + HDS_CHECK_STATUS("datClen",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===========================*/ @@ -121,9 +183,17 @@ datClen(const HDSLoc *locator, size_t *clen, int *status) { int datClone(const HDSLoc *locator1, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datClone_v5(locator1, locator2, status); - return datClone_v4(locator1, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datClone",*status); + if (isv5) { + retval = datClone_v5(locator1, locator2, status); + } else { + retval = datClone_v4(locator1, locator2, status); + } + HDS_CHECK_STATUS("datClone",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================*/ @@ -133,9 +203,17 @@ datClone(const HDSLoc *locator1, HDSLoc **locator2, int *status) { int datCoerc(const HDSLoc *locator1, int ndim, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datCoerc_v5(locator1, ndim, locator2, status); - return datCoerc_v4(locator1, ndim, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datCoerc",*status); + if (isv5) { + retval = datCoerc_v5(locator1, ndim, locator2, status); + } else { + retval = datCoerc_v4(locator1, ndim, locator2, status); + } + HDS_CHECK_STATUS("datCoerc",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================*/ @@ -145,15 +223,22 @@ datCoerc(const HDSLoc *locator1, int ndim, HDSLoc **locator2, int *status) { int datCopy(const HDSLoc *locator1, const HDSLoc *locator2, const char *name_c, int *status) { /* Requires special code */ + int instat = *status; + int isv5 = 0; + EnterCheck("datCopy",*status); + if (*status != SAI__OK) return *status; if (ISHDSv5(locator1) && ISHDSv5(locator2)) { /* Just call the v5 code */ - datCopy_v5( locator1, locator2, name_c, status ); + isv5 = 1; + datCopy_v5(locator1, locator2, name_c, status); } else if ( !ISHDSv5(locator1) && !ISHDSv5(locator2) ) { - datCopy_v4( locator1, locator2, name_c, status ); + isv5 = 0; + datCopy_v4(locator1, locator2, name_c, status); } else { printf("Aborting. datCopy: Special code required for copy across different versions of files.\n"); abort(); } + HDS_CHECK_STATUS("datCopy",(isv5 ? "(v5)" : "(v4)")); return *status; } @@ -164,9 +249,17 @@ datCopy(const HDSLoc *locator1, const HDSLoc *locator2, const char *name_c, int int datDrep(const HDSLoc *locator, char **format_str, char **order_str, int *status) { - if (ISHDSv5(locator)) return datDrep_v5(locator, format_str, order_str, status); - return datDrep_v4(locator, format_str, order_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datDrep",*status); + if (isv5) { + retval = datDrep_v5(locator, format_str, order_str, status); + } else { + retval = datDrep_v4(locator, format_str, order_str, status); + } + HDS_CHECK_STATUS("datDrep",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -176,9 +269,17 @@ datDrep(const HDSLoc *locator, char **format_str, char **order_str, int *status) int datErase(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datErase_v5(locator, name_str, status); - return datErase_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datErase",*status); + if (isv5) { + retval = datErase_v5(locator, name_str, status); + } else { + retval = datErase_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datErase",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===========================================================*/ @@ -187,6 +288,7 @@ datErase(const HDSLoc *locator, const char *name_str, int *status) { int datErmsg(int status, size_t *len, char *msg_str) { + EnterCheck("datErmsg",-1); return datErmsg_v5(status, len, msg_str); } @@ -197,9 +299,17 @@ datErmsg(int status, size_t *len, char *msg_str) { int datFind(const HDSLoc *locator1, const char *name_str, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datFind_v5(locator1, name_str, locator2, status); - return datFind_v4(locator1, name_str, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datFind",*status); + if (isv5) { + retval = datFind_v5(locator1, name_str, locator2, status); + } else { + retval = datFind_v4(locator1, name_str, locator2, status); + } + HDS_CHECK_STATUS("datFind",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*============================*/ @@ -209,9 +319,17 @@ datFind(const HDSLoc *locator1, const char *name_str, HDSLoc **locator2, int *st int datGet(const HDSLoc *locator, const char *type_str, int ndim, const hdsdim dims[], void *values, int *status) { - if (ISHDSv5(locator)) return datGet_v5(locator, type_str, ndim, dims, values, status); - return datGet_v4(locator, type_str, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet",*status); + if (isv5) { + retval = datGet_v5(locator, type_str, ndim, dims, values, status); + } else { + retval = datGet_v4(locator, type_str, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGet",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================*/ @@ -221,9 +339,17 @@ datGet(const HDSLoc *locator, const char *type_str, int ndim, const hdsdim dims[ int datGetC(const HDSLoc *locator, const int ndim, const hdsdim dims[], char values[], size_t char_len, int *status) { - if (ISHDSv5(locator)) return datGetC_v5(locator, ndim, dims, values, char_len, status); - return datGetC_v4(locator, ndim, dims, values, char_len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetC",*status); + if (isv5) { + retval = datGetC_v5(locator, ndim, dims, values, char_len, status); + } else { + retval = datGetC_v4(locator, ndim, dims, values, char_len, status); + } + HDS_CHECK_STATUS("datGetC",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -233,9 +359,17 @@ datGetC(const HDSLoc *locator, const int ndim, const hdsdim dims[], char values[ int datGetD(const HDSLoc *locator, int ndim, const hdsdim dims[], double values[], int *status) { - if (ISHDSv5(locator)) return datGetD_v5(locator, ndim, dims, values, status); - return datGetD_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetD",*status); + if (isv5) { + retval = datGetD_v5(locator, ndim, dims, values, status); + } else { + retval = datGetD_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetD",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================*/ @@ -245,9 +379,17 @@ datGetD(const HDSLoc *locator, int ndim, const hdsdim dims[], double values[], i int datGetI(const HDSLoc *locator, int ndim, const hdsdim dims[], int values[], int *status) { - if (ISHDSv5(locator)) return datGetI_v5(locator, ndim, dims, values, status); - return datGetI_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetI",*status); + if (isv5) { + retval = datGetI_v5(locator, ndim, dims, values, status); + } else { + retval = datGetI_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetI",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================*/ @@ -257,9 +399,17 @@ datGetI(const HDSLoc *locator, int ndim, const hdsdim dims[], int values[], int int datGetK(const HDSLoc *locator, int ndim, const hdsdim dims[], int64_t values[], int *status) { - if (ISHDSv5(locator)) return datGetK_v5(locator, ndim, dims, values, status); - return datGetK_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetK",*status); + if (isv5) { + retval = datGetK_v5(locator, ndim, dims, values, status); + } else { + retval = datGetK_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetK",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================*/ @@ -269,9 +419,17 @@ datGetK(const HDSLoc *locator, int ndim, const hdsdim dims[], int64_t values[], int datGetW(const HDSLoc *locator, int ndim, const hdsdim dims[], short values[], int *status) { - if (ISHDSv5(locator)) return datGetW_v5(locator, ndim, dims, values, status); - return datGetW_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetW",*status); + if (isv5) { + retval = datGetW_v5(locator, ndim, dims, values, status); + } else { + retval = datGetW_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================*/ @@ -281,9 +439,17 @@ datGetW(const HDSLoc *locator, int ndim, const hdsdim dims[], short values[], in int datGetUW(const HDSLoc *locator, int ndim, const hdsdim dims[], unsigned short values[], int *status) { - if (ISHDSv5(locator)) return datGetUW_v5(locator, ndim, dims, values, status); - return datGetUW_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetUW",*status); + if (isv5) { + retval = datGetUW_v5(locator, ndim, dims, values, status); + } else { + retval = datGetUW_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetUW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================*/ @@ -293,9 +459,17 @@ datGetUW(const HDSLoc *locator, int ndim, const hdsdim dims[], unsigned short va int datGetL(const HDSLoc *locator, int ndim, const hdsdim dims[], hdsbool_t values[], int *status) { - if (ISHDSv5(locator)) return datGetL_v5(locator, ndim, dims, values, status); - return datGetL_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetL",*status); + if (isv5) { + retval = datGetL_v5(locator, ndim, dims, values, status); + } else { + retval = datGetL_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetL",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================*/ @@ -305,9 +479,17 @@ datGetL(const HDSLoc *locator, int ndim, const hdsdim dims[], hdsbool_t values[] int datGetR(const HDSLoc *locator, int ndim, const hdsdim dims[], float values[], int *status) { - if (ISHDSv5(locator)) return datGetR_v5(locator, ndim, dims, values, status); - return datGetR_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetR",*status); + if (isv5) { + retval = datGetR_v5(locator, ndim, dims, values, status); + } else { + retval = datGetR_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datGetR",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================*/ @@ -317,9 +499,17 @@ datGetR(const HDSLoc *locator, int ndim, const hdsdim dims[], float values[], in int datGet0C(const HDSLoc * locator, char * value, size_t len, int * status) { - if (ISHDSv5(locator)) return datGet0C_v5(locator, value, len, status); - return datGet0C_v4(locator, value, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0C",*status); + if (isv5) { + retval = datGet0C_v5(locator, value, len, status); + } else { + retval = datGet0C_v4(locator, value, len, status); + } + HDS_CHECK_STATUS("datGet0C",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================*/ @@ -329,9 +519,17 @@ datGet0C(const HDSLoc * locator, char * value, size_t len, int * status) { int datGet0D(const HDSLoc * locator, double * value, int * status) { - if (ISHDSv5(locator)) return datGet0D_v5(locator, value, status); - return datGet0D_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0D",*status); + if (isv5) { + retval = datGet0D_v5(locator, value, status); + } else { + retval = datGet0D_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0D",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -341,9 +539,17 @@ datGet0D(const HDSLoc * locator, double * value, int * status) { int datGet0R(const HDSLoc * locator, float * value, int * status) { - if (ISHDSv5(locator)) return datGet0R_v5(locator, value, status); - return datGet0R_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0R",*status); + if (isv5) { + retval = datGet0R_v5(locator, value, status); + } else { + retval = datGet0R_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0R",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -353,9 +559,17 @@ datGet0R(const HDSLoc * locator, float * value, int * status) { int datGet0I(const HDSLoc * locator, int * value, int * status) { - if (ISHDSv5(locator)) return datGet0I_v5(locator, value, status); - return datGet0I_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0I",*status); + if (isv5) { + retval = datGet0I_v5(locator, value, status); + } else { + retval = datGet0I_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0I",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -365,9 +579,17 @@ datGet0I(const HDSLoc * locator, int * value, int * status) { int datGet0K(const HDSLoc * locator, int64_t * value, int * status) { - if (ISHDSv5(locator)) return datGet0K_v5(locator, value, status); - return datGet0K_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0K",*status); + if (isv5) { + retval = datGet0K_v5(locator, value, status); + } else { + retval = datGet0K_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0K",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=============================================*/ @@ -377,9 +599,17 @@ datGet0K(const HDSLoc * locator, int64_t * value, int * status) { int datGet0W(const HDSLoc * locator, short * value, int * status) { - if (ISHDSv5(locator)) return datGet0W_v5(locator, value, status); - return datGet0W_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0W",*status); + if (isv5) { + retval = datGet0W_v5(locator, value, status); + } else { + retval = datGet0W_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0W",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=============================================*/ @@ -389,9 +619,17 @@ datGet0W(const HDSLoc * locator, short * value, int * status) { int datGet0UW(const HDSLoc * locator, unsigned short * value, int * status) { - if (ISHDSv5(locator)) return datGet0UW_v5(locator, value, status); - return datGet0UW_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0UW",*status); + if (isv5) { + retval = datGet0UW_v5(locator, value, status); + } else { + retval = datGet0UW_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0UW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -401,9 +639,17 @@ datGet0UW(const HDSLoc * locator, unsigned short * value, int * status) { int datGet0L(const HDSLoc * locator, hdsbool_t * value, int * status) { - if (ISHDSv5(locator)) return datGet0L_v5(locator, value, status); - return datGet0L_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet0L",*status); + if (isv5) { + retval = datGet0L_v5(locator, value, status); + } else { + retval = datGet0L_v4(locator, value, status); + } + HDS_CHECK_STATUS("datGet0L",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -413,9 +659,17 @@ datGet0L(const HDSLoc * locator, hdsbool_t * value, int * status) { int datGet1C(const HDSLoc * locator, size_t maxval, size_t bufsize, char *buffer, char *pntrs[], size_t * actval, int * status) { - if (ISHDSv5(locator)) return datGet1C_v5(locator, maxval, bufsize, buffer, pntrs, actval, status); - return datGet1C_v4(locator, maxval, bufsize, buffer, pntrs, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1C",*status); + if (isv5) { + retval = datGet1C_v5(locator, maxval, bufsize, buffer, pntrs, actval, status); + } else { + retval = datGet1C_v4(locator, maxval, bufsize, buffer, pntrs, actval, status); + } + HDS_CHECK_STATUS("datGet1C",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -425,9 +679,17 @@ datGet1C(const HDSLoc * locator, size_t maxval, size_t bufsize, char *buffer, ch int datGet1D(const HDSLoc * locator, size_t maxval, double values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1D_v5(locator, maxval, values, actval, status); - return datGet1D_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1D",*status); + if (isv5) { + retval = datGet1D_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1D_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1D",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -437,9 +699,17 @@ datGet1D(const HDSLoc * locator, size_t maxval, double values[], size_t *actval, int datGet1I(const HDSLoc * locator, size_t maxval, int values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1I_v5(locator, maxval, values, actval, status); - return datGet1I_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1I",*status); + if (isv5) { + retval = datGet1I_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1I_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1I",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*============================================*/ @@ -449,9 +719,17 @@ datGet1I(const HDSLoc * locator, size_t maxval, int values[], size_t *actval, in int datGet1K(const HDSLoc * locator, size_t maxval, int64_t values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1K_v5(locator, maxval, values, actval, status); - return datGet1K_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1K",*status); + if (isv5) { + retval = datGet1K_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1K_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1K",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=========================================*/ @@ -461,9 +739,17 @@ datGet1K(const HDSLoc * locator, size_t maxval, int64_t values[], size_t *actval int datGet1W(const HDSLoc * locator, size_t maxval, short values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1W_v5(locator, maxval, values, actval, status); - return datGet1W_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1W",*status); + if (isv5) { + retval = datGet1W_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1W_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1W",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================================*/ @@ -473,9 +759,17 @@ datGet1W(const HDSLoc * locator, size_t maxval, short values[], size_t *actval, int datGet1UW(const HDSLoc * locator, size_t maxval, unsigned short values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1UW_v5(locator, maxval, values, actval, status); - return datGet1UW_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1UW",*status); + if (isv5) { + retval = datGet1UW_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1UW_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1UW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -485,9 +779,17 @@ datGet1UW(const HDSLoc * locator, size_t maxval, unsigned short values[], size_t int datGet1R(const HDSLoc * locator, size_t maxval, float values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1R_v5(locator, maxval, values, actval, status); - return datGet1R_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1R",*status); + if (isv5) { + retval = datGet1R_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1R_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1R",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -497,9 +799,17 @@ datGet1R(const HDSLoc * locator, size_t maxval, float values[], size_t *actval, int datGet1L(const HDSLoc * locator, size_t maxval, hdsbool_t values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGet1L_v5(locator, maxval, values, actval, status); - return datGet1L_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGet1L",*status); + if (isv5) { + retval = datGet1L_v5(locator, maxval, values, actval, status); + } else { + retval = datGet1L_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGet1L",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -509,9 +819,17 @@ datGet1L(const HDSLoc * locator, size_t maxval, hdsbool_t values[], size_t *actv int datGetVC(const HDSLoc * locator, size_t maxval, size_t bufsize, char *buffer, char *pntrs[], size_t * actval, int * status) { - if (ISHDSv5(locator)) return datGetVC_v5(locator, maxval, bufsize, buffer, pntrs, actval, status); - return datGetVC_v4(locator, maxval, bufsize, buffer, pntrs, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetVC",*status); + if (isv5) { + retval = datGetVC_v5(locator, maxval, bufsize, buffer, pntrs, actval, status); + } else { + retval = datGetVC_v4(locator, maxval, bufsize, buffer, pntrs, actval, status); + } + HDS_CHECK_STATUS("datGetVC",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -522,9 +840,17 @@ datGetVC(const HDSLoc * locator, size_t maxval, size_t bufsize, char *buffer, ch int datGetVD(const HDSLoc * locator, size_t maxval, double values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGetVD_v5(locator, maxval, values, actval, status); - return datGetVD_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetVD",*status); + if (isv5) { + retval = datGetVD_v5(locator, maxval, values, actval, status); + } else { + retval = datGetVD_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGetVD",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==========================================*/ @@ -534,9 +860,17 @@ datGetVD(const HDSLoc * locator, size_t maxval, double values[], size_t *actval, int datGetVI(const HDSLoc * locator, size_t maxval, int values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGetVI_v5(locator, maxval, values, actval, status); - return datGetVI_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetVI",*status); + if (isv5) { + retval = datGetVI_v5(locator, maxval, values, actval, status); + } else { + retval = datGetVI_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGetVI",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==========================================*/ @@ -546,9 +880,17 @@ datGetVI(const HDSLoc * locator, size_t maxval, int values[], size_t *actval, in int datGetVK(const HDSLoc * locator, size_t maxval, int64_t values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGetVK_v5(locator, maxval, values, actval, status); - return datGetVK_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetVK",*status); + if (isv5) { + retval = datGetVK_v5(locator, maxval, values, actval, status); + } else { + retval = datGetVK_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGetVK",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==========================================*/ @@ -558,9 +900,17 @@ datGetVK(const HDSLoc * locator, size_t maxval, int64_t values[], size_t *actval int datGetVR(const HDSLoc * locator, size_t maxval, float values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGetVR_v5(locator, maxval, values, actval, status); - return datGetVR_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetVR",*status); + if (isv5) { + retval = datGetVR_v5(locator, maxval, values, actval, status); + } else { + retval = datGetVR_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGetVR",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==========================================*/ @@ -570,9 +920,17 @@ datGetVR(const HDSLoc * locator, size_t maxval, float values[], size_t *actval, int datGetVL(const HDSLoc * locator, size_t maxval, hdsbool_t values[], size_t *actval, int * status) { - if (ISHDSv5(locator)) return datGetVL_v5(locator, maxval, values, actval, status); - return datGetVL_v4(locator, maxval, values, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datGetVL",*status); + if (isv5) { + retval = datGetVL_v5(locator, maxval, values, actval, status); + } else { + retval = datGetVL_v4(locator, maxval, values, actval, status); + } + HDS_CHECK_STATUS("datGetVL",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -583,9 +941,17 @@ datGetVL(const HDSLoc * locator, size_t maxval, hdsbool_t values[], size_t *actv int datIndex(const HDSLoc *locator1, int index, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datIndex_v5(locator1, index, locator2, status); - return datIndex_v4(locator1, index, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datIndex",*status); + if (isv5) { + retval = datIndex_v5(locator1, index, locator2, status); + } else { + retval = datIndex_v4(locator1, index, locator2, status); + } + HDS_CHECK_STATUS("datIndex",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================*/ @@ -595,9 +961,17 @@ datIndex(const HDSLoc *locator1, int index, HDSLoc **locator2, int *status) { int datLen(const HDSLoc *locator, size_t *len, int *status) { - if (ISHDSv5(locator)) return datLen_v5(locator, len, status); - return datLen_v4(locator, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datLen",*status); + if (isv5) { + retval = datLen_v5(locator, len, status); + } else { + retval = datLen_v4(locator, len, status); + } + HDS_CHECK_STATUS("datLen",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===========================*/ @@ -607,9 +981,17 @@ datLen(const HDSLoc *locator, size_t *len, int *status) { int datMap(const HDSLoc *locator, const char *type_str, const char *mode_str, int ndim, const hdsdim dims[], void **pntr, int *status) { - if (ISHDSv5(locator)) return datMap_v5(locator, type_str, mode_str, ndim, dims, pntr, status); - return datMap_v4(locator, type_str, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMap",*status); + if (isv5) { + retval = datMap_v5(locator, type_str, mode_str, ndim, dims, pntr, status); + } else { + retval = datMap_v4(locator, type_str, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMap",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -619,9 +1001,17 @@ datMap(const HDSLoc *locator, const char *type_str, const char *mode_str, int nd int datMapC(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims[], unsigned char **pntr, int *status) { - if (ISHDSv5(locator)) return datMapC_v5(locator, mode_str, ndim, dims, pntr, status); - return datMapC_v4(locator, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapC",*status); + if (isv5) { + retval = datMapC_v5(locator, mode_str, ndim, dims, pntr, status); + } else { + retval = datMapC_v4(locator, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMapC",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*====================================*/ @@ -631,9 +1021,17 @@ datMapC(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims int datMapD(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims[], double **pntr, int *status) { - if (ISHDSv5(locator)) return datMapD_v5(locator, mode_str, ndim, dims, pntr, status); - return datMapD_v4(locator, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapD",*status); + if (isv5) { + retval = datMapD_v5(locator, mode_str, ndim, dims, pntr, status); + } else { + retval = datMapD_v4(locator, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMapD",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -643,9 +1041,17 @@ datMapD(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims int datMapI(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims[], int **pntr, int *status) { - if (ISHDSv5(locator)) return datMapI_v5(locator, mode_str, ndim, dims, pntr, status); - return datMapI_v4(locator, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapI",*status); + if (isv5) { + retval = datMapI_v5(locator, mode_str, ndim, dims, pntr, status); + } else { + retval = datMapI_v4(locator, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMapI",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -655,9 +1061,17 @@ datMapI(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims int datMapK(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims[], int **pntr, int *status) { - if (ISHDSv5(locator)) return datMapK_v5(locator, mode_str, ndim, dims, pntr, status); - return datMapK_v4(locator, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapK",*status); + if (isv5) { + retval = datMapK_v5(locator, mode_str, ndim, dims, pntr, status); + } else { + retval = datMapK_v4(locator, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMapK",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -667,9 +1081,17 @@ datMapK(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims int datMapL(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims[], hdsbool_t **pntr, int *status) { - if (ISHDSv5(locator)) return datMapL_v5(locator, mode_str, ndim, dims, pntr, status); - return datMapL_v4(locator, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapL",*status); + if (isv5) { + retval = datMapL_v5(locator, mode_str, ndim, dims, pntr, status); + } else { + retval = datMapL_v4(locator, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMapL",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -679,9 +1101,17 @@ datMapL(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims int datMapR(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims[], float **pntr, int *status) { - if (ISHDSv5(locator)) return datMapR_v5(locator, mode_str, ndim, dims, pntr, status); - return datMapR_v4(locator, mode_str, ndim, dims, pntr, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapR",*status); + if (isv5) { + retval = datMapR_v5(locator, mode_str, ndim, dims, pntr, status); + } else { + retval = datMapR_v4(locator, mode_str, ndim, dims, pntr, status); + } + HDS_CHECK_STATUS("datMapR",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -692,9 +1122,17 @@ datMapR(const HDSLoc *locator, const char *mode_str, int ndim, const hdsdim dims int datMapN(const HDSLoc *locator, const char *type_str, const char *mode_str, int ndim, void **pntr, hdsdim dims[], int *status) { - if (ISHDSv5(locator)) return datMapN_v5(locator, type_str, mode_str, ndim, pntr, dims, status); - return datMapN_v4(locator, type_str, mode_str, ndim, pntr, dims, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapN",*status); + if (isv5) { + retval = datMapN_v5(locator, type_str, mode_str, ndim, pntr, dims, status); + } else { + retval = datMapN_v4(locator, type_str, mode_str, ndim, pntr, dims, status); + } + HDS_CHECK_STATUS("datMapN",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -704,9 +1142,17 @@ datMapN(const HDSLoc *locator, const char *type_str, const char *mode_str, int n int datMapV(const HDSLoc *locator, const char *type_str, const char *mode_str, void **pntr, size_t *actval, int *status) { - if (ISHDSv5(locator)) return datMapV_v5(locator, type_str, mode_str, pntr, actval, status); - return datMapV_v4(locator, type_str, mode_str, pntr, actval, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMapV",*status); + if (isv5) { + retval = datMapV_v5(locator, type_str, mode_str, pntr, actval, status); + } else { + retval = datMapV_v4(locator, type_str, mode_str, pntr, actval, status); + } + HDS_CHECK_STATUS("datMapV",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -717,9 +1163,17 @@ datMapV(const HDSLoc *locator, const char *type_str, const char *mode_str, void int datMould(const HDSLoc *locator, int ndim, const hdsdim dims[], int *status) { - if (ISHDSv5(locator)) return datMould_v5(locator, ndim, dims, status); - return datMould_v4(locator, ndim, dims, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datMould",*status); + if (isv5) { + retval = datMould_v5(locator, ndim, dims, status); + } else { + retval = datMould_v4(locator, ndim, dims, status); + } + HDS_CHECK_STATUS("datMould",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================*/ @@ -729,15 +1183,22 @@ datMould(const HDSLoc *locator, int ndim, const hdsdim dims[], int *status) { int datMove(HDSLoc **locator1, const HDSLoc *locator2, const char *name_str, int *status) { /* Requires special code */ + int instat = *status; + int isv5 = 0; + EnterCheck("datMove",*status); + if (*status != SAI__OK) return *status; if (ISHDSv5(*locator1) && ISHDSv5(locator2)) { /* Just call the v5 code */ - datMove_v5( locator1, locator2, name_str, status ); + isv5 = 1; + datMove_v5(locator1, locator2, name_str, status); } else if ( !ISHDSv5(*locator1) && !ISHDSv5(locator2) ) { - datMove_v4( locator1, locator2, name_str, status ); + isv5 = 0; + datMove_v4(locator1, locator2, name_str, status); } else { printf("Aborting. datMove: Special code required for copy across different versions of files.\n"); abort(); } + HDS_CHECK_STATUS("datMove",(isv5 ? "(v5)" : "(v4)")); return *status; } @@ -747,10 +1208,13 @@ datMove(HDSLoc **locator1, const HDSLoc *locator2, const char *name_str, int *st void datMsg(const char * token, const HDSLoc * locator) { - - if (ISHDSv5(locator)) return datMsg_v5(token, locator); - return datMsg_v4(token, locator); - + EnterCheck("datMsg",-1); + if (ISHDSv5(locator)) { + datMsg_v5(token, locator); + } else { + datMsg_v4(token, locator); + } + return; } /*===============================*/ @@ -760,9 +1224,17 @@ datMsg(const char * token, const HDSLoc * locator) { int datName(const HDSLoc *locator, char name_str[DAT__SZNAM+1], int *status) { - if (ISHDSv5(locator)) return datName_v5(locator, name_str, status); - return datName_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datName",*status); + if (isv5) { + retval = datName_v5(locator, name_str, status); + } else { + retval = datName_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datName",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=========================================*/ @@ -772,9 +1244,17 @@ datName(const HDSLoc *locator, char name_str[DAT__SZNAM+1], int *status) { int datNcomp(const HDSLoc *locator, int *ncomp, int *status) { - if (ISHDSv5(locator)) return datNcomp_v5(locator, ncomp, status); - return datNcomp_v4(locator, ncomp, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNcomp",*status); + if (isv5) { + retval = datNcomp_v5(locator, ncomp, status); + } else { + retval = datNcomp_v4(locator, ncomp, status); + } + HDS_CHECK_STATUS("datNcomp",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===============================*/ @@ -784,9 +1264,17 @@ datNcomp(const HDSLoc *locator, int *ncomp, int *status) { int datNew(const HDSLoc *locator, const char *name_str, const char *type_str, int ndim, const hdsdim dims[], int *status) { - if (ISHDSv5(locator)) return datNew_v5(locator, name_str, type_str, ndim, dims, status); - return datNew_v4(locator, name_str, type_str, ndim, dims, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew",*status); + if (isv5) { + retval = datNew_v5(locator, name_str, type_str, ndim, dims, status); + } else { + retval = datNew_v4(locator, name_str, type_str, ndim, dims, status); + } + HDS_CHECK_STATUS("datNew",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*============================================*/ @@ -796,9 +1284,17 @@ datNew(const HDSLoc *locator, const char *name_str, const char *type_str, int nd int datNewC(const HDSLoc *locator, const char *name_str, size_t len, int ndim, const hdsdim dims[], int *status) { - if (ISHDSv5(locator)) return datNewC_v5(locator, name_str, len, ndim, dims, status); - return datNewC_v4(locator, name_str, len, ndim, dims, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNewC",*status); + if (isv5) { + retval = datNewC_v5(locator, name_str, len, ndim, dims, status); + } else { + retval = datNewC_v4(locator, name_str, len, ndim, dims, status); + } + HDS_CHECK_STATUS("datNewC",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -808,9 +1304,17 @@ datNewC(const HDSLoc *locator, const char *name_str, size_t len, int ndim, const int datNew0(const HDSLoc *locator, const char *name_str, const char *type_str, int *status) { - if (ISHDSv5(locator)) return datNew0_v5(locator, name_str, type_str, status); - return datNew0_v4(locator, name_str, type_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0",*status); + if (isv5) { + retval = datNew0_v5(locator, name_str, type_str, status); + } else { + retval = datNew0_v4(locator, name_str, type_str, status); + } + HDS_CHECK_STATUS("datNew0",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===============================================*/ @@ -820,9 +1324,17 @@ datNew0(const HDSLoc *locator, const char *name_str, const char *type_str, int * int datNew0D(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0D_v5(locator, name_str, status); - return datNew0D_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0D",*status); + if (isv5) { + retval = datNew0D_v5(locator, name_str, status); + } else { + retval = datNew0D_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0D",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -832,9 +1344,17 @@ datNew0D(const HDSLoc *locator, const char *name_str, int *status) { int datNew0I(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0I_v5(locator, name_str, status); - return datNew0I_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0I",*status); + if (isv5) { + retval = datNew0I_v5(locator, name_str, status); + } else { + retval = datNew0I_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0I",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=========================================================*/ @@ -844,9 +1364,17 @@ datNew0I(const HDSLoc *locator, const char *name_str, int *status) { int datNew0K(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0K_v5(locator, name_str, status); - return datNew0K_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0K",*status); + if (isv5) { + retval = datNew0K_v5(locator, name_str, status); + } else { + retval = datNew0K_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0K",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================================*/ @@ -856,9 +1384,17 @@ datNew0K(const HDSLoc *locator, const char *name_str, int *status) { int datNew0W(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0W_v5(locator, name_str, status); - return datNew0W_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0W",*status); + if (isv5) { + retval = datNew0W_v5(locator, name_str, status); + } else { + retval = datNew0W_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0W",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================================*/ @@ -868,9 +1404,17 @@ datNew0W(const HDSLoc *locator, const char *name_str, int *status) { int datNew0UW(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0UW_v5(locator, name_str, status); - return datNew0UW_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0UW",*status); + if (isv5) { + retval = datNew0UW_v5(locator, name_str, status); + } else { + retval = datNew0UW_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0UW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=============================================*/ @@ -880,9 +1424,17 @@ datNew0UW(const HDSLoc *locator, const char *name_str, int *status) { int datNew0R(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0R_v5(locator, name_str, status); - return datNew0R_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0R",*status); + if (isv5) { + retval = datNew0R_v5(locator, name_str, status); + } else { + retval = datNew0R_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0R",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -892,9 +1444,17 @@ datNew0R(const HDSLoc *locator, const char *name_str, int *status) { int datNew0L(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datNew0L_v5(locator, name_str, status); - return datNew0L_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0L",*status); + if (isv5) { + retval = datNew0L_v5(locator, name_str, status); + } else { + retval = datNew0L_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datNew0L",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -904,9 +1464,17 @@ datNew0L(const HDSLoc *locator, const char *name_str, int *status) { int datNew0C(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew0C_v5(locator, name_str, len, status); - return datNew0C_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew0C",*status); + if (isv5) { + retval = datNew0C_v5(locator, name_str, len, status); + } else { + retval = datNew0C_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew0C",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -918,9 +1486,17 @@ datNew0C(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datNew1(const HDSLoc *locator, const char *name_str, const char *type_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1_v5(locator, name_str, type_str, len, status); - return datNew1_v4(locator, name_str, type_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1",*status); + if (isv5) { + retval = datNew1_v5(locator, name_str, type_str, len, status); + } else { + retval = datNew1_v4(locator, name_str, type_str, len, status); + } + HDS_CHECK_STATUS("datNew1",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -930,9 +1506,17 @@ datNew1(const HDSLoc *locator, const char *name_str, const char *type_str, size_ int datNew1C(const HDSLoc *locator, const char *name_str, size_t len, size_t nelem, int *status) { - if (ISHDSv5(locator)) return datNew1C_v5(locator, name_str, len, nelem, status); - return datNew1C_v4(locator, name_str, len, nelem, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1C",*status); + if (isv5) { + retval = datNew1C_v5(locator, name_str, len, nelem, status); + } else { + retval = datNew1C_v4(locator, name_str, len, nelem, status); + } + HDS_CHECK_STATUS("datNew1C",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -942,9 +1526,17 @@ datNew1C(const HDSLoc *locator, const char *name_str, size_t len, size_t nelem, int datNew1D(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1D_v5(locator, name_str, len, status); - return datNew1D_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1D",*status); + if (isv5) { + retval = datNew1D_v5(locator, name_str, len, status); + } else { + retval = datNew1D_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1D",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -954,9 +1546,17 @@ datNew1D(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datNew1I(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1I_v5(locator, name_str, len, status); - return datNew1I_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1I",*status); + if (isv5) { + retval = datNew1I_v5(locator, name_str, len, status); + } else { + retval = datNew1I_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1I",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -966,9 +1566,17 @@ datNew1I(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datNew1K(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1K_v5(locator, name_str, len, status); - return datNew1K_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1K",*status); + if (isv5) { + retval = datNew1K_v5(locator, name_str, len, status); + } else { + retval = datNew1K_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1K",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=============================================*/ @@ -978,9 +1586,17 @@ datNew1K(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datNew1W(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1W_v5(locator, name_str, len, status); - return datNew1W_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1W",*status); + if (isv5) { + retval = datNew1W_v5(locator, name_str, len, status); + } else { + retval = datNew1W_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1W",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================================*/ @@ -990,9 +1606,17 @@ datNew1W(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datNew1UW(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1UW_v5(locator, name_str, len, status); - return datNew1UW_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1UW",*status); + if (isv5) { + retval = datNew1UW_v5(locator, name_str, len, status); + } else { + retval = datNew1UW_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1UW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -1002,9 +1626,17 @@ datNew1UW(const HDSLoc *locator, const char *name_str, size_t len, int *status) int datNew1L(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1L_v5(locator, name_str, len, status); - return datNew1L_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1L",*status); + if (isv5) { + retval = datNew1L_v5(locator, name_str, len, status); + } else { + retval = datNew1L_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1L",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -1014,9 +1646,17 @@ datNew1L(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datNew1R(const HDSLoc *locator, const char *name_str, size_t len, int *status) { - if (ISHDSv5(locator)) return datNew1R_v5(locator, name_str, len, status); - return datNew1R_v4(locator, name_str, len, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datNew1R",*status); + if (isv5) { + retval = datNew1R_v5(locator, name_str, len, status); + } else { + retval = datNew1R_v4(locator, name_str, len, status); + } + HDS_CHECK_STATUS("datNew1R",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*====================================*/ @@ -1026,9 +1666,17 @@ datNew1R(const HDSLoc *locator, const char *name_str, size_t len, int *status) { int datParen(const HDSLoc *locator1, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datParen_v5(locator1, locator2, status); - return datParen_v4(locator1, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datParen",*status); + if (isv5) { + retval = datParen_v5(locator1, locator2, status); + } else { + retval = datParen_v4(locator1, locator2, status); + } + HDS_CHECK_STATUS("datParen",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -1039,9 +1687,17 @@ datParen(const HDSLoc *locator1, HDSLoc **locator2, int *status) { int datPrec(const HDSLoc *locator, size_t *nbytes, int *status) { - if (ISHDSv5(locator)) return datPrec_v5(locator, nbytes, status); - return datPrec_v4(locator, nbytes, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPrec",*status); + if (isv5) { + retval = datPrec_v5(locator, nbytes, status); + } else { + retval = datPrec_v4(locator, nbytes, status); + } + HDS_CHECK_STATUS("datPrec",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*====================================*/ @@ -1051,9 +1707,17 @@ datPrec(const HDSLoc *locator, size_t *nbytes, int *status) { int datPrim(const HDSLoc *locator, hdsbool_t *prim, int *status) { - if (ISHDSv5(locator)) return datPrim_v5(locator, prim, status); - return datPrim_v4(locator, prim, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPrim",*status); + if (isv5) { + retval = datPrim_v5(locator, prim, status); + } else { + retval = datPrim_v4(locator, prim, status); + } + HDS_CHECK_STATUS("datPrim",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=========================================================*/ @@ -1063,9 +1727,17 @@ datPrim(const HDSLoc *locator, hdsbool_t *prim, int *status) { int datPrmry(int set, HDSLoc **locator, hdsbool_t *prmry, int *status) { - if (ISHDSv5(*locator)) return datPrmry_v5(set, locator, prmry, status); - return datPrmry_v4(set, locator, prmry, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(*locator); + EnterCheck("datPrmry",*status); + if (isv5) { + retval = datPrmry_v5(set, locator, prmry, status); + } else { + retval = datPrmry_v4(set, locator, prmry, status); + } + HDS_CHECK_STATUS("datPrmry",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -1075,9 +1747,17 @@ datPrmry(int set, HDSLoc **locator, hdsbool_t *prmry, int *status) { int datPutC(const HDSLoc *locator, int ndim, const hdsdim dims[], const char string[], size_t string_length, int *status) { - if (ISHDSv5(locator)) return datPutC_v5(locator, ndim, dims, string, string_length, status); - return datPutC_v4(locator, ndim, dims, string, string_length, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutC",*status); + if (isv5) { + retval = datPutC_v5(locator, ndim, dims, string, string_length, status); + } else { + retval = datPutC_v4(locator, ndim, dims, string, string_length, status); + } + HDS_CHECK_STATUS("datPutC",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*====================================*/ @@ -1087,9 +1767,17 @@ datPutC(const HDSLoc *locator, int ndim, const hdsdim dims[], const char string[ int datPutD(const HDSLoc *locator, int ndim, const hdsdim dims[], const double values[], int *status) { - if (ISHDSv5(locator)) return datPutD_v5(locator, ndim, dims, values, status); - return datPutD_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutD",*status); + if (isv5) { + retval = datPutD_v5(locator, ndim, dims, values, status); + } else { + retval = datPutD_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutD",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -1099,9 +1787,17 @@ datPutD(const HDSLoc *locator, int ndim, const hdsdim dims[], const double value int datPutI(const HDSLoc *locator, int ndim, const hdsdim dims[], const int values[], int *status) { - if (ISHDSv5(locator)) return datPutI_v5(locator, ndim, dims, values, status); - return datPutI_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutI",*status); + if (isv5) { + retval = datPutI_v5(locator, ndim, dims, values, status); + } else { + retval = datPutI_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutI",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -1111,9 +1807,17 @@ datPutI(const HDSLoc *locator, int ndim, const hdsdim dims[], const int values[] int datPutK(const HDSLoc *locator, int ndim, const hdsdim dims[], const int64_t values[], int *status) { - if (ISHDSv5(locator)) return datPutK_v5(locator, ndim, dims, values, status); - return datPutK_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutK",*status); + if (isv5) { + retval = datPutK_v5(locator, ndim, dims, values, status); + } else { + retval = datPutK_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutK",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -1123,9 +1827,17 @@ datPutK(const HDSLoc *locator, int ndim, const hdsdim dims[], const int64_t valu int datPutW(const HDSLoc *locator, int ndim, const hdsdim dims[], const short values[], int *status) { - if (ISHDSv5(locator)) return datPutW_v5(locator, ndim, dims, values, status); - return datPutW_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutW",*status); + if (isv5) { + retval = datPutW_v5(locator, ndim, dims, values, status); + } else { + retval = datPutW_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*====================================*/ @@ -1135,9 +1847,17 @@ datPutW(const HDSLoc *locator, int ndim, const hdsdim dims[], const short values int datPutUW(const HDSLoc *locator, int ndim, const hdsdim dims[], const unsigned short values[], int *status) { - if (ISHDSv5(locator)) return datPutUW_v5(locator, ndim, dims, values, status); - return datPutUW_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutUW",*status); + if (isv5) { + retval = datPutUW_v5(locator, ndim, dims, values, status); + } else { + retval = datPutUW_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutUW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -1147,9 +1867,17 @@ datPutUW(const HDSLoc *locator, int ndim, const hdsdim dims[], const unsigned sh int datPutR(const HDSLoc *locator, int ndim, const hdsdim dims[], const float values[], int *status) { - if (ISHDSv5(locator)) return datPutR_v5(locator, ndim, dims, values, status); - return datPutR_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutR",*status); + if (isv5) { + retval = datPutR_v5(locator, ndim, dims, values, status); + } else { + retval = datPutR_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutR",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -1159,9 +1887,17 @@ datPutR(const HDSLoc *locator, int ndim, const hdsdim dims[], const float values int datPutL(const HDSLoc *locator, int ndim, const hdsdim dims[], const hdsbool_t values[], int *status) { - if (ISHDSv5(locator)) return datPutL_v5(locator, ndim, dims, values, status); - return datPutL_v4(locator, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutL",*status); + if (isv5) { + retval = datPutL_v5(locator, ndim, dims, values, status); + } else { + retval = datPutL_v4(locator, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPutL",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==========================*/ @@ -1171,9 +1907,17 @@ datPutL(const HDSLoc *locator, int ndim, const hdsdim dims[], const hdsbool_t va int datPut(const HDSLoc *locator, const char *type_str, int ndim, const hdsdim dims[], const void *values, int *status) { - if (ISHDSv5(locator)) return datPut_v5(locator, type_str, ndim, dims, values, status); - return datPut_v4(locator, type_str, ndim, dims, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut",*status); + if (isv5) { + retval = datPut_v5(locator, type_str, ndim, dims, values, status); + } else { + retval = datPut_v4(locator, type_str, ndim, dims, values, status); + } + HDS_CHECK_STATUS("datPut",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -1183,9 +1927,17 @@ datPut(const HDSLoc *locator, const char *type_str, int ndim, const hdsdim dims[ int datPut0C(const HDSLoc * locator, const char * value, int * status) { - if (ISHDSv5(locator)) return datPut0C_v5(locator, value, status); - return datPut0C_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0C",*status); + if (isv5) { + retval = datPut0C_v5(locator, value, status); + } else { + retval = datPut0C_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0C",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=======================================*/ @@ -1195,9 +1947,17 @@ datPut0C(const HDSLoc * locator, const char * value, int * status) { int datPut0D(const HDSLoc * locator, double value, int * status) { - if (ISHDSv5(locator)) return datPut0D_v5(locator, value, status); - return datPut0D_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0D",*status); + if (isv5) { + retval = datPut0D_v5(locator, value, status); + } else { + retval = datPut0D_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0D",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*======================================*/ @@ -1207,9 +1967,17 @@ datPut0D(const HDSLoc * locator, double value, int * status) { int datPut0R(const HDSLoc * locator, float value, int * status) { - if (ISHDSv5(locator)) return datPut0R_v5(locator, value, status); - return datPut0R_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0R",*status); + if (isv5) { + retval = datPut0R_v5(locator, value, status); + } else { + retval = datPut0R_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0R",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1219,9 +1987,17 @@ datPut0R(const HDSLoc * locator, float value, int * status) { int datPut0I(const HDSLoc * locator, int value, int * status) { - if (ISHDSv5(locator)) return datPut0I_v5(locator, value, status); - return datPut0I_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0I",*status); + if (isv5) { + retval = datPut0I_v5(locator, value, status); + } else { + retval = datPut0I_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0I",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1231,9 +2007,17 @@ datPut0I(const HDSLoc * locator, int value, int * status) { int datPut0K(const HDSLoc * locator, int64_t value, int * status) { - if (ISHDSv5(locator)) return datPut0K_v5(locator, value, status); - return datPut0K_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0K",*status); + if (isv5) { + retval = datPut0K_v5(locator, value, status); + } else { + retval = datPut0K_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0K",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==============================================*/ @@ -1243,9 +2027,17 @@ datPut0K(const HDSLoc * locator, int64_t value, int * status) { int datPut0W(const HDSLoc * locator, short value, int * status) { - if (ISHDSv5(locator)) return datPut0W_v5(locator, value, status); - return datPut0W_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0W",*status); + if (isv5) { + retval = datPut0W_v5(locator, value, status); + } else { + retval = datPut0W_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0W",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================================*/ @@ -1255,9 +2047,17 @@ datPut0W(const HDSLoc * locator, short value, int * status) { int datPut0UW(const HDSLoc * locator, unsigned short value, int * status) { - if (ISHDSv5(locator)) return datPut0UW_v5(locator, value, status); - return datPut0UW_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0UW",*status); + if (isv5) { + retval = datPut0UW_v5(locator, value, status); + } else { + retval = datPut0UW_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0UW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1267,9 +2067,17 @@ datPut0UW(const HDSLoc * locator, unsigned short value, int * status) { int datPut0L(const HDSLoc * locator, hdsbool_t value, int * status) { - if (ISHDSv5(locator)) return datPut0L_v5(locator, value, status); - return datPut0L_v4(locator, value, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut0L",*status); + if (isv5) { + retval = datPut0L_v5(locator, value, status); + } else { + retval = datPut0L_v4(locator, value, status); + } + HDS_CHECK_STATUS("datPut0L",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1279,9 +2087,17 @@ datPut0L(const HDSLoc * locator, hdsbool_t value, int * status) { int datPut1C(const HDSLoc * locator, size_t nval, const char *values[], int * status) { - if (ISHDSv5(locator)) return datPut1C_v5(locator, nval, values, status); - return datPut1C_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1C",*status); + if (isv5) { + retval = datPut1C_v5(locator, nval, values, status); + } else { + retval = datPut1C_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1C",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1291,9 +2107,17 @@ datPut1C(const HDSLoc * locator, size_t nval, const char *values[], int * status int datPut1D(const HDSLoc * locator, size_t nval, const double values[], int * status) { - if (ISHDSv5(locator)) return datPut1D_v5(locator, nval, values, status); - return datPut1D_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1D",*status); + if (isv5) { + retval = datPut1D_v5(locator, nval, values, status); + } else { + retval = datPut1D_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1D",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1303,9 +2127,17 @@ datPut1D(const HDSLoc * locator, size_t nval, const double values[], int * statu int datPut1I(const HDSLoc * locator, size_t nval, const int values[], int * status) { - if (ISHDSv5(locator)) return datPut1I_v5(locator, nval, values, status); - return datPut1I_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1I",*status); + if (isv5) { + retval = datPut1I_v5(locator, nval, values, status); + } else { + retval = datPut1I_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1I",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1315,9 +2147,17 @@ datPut1I(const HDSLoc * locator, size_t nval, const int values[], int * status) int datPut1K(const HDSLoc * locator, size_t nval, const int64_t values[], int * status) { - if (ISHDSv5(locator)) return datPut1K_v5(locator, nval, values, status); - return datPut1K_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1K",*status); + if (isv5) { + retval = datPut1K_v5(locator, nval, values, status); + } else { + retval = datPut1K_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1K",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===========================================*/ @@ -1327,9 +2167,17 @@ datPut1K(const HDSLoc * locator, size_t nval, const int64_t values[], int * stat int datPut1W(const HDSLoc * locator, size_t nval, const short values[], int * status) { - if (ISHDSv5(locator)) return datPut1W_v5(locator, nval, values, status); - return datPut1W_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1W",*status); + if (isv5) { + retval = datPut1W_v5(locator, nval, values, status); + } else { + retval = datPut1W_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1W",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===============================================*/ @@ -1339,9 +2187,17 @@ datPut1W(const HDSLoc * locator, size_t nval, const short values[], int * status int datPut1UW(const HDSLoc * locator, size_t nval, const unsigned short values[], int * status) { - if (ISHDSv5(locator)) return datPut1UW_v5(locator, nval, values, status); - return datPut1UW_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1UW",*status); + if (isv5) { + retval = datPut1UW_v5(locator, nval, values, status); + } else { + retval = datPut1UW_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1UW",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1351,9 +2207,17 @@ datPut1UW(const HDSLoc * locator, size_t nval, const unsigned short values[], in int datPut1R(const HDSLoc * locator, size_t nval, const float values[], int * status) { - if (ISHDSv5(locator)) return datPut1R_v5(locator, nval, values, status); - return datPut1R_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1R",*status); + if (isv5) { + retval = datPut1R_v5(locator, nval, values, status); + } else { + retval = datPut1R_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1R",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1363,9 +2227,17 @@ datPut1R(const HDSLoc * locator, size_t nval, const float values[], int * status int datPut1L(const HDSLoc * locator, size_t nval, const hdsbool_t values[], int * status) { - if (ISHDSv5(locator)) return datPut1L_v5(locator, nval, values, status); - return datPut1L_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPut1L",*status); + if (isv5) { + retval = datPut1L_v5(locator, nval, values, status); + } else { + retval = datPut1L_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPut1L",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1375,9 +2247,17 @@ datPut1L(const HDSLoc * locator, size_t nval, const hdsbool_t values[], int * st int datPutVD(const HDSLoc * locator, size_t nval, const double values[], int * status) { - if (ISHDSv5(locator)) return datPutVD_v5(locator, nval, values, status); - return datPutVD_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutVD",*status); + if (isv5) { + retval = datPutVD_v5(locator, nval, values, status); + } else { + retval = datPutVD_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPutVD",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1387,9 +2267,17 @@ datPutVD(const HDSLoc * locator, size_t nval, const double values[], int * statu int datPutVI(const HDSLoc * locator, size_t nval, const int values[], int * status) { - if (ISHDSv5(locator)) return datPutVI_v5(locator, nval, values, status); - return datPutVI_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutVI",*status); + if (isv5) { + retval = datPutVI_v5(locator, nval, values, status); + } else { + retval = datPutVI_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPutVI",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1399,9 +2287,17 @@ datPutVI(const HDSLoc * locator, size_t nval, const int values[], int * status) int datPutVK(const HDSLoc * locator, size_t nval, const int64_t values[], int * status) { - if (ISHDSv5(locator)) return datPutVK_v5(locator, nval, values, status); - return datPutVK_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutVK",*status); + if (isv5) { + retval = datPutVK_v5(locator, nval, values, status); + } else { + retval = datPutVK_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPutVK",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1411,9 +2307,17 @@ datPutVK(const HDSLoc * locator, size_t nval, const int64_t values[], int * stat int datPutVR(const HDSLoc * locator, size_t nval, const float values[], int * status) { - if (ISHDSv5(locator)) return datPutVR_v5(locator, nval, values, status); - return datPutVR_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutVR",*status); + if (isv5) { + retval = datPutVR_v5(locator, nval, values, status); + } else { + retval = datPutVR_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPutVR",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1423,9 +2327,17 @@ datPutVR(const HDSLoc * locator, size_t nval, const float values[], int * status int datPutVL(const HDSLoc * locator, size_t nval, const hdsbool_t values[], int * status) { - if (ISHDSv5(locator)) return datPutVL_v5(locator, nval, values, status); - return datPutVL_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutVL",*status); + if (isv5) { + retval = datPutVL_v5(locator, nval, values, status); + } else { + retval = datPutVL_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPutVL",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1435,9 +2347,17 @@ datPutVL(const HDSLoc * locator, size_t nval, const hdsbool_t values[], int * st int datPutVC(const HDSLoc * locator, size_t nval, const char *values[], int * status) { - if (ISHDSv5(locator)) return datPutVC_v5(locator, nval, values, status); - return datPutVC_v4(locator, nval, values, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datPutVC",*status); + if (isv5) { + retval = datPutVC_v5(locator, nval, values, status); + } else { + retval = datPutVC_v4(locator, nval, values, status); + } + HDS_CHECK_STATUS("datPutVC",(isv5 ? "(v5)" : "(v4)")); + return retval; } @@ -1448,9 +2368,17 @@ datPutVC(const HDSLoc * locator, size_t nval, const char *values[], int * status int datRef(const HDSLoc * locator, char * ref, size_t reflen, int *status) { - if (ISHDSv5(locator)) return datRef_v5(locator, ref, reflen, status); - return datRef_v4(locator, ref, reflen, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datRef",*status); + if (isv5) { + retval = datRef_v5(locator, ref, reflen, status); + } else { + retval = datRef_v4(locator, ref, reflen, status); + } + HDS_CHECK_STATUS("datRef",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================================*/ @@ -1460,9 +2388,17 @@ datRef(const HDSLoc * locator, char * ref, size_t reflen, int *status) { int datRefct(const HDSLoc *locator, int *refct, int *status) { - if (ISHDSv5(locator)) return datRefct_v5(locator, refct, status); - return datRefct_v4(locator, refct, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datRefct",*status); + if (isv5) { + retval = datRefct_v5(locator, refct, status); + } else { + retval = datRefct_v4(locator, refct, status); + } + HDS_CHECK_STATUS("datRefct",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=============================*/ @@ -1472,9 +2408,17 @@ datRefct(const HDSLoc *locator, int *refct, int *status) { int datRenam(const HDSLoc *locator, const char *name_str, int *status) { - if (ISHDSv5(locator)) return datRenam_v5(locator, name_str, status); - return datRenam_v4(locator, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datRenam",*status); + if (isv5) { + retval = datRenam_v5(locator, name_str, status); + } else { + retval = datRenam_v4(locator, name_str, status); + } + HDS_CHECK_STATUS("datRenam",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================*/ @@ -1484,9 +2428,17 @@ datRenam(const HDSLoc *locator, const char *name_str, int *status) { int datReset(const HDSLoc *locator, int *status) { - if (ISHDSv5(locator)) return datReset_v5(locator, status); - return datReset_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datReset",*status); + if (isv5) { + retval = datReset_v5(locator, status); + } else { + retval = datReset_v4(locator, status); + } + HDS_CHECK_STATUS("datReset",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================*/ @@ -1496,9 +2448,17 @@ datReset(const HDSLoc *locator, int *status) { int datRetyp(const HDSLoc *locator, const char *type_str, int *status) { - if (ISHDSv5(locator)) return datRetyp_v5(locator, type_str, status); - return datRetyp_v4(locator, type_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datRetyp",*status); + if (isv5) { + retval = datRetyp_v5(locator, type_str, status); + } else { + retval = datRetyp_v4(locator, type_str, status); + } + HDS_CHECK_STATUS("datRetyp",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=================================*/ @@ -1508,9 +2468,17 @@ datRetyp(const HDSLoc *locator, const char *type_str, int *status) { int datShape(const HDSLoc *locator, int maxdim, hdsdim dims[], int *actdim, int *status) { - if (ISHDSv5(locator)) return datShape_v5(locator, maxdim, dims, actdim, status); - return datShape_v4(locator, maxdim, dims, actdim, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datShape",*status); + if (isv5) { + retval = datShape_v5(locator, maxdim, dims, actdim, status); + } else { + retval = datShape_v4(locator, maxdim, dims, actdim, status); + } + HDS_CHECK_STATUS("datShape",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===============================*/ @@ -1520,9 +2488,17 @@ datShape(const HDSLoc *locator, int maxdim, hdsdim dims[], int *actdim, int *sta int datSize(const HDSLoc *locator, size_t *size, int *status) { - if (ISHDSv5(locator)) return datSize_v5(locator, size, status); - return datSize_v4(locator, size, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datSize",*status); + if (isv5) { + retval = datSize_v5(locator, size, status); + } else { + retval = datSize_v4(locator, size, status); + } + HDS_CHECK_STATUS("datSize",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================*/ @@ -1532,9 +2508,17 @@ datSize(const HDSLoc *locator, size_t *size, int *status) { int datSlice(const HDSLoc *locator1, int ndim, const hdsdim lower[], const hdsdim upper[], HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datSlice_v5(locator1, ndim, lower, upper, locator2, status); - return datSlice_v4(locator1, ndim, lower, upper, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datSlice",*status); + if (isv5) { + retval = datSlice_v5(locator1, ndim, lower, upper, locator2, status); + } else { + retval = datSlice_v4(locator1, ndim, lower, upper, locator2, status); + } + HDS_CHECK_STATUS("datSlice",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=================================*/ @@ -1544,9 +2528,17 @@ datSlice(const HDSLoc *locator1, int ndim, const hdsdim lower[], const hdsdim up int datState(const HDSLoc *locator, hdsbool_t *state, int *status) { - if (ISHDSv5(locator)) return datState_v5(locator, state, status); - return datState_v4(locator, state, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datState",*status); + if (isv5) { + retval = datState_v5(locator, state, status); + } else { + retval = datState_v4(locator, state, status); + } + HDS_CHECK_STATUS("datState",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================*/ @@ -1556,9 +2548,17 @@ datState(const HDSLoc *locator, hdsbool_t *state, int *status) { int datStruc(const HDSLoc *locator, hdsbool_t *struc, int *status) { - if (ISHDSv5(locator)) return datStruc_v5(locator, struc, status); - return datStruc_v4(locator, struc, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datStruc",*status); + if (isv5) { + retval = datStruc_v5(locator, struc, status); + } else { + retval = datStruc_v4(locator, struc, status); + } + HDS_CHECK_STATUS("datStruc",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================*/ @@ -1567,7 +2567,13 @@ datStruc(const HDSLoc *locator, hdsbool_t *struc, int *status) { int datTemp(const char *type_str, int ndim, const hdsdim dims[], HDSLoc **locator, int *status) { - return datTemp_v5(type_str, ndim, dims, locator, status); + int retval = 0; + int instat = *status; + EnterCheck("datTemp",*status); + if (*status != SAI__OK) return *status; + retval = datTemp_v5(type_str, ndim, dims, locator, status); + HDS_CHECK_STATUS("datTemp","(v5)"); + return retval; } /*=========================================*/ @@ -1577,9 +2583,17 @@ datTemp(const char *type_str, int ndim, const hdsdim dims[], HDSLoc **locator, i int datThere(const HDSLoc *locator, const char *name_c, hdsbool_t *there, int *status) { - if (ISHDSv5(locator)) return datThere_v5(locator, name_c, there, status); - return datThere_v4(locator, name_c, there, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datThere",*status); + if (isv5) { + retval = datThere_v5(locator, name_c, there, status); + } else { + retval = datThere_v4(locator, name_c, there, status); + } + HDS_CHECK_STATUS("datThere",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===============================*/ @@ -1589,9 +2603,17 @@ datThere(const HDSLoc *locator, const char *name_c, hdsbool_t *there, int *statu int datType(const HDSLoc *locator, char type_str[DAT__SZTYP + 1], int *status) { - if (ISHDSv5(locator)) return datType_v5(locator, type_str, status); - return datType_v4(locator, type_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datType",*status); + if (isv5) { + retval = datType_v5(locator, type_str, status); + } else { + retval = datType_v4(locator, type_str, status); + } + HDS_CHECK_STATUS("datType",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=========================*/ @@ -1601,9 +2623,17 @@ datType(const HDSLoc *locator, char type_str[DAT__SZTYP + 1], int *status) { int datUnmap(const HDSLoc *locator, int *status) { - if (ISHDSv5(locator)) return datUnmap_v5(locator, status); - return datUnmap_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datUnmap",*status); + if (isv5) { + retval = datUnmap_v5(locator, status); + } else { + retval = datUnmap_v4(locator, status); + } + HDS_CHECK_STATUS("datUnmap",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -1613,9 +2643,17 @@ datUnmap(const HDSLoc *locator, int *status) { int datValid(const HDSLoc *locator, hdsbool_t *valid, int *status) { - if (ISHDSv5(locator)) return datValid_v5(locator, valid, status); - return datValid_v4(locator, valid, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datValid",*status); + if (isv5) { + retval = datValid_v5(locator, valid, status); + } else { + retval = datValid_v4(locator, valid, status); + } + HDS_CHECK_STATUS("datValid",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===========================*/ @@ -1625,9 +2663,17 @@ datValid(const HDSLoc *locator, hdsbool_t *valid, int *status) { int datVec(const HDSLoc *locator1, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return datVec_v5(locator1, locator2, status); - return datVec_v4(locator1, locator2, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("datVec",*status); + if (isv5) { + retval = datVec_v5(locator1, locator2, status); + } else { + retval = datVec_v4(locator1, locator2, status); + } + HDS_CHECK_STATUS("datVec",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================================*/ @@ -1643,9 +2689,17 @@ datVec(const HDSLoc *locator1, HDSLoc **locator2, int *status) { int hdsCopy(const HDSLoc *locator, const char *file_str, const char name_str[DAT__SZNAM], int *status) { - if (ISHDSv5(locator)) return hdsCopy_v5(locator, file_str, name_str, status); - return hdsCopy_v4(locator, file_str, name_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsCopy",*status); + if (isv5) { + retval = hdsCopy_v5(locator, file_str, name_str, status); + } else { + retval = hdsCopy_v4(locator, file_str, name_str, status); + } + HDS_CHECK_STATUS("hdsCopy",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=================================*/ @@ -1655,9 +2709,17 @@ hdsCopy(const HDSLoc *locator, const char *file_str, const char name_str[DAT__SZ int hdsErase(HDSLoc **locator, int *status) { - if (ISHDSv5(*locator)) return hdsErase_v5(locator, status); - return hdsErase_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(*locator); + EnterCheck("hdsErase",*status); + if (isv5) { + retval = hdsErase_v5(locator, status); + } else { + retval = hdsErase_v4(locator, status); + } + HDS_CHECK_STATUS("hdsErase",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===============================================================*/ @@ -1679,6 +2741,8 @@ hdsEwild(int *iwld, int *status) { int hdsFlush(const char *group_str, int *status) { /* We are only allowed to flush a group that actually exists */ + int instat = *status; + EnterCheck("hdsFlush",*status); if (*status != SAI__OK) return *status; /* We need a new API that will let us query whether a group @@ -1689,7 +2753,6 @@ hdsFlush(const char *group_str, int *status) { hdsFlush_v5(group_str, status); if (*status == DAT__GRPIN) emsAnnul(status); hdsFlush_v4(group_str, status); - return *status; } @@ -1700,9 +2763,17 @@ hdsFlush(const char *group_str, int *status) { int hdsFree(const HDSLoc *locator, int *status) { - if (ISHDSv5(locator)) return hdsFree_v5(locator, status); - return hdsFree_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsFree",*status); + if (isv5) { + retval = hdsFree_v5(locator, status); + } else { + retval = hdsFree_v4(locator, status); + } + HDS_CHECK_STATUS("hdsFree",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*==================================*/ @@ -1712,9 +2783,17 @@ hdsFree(const HDSLoc *locator, int *status) { int hdsGroup(const HDSLoc *locator, char group_str[DAT__SZGRP+1], int *status) { - if (ISHDSv5(locator)) return hdsGroup_v5(locator, group_str, status); - return hdsGroup_v4(locator, group_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsGroup",*status); + if (isv5) { + retval = hdsGroup_v5(locator, group_str, status); + } else { + retval = hdsGroup_v4(locator, group_str, status); + } + HDS_CHECK_STATUS("hdsGroup",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=========================================*/ @@ -1723,6 +2802,8 @@ hdsGroup(const HDSLoc *locator, char group_str[DAT__SZGRP+1], int *status) { int hdsGtune(const char *param_str, int *value, int *status) { + int instat = *status; + EnterCheck("hdsGtune",*status); if (*status != SAI__OK) return *status; hdsGtune_v4(param_str, value, status); hdsGtune_v5(param_str, value, status); @@ -1740,9 +2821,17 @@ hdsGtune(const char *param_str, int *value, int *status) { int hdsInfoI(const HDSLoc* locator, const char *topic_str, const char *extra, int *result, int *status) { - if (ISHDSv5(locator)) return hdsInfoI_v5(locator, topic_str, extra, result, status); - return hdsInfoI_v4(locator, topic_str, extra, result, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsInfoI",*status); + if (isv5) { + retval = hdsInfoI_v5(locator, topic_str, extra, result, status); + } else { + retval = hdsInfoI_v4(locator, topic_str, extra, result, status); + } + HDS_CHECK_STATUS("hdsInfoI",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=================================*/ @@ -1752,9 +2841,17 @@ hdsInfoI(const HDSLoc* locator, const char *topic_str, const char *extra, int *r int hdsLink(const HDSLoc *locator, const char *group_str, int *status) { - if (ISHDSv5(locator)) return hdsLink_v5(locator, group_str, status); - return hdsLink_v4(locator, group_str, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsLink",*status); + if (isv5) { + retval = hdsLink_v5(locator, group_str, status); + } else { + retval = hdsLink_v4(locator, group_str, status); + } + HDS_CHECK_STATUS("hdsLink",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*================================*/ @@ -1764,9 +2861,17 @@ hdsLink(const HDSLoc *locator, const char *group_str, int *status) { int hdsLock(const HDSLoc *locator, int *status) { - if (ISHDSv5(locator)) return hdsLock_v5(locator, status); - return hdsLock_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsLock",*status); + if (isv5) { + retval = hdsLock_v5(locator, status); + } else { + retval = hdsLock_v4(locator, status); + } + HDS_CHECK_STATUS("hdsLock",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*====================================*/ @@ -1775,7 +2880,13 @@ hdsLock(const HDSLoc *locator, int *status) { int hdsNew(const char *file_str, const char *name_str, const char *type_str, int ndim, const hdsdim dims[], HDSLoc **locator, int *status) { - return hdsNew_v5(file_str, name_str, type_str, ndim, dims, locator, status); + int retval = 0; + int instat = *status; + EnterCheck("hdsNew",*status); + if (*status != SAI__OK) return *status; + retval = hdsNew_v5(file_str, name_str, type_str, ndim, dims, locator, status); + HDS_CHECK_STATUS("hdsNew","(v5)"); + return retval; } /*========================================*/ @@ -1784,12 +2895,15 @@ hdsNew(const char *file_str, const char *name_str, const char *type_str, int ndi int hdsOpen(const char *file_str, const char *mode_str, HDSLoc **locator, int *status) { + int instat = *status; + EnterCheck("hdsOpen",*status); if (*status != SAI__OK) return *status; hdsOpen_v5(file_str, mode_str, locator, status); if (*status != SAI__OK) { emsAnnul(status); hdsOpen_v4(file_str, mode_str, locator, status); } + HDS_CHECK_STATUS( "hdsOpen", "(v5)" ); return *status; } @@ -1811,8 +2925,14 @@ hdsShow(const char *topic_str, int *status) { int hdsState(hdsbool_t *state, int *status) { - hdsState_v4(state, status); - return hdsState_v5(state, status); + int retval = 0; + int instat = *status; + EnterCheck("hdsState",*status); + if (*status != SAI__OK) return *status; + retval = hdsState_v5(state, status); + retval = hdsState_v4(state, status); + HDS_CHECK_STATUS("hdsState", "(both)"); + return retval; } /*============================*/ @@ -1821,8 +2941,14 @@ hdsState(hdsbool_t *state, int *status) { int hdsStop(int *status) { - hdsStop_v4(status); - return hdsStop_v5(status); + int retval = 0; + int instat = *status; + EnterCheck("hdsStop",*status); + if (*status != SAI__OK) return *status; + retval = hdsStop_v5(status); + retval = hdsStop_v4(status); + HDS_CHECK_STATUS("hdsStop", "(both)"); + return retval; } /*==============================*/ @@ -1832,9 +2958,17 @@ hdsStop(int *status) { int hdsTrace(const HDSLoc *locator, int *nlev, char *path_str, char *file_str, int *status, size_t path_length, size_t file_length) { - if (ISHDSv5(locator)) return hdsTrace_v5(locator, nlev, path_str, file_str, status, path_length, file_length); - return hdsTrace_v4(locator, nlev, path_str, file_str, status, path_length, file_length); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("hdsTrace",*status); + if (isv5) { + retval = hdsTrace_v5(locator, nlev, path_str, file_str, status, path_length, file_length); + } else { + retval = hdsTrace_v4(locator, nlev, path_str, file_str, status, path_length, file_length); + } + HDS_CHECK_STATUS("hdsTrace",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*========================================*/ @@ -1843,8 +2977,14 @@ hdsTrace(const HDSLoc *locator, int *nlev, char *path_str, char *file_str, int * int hdsTune(const char *param_str, int value, int *status) { - hdsTune_v4(param_str, value, status); - return hdsTune_v5(param_str, value, status); + int retval = 0; + int instat = *status; + EnterCheck("hdsTune",*status); + if (*status != SAI__OK) return *status; + retval = hdsTune_v5(param_str, value, status); + retval = hdsTune_v4(param_str, value, status); + HDS_CHECK_STATUS("hdsTune", "(both)"); + return retval; } /*=================================================================*/ @@ -1870,9 +3010,17 @@ hdsWild(const char *fspec, const char *mode, int *iwld, HDSLoc **locator, int *s int datConv(const HDSLoc *locator, const char *type_str, hdsbool_t *conv, int *status) { - if (ISHDSv5(locator)) return datConv_v5(locator, type_str, conv, status); - return datConv_v4(locator, type_str, conv, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator); + EnterCheck("datConv",*status); + if (isv5) { + retval = datConv_v5(locator, type_str, conv, status); + } else { + retval = datConv_v4(locator, type_str, conv, status); + } + HDS_CHECK_STATUS("datConv",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*=====================================================*/ @@ -1882,21 +3030,38 @@ datConv(const HDSLoc *locator, const char *type_str, hdsbool_t *conv, int *statu int hdsClose(HDSLoc **locator, int *status) { - if (ISHDSv5(*locator)) return hdsClose_v5(locator, status); - return hdsClose_v4(locator, status); - + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(*locator); + EnterCheck("hdsClose",*status); + if (isv5) { + retval = hdsClose_v5(locator, status); + } else { + retval = hdsClose_v4(locator, status); + } + HDS_CHECK_STATUS("hdsClose",(isv5 ? "(v5)" : "(v4)")); + return retval; } /*===================================================================*/ /* hdsFind - Find an object (Fortran routine, requires hdsf library) */ /*===================================================================*/ -void -hdsFind(const HDSLoc *locator1, const char *name, const char *mode, HDSLoc **locator2, int *status) { - if (ISHDSv5(locator1)) return hdsFind_v5(locator1, name, mode, locator2, status); - return hdsFind_v4(locator1, name, mode, locator2, status); +int +hdsFind(const HDSLoc *locator1, const char *name, const char *mode, HDSLoc **locator2, int *status) { + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5(locator1); + EnterCheck("hdsFind",*status); + if (isv5) { + retval = hdsFind_v5(locator1, name, mode, locator2, status); + } else { + retval = hdsFind_v4(locator1, name, mode, locator2, status); + } + HDS_CHECK_STATUS("hdsFind",(isv5 ? "(v5)" : "(v4)")); + return retval; } diff --git a/libraries/hds/helper/mkhdswrapper.py b/libraries/hds/helper/mkhdswrapper.py index e7ec812a883..fcef7fc1a6b 100644 --- a/libraries/hds/helper/mkhdswrapper.py +++ b/libraries/hds/helper/mkhdswrapper.py @@ -66,7 +66,7 @@ def version_names(line): return (v4,v5) # Code for the different type of functions -def func_simple(line): +def func_simple(func,line): (v4,v5) = version_names(line) # are we dealing with locator or locator1? locvar = "locator" @@ -75,26 +75,66 @@ def func_simple(line): elif line.startswith("datAnnul") or line.startswith("datPrmry") or line.startswith("hdsErase") or line.startswith("hdsClose"): locvar = "*locator" print(""" - if (ISHDSv5({0})) return {1} - return {2} -""".format(locvar, v5, v4)) + int retval = 0; + int instat = *status; + int isv5 = ISHDSv5({0}); + EnterCheck(\"{3}\",*status); + if (isv5) {{ + retval = {1} + }} else {{ + retval = {2} + }} + HDS_CHECK_STATUS(\"{3}\",(isv5 ? "(v5)" : "(v4)")); + return retval;""".format(locvar, v5, v4, func)) -def func_special(line): +def func_special(func,line): print(" /* Requires special code */") print(' printf("Aborting. Special code required in: %s\\n", "{0}");'.format(line)) print(" abort();") if line.find("status") > -1: print(" return *status;") -def func_both(line): +def func_both(func,line): + (v4,v5) = version_names(line) + print(""" int retval = 0; + int instat = *status; + EnterCheck(\"{2}\",*status); + if (*status != SAI__OK) return *status; + retval = {0} + retval = {1} + HDS_CHECK_STATUS(\"{2}\", "(both)"); + return retval;""".format(v5,v4,func)) + +def func_void(func, line): (v4,v5) = version_names(line) + print(""" EnterCheck(\"{3}\",-1); + if (ISHDSv5({0})) {{ + {1} + }} else {{ + {2} + }} + return;""".format("locator", v5, v4,func)) + +def func_v5void(func,line): + (v4,v5) = version_names(line) + print(' EnterCheck("'+func+'",-1);') print(" "+v5) - print(" return "+v4) + print(" return;") -def func_v5(line): - v5 = line.replace("(", "_v5(") - print(" return "+v5) +def func_v5(func,line): + (v4,v5) = version_names(line) + if line.find("status)") > -1: + print(""" int retval = 0; + int instat = *status; + EnterCheck(\"{1}\",*status); + if (*status != SAI__OK) return *status; + retval = {0} + HDS_CHECK_STATUS(\"{1}\","(v5)"); + return retval;""".format(v5,func)) + else: + print(' EnterCheck("'+func+'",-1);') + print(" return " +v5) def func_move(func,line): (v4,v5) = version_names(line) @@ -102,33 +142,79 @@ def func_move(func,line): if line.startswith("datMove"): loc1 = "*locator1" print(""" /* Requires special code */ + int instat = *status; + int isv5 = 0; + EnterCheck(\"{3}\",*status); + if (*status != SAI__OK) return *status; if (ISHDSv5({0}) && ISHDSv5(locator2)) {{ /* Just call the v5 code */ + isv5 = 1; {1} }} else if ( !ISHDSv5({0}) && !ISHDSv5(locator2) ) {{ + isv5 = 0; {2} }} else {{ printf(\"Aborting. {3}: Special code required for copy across different versions of files.\\n\"); abort(); }} + HDS_CHECK_STATUS(\"{3}\",(isv5 ? "(v5)" : "(v4)")); return *status;""".format(loc1,v5,v4,func)) +def func_hdsOpen(line): + print(""" int instat = *status; + EnterCheck(\"hdsOpen\",*status); + if (*status != SAI__OK) return *status; + hdsOpen_v5(file_str, mode_str, locator, status); + if (*status != SAI__OK) { + emsAnnul(status); + hdsOpen_v4(file_str, mode_str, locator, status); + } + HDS_CHECK_STATUS( "hdsOpen", "(v5)" ); + return *status;""") + +def func_hdsGtune(line): + print(""" int instat = *status; + EnterCheck(\"hdsGtune\",*status); + if (*status != SAI__OK) return *status; + hdsGtune_v4(param_str, value, status); + hdsGtune_v5(param_str, value, status); + if (*status != SAI__OK) { + emsRepf("hdsGtune_wrap", "hdsGtune: Error obtaining value of tuning parameter '%s'", + status, param_str); + } + return *status;""") + +def func_hdsFlush(line): + print(""" /* We are only allowed to flush a group that actually exists */ + int instat = *status; + EnterCheck(\"hdsFlush\",*status); + if (*status != SAI__OK) return *status; + /* We need a new API that will let us query whether a group + exists before we try to flush it. _v5 triggers an error + if the group doesn't exist but v4 does not trigger such an error. + For now we catch the specific error from v5 and assume that means + v4 will deal with it. */ + hdsFlush_v5(group_str, status); + if (*status == DAT__GRPIN) emsAnnul(status); + hdsFlush_v4(group_str, status); + return *status;""") # Dictionary indicating special cases special = dict({ "datCcopy": "move", - "datCctyp": "v5", + "datCctyp": "v5+void", "datChscn": "v5", "datCopy": "move", "datErmsg": "v5", "datMove": "move", + "datMsg": "void", "datTemp": "v5", "hdsEwild": "special", - "hdsFlush": "both", - "hdsGtune": "both", + "hdsFlush": "hdsFlush", + "hdsGtune": "hdsGtune", "hdsNew": "v5", - "hdsOpen": "both", + "hdsOpen": "hdsOpen", "hdsShow": "special", "hdsState": "both", "hdsStop": "both", @@ -163,26 +249,46 @@ def func_move(func,line): if hds_function in special: mode = special[hds_function] if mode == "both": - func_both(line) + func_both(hds_function,line) elif mode == "special": - func_special(line) + func_special(hds_function,line) + elif mode == "void": + func_void(hds_function,line) + elif mode == "v5+void": + func_v5void(hds_function,line) elif mode == "v5": - func_v5(line) + func_v5(hds_function,line) + elif mode == "hdsOpen": + func_hdsOpen(line) + elif mode == "hdsGtune": + func_hdsGtune(line) + elif mode == "hdsFlush": + func_hdsFlush(line) elif mode == "move": func_move(hds_function,line) else: - raise ValueError("Unrecognized mode for function {0}".format(hds_function)) + raise ValueError("Unrecognized mode {0} for function {1}".format(mode,hds_function)) else: - func_simple(line) + func_simple(hds_function,line) print("}") else: if not inserted_includes and line.startswith("/*=="): print('#include ') # For abort() print('#include ') # For printf() + print('#include "sae_par.h"') + print('#include "ems.h"') print('#include "hds.h"') + print('#include "dat_err.h"') print('#include "star/hds_v4.h"') print('#include "star/hds_v5.h"') print('#define ISHDSv5(loc) ((loc) && (loc)->hds_version >= 5)') + print('#if DEBUG_HDS') + print('#define HDS_CHECK_STATUS(func,txt) if (*status != instat && *status != SAI__OK) { emsRepf("wrap_" func, func ": Error in call to HDS %s", status, txt); printf("Bad status from %s: %d\\n", func, *status);}') + print('static void EnterCheck( const char * func, int status ) { printf("Enter HDS routine: %s [%d]\\n", func,status); }') + print("#else") + print('# define HDS_CHECK_STATUS(func,txt) if (*status != instat && *status != SAI__OK) { emsRepf("wrap_" func, func ": Error in call to HDS %s", status, txt);}') + print("# define EnterCheck(A,B) ;") + print('#endif') print("") inserted_includes=1 elif line.find("dat_par.h") != -1: