# HG changeset patch # User Rik # Date 1428466702 25200 # Node ID dbf2418a46dd099078ec34fb11ca026017110c89 # Parent 055ad6fbc910fcd3adcc502756f48cc6677ac004 Document expansion of escape sequences in single quotes (bug #44745). * io.txi: Note that all *printf functions expand escape sequences. * error.cc (Ferror, Fwarning): Note that escape sequences are expanded. * file-io.cc (Fprintf, Ffprintf, Fsprintf): Note that escape sequences are expanded. * regexp.cc (Fregexp, Fregexprep): Note that escape sequences are expanded. diff -r 055ad6fbc910 -r dbf2418a46dd doc/interpreter/io.txi --- a/doc/interpreter/io.txi Tue Apr 07 18:29:01 2015 -0700 +++ b/doc/interpreter/io.txi Tue Apr 07 21:18:22 2015 -0700 @@ -392,6 +392,10 @@ interpret the format template differently in order to improve the performance of printing vector and matrix values. +Implementation Note: For compatability with @sc{matlab}, escape sequences in +the template string (e.g., @qcode{"\n"} => newline) are expanded even +when the template string is defined with single quotes. + @DOCSTRING(printf) @DOCSTRING(fprintf) diff -r 055ad6fbc910 -r dbf2418a46dd libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Tue Apr 07 18:29:01 2015 -0700 +++ b/libinterp/corefcn/error.cc Tue Apr 07 21:18:22 2015 -0700 @@ -1093,11 +1093,11 @@ which will only stop execution if an error has been found.\n\ \n\ Implementation Note: For compatibility with @sc{matlab}, escape\n\ -sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\ -regardless of whether @var{template} has been defined within single quotes\n\ -as long as there are two or more input arguments.\n\ -Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\ -\"\\\\n\") or use the @code{regexptranslate} function.\n\ +sequences in @var{template} (e.g., \"\\n\" => newline) are processed\n\ +regardless of whether @var{template} has been defined with single quotes,\n\ +as long as there are two or more input arguments. To disable escape sequence\n\ +expansion use a second backslash before the sequence (e.g., \"\\\\n\") or\n\ +use the @code{regexptranslate} function.\n\ @seealso{warning, lasterror}\n\ @end deftypefn") { @@ -1392,11 +1392,11 @@ workspace.\n\ \n\ Implementation Note: For compatibility with @sc{matlab}, escape\n\ -sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\ -regardless of whether @var{template} has been defined within single quotes\n\ -as long as there are two or more input arguments.\n\ -Use a second backslash to stop interpolation of the escape sequence (e.g.,\n\ -\"\\\\n\") or use the @code{regexptranslate} function.\n\ +sequences in @var{template} (e.g., \"\\n\" => newline) are processed\n\ +regardless of whether @var{template} has been defined with single quotes,\n\ +as long as there are two or more input arguments. To disable escape sequence\n\ +expansion use a second backslash before the sequence (e.g., \"\\\\n\") or\n\ +use the @code{regexptranslate} function.\n\ @seealso{warning_ids, lastwarn, error}\n\ @end deftypefn") { diff -r 055ad6fbc910 -r dbf2418a46dd libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Tue Apr 07 18:29:01 2015 -0700 +++ b/libinterp/corefcn/file-io.cc Tue Apr 07 21:18:22 2015 -0700 @@ -888,6 +888,10 @@ function exactly equivalent to @code{printf}.\n\ \n\ The optional output returns the number of bytes written to the file.\n\ +\n\ +Implementation Note: For compatability with @sc{matlab}, escape sequences in\n\ +the template string (e.g., @qcode{\"\\\\n\"} => newline) are expanded even\n\ +when the template string is defined with single quotes.\n\ @seealso{fputs, fdisp, fwrite, fscanf, printf, sprintf, fopen}\n\ @end deftypefn") { @@ -954,6 +958,10 @@ See the Formatted Output section of the GNU Octave manual for a\n\ complete description of the syntax of the template string.\n\ @end ifclear\n\ +\n\ +Implementation Note: For compatability with @sc{matlab}, escape sequences in\n\ +the template string (e.g., @qcode{\"\\\\n\"} => newline) are expanded even\n\ +when the template string is defined with single quotes.\n\ @seealso{fprintf, sprintf, scanf}\n\ @end deftypefn") { @@ -1059,6 +1067,10 @@ suitably sized string as an argument, Octave's @code{sprintf} function\n\ returns the string, automatically sized to hold all of the items\n\ converted.\n\ +\n\ +Implementation Note: For compatability with @sc{matlab}, escape sequences in\n\ +the template string (e.g., @qcode{\"\\\\n\"} => newline) are expanded even\n\ +when the template string is defined with single quotes.\n\ @seealso{printf, fprintf, sscanf}\n\ @end deftypefn") { diff -r 055ad6fbc910 -r dbf2418a46dd libinterp/corefcn/regexp.cc --- a/libinterp/corefcn/regexp.cc Tue Apr 07 18:29:01 2015 -0700 +++ b/libinterp/corefcn/regexp.cc Tue Apr 07 21:18:22 2015 -0700 @@ -677,11 +677,11 @@ Match within a word\n\ @end table\n\ \n\ -Implementation Note: For compatibility with @sc{matlab}, ordinary escape\n\ -sequences (e.g., @qcode{\"\\n\"} => newline) are processed in @var{pat}\n\ -regardless of whether @var{pat} has been defined within single quotes. Use\n\ -a second backslash to stop interpolation of the escape sequence (e.g.,\n\ -\"\\\\n\") or use the @code{regexptranslate} function.\n\ +Implementation Note: For compatibility with @sc{matlab}, escape sequences\n\ +in @var{pat} (e.g., @qcode{\"\\\\n\"} => newline) are expanded even when\n\ +@var{pat} has been defined with single quotes. To disable expansion use\n\ +a second backslash before the escape sequence (e.g., \"\\\\n\") or use the\n\ +@code{regexptranslate} function.\n\ \n\ The outputs of @code{regexp} default to the order given below\n\ \n\ @@ -1309,11 +1309,11 @@ \n\ @end table\n\ \n\ -Implementation Note: For compatibility with @sc{matlab}, ordinary escape\n\ -sequences (e.g., @qcode{\"\\n\"} => newline) are processed in both @var{pat}\n\ -and @var{repstr} regardless of whether they were defined within single\n\ -quotes. Use a second backslash to stop interpolation of the escape sequence\n\ -(e.g., \"\\\\n\") or use the @code{regexptranslate} function.\n\ +Implementation Note: For compatibility with @sc{matlab}, escape sequences\n\ +in @var{pat} (e.g., @qcode{\"\\\\n\"} => newline) are expanded even when\n\ +@var{pat} has been defined with single quotes. To disable expansion use\n\ +a second backslash before the escape sequence (e.g., \"\\\\n\") or use the\n\ +@code{regexptranslate} function.\n\ @seealso{regexp, regexpi, strrep}\n\ @end deftypefn") {