# HG changeset patch # User John W. Eaton # Date 1483393752 18000 # Mon Jan 02 16:49:12 2017 -0500 # Node ID 5e42555c0a41075ac3b94f624aa29525aa292c25 # Parent 89ce4a3175e52f6159074c29f60e416c43591ce1 F77_INT fixes for Octave 4.4. diff --git a/src/__c1__.cc b/src/__c1__.cc --- a/src/__c1__.cc +++ b/src/__c1__.cc @@ -34,17 +34,24 @@ FOR INTERNAL USE ONLY" #include #include +#if defined (OCTAVE_HAVE_F77_INT_TYPE) +# define TO_F77_INT(x) octave::to_f77_int (x) +#else +typedef octave_idx_type F77_INT; +# define TO_F77_INT(x) (x) +#endif + extern "C" { F77_RET_T F77_FUNC (d1, D1) - (const octave_idx_type& nmax, const octave_idx_type& mmax, - const octave_idx_type& nxx, const double *y, - const octave_idx_type& delay, const octave_idx_type& m, - const octave_idx_type& ncmin, const double& pr, + (const F77_INT& nmax, const F77_INT& mmax, + const F77_INT& nxx, const double *y, + const F77_INT& delay, const F77_INT& m, + const F77_INT& ncmin, const double& pr, double& pln, double& eln, - const octave_idx_type& nmin, const octave_idx_type& kmax, - const octave_idx_type& iverb); + const F77_INT& nmin, const F77_INT& kmax, + const F77_INT& iverb); F77_RET_T F77_FUNC (rand, RAND) @@ -66,23 +73,23 @@ DEFUN_DLD (__c1__, args, nargout, HELPTE { // Assigning inputs Matrix input = args(0).matrix_value (); - octave_idx_type mindim = args(1).idx_type_value (); - octave_idx_type maxdim = args(2).idx_type_value (); - octave_idx_type delay = args(3).idx_type_value (); - octave_idx_type tmin = args(4).idx_type_value (); - octave_idx_type cmin = args(5).idx_type_value (); + F77_INT mindim = TO_F77_INT (args(1).idx_type_value ()); + F77_INT maxdim = TO_F77_INT (args(2).idx_type_value ()); + F77_INT delay = TO_F77_INT (args(3).idx_type_value ()); + F77_INT tmin = TO_F77_INT (args(4).idx_type_value ()); + F77_INT cmin = TO_F77_INT (args(5).idx_type_value ()); double resolution = args(6).double_value (); double seed = args(7).double_value (); - octave_idx_type kmax = args(8).idx_type_value (); + F77_INT kmax = TO_F77_INT (args(8).idx_type_value ()); bool verbose = args(9).bool_value (); - octave_idx_type iverb = verbose; + F77_INT iverb = TO_F77_INT (verbose); if (! error_state) { - octave_idx_type lines_read = input.rows (); //nmax in d1() - octave_idx_type columns_read = input.columns (); + F77_INT lines_read = TO_F77_INT (input.rows ()); //nmax in d1() + F77_INT columns_read = TO_F77_INT (input.columns ()); dim_vector dv (maxdim - mindim + 1, 1); @@ -94,7 +101,7 @@ DEFUN_DLD (__c1__, args, nargout, HELPTE // Seed the rand() function for d1() F77_XFCN (rand, RAND, (sqrt(seed))); - for (octave_idx_type m = mindim; m <= maxdim; m++) + for (F77_INT m = mindim; m <= maxdim; m++) { octave_scalar_map tmp (keys); tmp.setfield ("dim", m); diff --git a/src/__surrogates__.cc b/src/__surrogates__.cc --- a/src/__surrogates__.cc +++ b/src/__surrogates__.cc @@ -34,14 +34,21 @@ FOR INTERNAL USE ONLY" #include #include +#if defined (OCTAVE_HAVE_F77_INT_TYPE) +# define TO_F77_INT(x) octave::to_f77_int (x) +#else +typedef octave_idx_type F77_INT; +# define TO_F77_INT(x) (x) +#endif + extern "C" { F77_RET_T F77_FUNC (ts_surrogates, TS_SURROGATES) - (const double *xx, const octave_idx_type& nmaxp, - const octave_idx_type& mcmax, const octave_idx_type& imax, - const octave_idx_type& ispec, const double& seed, double *output, - octave_idx_type& iterations, double& rel_discrepency); + (const double *xx, const F77_INT& nmaxp, + const F77_INT& mcmax, const F77_INT& imax, + const F77_INT& ispec, const double& seed, double *output, + F77_INT& iterations, double& rel_discrepency); } @@ -59,15 +66,15 @@ DEFUN_DLD (__surrogates__, args, nargout // Assigning inputs Matrix input = args(0).matrix_value (); octave_idx_type nsur = args(1).idx_type_value (); - octave_idx_type imax = args(2).idx_type_value (); - octave_idx_type ispec = args(3).idx_type_value (); + F77_INT imax = TO_F77_INT (args(2).idx_type_value ()); + F77_INT ispec = TO_F77_INT (args(3).idx_type_value ()); double seed = args(4).double_value (); if (! error_state) { - octave_idx_type nmaxp = input.rows (); - octave_idx_type mcmax = input.columns (); + F77_INT nmaxp = TO_F77_INT (input.rows ()); + F77_INT mcmax = TO_F77_INT (input.columns ()); Cell surro_data (dim_vector (nsur,1)); Matrix surro_tmp (input.dims ()); @@ -75,7 +82,7 @@ DEFUN_DLD (__surrogates__, args, nargout for (octave_idx_type i = 0; i < nsur; i++) { - octave_idx_type it_tmp; + F77_INT it_tmp; double rel_discrepency_tmp; F77_XFCN (ts_surrogates, TS_SURROGATES, diff --git a/src/__upo__.cc b/src/__upo__.cc --- a/src/__upo__.cc +++ b/src/__upo__.cc @@ -33,18 +33,24 @@ FOR INTERNAL USE ONLY" #include #include +#if defined (OCTAVE_HAVE_F77_INT_TYPE) +# define TO_F77_INT(x) octave::to_f77_int (x) +#else +typedef octave_idx_type F77_INT; +# define TO_F77_INT(x) (x) +#endif extern "C" { F77_RET_T F77_FUNC (ts_upo, TS_UPO) - (const int& m, const double& eps, + (const F77_INT& m, const double& eps, const double& frac, const double& teq, const double& tdis, const double& h, - const double& tacc, const int& iper, - const int& icen, const int& lines_read, + const double& tacc, const F77_INT& iper, + const F77_INT& icen, const F77_INT& lines_read, double* in_out1, double* olens, - double* orbit_data, const int& sizedat, + double* orbit_data, const F77_INT& sizedat, double* accuracy, double* stability); } @@ -63,22 +69,22 @@ DEFUN_DLD (__upo__, args, nargout, HELPT { // Assigning inputs NDArray in_out1 = args(0).array_value(); - int m = args(1).int_value(); + F77_INT m = TO_F77_INT (args(1).int_value()); double eps = args(2).double_value(); double frac = args(3).double_value(); double teq = args(4).double_value(); double tdis = args(5).double_value(); double h = args(6).double_value(); double tacc = args(7).double_value(); - int iper = args(8).int_value(); - int icen = args(9).int_value(); + F77_INT iper = TO_F77_INT (args(8).int_value()); + F77_INT icen = TO_F77_INT (args(9).int_value()); if (! error_state) { - int lines_read = in_out1.numel(); + F77_INT lines_read = TO_F77_INT (in_out1.numel()); // Generating output vectors with estimated lengths // The extra length (+1) is to store the actual lengths NDArray olens (dim_vector (icen+1,1)); diff --git a/src/lazy.cc b/src/lazy.cc --- a/src/lazy.cc +++ b/src/lazy.cc @@ -71,12 +71,19 @@ Uses TISEAN package lazy\n\ // In order to avoid clobbered warnings transposed is initialized globally. bool transposed; +#if defined (OCTAVE_HAVE_F77_INT_TYPE) +# define TO_F77_INT(x) octave::to_f77_int (x) +#else +typedef octave_idx_type F77_INT; +# define TO_F77_INT(x) (x) +#endif + extern "C" { F77_RET_T F77_FUNC (ts_lazy, TS_LAZY) - (const int& m, const double& rv, - const int& imax, const int& lines_read, + (const F77_INT& m, const double& rv, + const F77_INT& imax, const F77_INT& lines_read, double* in_out1, double* in_out2); } @@ -100,12 +107,12 @@ DEFUN_DLD (lazy, args, nargout, HELPTEXT { // Assigning inputs Matrix in_out1 = args(0).matrix_value(); - int m = args(1).int_value(); + F77_INT m = TO_F77_INT (args(1).int_value()); double rv = args(2).double_value(); - int imax = DEFAULT_IMAX; + F77_INT imax = DEFAULT_IMAX; if (nargin == 4) - imax = args(3).int_value(); + imax = TO_F77_INT (args(3).int_value()); // --- DATA VALIDATION --- @@ -144,7 +151,7 @@ DEFUN_DLD (lazy, args, nargout, HELPTEXT in_out1 = in_out1.transpose(); } - int lines_read = in_out1.numel(); + F77_INT lines_read = TO_F77_INT (in_out1.numel()); NDArray in_out2 (Matrix (lines_read, 1)); F77_XFCN (ts_lazy, TS_LAZY,