Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Construct high-level datatypes for C structs #39

Open
edsko opened this issue Aug 2, 2024 · 2 comments
Open

Construct high-level datatypes for C structs #39

edsko opened this issue Aug 2, 2024 · 2 comments
Labels
confirmed-use-case Features for which there are client-confirmed use cases

Comments

@edsko
Copy link
Collaborator

edsko commented Aug 2, 2024

This is the high-level counterpart to #14. For example, a field of type Ptr CChar in the low-level API might have type String the high-level API.

@edsko edsko added this to the 3: High-level API milestone Aug 2, 2024
@edsko
Copy link
Collaborator Author

edsko commented Aug 2, 2024

Here (and for all other high-level types, such as #40, #18) it's conceivable that we might want to use existing type instead of generating one.

@edsko edsko added the confirmed-use-case Features for which there are client-confirmed use cases label Aug 3, 2024
@edsko
Copy link
Collaborator Author

edsko commented Aug 3, 2024

One complication to consider here is that some structs might have multiple fields that logically are a single value, for example:

typedef struct
{
    acme_sum sum;
    acme_flag flags;
    size_t iq_len;
    acme_iq* iq_arr;
} acme_struct;

where the pair of iq_len and iq_arr is one entity, so that we might want to generate something like

data AcmeStruct = AcmeStruct {
    asSum :: AcmeSum
  , asFlags :: AcmeFlagSet
  , asIqArr :: Vector.Storable.Vector AcmeIQ
  }

(Here and elsewhere, we need to think about array ownership also.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-use-case Features for which there are client-confirmed use cases
Projects
None yet
Development

No branches or pull requests

1 participant