comparison src/interpfcn/error.cc @ 15173:8593bed236f1

doc: Document escape character processing within single quotes for regexp, warning, error. regexp.cc (regexp, regexprep): Add implementation note about doing escape character processing within single quotes of pattern and replacement string. error.cc (warning, error): Add implementation note about doing escape character processing when the number of input arguments is greater than two.
author Rik <rik@octave.org>
date Tue, 14 Aug 2012 15:17:39 -0700
parents 60ff2cef569d
children
comparison
equal deleted inserted replaced
15172:c7d466a02065 15173:8593bed236f1
1066 function h () nargin == 1 || error (\"nargin != 1\\n\"); end\n\ 1066 function h () nargin == 1 || error (\"nargin != 1\\n\"); end\n\
1067 f ()\n\ 1067 f ()\n\
1068 error: nargin != 1\n\ 1068 error: nargin != 1\n\
1069 @end group\n\ 1069 @end group\n\
1070 @end example\n\ 1070 @end example\n\
1071 \n\
1072 Implementation Note: For compatibility with @sc{matlab}, escape\n\
1073 sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\
1074 regardless of whether @var{template} has been defined within single quotes\n\
1075 as long as there are two or more input arguments.\n\
1076 Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\
1077 \"\\\\n\") or use the @code{regexptranslate} function.\n\
1078 @seealso{warning, lasterror}\n\
1071 @end deftypefn") 1079 @end deftypefn")
1072 { 1080 {
1073 octave_value retval; 1081 octave_value retval;
1074 1082
1075 int nargin = args.length (); 1083 int nargin = args.length ();
1165 @example\n\ 1173 @example\n\
1166 @group\n\ 1174 @group\n\
1167 warning (\"error\");\n\ 1175 warning (\"error\");\n\
1168 @end group\n\ 1176 @end group\n\
1169 @end example\n\ 1177 @end example\n\
1170 @seealso{warning_ids}\n\ 1178 \n\
1179 Implementation Note: For compatibility with @sc{matlab}, escape\n\
1180 sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\
1181 regardless of whether @var{template} has been defined within single quotes\n\
1182 as long as there are two or more input arguments.\n\
1183 Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\
1184 \"\\\\n\") or use the @code{regexptranslate} function.\n\
1185 @seealso{warning_ids, lastwarn, error}\n\
1171 @end deftypefn") 1186 @end deftypefn")
1172 { 1187 {
1173 octave_value retval; 1188 octave_value retval;
1174 1189
1175 int nargin = args.length (); 1190 int nargin = args.length ();
1551 as input. Any fields of @var{err} that match those above are set while any\n\ 1566 as input. Any fields of @var{err} that match those above are set while any\n\
1552 unspecified fields are initialized with default values.\n\ 1567 unspecified fields are initialized with default values.\n\
1553 \n\ 1568 \n\
1554 If @code{lasterror} is called with the argument \"reset\", all fields are\n\ 1569 If @code{lasterror} is called with the argument \"reset\", all fields are\n\
1555 set to their default values.\n\ 1570 set to their default values.\n\
1556 @seealso{lasterr}\n\ 1571 @seealso{lasterr, error, lastwarn}\n\
1557 @end deftypefn") 1572 @end deftypefn")
1558 { 1573 {
1559 octave_value retval; 1574 octave_value retval;
1560 int nargin = args.length (); 1575 int nargin = args.length ();
1561 1576
1676 @deftypefnx {Built-in Function} {} lasterr (@var{msg}, @var{msgid})\n\ 1691 @deftypefnx {Built-in Function} {} lasterr (@var{msg}, @var{msgid})\n\
1677 Query or set the last error message. When called without input arguments,\n\ 1692 Query or set the last error message. When called without input arguments,\n\
1678 return the last error message and message identifier. With one\n\ 1693 return the last error message and message identifier. With one\n\
1679 argument, set the last error message to @var{msg}. With two arguments,\n\ 1694 argument, set the last error message to @var{msg}. With two arguments,\n\
1680 also set the last message identifier.\n\ 1695 also set the last message identifier.\n\
1681 @seealso{lasterror}\n\ 1696 @seealso{lasterror, error, lastwarn}\n\
1682 @end deftypefn") 1697 @end deftypefn")
1683 { 1698 {
1684 octave_value_list retval; 1699 octave_value_list retval;
1685 1700
1686 unwind_protect frame; 1701 unwind_protect frame;
1720 return retval; 1735 return retval;
1721 } 1736 }
1722 1737
1723 DEFUN (lastwarn, args, nargout, 1738 DEFUN (lastwarn, args, nargout,
1724 "-*- texinfo -*-\n\ 1739 "-*- texinfo -*-\n\
1725 @deftypefn {Built-in Function} {[@var{msg}, @var{msgid}] =} lastwarn (@var{msg}, @var{msgid})\n\ 1740 @deftypefn {Built-in Function} {[@var{msg}, @var{msgid}] =} lastwarn ()\n\
1726 Without any arguments, return the last warning message. With one\n\ 1741 @deftypefnx {Built-in Function} {} lastwarn (@var{msg})\n\
1742 @deftypefnx {Built-in Function} {} lastwarn (@var{msg}, @var{msgid})\n\
1743 Query or set the last warning message. When called without input arguments,\n\
1744 return the last warning message and message identifier. With one\n\
1727 argument, set the last warning message to @var{msg}. With two arguments,\n\ 1745 argument, set the last warning message to @var{msg}. With two arguments,\n\
1728 also set the last message identifier.\n\ 1746 also set the last message identifier.\n\
1747 @seealso{warning, lasterror, lasterr}\n\
1729 @end deftypefn") 1748 @end deftypefn")
1730 { 1749 {
1731 octave_value_list retval; 1750 octave_value_list retval;
1732 1751
1733 int argc = args.length () + 1; 1752 int argc = args.length () + 1;