I am awarding today's "idiot of the day" award to myself, for failing to recognize that no new core types are required for C at all. What we need is a target-specific module (we already have some of those) that does something like:
;; On 32-bit platforms: (defstruct c_short :val val: int16) (defstruct c_int :val val:int32) (defstruct c_long :val val:int32) ;; On LP64 platforms: (defstruct c_short :val val: int16) (defstruct c_int :val val:int32) (defstruct c_long :val val:int64) ;; On ILP64 platforms: (defstruct c_short :val val: int16) (defstruct c_int :val val:int64) (defstruct c_long :val val:int64) (definstance (Arith c_short) + = (lambda (x y) (c_short (+ x.val y.val))) - = (lambda (x y) (c_short (+ x.val y.val))) ...) This relies on the calling convention requirement that structs whose size is the same as a scalar are passed in registers. We can, if necessary, introduce a DECLARE form for this. The remaining issue is pretty printing, which is something we need to look at more generally. shap _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
