This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: CDL question
- From: John Dallaway <john at dallaway dot org dot uk>
- To: Sergei Gavrikov <sergei dot gavrikov at gmail dot com>
- Cc: eCos discuss list <ecos-discuss at ecos dot sourceware dot org>
- Date: Sat, 06 Jun 2009 16:17:06 +0100
- Subject: [ECOS] Re: CDL question
- References: <20090606140119.GA13837@ubuntu.local>
Hi Sergei
Sergei Gavrikov wrote:
> What I try to do using CDL expressions
>
> if {board == A} {
> default_value A
> legal_values {A B C}
> } else if {board == B} {
> default_value X
> legal_values {X Y Z}
> }
>
> and using in two-lines coding I could get only, for example,
>
> default_value B
> legal_values {A B C X Y Z}
>
> Thanks for any comments on it.
The following should work, but there may be a more elegant approach:
default_value { (board == "A") ? "A" : "X" }
legal_values {
((board == "A") ? "A" : "")
((board == "A") ? "B" : "")
((board == "A") ? "C" : "")
((board == "B") ? "X" : "")
((board == "B") ? "Y" : "")
((board == "B") ? "Z" : "")
}
John Dallaway
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss