* CDL values
@ 2005-04-05 15:12 Gary Thomas
2005-04-05 15:32 ` GONZALEZ Laurent
2005-04-05 15:48 ` Bart Veer
0 siblings, 2 replies; 4+ messages in thread
From: Gary Thomas @ 2005-04-05 15:12 UTC (permalink / raw)
To: eCos development
I'd like to have a CDL variable, flavor data, whose value
is specified as a single character. I've not found any way
to write this, other than using the ASCII HEX equivalent.
If I write this:
cdl_option XYZ {
flavor data
default_value 'a'
}
I always get a syntax error.
Ideas? Is this possible?
n.b. this is used in some C code where I'd like to say
a = ch - XYZ;
instead of
a = ch = 'a';
Thanks
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CDL values
2005-04-05 15:12 CDL values Gary Thomas
@ 2005-04-05 15:32 ` GONZALEZ Laurent
2005-04-05 15:48 ` Bart Veer
1 sibling, 0 replies; 4+ messages in thread
From: GONZALEZ Laurent @ 2005-04-05 15:32 UTC (permalink / raw)
To: ecos-devel
On Tue, 05 Apr 2005 09:11:52 -0600
Gary Thomas <gary@mlbassoc.com> wrote:
> I'd like to have a CDL variable, flavor data, whose value
> is specified as a single character. I've not found any way
> to write this, other than using the ASCII HEX equivalent.
>
> If I write this:
> cdl_option XYZ {
> flavor data
> default_value 'a'
> }
> I always get a syntax error.
>
> Ideas? Is this possible?
>
> n.b. this is used in some C code where I'd like to say
> a = ch - XYZ;
> instead of
> a = ch = 'a';
>
This is a bit ugly, but the following should do the job:
cdl_option XYZ {
flavor data
default_value \"a\"
define_format "'%s'"
}
regards.
--
GONZALEZ Laurent
------------------------------------
Real-Time OS Team Leader
TRANGO Systems - Groupe ELSYS Design
74, avenue des Martyrs
38000 Grenoble
Tel: 33 (0)4 76 12 28 44
Fax: 33 (0)4 76 12 28 49
http://www.trango-systems.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CDL values
2005-04-05 15:12 CDL values Gary Thomas
2005-04-05 15:32 ` GONZALEZ Laurent
@ 2005-04-05 15:48 ` Bart Veer
2005-04-05 18:50 ` Gary Thomas
1 sibling, 1 reply; 4+ messages in thread
From: Bart Veer @ 2005-04-05 15:48 UTC (permalink / raw)
To: gary; +Cc: ecos-devel
>>>>> "Gary" == Gary Thomas <gary@mlbassoc.com> writes:
Gary> I'd like to have a CDL variable, flavor data, whose value
Gary> is specified as a single character. I've not found any way
Gary> to write this, other than using the ASCII HEX equivalent.
Gary> If I write this:
Gary> cdl_option XYZ {
Gary> flavor data
Gary> default_value 'a'
Gary> }
Gary> I always get a syntax error.
Gary> Ideas? Is this possible?
Sure, but not that way. In CDL as in Tcl everything is really a
string, there is no concept of individual chars. Instead you should be
able to do something like (untested):
cdl_option XYZ {
flavor data
default_value { "'a'" }
legal_values {
"'a'" "'b'" "'c'" "'d'" "'e'" "'f'" "'g'" "'h'" "'i'"
"'j'" "'k'" "'l'" "'m'" "'n'" "'o'" "'p'" "'q'" "'r'"
"'s'" "'t'" "'u'" "'v'" "'w'" "'x'" "'y'" "'z'"
}
}
The outer braces stop the Tcl interpreter from handling the quotes, so
CDL sees default_value "'a'" and will treat this as the string 'a'.
The legal_values list enforces the single character limit.
Alternatively you can leave out the ' marks from the values and put
them in with a define_format:
cdl_option XYZ {
flavor data
default_value { "a" }
legal_values {
"a" "b" "c" "d" "e" "f" "g" "h" "i"
"j" "k" "l" "m" "n" "o" "p" "q" "r"
"s" "t" "u" "v" "w" "x" "y" "z"
}
define_format "'%s'"
}
Bart
--
Bart Veer eCos Configuration Architect
http://www.ecoscentric.com/ The eCos and RedBoot experts
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: CDL values
2005-04-05 15:48 ` Bart Veer
@ 2005-04-05 18:50 ` Gary Thomas
0 siblings, 0 replies; 4+ messages in thread
From: Gary Thomas @ 2005-04-05 18:50 UTC (permalink / raw)
To: Bart Veer; +Cc: eCos development
On Tue, 2005-04-05 at 16:48 +0100, Bart Veer wrote:
> >>>>> "Gary" == Gary Thomas <gary@mlbassoc.com> writes:
>
> Gary> I'd like to have a CDL variable, flavor data, whose value
> Gary> is specified as a single character. I've not found any way
> Gary> to write this, other than using the ASCII HEX equivalent.
>
> Gary> If I write this:
> Gary> cdl_option XYZ {
> Gary> flavor data
> Gary> default_value 'a'
> Gary> }
> Gary> I always get a syntax error.
>
> Gary> Ideas? Is this possible?
>
> Sure, but not that way. In CDL as in Tcl everything is really a
> string, there is no concept of individual chars. Instead you should be
> able to do something like (untested):
>
> cdl_option XYZ {
> flavor data
> default_value { "'a'" }
> legal_values {
> "'a'" "'b'" "'c'" "'d'" "'e'" "'f'" "'g'" "'h'" "'i'"
> "'j'" "'k'" "'l'" "'m'" "'n'" "'o'" "'p'" "'q'" "'r'"
> "'s'" "'t'" "'u'" "'v'" "'w'" "'x'" "'y'" "'z'"
> }
> }
>
> The outer braces stop the Tcl interpreter from handling the quotes, so
> CDL sees default_value "'a'" and will treat this as the string 'a'.
> The legal_values list enforces the single character limit.
>
> Alternatively you can leave out the ' marks from the values and put
> them in with a define_format:
>
> cdl_option XYZ {
> flavor data
> default_value { "a" }
> legal_values {
> "a" "b" "c" "d" "e" "f" "g" "h" "i"
> "j" "k" "l" "m" "n" "o" "p" "q" "r"
> "s" "t" "u" "v" "w" "x" "y" "z"
> }
> define_format "'%s'"
> }
I chose the latter and it works fine, thanks.
--
------------------------------------------------------------
Gary Thomas | Consulting for the
MLB Associates | Embedded world
------------------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-05 18:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-05 15:12 CDL values Gary Thomas
2005-04-05 15:32 ` GONZALEZ Laurent
2005-04-05 15:48 ` Bart Veer
2005-04-05 18:50 ` Gary Thomas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).