# HG changeset patch # User Rik # Date 1333652147 25200 # Node ID c67822beb7a422edf95419bbf95ddb5391e0eea2 # Parent 8c988dabbe8e61bac8067cb251689b674e07b857 maint: Backed out changeset 8c988dabbe8e diff -r 8c988dabbe8e -r c67822beb7a4 doc/interpreter/strings.txi --- a/doc/interpreter/strings.txi Wed Apr 04 21:08:38 2012 -0700 +++ b/doc/interpreter/strings.txi Thu Apr 05 11:55:47 2012 -0700 @@ -69,8 +69,8 @@ In double-quoted strings, the backslash character is used to introduce @dfn{escape sequences} that represent other characters. For example, @samp{\n} embeds a newline character in a double-quoted string and -@samp{\"} embeds a double quote character. In single-quoted strings, the -backslash is not a special character. An example showing the difference is +@samp{\"} embeds a double quote character. In single-quoted strings, backslash +is not a special character. Here is an example showing the difference: @example @group @@ -81,7 +81,7 @@ @end group @end example -Below is a table of all escape sequences recognized by Octave (within +Here is a table of all the escape sequences used in Octave (within double quoted strings). They are the same as those used in the C programming language. @@ -147,21 +147,13 @@ @end group @end example -In scripts the two different string types can be distinguished, if necessary, +In scripts the two different string types can be distinguished if necessary by using @code{is_dq_string} and @code{is_sq_string}. @DOCSTRING(is_dq_string) @DOCSTRING(is_sq_string) -The use of double quotes for strings with escape sequences and single quotes -for verbatim input is quite straightforward. However, @sc{matlab} behavior -is inconsistent in this regard and in certain instances will do escape sequence -processing even within single quotes. When absolute compatibility is essential -Octave can perform the same processing. - -@DOCSTRING(single_quote_escape_processing) - @node Character Arrays @section Character Arrays diff -r 8c988dabbe8e -r c67822beb7a4 src/octave.cc --- a/src/octave.cc Wed Apr 04 21:08:38 2012 -0700 +++ b/src/octave.cc Thu Apr 05 11:55:47 2012 -0700 @@ -615,7 +615,6 @@ "%%-- %D %I:%M %p --%%"); bind_internal_variable ("page_screen_output", false); bind_internal_variable ("print_empty_dimensions", false); - bind_internal_variable ("single_quote_escape_processing", true); disable_warning ("Octave:abbreviated-property-match"); disable_warning ("Octave:fopen-file-in-path"); diff -r 8c988dabbe8e -r c67822beb7a4 src/ov.cc --- a/src/ov.cc Wed Apr 04 21:08:38 2012 -0700 +++ b/src/ov.cc Thu Apr 05 11:55:47 2012 -0700 @@ -87,9 +87,6 @@ #include "utils.h" #include "variables.h" -// Expand escape sequences even in single quoted strings (Matlab compatibility) -bool Vsingle_quote_escape_processing = false; - // We are likely to have a lot of octave_value objects to allocate, so // make the grow_size large. DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024); @@ -3047,42 +3044,3 @@ %!error is_dq_string () %!error is_dq_string ("foo", 2) */ - -DEFUN (single_quote_escape_processing, args, nargout, - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} single_quote_escape_processing ()\n\ -@deftypefnx {Built-in Function} {@var{old_val} =} single_quote_escape_processing (@var{new_val})\n\ -@deftypefnx {Built-in Function} {} single_quote_escape_processing (@var{new_val}, \"local\")\n\ -Query or set the internal variable that controls whether Octave processes\n\ -escape sequences within single quoted strings.\n\ -\n\ -Ordinarily, escape sequences such as \"\\n\" => newline are only processed\n\ -in double quoted strings. However, @sc{matlab} performs escape sequence\n\ -processing even for single quoted strings for certain functions. This\n\ -variable enables @sc{matlab} compatibility for these instances:\n\ -\n\ -@table @code\n\ -@item printf\n\ -@itemx sprintf\n\ -@itemx fprintf\n\ -Process format specification string @var{template}.\n\ -\n\ -@item error\n\ -Process format specification string @var{template}.\n\ -\n\ -@item regexp\n\ -@itemx regexpi\n\ -Process pattern string @var{pat}.\n\ -\n\ -@item regexprep\n\ -Process pattern string @var{pat} and replacement string @var{repstr}.\n\ -@end table\n\ -\n\ -When called from inside a function with the \"local\" option, the variable is\n\ -changed locally for the function and any subroutines it calls. The original\n\ -variable value is restored when exiting the function.\n\ -@seealso{printf, sprintf, fprintf, error, regexp, regexpi, regexprep}\n\ -@end deftypefn") -{ - return SET_INTERNAL_VARIABLE (single_quote_escape_processing); -} diff -r 8c988dabbe8e -r c67822beb7a4 src/ov.h --- a/src/ov.h Wed Apr 04 21:08:38 2012 -0700 +++ b/src/ov.h Thu Apr 05 11:55:47 2012 -0700 @@ -1387,7 +1387,4 @@ DEF_DUMMY_VALUE_EXTRACTOR (octave_value, octave_value ()) #undef DEF_DUMMY_VALUE_EXTRACTOR -// Expand escape sequences even in single quoted strings (Matlab compatibility) -extern bool Vsingle_quote_escape_processing; - #endif