diff options
| author | 2023-05-29 11:37:32 +0200 | |
|---|---|---|
| committer | 2023-05-29 11:37:32 +0200 | |
| commit | 1c04435e5d33378ffa8eca65ca1ed35f3f9f4134 (patch) | |
| tree | eab923f7dde10ba1d71d8efe025891e743009203 /common.h | |
| parent | 84824a0ed3a0cf90728078b74ca39778c51e60b9 (diff) | |
field access
Diffstat (limited to 'common.h')
| -rw-r--r-- | common.h | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -162,11 +162,16 @@ struct enumvar { union { vlong i; uvlong u; }; }; -struct field { - const char *name; +struct fielddata { union type t; ushort off; - uchar bitsiz, bitoff; + uchar bitsiz, + bitoff : 6, + qual : 2; +}; +struct namedfield { + const char *name; + struct fielddata f; }; struct typedata { @@ -174,14 +179,22 @@ struct typedata { ushort id; union { union type child; + struct { /* functions */ + const uchar *quals; /* packed N x 2bit array (NULL if no param has quals) */ + const union type *param; + }; struct { /* aggregates */ - const uchar *quals; /* packed N x 2bit array (NULL if no member has quals) */ - union { - struct field *fld; - const union type *param; - }; + /* struct fieldmap { + union { + struct field *fs; + int *is; + }; + const char **k; + uint ; + } *fmap; */ + struct namedfield *fld; }; - struct { + struct { /* enum */ uchar backing; struct enumvar *var; }; @@ -189,7 +202,7 @@ struct typedata { union { uint arrlen; /* array */ struct { - short nmemb; + short nmemb; /* functions, aggregates, enums */ uchar align; union { struct { /* function */ @@ -231,6 +244,7 @@ union type mkptrtype(union type, int qual); union type mkarrtype(union type t, int qual, uint n); union type mkfntype(union type ret, uint n, const union type *, const uchar *qual, bool kandr, bool variadic); union type mktagtype(const char *name, struct typedata *td); +bool getfield(struct fielddata *res, union type, const char *); union type completetype(const char *name, int id, struct typedata *td); union type typedecay(union type); bool assigncompat(union type dst, union type src); |