This is the mail archive of the
ecos-devel@sources.redhat.com
mailing list for the eCos project.
Re: CDL values
- From: Bart Veer <bartv at ecoscentric dot com>
- To: gary at mlbassoc dot com
- Cc: ecos-devel at ecos dot sourceware dot org
- Date: Tue, 5 Apr 2005 16:48:11 +0100 (BST)
- Subject: Re: CDL values
- References: <1112713912.1985.120.camel@hermes>
>>>>> "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