On 14 August 2012 23:15, Michael Roth <mdr...@linux.vnet.ibm.com> wrote:
> On Tue, Aug 14, 2012 at 08:41:56PM +0100, Peter Maydell wrote:
>> On 14 August 2012 17:27, Michael Roth <mdr...@linux.vnet.ibm.com> wrote:
>> > +In our *SerialDevice* example, the *CharDriverState* pointer reflects the 
>> > host
>> > +backend that we use to send serial output to the user.  This is only 
>> > assigned
>> > +during device construction and never changes.  This means we can add an
>> > +**immutable** marker to it:
>> > +
>> > +    QIDL_START(SerialDevice, state)
>> > +    typedef struct SerialDevice {
>> > +        SysBusDevice parent;
>> > +
>> > +        uint8_t thr;            // transmit holding register
>> > +        uint8_t lsr;            // line status register
>> > +        uint8_t ier;            // interrupt enable register
>> > +
>> > +        int int_pending;        // whether we have a pending queued 
>> > interrupt
>> > +        CharDriverState *chr QIDL(immutable);
>> > +    } SerialDevice;
>> > +    QIDL_END(SerialDevice)
>>
>> I think it would be nicer to have a QIDL input format from which the 
>> structure
>> is generated as one of the outputs; that would avoid having to have some of
>> this ugly QIDL() markup.
>
> Some kind of inline/embedded input format, or external (like QAPI
> schemas)?

External, I think. I just kinda feel in the long run it's going to be cleaner
and more flexible to have a defined syntax we generate things from
rather than trying to mark up C.

-- PMM

Reply via email to