[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #39774] Support octal and hexadecimal sprintf
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #39774] Support octal and hexadecimal sprintf escape sequences |
Date: |
Wed, 14 Aug 2013 20:24:55 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 |
Follow-up Comment #2, bug #39774 (project octave):
We already do this for single-quoted strings in regular expressions. Take a
look at regexp.cc
std::string pattern = args(1).string_value ();
if (error_state)
return retval;
// Matlab compatibility.
if (args(1).is_sq_string ())
pattern = do_regexp_ptn_string_escapes (pattern);
The function do_regexp_ptn_string_escapes is special because the escape
sequences are not qute the same as the ordinary *printf family. However, we
already have do_string_escapes in util.cc which does escape sequence
processing. You could code the same thing in file-io.cc for printf and check
is_sq_string() before calling do_string_escapes.
do_string_escapes() would need to be modified to support hexadecimal and octal
though. Right now it just does the basics like "\n" -> NEWLINE.
Incidentally, I hate Matlab's single option for a character string delimiter.
It makes everything totally confusing in Octave because we *do* have
non-interpreted single-quoted strings, except where they interact with a
Matlab function in which case they are treated as double-quoted strings.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39774>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/