Mercurial > octave-nkf
comparison libinterp/corefcn/error.cc @ 17787:175b392e91fe
Use GNU style coding conventions for code in libinterp/
* libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc,
libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc,
libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc,
libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc,
libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc,
libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc,
libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h,
libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc,
libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc,
libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h,
libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc,
libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc,
libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc,
libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc,
libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h,
libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc,
libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc,
libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc,
libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc,
libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h,
libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc,
libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/input.h, libinterp/corefcn/inv.cc,
libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc,
libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h,
libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc,
libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc,
libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc,
libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc,
libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc,
libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc,
libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h,
libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc,
libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc,
libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc,
libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h,
libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h,
libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc,
libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h,
libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h,
libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h,
libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h,
libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h,
libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc,
libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc,
libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc,
libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc,
libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h,
libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h,
libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc,
libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc,
libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc,
libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h,
libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc,
libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h,
libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc,
libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc,
libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc,
libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc,
libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc,
libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc,
libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc,
libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc,
libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc,
libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc,
libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc,
libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc,
libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc,
libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc,
libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h,
libinterp/octave-value/ov-base-scalar.cc,
libinterp/octave-value/ov-base-scalar.h,
libinterp/octave-value/ov-base-sparse.cc,
libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc,
libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc,
libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc,
libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc,
libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc,
libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h,
libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h,
libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h,
libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h,
libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h,
libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h,
libinterp/octave-value/ov-fcn-inline.cc,
libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h,
libinterp/octave-value/ov-flt-complex.cc,
libinterp/octave-value/ov-flt-complex.h,
libinterp/octave-value/ov-flt-cx-diag.cc,
libinterp/octave-value/ov-flt-cx-diag.h,
libinterp/octave-value/ov-flt-cx-mat.cc,
libinterp/octave-value/ov-flt-cx-mat.h,
libinterp/octave-value/ov-flt-re-diag.cc,
libinterp/octave-value/ov-flt-re-diag.h,
libinterp/octave-value/ov-flt-re-mat.cc,
libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc,
libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc,
libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h,
libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h,
libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h,
libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h,
libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc,
libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc,
libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc,
libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc,
libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc,
libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc,
libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc,
libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc,
libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h,
libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc,
libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc,
libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h,
libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc,
libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc,
libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc,
libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc,
libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc,
libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc,
libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc,
libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc,
libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc,
libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc,
libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc,
libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc,
libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc,
libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc,
libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc,
libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc,
libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc,
libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc,
libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc,
libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc,
libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc,
libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc,
libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc,
libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc,
libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc,
libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc,
libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc,
libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc,
libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc,
libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc,
libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc,
libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc,
libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc,
libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc,
libinterp/operators/ops.h, libinterp/parse-tree/lex.h,
libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc,
libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc,
libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc,
libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h,
libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h,
libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc,
libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h,
libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc,
libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc,
libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h,
libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc,
libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc,
libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h,
libinterp/parse-tree/token.h, libinterp/version.cc:
Use GNU style coding conventions for code in libinterp/
author | Rik <rik@octave.org> |
---|---|
date | Mon, 28 Oct 2013 19:51:46 -0700 |
parents | d63878346099 |
children | 25e87795f437 d96747f74b1e |
comparison
equal
deleted
inserted
replaced
17786:34d9812a943b | 17787:175b392e91fe |
---|---|
162 | 162 |
163 octave_vformat (output_buf, fmt, args); | 163 octave_vformat (output_buf, fmt, args); |
164 | 164 |
165 output_buf << std::endl; | 165 output_buf << std::endl; |
166 | 166 |
167 // FIXME -- we really want to capture the message before it | 167 // FIXME: we really want to capture the message before it has all the |
168 // has all the formatting goop attached to it. We probably also | 168 // formatting goop attached to it. We probably also want just the |
169 // want just the message, not the traceback information. | 169 // message, not the traceback information. |
170 | 170 |
171 std::string msg_string = output_buf.str (); | 171 std::string msg_string = output_buf.str (); |
172 | 172 |
173 if (! warning_state) | 173 if (! warning_state) |
174 { | 174 { |
195 return; | 195 return; |
196 | 196 |
197 if (! buffer_error_messages) | 197 if (! buffer_error_messages) |
198 flush_octave_stdout (); | 198 flush_octave_stdout (); |
199 | 199 |
200 // FIXME -- we really want to capture the message before it | 200 // FIXME: we really want to capture the message before it has all the |
201 // has all the formatting goop attached to it. We probably also | 201 // formatting goop attached to it. We probably also want just the |
202 // want just the message, not the traceback information. | 202 // message, not the traceback information. |
203 | 203 |
204 std::ostringstream output_buf; | 204 std::ostringstream output_buf; |
205 | 205 |
206 octave_vformat (output_buf, fmt, args); | 206 octave_vformat (output_buf, fmt, args); |
207 | 207 |
229 std::string cfn = curfcn->name (); | 229 std::string cfn = curfcn->name (); |
230 if (! cfn.empty ()) | 230 if (! cfn.empty ()) |
231 { | 231 { |
232 cfn += ':'; | 232 cfn += ':'; |
233 if (cfn.length () > base_msg.length () | 233 if (cfn.length () > base_msg.length () |
234 || base_msg.compare (0, cfn.length (), cfn) != 0) | 234 || base_msg.compare (0, cfn.length (), cfn) != 0) |
235 { | 235 { |
236 msg_string += cfn + ' '; | 236 msg_string += cfn + ' '; |
237 } | 237 } |
238 } | 238 } |
239 } | 239 } |
825 | 825 |
826 return retval; | 826 return retval; |
827 } | 827 } |
828 | 828 |
829 DEFUN (rethrow, args, , | 829 DEFUN (rethrow, args, , |
830 "-*- texinfo -*-\n\ | 830 "-*- texinfo -*-\n\ |
831 @deftypefn {Built-in Function} {} rethrow (@var{err})\n\ | 831 @deftypefn {Built-in Function} {} rethrow (@var{err})\n\ |
832 Reissue a previous error as defined by @var{err}. @var{err} is a structure\n\ | 832 Reissue a previous error as defined by @var{err}. @var{err} is a structure\n\ |
833 that must contain at least the @qcode{\"message\"} and @qcode{\"identifier\"}\n\ | 833 that must contain at least the @qcode{\"message\"} and @qcode{\"identifier\"}\n\ |
834 fields. @var{err} can also contain a field @qcode{\"stack\"} that gives\n\ | 834 fields. @var{err} can also contain a field @qcode{\"stack\"} that gives\n\ |
835 information on the assumed location of the error. Typically @var{err} is\n\ | 835 information on the assumed location of the error. Typically @var{err} is\n\ |
893 } | 893 } |
894 else | 894 else |
895 rethrow_error (id.c_str (), "%s", tmp_msg); | 895 rethrow_error (id.c_str (), "%s", tmp_msg); |
896 delete [] tmp_msg; | 896 delete [] tmp_msg; |
897 | 897 |
898 // FIXME -- is this the right thing to do for | 898 // FIXME: is this the right thing to do for Vlast_error_stack? |
899 // Vlast_error_stack? Should it be saved and restored | 899 // Should it be saved and restored with unwind_protect? |
900 // with unwind_protect? | |
901 | 900 |
902 Vlast_error_stack = err_stack; | 901 Vlast_error_stack = err_stack; |
903 | 902 |
904 if (err.contains ("stack")) | 903 if (err.contains ("stack")) |
905 { | 904 { |
922 { | 921 { |
923 if (c > 0) | 922 if (c > 0) |
924 pr_where_1 ("error: called from '%s' near line %d, column %d", | 923 pr_where_1 ("error: called from '%s' near line %d, column %d", |
925 nm.c_str (), l, c); | 924 nm.c_str (), l, c); |
926 else | 925 else |
927 pr_where_1 ("error: called from '%d' near line %d", nm.c_str (), l); | 926 pr_where_1 ("error: called from '%d' near line %d", |
927 nm.c_str (), l); | |
928 } | 928 } |
929 } | 929 } |
930 } | 930 } |
931 else | 931 else |
932 { | 932 { |
936 { | 936 { |
937 if (c > 0) | 937 if (c > 0) |
938 pr_where_1 ("error: in file %s near line %d, column %d", | 938 pr_where_1 ("error: in file %s near line %d, column %d", |
939 file.c_str (), l, c); | 939 file.c_str (), l, c); |
940 else | 940 else |
941 pr_where_1 ("error: in file %s near line %d", file.c_str (), l); | 941 pr_where_1 ("error: in file %s near line %d", |
942 file.c_str (), l); | |
942 } | 943 } |
943 } | 944 } |
944 else | 945 else |
945 { | 946 { |
946 if (l > 0) | 947 if (l > 0) |
947 { | 948 { |
948 if (c > 0) | 949 if (c > 0) |
949 pr_where_1 ("error: called from '%s' in file %s near line %d, column %d", | 950 pr_where_1 ("error: called from '%s' in file %s near line %d, column %d", |
950 nm.c_str (), file.c_str (), l, c); | 951 nm.c_str (), file.c_str (), l, c); |
951 else | 952 else |
952 pr_where_1 ("error: called from '%d' in file %s near line %d", nm.c_str (), file.c_str (), l); | 953 pr_where_1 ("error: called from '%d' in file %s near line %d", |
954 nm.c_str (), file.c_str (), l); | |
953 } | 955 } |
954 } | 956 } |
955 } | 957 } |
956 } | 958 } |
957 } | 959 } |
1003 for (int i = 1; i < nargin; i++) | 1005 for (int i = 1; i < nargin; i++) |
1004 nargs(i-1) = args(i); | 1006 nargs(i-1) = args(i); |
1005 } | 1007 } |
1006 else | 1008 else |
1007 nargs(0) = "call to " + caller | 1009 nargs(0) = "call to " + caller |
1008 + " with message identifier requires message"; | 1010 + " with message identifier requires message"; |
1009 } | 1011 } |
1010 } | 1012 } |
1011 } | 1013 } |
1012 | 1014 |
1013 return have_fmt; | 1015 return have_fmt; |
1014 } | 1016 } |
1015 | 1017 |
1016 DEFUN (error, args, , | 1018 DEFUN (error, args, , |
1017 "-*- texinfo -*-\n\ | 1019 "-*- texinfo -*-\n\ |
1018 @deftypefn {Built-in Function} {} error (@var{template}, @dots{})\n\ | 1020 @deftypefn {Built-in Function} {} error (@var{template}, @dots{})\n\ |
1019 @deftypefnx {Built-in Function} {} error (@var{id}, @var{template}, @dots{})\n\ | 1021 @deftypefnx {Built-in Function} {} error (@var{id}, @var{template}, @dots{})\n\ |
1020 Format the optional arguments under the control of the template string\n\ | 1022 Format the optional arguments under the control of the template string\n\ |
1021 @var{template} using the same rules as the @code{printf} family of\n\ | 1023 @var{template} using the same rules as the @code{printf} family of\n\ |
1022 functions (@pxref{Formatted Output}) and print the resulting message\n\ | 1024 functions (@pxref{Formatted Output}) and print the resulting message\n\ |
1130 if (m.contains ("message")) | 1132 if (m.contains ("message")) |
1131 { | 1133 { |
1132 octave_value c = m.getfield ("message"); | 1134 octave_value c = m.getfield ("message"); |
1133 | 1135 |
1134 if (c.is_string ()) | 1136 if (c.is_string ()) |
1135 nargs(0) = c.string_value (); | 1137 nargs(0) = c.string_value (); |
1136 } | 1138 } |
1137 | 1139 |
1138 if (m.contains ("identifier")) | 1140 if (m.contains ("identifier")) |
1139 { | 1141 { |
1140 octave_value c = m.getfield ("identifier"); | 1142 octave_value c = m.getfield ("identifier"); |
1141 | 1143 |
1142 if (c.is_string ()) | 1144 if (c.is_string ()) |
1143 id = c.string_value (); | 1145 id = c.string_value (); |
1144 } | 1146 } |
1145 | 1147 |
1146 // FIXME -- also need to handle "stack" field in error | 1148 // FIXME: also need to handle "stack" field in error structure, |
1147 // structure, but that will require some more significant | 1149 // but that will require some more significant surgery on |
1148 // surgery on handle_message, error_with_id, etc. | 1150 // handle_message, error_with_id, etc. |
1149 } | 1151 } |
1150 else | 1152 else |
1151 { | 1153 { |
1152 have_fmt = maybe_extract_message_id ("error", args, nargs, id); | 1154 have_fmt = maybe_extract_message_id ("error", args, nargs, id); |
1153 | 1155 |
1214 | 1216 |
1215 return retval; | 1217 return retval; |
1216 } | 1218 } |
1217 | 1219 |
1218 DEFUN (warning, args, nargout, | 1220 DEFUN (warning, args, nargout, |
1219 "-*- texinfo -*-\n\ | 1221 "-*- texinfo -*-\n\ |
1220 @deftypefn {Built-in Function} {} warning (@var{template}, @dots{})\n\ | 1222 @deftypefn {Built-in Function} {} warning (@var{template}, @dots{})\n\ |
1221 @deftypefnx {Built-in Function} {} warning (@var{id}, @var{template}, @dots{})\n\ | 1223 @deftypefnx {Built-in Function} {} warning (@var{id}, @var{template}, @dots{})\n\ |
1222 @deftypefnx {Built-in Function} {} warning (\"on\", @var{id})\n\ | 1224 @deftypefnx {Built-in Function} {} warning (\"on\", @var{id})\n\ |
1223 @deftypefnx {Built-in Function} {} warning (\"off\", @var{id})\n\ | 1225 @deftypefnx {Built-in Function} {} warning (\"off\", @var{id})\n\ |
1224 @deftypefnx {Built-in Function} {} warning (\"query\", @var{id})\n\ | 1226 @deftypefnx {Built-in Function} {} warning (\"query\", @var{id})\n\ |
1305 | 1307 |
1306 octave_scalar_map val = warning_query (arg2); | 1308 octave_scalar_map val = warning_query (arg2); |
1307 | 1309 |
1308 octave_value curr_state = val.contents ("state"); | 1310 octave_value curr_state = val.contents ("state"); |
1309 | 1311 |
1310 // FIXME -- this might be better with a dictionary | 1312 // FIXME: this might be better with a dictionary object. |
1311 // object. | |
1312 | 1313 |
1313 octave_value curr_warning_states | 1314 octave_value curr_warning_states |
1314 = symbol_table::varval (".saved_warning_states.", | 1315 = symbol_table::varval (".saved_warning_states.", |
1315 scope, context); | 1316 scope, context); |
1316 | 1317 |
1371 | 1372 |
1372 // Now ignore the "local" argument and continue to | 1373 // Now ignore the "local" argument and continue to |
1373 // handle the current setting. | 1374 // handle the current setting. |
1374 argc--; | 1375 argc--; |
1375 } | 1376 } |
1376 | 1377 |
1377 if (arg2 == "all") | 1378 if (arg2 == "all") |
1378 { | 1379 { |
1379 octave_map tmp; | 1380 octave_map tmp; |
1380 | 1381 |
1381 Cell id (1, 1); | 1382 Cell id (1, 1); |
1477 | 1478 |
1478 for (octave_idx_type i = 0; i < nel; i++) | 1479 for (octave_idx_type i = 0; i < nel; i++) |
1479 { | 1480 { |
1480 if (ident(i).string_value () == arg2) | 1481 if (ident(i).string_value () == arg2) |
1481 { | 1482 { |
1482 // FIXME -- if state for "all" is | 1483 // FIXME: if state for "all" is same as arg1, |
1483 // same as arg1, we can simply remove the | 1484 // we can simply remove the item |
1484 // item from the list. | 1485 // from the list. |
1485 | 1486 |
1486 state(i) = arg1; | 1487 state(i) = arg1; |
1487 warning_options.assign ("state", state); | 1488 warning_options.assign ("state", state); |
1488 found = true; | 1489 found = true; |
1489 break; | 1490 break; |
1490 } | 1491 } |
1491 } | 1492 } |
1492 | 1493 |
1493 if (! found) | 1494 if (! found) |
1494 { | 1495 { |
1495 // FIXME -- if state for "all" is | 1496 // FIXME: if state for "all" is same as arg1, |
1496 // same as arg1, we don't need to do anything. | 1497 // we don't need to do anything. |
1497 | 1498 |
1498 ident.resize (dim_vector (1, nel+1)); | 1499 ident.resize (dim_vector (1, nel+1)); |
1499 state.resize (dim_vector (1, nel+1)); | 1500 state.resize (dim_vector (1, nel+1)); |
1500 | 1501 |
1501 ident(nel) = arg2; | 1502 ident(nel) = arg2; |
1644 set_warning_state ("Octave:noninteger-range-as-index", "error"); | 1645 set_warning_state ("Octave:noninteger-range-as-index", "error"); |
1645 | 1646 |
1646 } | 1647 } |
1647 | 1648 |
1648 DEFUN (lasterror, args, , | 1649 DEFUN (lasterror, args, , |
1649 "-*- texinfo -*-\n\ | 1650 "-*- texinfo -*-\n\ |
1650 @deftypefn {Built-in Function} {@var{lasterr} =} lasterror ()\n\ | 1651 @deftypefn {Built-in Function} {@var{lasterr} =} lasterror ()\n\ |
1651 @deftypefnx {Built-in Function} {} lasterror (@var{err})\n\ | 1652 @deftypefnx {Built-in Function} {} lasterror (@var{err})\n\ |
1652 @deftypefnx {Built-in Function} {} lasterror (\"reset\")\n\ | 1653 @deftypefnx {Built-in Function} {} lasterror (\"reset\")\n\ |
1653 Query or set the last error message structure. When called without\n\ | 1654 Query or set the last error message structure. When called without\n\ |
1654 arguments, return a structure containing the last error message and other\n\ | 1655 arguments, return a structure containing the last error message and other\n\ |
1746 new_error_id = tmp; | 1747 new_error_id = tmp; |
1747 } | 1748 } |
1748 | 1749 |
1749 if (! error_state && new_err.contains ("stack")) | 1750 if (! error_state && new_err.contains ("stack")) |
1750 { | 1751 { |
1751 new_err_stack = | 1752 new_err_stack = |
1752 new_err.getfield ("stack").scalar_map_value (); | 1753 new_err.getfield ("stack").scalar_map_value (); |
1753 | 1754 |
1754 if (! error_state && new_err_stack.contains ("file")) | 1755 if (! error_state && new_err_stack.contains ("file")) |
1755 { | 1756 { |
1756 const std::string tmp = | 1757 const std::string tmp = |
1815 | 1816 |
1816 return retval; | 1817 return retval; |
1817 } | 1818 } |
1818 | 1819 |
1819 DEFUN (lasterr, args, nargout, | 1820 DEFUN (lasterr, args, nargout, |
1820 "-*- texinfo -*-\n\ | 1821 "-*- texinfo -*-\n\ |
1821 @deftypefn {Built-in Function} {[@var{msg}, @var{msgid}] =} lasterr ()\n\ | 1822 @deftypefn {Built-in Function} {[@var{msg}, @var{msgid}] =} lasterr ()\n\ |
1822 @deftypefnx {Built-in Function} {} lasterr (@var{msg})\n\ | 1823 @deftypefnx {Built-in Function} {} lasterr (@var{msg})\n\ |
1823 @deftypefnx {Built-in Function} {} lasterr (@var{msg}, @var{msgid})\n\ | 1824 @deftypefnx {Built-in Function} {} lasterr (@var{msg}, @var{msgid})\n\ |
1824 Query or set the last error message. When called without input arguments,\n\ | 1825 Query or set the last error message. When called without input arguments,\n\ |
1825 return the last error message and message identifier. With one\n\ | 1826 return the last error message and message identifier. With one\n\ |
1866 | 1867 |
1867 return retval; | 1868 return retval; |
1868 } | 1869 } |
1869 | 1870 |
1870 DEFUN (lastwarn, args, nargout, | 1871 DEFUN (lastwarn, args, nargout, |
1871 "-*- texinfo -*-\n\ | 1872 "-*- texinfo -*-\n\ |
1872 @deftypefn {Built-in Function} {[@var{msg}, @var{msgid}] =} lastwarn ()\n\ | 1873 @deftypefn {Built-in Function} {[@var{msg}, @var{msgid}] =} lastwarn ()\n\ |
1873 @deftypefnx {Built-in Function} {} lastwarn (@var{msg})\n\ | 1874 @deftypefnx {Built-in Function} {} lastwarn (@var{msg})\n\ |
1874 @deftypefnx {Built-in Function} {} lastwarn (@var{msg}, @var{msgid})\n\ | 1875 @deftypefnx {Built-in Function} {} lastwarn (@var{msg}, @var{msgid})\n\ |
1875 Query or set the last warning message. When called without input arguments,\n\ | 1876 Query or set the last warning message. When called without input arguments,\n\ |
1876 return the last warning message and message identifier. With one\n\ | 1877 return the last warning message and message identifier. With one\n\ |
1913 | 1914 |
1914 return retval; | 1915 return retval; |
1915 } | 1916 } |
1916 | 1917 |
1917 DEFUN (usage, args, , | 1918 DEFUN (usage, args, , |
1918 "-*- texinfo -*-\n\ | 1919 "-*- texinfo -*-\n\ |
1919 @deftypefn {Built-in Function} {} usage (@var{msg})\n\ | 1920 @deftypefn {Built-in Function} {} usage (@var{msg})\n\ |
1920 Print the message @var{msg}, prefixed by the string @samp{usage: }, and\n\ | 1921 Print the message @var{msg}, prefixed by the string @samp{usage: }, and\n\ |
1921 set Octave's internal error state such that control will return to the\n\ | 1922 set Octave's internal error state such that control will return to the\n\ |
1922 top level without evaluating any more commands. This is useful for\n\ | 1923 top level without evaluating any more commands. This is useful for\n\ |
1923 aborting from functions.\n\ | 1924 aborting from functions.\n\ |
1947 handle_message (usage_with_id, "", "unknown", args, true); | 1948 handle_message (usage_with_id, "", "unknown", args, true); |
1948 return retval; | 1949 return retval; |
1949 } | 1950 } |
1950 | 1951 |
1951 DEFUN (beep_on_error, args, nargout, | 1952 DEFUN (beep_on_error, args, nargout, |
1952 "-*- texinfo -*-\n\ | 1953 "-*- texinfo -*-\n\ |
1953 @deftypefn {Built-in Function} {@var{val} =} beep_on_error ()\n\ | 1954 @deftypefn {Built-in Function} {@var{val} =} beep_on_error ()\n\ |
1954 @deftypefnx {Built-in Function} {@var{old_val} =} beep_on_error (@var{new_val})\n\ | 1955 @deftypefnx {Built-in Function} {@var{old_val} =} beep_on_error (@var{new_val})\n\ |
1955 @deftypefnx {Built-in Function} {} beep_on_error (@var{new_val}, \"local\")\n\ | 1956 @deftypefnx {Built-in Function} {} beep_on_error (@var{new_val}, \"local\")\n\ |
1956 Query or set the internal variable that controls whether Octave will try\n\ | 1957 Query or set the internal variable that controls whether Octave will try\n\ |
1957 to ring the terminal bell before printing an error message.\n\ | 1958 to ring the terminal bell before printing an error message.\n\ |
1963 { | 1964 { |
1964 return SET_INTERNAL_VARIABLE (beep_on_error); | 1965 return SET_INTERNAL_VARIABLE (beep_on_error); |
1965 } | 1966 } |
1966 | 1967 |
1967 DEFUN (debug_on_error, args, nargout, | 1968 DEFUN (debug_on_error, args, nargout, |
1968 "-*- texinfo -*-\n\ | 1969 "-*- texinfo -*-\n\ |
1969 @deftypefn {Built-in Function} {@var{val} =} debug_on_error ()\n\ | 1970 @deftypefn {Built-in Function} {@var{val} =} debug_on_error ()\n\ |
1970 @deftypefnx {Built-in Function} {@var{old_val} =} debug_on_error (@var{new_val})\n\ | 1971 @deftypefnx {Built-in Function} {@var{old_val} =} debug_on_error (@var{new_val})\n\ |
1971 @deftypefnx {Built-in Function} {} debug_on_error (@var{new_val}, \"local\")\n\ | 1972 @deftypefnx {Built-in Function} {} debug_on_error (@var{new_val}, \"local\")\n\ |
1972 Query or set the internal variable that controls whether Octave will try\n\ | 1973 Query or set the internal variable that controls whether Octave will try\n\ |
1973 to enter the debugger when an error is encountered. This will also\n\ | 1974 to enter the debugger when an error is encountered. This will also\n\ |
1982 { | 1983 { |
1983 return SET_INTERNAL_VARIABLE (debug_on_error); | 1984 return SET_INTERNAL_VARIABLE (debug_on_error); |
1984 } | 1985 } |
1985 | 1986 |
1986 DEFUN (debug_on_warning, args, nargout, | 1987 DEFUN (debug_on_warning, args, nargout, |
1987 "-*- texinfo -*-\n\ | 1988 "-*- texinfo -*-\n\ |
1988 @deftypefn {Built-in Function} {@var{val} =} debug_on_warning ()\n\ | 1989 @deftypefn {Built-in Function} {@var{val} =} debug_on_warning ()\n\ |
1989 @deftypefnx {Built-in Function} {@var{old_val} =} debug_on_warning (@var{new_val})\n\ | 1990 @deftypefnx {Built-in Function} {@var{old_val} =} debug_on_warning (@var{new_val})\n\ |
1990 @deftypefnx {Built-in Function} {} debug_on_warning (@var{new_val}, \"local\")\n\ | 1991 @deftypefnx {Built-in Function} {} debug_on_warning (@var{new_val}, \"local\")\n\ |
1991 Query or set the internal variable that controls whether Octave will try\n\ | 1992 Query or set the internal variable that controls whether Octave will try\n\ |
1992 to enter the debugger when a warning is encountered.\n\ | 1993 to enter the debugger when a warning is encountered.\n\ |