Re: Packet definition variable length list on output

"Joe Pham" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I ran into a similar situation earlier, and I think a more elegant solution would be to provide the capability of optionally setting/changing the attributes of a protocol field.  For example:

* LIST {'createdefault': True} +numbers:
    * CSVINT +numbertype 
    * CSVSTRING {'quotechar': None, 'default': ""} +number

would become something like:

* LIST {'createdefault': True} +numbers:
    * CSVINT +numbertype 
    * CSVSTRING {'quotechar': None, 'default': ""} ++number

The '++' modifier indicates that the attributes of this field can be set.  Internally, this would generate a method called 'set_number_attr(**kwargs)'.  Then later in users code:

some_obj.set_number_attr(terminator=None)  # turn off terminator

This approach would not impact existing protocol files & generated code, yet provides the capability to set/change protocol field attributes.

Suggestions and comments are welcome.

-Joe Pham




______________________________________________________________________
NetZero Is Giving Away $3,000 A Day!
Sign up for NetZero HiSpeed 3G with Instant On!
Visit http://www.netzero.com/3Gsweeps TODAY for your chance to win!



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.