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


Subject: Re: [sv-bc] Hex escape codes in string literals
From: Michael McNamara (mac@verisity.com)
Date: Wed Feb 04 2004 - 10:01:14 PST


Indeed, thanks.

-- On Feb 4 2004 at 12:59, Rishiyur S. Nikhil sent a message:
> To: mac@verisity.com, sv-bc@eda.org
> Subject: "Re: [sv-bc] Hex escape codes in string literals"
> 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
> > >
>
>



This archive was generated by hypermail 2b28 : Wed Feb 04 2004 - 10:08:20 PST