Re: [sv-bc] Hex escape codes in string literals


Subject: Re: [sv-bc] Hex escape codes in string literals
From: Shalom Bresticker (Shalom.Bresticker@motorola.com)
Date: Sun Feb 08 2004 - 03:01:52 PST


Note that in 1364-2001, the ambiguity of "\ddd" was resolved
(issue #119) by changing in Table 1 and Table 66 the text from

"A character specified in 1-3 octal digits (0<= d <= 7)"
to
"A character specified in 1-3 octal digits (0 <= d <= 7).
If less than three characters are used, the following character
must not be an octal digit. Implementations may issue an error
if the character represented is greater than \377."

Shalom

"Rishiyur S. Nikhil" wrote:

> You mean:
>
> ab\o7\o61 and ab\x7\x31
>
> i.e., I want the literal character '1' ('\o61' or '\x31')
> immediately after the escape code.
>
> My point was that
> in this style of doing things, even though it is a printable
> character that does not normally need an escape code, I'd be
> forced to use one, which we can avoid by setting a maximum
> number of digits (3 digits for octal, 2 for hex).
>
> > however I admit that 007 does have a certain je n'sais quoi...
>
> (Yes, that's why I chose it! :-))
>
> Nikhil
>
> Michael McNamara wrote:
>
> >
> > You could also do:
> >
> > ab\o7\o1 and ab\x7\x1 to get \o40\o41\o07\o01
> >
> > however I admit that 007 does have a certain je n'sais quoi...
> >
> > -mac
> >
> > -- On Feb 4 2004 at 11:31, Rishiyur S. Nikhil sent a message:
> > > To: sv-bc@eda.org
> > > Subject: "[sv-bc] Hex escape codes in string literals"
> > > Background from V2K:
> > >
> > > The the V2K LRM, "Section 2.6.3 Special characters in strings" says
> > > that the \ddd escape can have from 1-3 octal digits.
> > >
> > > But what if we want a string where the escaped character is
> > > followed immediately by a literal octal character? How to avoid
> > > the literal octal character from being part of the escape code?
> > >
> > > E.g., a string containing the following characters:
> > >
> > > 'a' 'b' '\o7' '1'
> > >
> > > can't be written as: "ab\o71" (means 'a' 'b' '\o71' ?)
> > >
> > > No problem: since the escape code has a maximum of 3 octal digits,
> > > we can use 3 digits for the escape code to ``push out'' the
> > > following literal octal digit beyond the code:
> > >
> > > "ab\o0071"
> > >
> > > Issue in SV:
> > >
> > > In the SV LRM, "Section 2.6 String literals", says:
> > >
> > > SystemVerilog adds the following special string characters:
> > > ...
> > > \x02 hex number
> > >
> > > but does not specify the number of hex digits required (exactly 2?
> > > from 1-2? any number of hex digits?).
> > >
> > > I suggest specifying that it must be 1 or 2 hex digits.
> > >
> > > Nikhil
> > >

--
Shalom Bresticker                           Shalom.Bresticker@motorola.com
Design & Reuse Methodology                             Tel: +972 9 9522268
Motorola Semiconductor Israel, Ltd.                    Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL                       Cell: +972 50 441478



This archive was generated by hypermail 2b28 : Sun Feb 08 2004 - 03:09:12 PST