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

Incorrect translation of fixed size array to CArray #197

Open
david-bouyssie opened this issue Jun 3, 2021 · 3 comments
Open

Incorrect translation of fixed size array to CArray #197

david-bouyssie opened this issue Jun 3, 2021 · 3 comments

Comments

@david-bouyssie
Copy link

For this given struct (see https://github.com/libexpat/libexpat/blob/master/expat/lib/expat.h#L507):

typedef struct {
  int map[256];
  void *data;
  int(XMLCALL *convert)(void *data, const char *s);
  void(XMLCALL *release)(void *data);
} XML_Encoding;

The produced definition is:

type struct_XML_Encoding = CStruct4[CArray[CInt, Nat.Digit[Nat._2, Nat.Digit[Nat._5, Nat._6]]], Ptr[Byte], CFunctionPtr2[Ptr[Byte], CString, CInt], CFunctionPtr1[Ptr[Byte], Unit]]

There are two minor problems here:

  • Nat.Digit is missing a number suffix
  • CFunctionPtrX should be CFuncPtrX

However the major problem is Nat.Digit[Nat._2, Nat.Digit[Nat._5, Nat._6]] which should simplified I guess toNat.Digit3[Nat._2, Nat._5, Nat._6]

@david-bouyssie david-bouyssie changed the title Incorrect translation of fixed sized array to CArray Incorrect translation of fixed size array to CArray Jun 3, 2021
@ekrich
Copy link
Member

ekrich commented Jun 3, 2021

@david-bouyssie This has changed from 0.3.9 to 0.4.0 as you know. This has been changed in the following PR. #195

I still haven't worked through all the issues. I have been running the following to test:

sbt:scala-native-bindgen> verify

@david-bouyssie
Copy link
Author

Ok, sorry I should have checked that before.
I thought it was a distinct issue.
Glad you already fixed that one.

@ekrich
Copy link
Member

ekrich commented Jun 4, 2021

It is not fixed yet so I would leave this open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants