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

translate-c: can't handle goto #1

Open
1 task
kassane opened this issue Jul 4, 2022 · 5 comments
Open
1 task

translate-c: can't handle goto #1

kassane opened this issue Jul 4, 2022 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kassane
Copy link
Owner

kassane commented Jul 4, 2022

Ref:

@kassane
Copy link
Owner Author

kassane commented Jul 4, 2022

I will try to follow up with some alternative with the goal of bringing a fully zig (libc non-dependent) solution.

Then I will try to link to the zig project replacing libc++(LLVM).
Example project:

cc: @eddyb

@kassane kassane added the help wanted Extra attention is needed label Jul 5, 2022
@kassane
Copy link
Owner Author

kassane commented Dec 29, 2022

Currently zig is still not translating goto and labelstmt.
Therefore it was necessary to remove it from the original code and try to retranslate it to zig.

And it worked normally with the zig translated version. However, there are still dependencies on the C API.
The next step, to refactor the code so that it no longer depends on the C API.

@kassane
Copy link
Owner Author

kassane commented Dec 29, 2022

During the initial refactoring process it was still missing to replace these implementations equivalently in zig std.

// C API
pub extern fn memmove(__dst: ?*anyopaque, __src: ?*const anyopaque, __len: c_ulong) ?*anyopaque;
pub extern fn memcmp(__s1: ?*const anyopaque, __s2: ?*const anyopaque, __n: c_ulong) c_int;
pub extern fn memcpy(__dst: ?*anyopaque, __src: ?*const anyopaque, __n: c_ulong) ?*anyopaque;

Also, the malloc and free obtained by std.c.

@kassane kassane added the enhancement New feature or request label Dec 29, 2022
@kassane
Copy link
Owner Author

kassane commented Dec 29, 2022

Any suggestions? Please!
@kubkon

@kassane
Copy link
Owner Author

kassane commented Dec 29, 2022

I believe that some anyopaque pointers will need to be removed for zig types. During this process will include in some steps the comptime type to speed up some redefinitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant