On 06/07/2010 03:30 AM, Holger Hans Peter Freyther wrote:
        - Add stdint.h types to cint.h enum and code
>    - Add these to CObject.st

It shouldn't be necessary to add all of stdint.h. You just need to add long long (i.e. hardcoded 64-bit) values. Then, all values except #long/#ulong trivially map to one intXX_t/uintXX_t and you just need to cut/paste classes and CDATA_* values.

You can even do this last, since it would only take some search-and-replace to change your header file parser

        - Attempt to add bitfields

This is not hard if you do it entirely in CStruct. It may require some small refactoring, but nothing incredibly difficult. For the syntax I suggest:

    #( ....
       ((#bitfield1  3)
        (#bitfield2  4)
        (#bitfield3  1)) #uint)

since in non-packed structs the type will give you the alignment.

Feel free to add methods like

Integer extend [
    truncateToBits: n [
        "Keep the lowest N bits of the receiver."
        ^self bitAnd: (1 bitShift: n) - 1
    ]

    signExtendToBits: n [
        "Keep the lowest N bits of the receiver and sign extend them
         using two's complement."
        | mask |
        mask := 1 bitShift: n - 1.
        ^(self bitAnd: mask - 1) - (self bitAnd: mask)
    ]
]

        - Maybe start on the CPP/C Parser and see if what is missing to
           parse our header files.

The C parser is a bit hard mostly because there is no documentation on its state (I found none in 1.1.5). I think it's simpler to try to whip out a simple converter in Perl or awk, like it was done for the GTK+ bindings.

Paolo

_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to