# HG changeset patch # User John W. Eaton # Date 1711341724 14400 # Node ID 40fde86be9b00fa113967c167627d9158b27bc73 # Parent 06a308cae32c36a12a227e228896c90f7be78b4a replace calls to error_* with corresponding panic_* functions in libinterp Affected files: __isprimelarge__.cc, cellfun.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, graphics.cc, kron.cc, mex.cc, oct-map.cc, oct-stream.cc, pr-output.cc, schur.cc, variables.cc, and ops.h. diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/__isprimelarge__.cc --- a/libinterp/corefcn/__isprimelarge__.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/__isprimelarge__.cc Mon Mar 25 00:42:04 2024 -0400 @@ -242,7 +242,7 @@ if (g > 1) // found GCD ==> exit loop properly { - error_unless (n % g == 0); // theoretical possibility of GCD error + panic_unless (n % g == 0); // theoretical possibility of GCD error return g; } } diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/cellfun.cc --- a/libinterp/corefcn/cellfun.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/cellfun.cc Mon Mar 25 00:42:04 2024 -0400 @@ -1990,8 +1990,9 @@ do_mat2cell_2d (const Array2D& a, const Array *d, int nd) { Cell retval; - error_unless (nd == 1 || nd == 2); - error_unless (a.ndims () == 2); + + panic_unless (nd == 1 || nd == 2); + panic_unless (a.ndims () == 2); if (mat2cell_mismatch (a.dims (), d, nd)) return retval; @@ -2047,7 +2048,8 @@ do_mat2cell_nd (const ArrayND& a, const Array *d, int nd) { Cell retval; - error_unless (nd >= 1); + + panic_unless (nd >= 1); if (mat2cell_mismatch (a.dims (), d, nd)) return retval; @@ -2129,7 +2131,8 @@ do_mat2cell (octave_value& a, const Array *d, int nd) { Cell retval; - error_unless (nd >= 1); + + panic_unless (nd >= 1); if (mat2cell_mismatch (a.dims (), d, nd)) return retval; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/daspk.cc --- a/libinterp/corefcn/daspk.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/daspk.cc Mon Mar 25 00:42:04 2024 -0400 @@ -68,7 +68,7 @@ { ColumnVector retval; - error_unless (x.numel () == xdot.numel ()); + panic_unless (x.numel () == xdot.numel ()); octave_value_list args; @@ -119,7 +119,7 @@ { Matrix retval; - error_unless (x.numel () == xdot.numel ()); + panic_unless (x.numel () == xdot.numel ()); octave_value_list args; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/dasrt.cc --- a/libinterp/corefcn/dasrt.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/dasrt.cc Mon Mar 25 00:42:04 2024 -0400 @@ -69,7 +69,7 @@ { ColumnVector retval; - error_unless (x.numel () == xdot.numel ()); + panic_unless (x.numel () == xdot.numel ()); octave_value_list args; @@ -159,7 +159,7 @@ { Matrix retval; - error_unless (x.numel () == xdot.numel ()); + panic_unless (x.numel () == xdot.numel ()); octave_value_list args; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/dassl.cc --- a/libinterp/corefcn/dassl.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/dassl.cc Mon Mar 25 00:42:04 2024 -0400 @@ -67,7 +67,7 @@ { ColumnVector retval; - error_unless (x.numel () == xdot.numel ()); + panic_unless (x.numel () == xdot.numel ()); octave_value_list args; @@ -118,7 +118,7 @@ { Matrix retval; - error_unless (x.numel () == xdot.numel ()); + panic_unless (x.numel () == xdot.numel ()); octave_value_list args; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/data.cc Mon Mar 25 00:42:04 2024 -0400 @@ -8154,7 +8154,7 @@ idx_vector col1 (':'), col2 (':'), sl1 (1, k), sl2 (0, k-1); retval = SparseT (retval.index (col1, sl1)) - SparseT (retval.index (col2, sl2)); - error_unless (retval.columns () == k-1); + panic_unless (retval.columns () == k-1); order--; k--; } @@ -8167,7 +8167,7 @@ idx_vector col1 (':'), col2 (':'), sl1 (1, k), sl2 (0, k-1); retval = SparseT (retval.index (sl1, col1)) - SparseT (retval.index (sl2, col2)); - error_unless (retval.rows () == k-1); + panic_unless (retval.rows () == k-1); order--; k--; } diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/graphics.cc Mon Mar 25 00:42:04 2024 -0400 @@ -5310,10 +5310,10 @@ // Including ones we do don't implement? // FIXME: This function is probably never called without mode == "reset". - // Verify this is the case with error_unless() (1/6/2017). + // Verify this is the case with panic_unless() (1/6/2017). // If there are reports of problems then figure out what code is // calling it with the mode set to something else. - error_unless (mode == "reset"); + panic_unless (mode == "reset"); Matrix tlim (1, 2, 0.0); tlim(1) = 1; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/kron.cc --- a/libinterp/corefcn/kron.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/kron.cc Mon Mar 25 00:42:04 2024 -0400 @@ -55,8 +55,8 @@ static MArray kron (const MArray& a, const MArray& b) { - error_unless (a.ndims () == 2); - error_unless (b.ndims () == 2); + panic_unless (a.ndims () == 2); + panic_unless (b.ndims () == 2); octave_idx_type nra = a.rows (); octave_idx_type nrb = b.rows (); @@ -86,7 +86,7 @@ static MArray kron (const MDiagArray2& a, const MArray& b) { - error_unless (b.ndims () == 2); + panic_unless (b.ndims () == 2); octave_idx_type nra = a.rows (); octave_idx_type nrb = b.rows (); diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/mex.cc Mon Mar 25 00:42:04 2024 -0400 @@ -467,7 +467,8 @@ mxArray *retval = m_val.as_mxArray (m_interleaved); // RETVAL is assumed to be an mxArray_matlab object. Should we - // error_unless that condition here? + // panic_unless that condition here or just check and throw an + // error? if (retval) { diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/oct-map.cc --- a/libinterp/corefcn/oct-map.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/oct-map.cc Mon Mar 25 00:42:04 2024 -0400 @@ -612,7 +612,7 @@ for (octave_idx_type j = 0; j < nf; j++) { retval.m_vals.push_back (Cell (rd)); - error_unless (retval.m_vals[j].numel () == n); + panic_unless (retval.m_vals[j].numel () == n); for (octave_idx_type i = 0; i < n; i++) retval.m_vals[j].xelem (i) = map_list[i].m_vals[j]; } @@ -1033,7 +1033,7 @@ error (ee, "incompatible fields in struct assignment"); } - error_unless (rhs1.m_keys.is_same (m_keys)); + panic_unless (rhs1.m_keys.is_same (m_keys)); assign (i, rhs1); } } @@ -1081,7 +1081,7 @@ error (ee, "incompatible fields in struct assignment"); } - error_unless (rhs1.m_keys.is_same (m_keys)); + panic_unless (rhs1.m_keys.is_same (m_keys)); assign (i, j, rhs1); } } @@ -1129,7 +1129,7 @@ error (ee, "incompatible fields in struct assignment"); } - error_unless (rhs1.m_keys.is_same (m_keys)); + panic_unless (rhs1.m_keys.is_same (m_keys)); assign (ia, rhs1); } } diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/oct-stream.cc Mon Mar 25 00:42:04 2024 -0400 @@ -6678,7 +6678,7 @@ std::ptrdiff_t input_buf_size = static_cast (input_buf_elts) * input_elt_size; - error_if (input_buf_size < 0); + panic_if (input_buf_size < 0); // Must also work and return correct type object for 0 elements to read. std::istream *isp = input_stream (); diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/pr-output.cc --- a/libinterp/corefcn/pr-output.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/pr-output.cc Mon Mar 25 00:42:04 2024 -0400 @@ -300,7 +300,7 @@ pr_max_internal (const MArray& m) { // We expect a 2-d array. - error_unless (m.ndims () == 2); + panic_unless (m.ndims () == 2); octave_idx_type nr = m.rows (); octave_idx_type nc = m.columns (); @@ -680,7 +680,8 @@ static inline float_display_format make_matrix_format (const MT& m) { - error_unless (m.ndims () == 2); + // We expect a 2-d array. + panic_unless (m.ndims () == 2); if (free_format) return float_display_format (); @@ -1569,7 +1570,7 @@ print_empty_matrix (std::ostream& os, octave_idx_type nr, octave_idx_type nc, bool pr_as_read_syntax) { - error_unless (nr == 0 || nc == 0); + panic_unless (nr == 0 || nc == 0); if (pr_as_read_syntax) { @@ -1591,7 +1592,7 @@ print_empty_nd_array (std::ostream& os, const dim_vector& dims, bool pr_as_read_syntax) { - error_unless (dims.any_zero ()); + panic_unless (dims.any_zero ()); if (pr_as_read_syntax) os << "zeros (" << dims.str (',') << ')'; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/schur.cc --- a/libinterp/corefcn/schur.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/schur.cc Mon Mar 25 00:42:04 2024 -0400 @@ -46,7 +46,7 @@ octave_value retval = a; octave_idx_type n = a.rows (); - error_unless (a.columns () == n); + panic_unless (a.columns () == n); const typename Matrix::element_type zero = typename Matrix::element_type (); diff -r 06a308cae32c -r 40fde86be9b0 libinterp/corefcn/variables.cc --- a/libinterp/corefcn/variables.cc Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/corefcn/variables.cc Mon Mar 25 00:42:04 2024 -0400 @@ -768,7 +768,7 @@ int nargin = args.length (); - error_unless (var < nchoices); + panic_unless (var < nchoices); if (nargout > 0 || nargin == 0) retval = choices[var]; diff -r 06a308cae32c -r 40fde86be9b0 libinterp/operators/ops.h --- a/libinterp/operators/ops.h Sun Mar 24 18:12:06 2024 -0400 +++ b/libinterp/operators/ops.h Mon Mar 25 00:42:04 2024 -0400 @@ -147,7 +147,7 @@ OCTAVE_CAST_BASE_VALUE (CONCAT2 (octave_, t1)&, v1, a1); \ OCTAVE_CAST_BASE_VALUE (const CONCAT2 (octave_, t2)&, v2, a2); \ \ - error_unless (idx.empty ()); \ + panic_unless (idx.empty ()); \ v1.matrix_ref () op v2.CONCAT2 (f, _value) (); \ \ return octave_value (); \ @@ -162,7 +162,7 @@ OCTAVE_CAST_BASE_VALUE (CONCAT2 (octave_, t1)&, v1, a1); \ OCTAVE_CAST_BASE_VALUE (const CONCAT2 (octave_, t2)&, v2, a2); \ \ - error_unless (idx.empty ()); \ + panic_unless (idx.empty ()); \ fnop (v1.matrix_ref (), v2.CONCAT2 (f, _value) ()); \ \ return octave_value (); \