This is the mail archive of the ecos-devel@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CDL values


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]