#ifndef AASPI_INTERFACE_H #define AASPI_INTERFACE_H #ifdef _MSC_VER #include #endif #include "aaspi_types.h" #ifdef WIN32 #define f2cFortran #endif #include "cfortran.h" // Define new cfortran types for 64 bit integer #define INT64_cfT(M,I,A,B,D) *A #define INT64_cfV( T,A,B,F) SIMPLE_cfV(T,A,B,F) #define INT64_cfSEP(T, B) SIMPLE_cfSEP(T,B) #define INT64_cfINT(N,A,B,X,Y,Z) SIMPLE_cfINT(N,A,B,X,Y,Z) #define INT64_cfSTR(N,T,A,B,C,D,E) SIMPLE_cfSTR(N,T,A,B,C,D,E) #define INT64_cfCC( T,A,B) SIMPLE_cfCC(T,A,B) #define INT64_cfAA( T,A,B) INT64_cfB(T,A) #define INT64_cfU( T,A) INT64_cfN(T,A) #define INT64_cfN( T,A) aaspi_int64 * A #define INT64_cfB( T,A) A // Define new cfortran types for pointer to 64 bit integer #define PINT64_cfT(M,I,A,B,D) A #define PINT64_cfV( T,A,B,F) SIMPLE_cfV(T,A,B,F) #define PINT64_cfSEP(T, B) SIMPLE_cfSEP(T,B) #define PINT64_cfINT(N,A,B,X,Y,Z) SIMPLE_cfINT(N,A,B,X,Y,Z) #define PINT64_cfSTR(N,T,A,B,C,D,E) SIMPLE_cfSTR(N,T,A,B,C,D,E) #define PINT64_cfCC( T,A,B) SIMPLE_cfCC(T,A,B) #define PINT64_cfAA( T,A,B) PINT64_cfB(T,A) #define PINT64_cfU( T,A) PINT64_cfN(T,A) #define PINT64_cfN( T,A) aaspi_int64 * A #define PINT64_cfB( T,A) &A // Add int64 function return type #define INT64_cfPU(A) CFextern aaspi_int64 FCALLSC_QUALIFIER A #define INT64_cfE aaspi_int64 A0; #define INT64_cfFZ(UN,LN) aaspi_int64 FCALLSC_QUALIFIER fcallsc(UN,LN)( #define INT64_cfF(UN,LN) INT64_cfFZ(UN,LN) #define INT64_cfL A0= #define INT64_cfK #define INT64_cfI return A0; #define INT64_cfUU(T,A) _(T,_cfTYPE) A #define INT64_cfTYPE aaspi_int64 class AASPI_Framework; extern AASPI_Framework global_afw; extern "C" { void aaspi_init(); void aaspi_close_all_files(); void aaspi_args(int argc, char **argv); void aaspi_set_arg_count(int len); void aaspi_set_arg(int pos, char*arg); void aaspi_get_host_name(char *hst, int maxlen); void aaspi_get_user_name(char *usr, int maxlen); void aaspi_get_time(char *tm, int maxlen); void aaspi_get_home_dir(char *hd, int maxlen); void aaspi_get_prog_name(char *hd, int maxlen); // Read command line parameters void aaspi_get_param_string(const char *tag, char *par, const char *defval, int maxlen); void aaspi_get_param_int(const char *tag, int *par, int defval); void aaspi_get_param_int64(const char *tag, aaspi_int64 *par, aaspi_int64 defval); void aaspi_get_param_float(const char *tag, float *par, float defval); void aaspi_get_param_double(const char *tag, double *par, double defval); void aaspi_get_param_boolean(const char *tag, int *par, int defval); bool aaspi_has_param(const char *tag); // Read history file parameters int aaspi_get_esize(const char *file_tag, int *stat); int aaspi_get_data_format(const char *file_tag, int *stat); void aaspi_get_hist_string(const char *file_tag, const char *tag, char *par, const char *defval, int maxlen, int *stat); void aaspi_get_hist_int(const char *file_tag, const char *tag, int *par, int defval, int *stat); void aaspi_get_hist_int64(const char *file_tag, const char *tag, aaspi_int64 *par, aaspi_int64 defval, int *stat); void aaspi_get_hist_float(const char *file_tag, const char *tag, float *par, float defval, int *stat); void aaspi_get_hist_double(const char *file_tag, const char *tag, double *par, double defval, int *stat); void aaspi_get_hist_boolean(const char *file_tag, const char *tag, int *par, int defval, int *stat); bool aaspi_hist_has_param(const char *file_tag, const char *tag, int *stat); // Put history file parameters void aaspi_put_hist_string(const char *file_tag, const char *tag, const char *par, int *stat); void aaspi_put_hist_int(const char *file_tag, const char *tag, int par, int *stat); void aaspi_put_hist_int64(const char *file_tag, const char *tag, aaspi_int64 par, int *stat); void aaspi_put_hist_float(const char *file_tag, const char *tag, float par, int *stat); void aaspi_put_hist_double(const char *file_tag, const char *tag, double par, int *stat); void aaspi_put_hist_boolean(const char *file_tag, const char *tag, int par, int *stat); // History file manipulation int aaspi_get_num_axes(const char *file_tag, int *stat); void aaspi_get_axis_par(const char *file_tag, int iax, int *n, float *o, float *d, char *label, int maxlen, int *stat); void aaspi_put_axis_par(const char *file_tag, int iax, int n, float o, float d, const char *label, int *stat); void aaspi_copy_data_pointer(const char *file_tag_src, const char *file_tag_dst, int *stat); void aaspi_copy_history(const char *file_tag_src, const char *file_tag_dst, int *stat); void aaspi_copy_history_force_aaspi_binary(const char *file_tag_src, const char *file_tag_dst, int *stat); // Data IO void aaspi_read_raw(const char *file_tag, void *dst, int n, int *stat); void aaspi_write_raw(const char *file_tag, void *src, int n, int *stat); void aaspi_write_raw_force_aaspi_binary(const char *file_tag, void *src, int n, int *stat); // forcing write to aaspi binary void aaspi_seek(const char *file_tag, aaspi_int64 pos, int whence, int *stat); aaspi_int64 aaspi_tell(const char *file_tag, int *stat); // Header file manipulation -- get int aaspi_get_number_keys(const char *file_tag, int *stat); void aaspi_get_header_axis(const char *file_tag, int iax, int *n, float *o, float *d, char *label, int maxlen, int *stat); void aaspi_get_key_name(const char *file_tag, int keyidx, char *keyname, int maxlen, int *stat); void aaspi_get_key_index(const char *file_tag, const char *keyname, int *keyidx, int *stat); void aaspi_get_key_format(const char *file_tag, int keyidx, int *keyfmt, int *stat); void aaspi_get_key_format_string(const char *file_tag, int keyidx, char *keyfmt, int maxlen, int *stat); void aaspi_get_key_type(const char *file_tag, int keyidx, char *keytyp, int maxlen, int *stat); void aaspi_get_val_by_index(const char *file_tag, int recno, int keyidx, int nval, int *vals, int *stat); void aaspi_get_val_by_name(const char *file_tag, int recno, const char *keyname, int nval, int *vals, int *stat); void aaspi_get_val_headers(const char *file_tag, int recno, int nhdr, int *vals, int *stat); // Header file manipulation -- put void aaspi_copy_hff(const char *file_tag_src, const char *file_tag_dst, int *stat); void aaspi_copy_hff_force_aaspi_binary(const char *file_tag_src, const char *file_tag_dst, int *stat); // forcing write to aaspi binary void aaspi_put_number_keys(const char *file_tag, int nkeys, int *stat); void aaspi_put_header_axis(const char *file_tag, int iax, int n, float o, float d, const char *label, int *stat); void aaspi_put_key(const char *file_tag, const char *keyname, const char *keytyp, const char *keyfmt, int keyidx, int *stat); void aaspi_put_val_by_index(const char *file_tag, int recno, int keyidx, int nval, int *vals, int *stat); void aaspi_put_val_headers(const char *file_tag, int recno, int nhdr, int *vals, int *stat); } // end extern C // Framework routines FCALLSCSUB0(aaspi_init,AASPI_INIT,aaspi_init) FCALLSCSUB1(aaspi_set_arg_count,AASPI_SET_ARG_COUNT,aaspi_set_arg_count,INT) FCALLSCSUB2(aaspi_set_arg,AASPI_SET_ARG,aaspi_set_arg,INT,STRING) FCALLSCSUB0(aaspi_close_all_files,AASPI_CLOSE_ALL_FILES,aaspi_close_all_files) FCALLSCSUB2(aaspi_get_host_name,AASPI_GET_HOST_NAME,aaspi_get_host_name,PSTRING,INT) FCALLSCSUB2(aaspi_get_user_name,AASPI_GET_USER_NAME,aaspi_get_user_name,PSTRING,INT) FCALLSCSUB2(aaspi_get_time,AASPI_GET_TIME,aaspi_get_time,PSTRING,INT) FCALLSCSUB2(aaspi_get_home_dir,AASPI_HOME_DIR,aaspi_get_home_dir,PSTRING,INT) FCALLSCSUB2(aaspi_get_prog_name,AASPI_PROG_NAME,aaspi_get_prog_name,PSTRING,INT) // Command line parameter routines FCALLSCSUB4(aaspi_get_param_string,AASPI_GET_PARAM_STRING,aaspi_get_param_string,STRING,PSTRING,STRING,INT) FCALLSCSUB3(aaspi_get_param_int,AASPI_GET_PARAM_INT,aaspi_get_param_int,STRING,PINT,INT) FCALLSCSUB3(aaspi_get_param_int64,AASPI_GET_PARAM_INT64,aaspi_get_param_int64,STRING,PINT64,INT64) FCALLSCSUB3(aaspi_get_param_float,AASPI_GET_PARAM_FLOAT,aaspi_get_param_float,STRING,PFLOAT,FLOAT) FCALLSCSUB3(aaspi_get_param_double,AASPI_GET_PARAM_DOUBLE,aaspi_get_param_double,STRING,PDOUBLE,DOUBLE) FCALLSCSUB3(aaspi_get_param_boolean,AASPI_GET_PARAM_BOOLEAN,aaspi_get_param_boolean,STRING,PLOGICAL,LOGICAL) FCALLSCFUN1(LOGICAL,aaspi_has_param,AASPI_HAS_PARAM,aaspi_has_param,STRING) // History get parameter routines FCALLSCFUN2(INT,aaspi_get_esize,AASPI_GET_ESIZE,aaspi_get_esize,STRING,PINT) FCALLSCFUN2(INT,aaspi_get_data_format,AASPI_GET_DATA_FORMAT,aaspi_get_data_format,STRING,PINT) FCALLSCSUB6(aaspi_get_hist_string,AASPI_GET_HIST_STRING,aaspi_get_hist_string,STRING,STRING,PSTRING,STRING,INT,PINT) FCALLSCSUB5(aaspi_get_hist_int,AASPI_GET_HIST_INT,aaspi_get_hist_int,STRING,STRING,PINT,INT,PINT) FCALLSCSUB5(aaspi_get_hist_int64,AASPI_GET_HIST_INT64,aaspi_get_hist_int64,STRING,STRING,PINT64,INT64,PINT) FCALLSCSUB5(aaspi_get_hist_float,AASPI_GET_HIST_FLOAT,aaspi_get_hist_float,STRING,STRING,PFLOAT,FLOAT,PINT) FCALLSCSUB5(aaspi_get_hist_double,AASPI_GET_HIST_DOUBLE,aaspi_get_hist_double,STRING,STRING,PDOUBLE,DOUBLE,PINT) FCALLSCSUB5(aaspi_get_hist_boolean,AASPI_GET_HIST_BOOLEAN,aaspi_get_hist_boolean,STRING,STRING,PLOGICAL,LOGICAL,PINT) FCALLSCFUN3(LOGICAL,aaspi_hist_has_param,AASPI_HIST_HAS_PARAM,aaspi_hist_has_param,STRING,STRING,PINT) // History put parameter routines FCALLSCSUB4(aaspi_put_hist_string,AASPI_PUT_HIST_STRING,aaspi_put_hist_string,STRING,STRING,STRING,PINT) FCALLSCSUB4(aaspi_put_hist_int,AASPI_PUT_HIST_INT,aaspi_put_hist_int,STRING,STRING,INT,PINT) FCALLSCSUB4(aaspi_put_hist_int64,AASPI_PUT_HIST_INT64,aaspi_put_hist_int64,STRING,STRING,INT64,PINT) FCALLSCSUB4(aaspi_put_hist_float,AASPI_PUT_HIST_FLOAT,aaspi_put_hist_float,STRING,STRING,FLOAT,PINT) FCALLSCSUB4(aaspi_put_hist_double,AASPI_PUT_HIST_DOUBLE,aaspi_put_hist_double,STRING,STRING,DOUBLE,PINT) FCALLSCSUB4(aaspi_put_hist_boolean,AASPI_PUT_HIST_BOOLEAN,aaspi_put_hist_boolean,STRING,STRING,LOGICAL,PINT) // History file manipulation FCALLSCFUN2(INT,aaspi_get_num_axes,AASPI_GET_NUM_AXES,aaspi_get_num_axes,STRING,PINT) FCALLSCSUB8(aaspi_get_axis_par,AASPI_GET_AXIS_PAR,aaspi_get_axis_par,STRING,INT,PINT,PFLOAT,PFLOAT,PSTRING,INT,PINT) FCALLSCSUB7(aaspi_put_axis_par,AASPI_PUT_AXIS_PAR,aaspi_put_axis_par,STRING,INT,INT,FLOAT,FLOAT,STRING,PINT) void aaspi_put_axis_par(const char *file_tag, int iax, int n, float o, float d, const char *label, int *stat); FCALLSCSUB3(aaspi_copy_data_pointer,AASPI_COPY_DATA_POINTER,aaspi_copy_data_pointer,STRING,STRING,PINT) FCALLSCSUB3(aaspi_copy_history,AASPI_COPY_HISTORY,aaspi_copy_history,STRING,STRING,PINT) FCALLSCSUB3(aaspi_copy_history_force_aaspi_binary, AASPI_COPY_HISTORY_FORCE_AASPI_BINARY, aaspi_copy_history_force_aaspi_binary, STRING, STRING, PINT) // Data IO FCALLSCSUB4(aaspi_read_raw,AASPI_READ_RAW,aaspi_read_raw,STRING,PVOID,INT,PINT) FCALLSCSUB4(aaspi_write_raw,AASPI_WRITE_RAW,aaspi_write_raw,STRING,PVOID,INT,PINT) FCALLSCSUB4(aaspi_write_raw_force_aaspi_binary, AASPI_WRITE_RAW_FORCE_AASPI_BINARY, aaspi_write_raw_force_aaspi_binary, STRING, PVOID, INT, PINT) FCALLSCSUB4(aaspi_seek,AASPI_SEEK,aaspi_seek,STRING,INT64,INT,PINT) FCALLSCFUN2(INT64,aaspi_tell,AASPI_TELL,aaspi_tell,STRING,PINT) // Header file -- get FCALLSCFUN2(INT,aaspi_get_number_keys,AASPI_GET_NUMBER_KEYS,aaspi_get_number_keys,STRING,PINT) FCALLSCSUB8(aaspi_get_header_axis,AASPI_GET_HEADER_AXIS,aaspi_get_header_axis,STRING,INT,PINT,PFLOAT,PFLOAT,PSTRING,INT,PINT) FCALLSCSUB5(aaspi_get_key_name,AASPI_GET_KEY_NAME,aaspi_get_key_name,STRING,INT,PSTRING,INT,PINT) FCALLSCSUB4(aaspi_get_key_index,AASPI_GET_KEY_INDEX,aaspi_get_key_index,STRING,STRING,PINT,PINT) FCALLSCSUB4(aaspi_get_key_format,AASPI_GET_KEY_FORMAT,aaspi_get_key_format,STRING,INT,PINT,PINT) FCALLSCSUB5(aaspi_get_key_format_string,AASPI_GET_KEY_FORMAT_STRING,aaspi_get_key_format_string,STRING,INT,PSTRING,INT,PINT) FCALLSCSUB5(aaspi_get_key_type,AASPI_GET_KEY_TYPE,aaspi_get_key_type,STRING,INT,PSTRING,INT,PINT) FCALLSCSUB6(aaspi_get_val_by_index,AASPI_GET_VAL_BY_INDEX,aaspi_get_val_by_index,STRING,INT,INT,INT,PINT,PINT) FCALLSCSUB6(aaspi_get_val_by_name,AASPI_GET_VAL_BY_NAME,aaspi_get_val_by_name,STRING,INT,STRING,INT,PINT,PINT) FCALLSCSUB5(aaspi_get_val_headers,AASPI_GET_VAL_HEADERS,aaspi_get_val_headers,STRING,INT,INT,PINT,PINT) // Header file -- put FCALLSCSUB3(aaspi_copy_hff,AASPI_COPY_HFF,aaspi_copy_hff,STRING,STRING,PINT) FCALLSCSUB3(aaspi_copy_hff_force_aaspi_binary, AASPI_COPY_HFF_FORCE_AASPI_BINARY, aaspi_copy_hff_force_aaspi_binary, STRING, STRING, PINT) FCALLSCSUB3(aaspi_put_number_keys,AASPI_PUT_NUMBER_KEYS,aaspi_put_number_keys,STRING,INT,PINT) FCALLSCSUB7(aaspi_put_header_axis,AASPI_PUT_HEADER_AXIS,aaspi_put_header_axis,STRING,INT,INT,FLOAT,FLOAT,STRING,PINT) FCALLSCSUB6(aaspi_put_key,AASPI_PUT_KEY,aaspi_put_key,STRING,STRING,STRING,STRING,INT,PINT) FCALLSCSUB6(aaspi_put_val_by_index,AASPI_PUT_VAL_BY_INDEX,aaspi_put_val_by_index,STRING,INT,INT,INT,PINT,PINT) FCALLSCSUB5(aaspi_put_val_headers,aaspi_put_val_headers,aaspi_put_val_headers,STRING,INT,INT,PINT,PINT) // Working here #endif