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

Improve the wrapper helper #1844

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions wrapperhelper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ The first file is a `C` file containing every declaration required. The second f

The support file may contain pragma declarations of the form
```c
#pragma wrappers type-letters c TYPE
#pragma wrappers type_letters c TYPE
#pragma wrappers type_letters_strict c TYPE
```
where `TYPE` is a `type-name`. This marks the *exact* type `TYPE` as being a complex type though with a conversion as `c` (which may be multiple characters). Meaning:
where `TYPE` is a `type-name`. The second form marks the *exact* type `TYPE` as being a complex type though with a conversion as `c` (which may be multiple characters), while the first marks the type `TYPE`, regardless of type qualifers (`_Atomic`, `const`, `restrict`, `volatile`). Meaning:
- if a parameter has type `TYPE`, the character output will be `c`;
- if a parameter has a pointer to `TYPE`, or a structure containing `TYPE`, the output will be a `GOM` function.

Declarations of the form
```c
#pragma wrappers mark_simple TAG
```
will mark the structure or union with tag `TAG`, or the structure or union aliased to `TAG` by a `typedef` if no such structure exist, as simple. This means that a pointer to such a structure will have a character output of `p`.
This is not the same as making the pointer to the structure a complex type with conversion as `p` as e.g. pointers to pointers will behave differently.

System headers included (directly or indirectly) by the support file are overriden by the files in `include-fixed`.

The first three lines of the input are ignored.
Expand Down
15 changes: 4 additions & 11 deletions wrapperhelper/example-libc.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,7 @@
#include <wordexp.h>

#pragma wrappers type_letters S FILE*
#pragma wrappers type_letters S const FILE*
#pragma wrappers type_letters S FILE* restrict
#pragma wrappers type_letters S const FILE* restrict
#pragma wrappers type_letters p FTS*
#pragma wrappers type_letters p const FTS*
#pragma wrappers type_letters p FTS64*
#pragma wrappers type_letters p const FTS64*
#pragma wrappers type_letters p glob_t*
#pragma wrappers type_letters p const glob_t*
#pragma wrappers type_letters p glob64_t*
#pragma wrappers type_letters p const glob64_t*
#pragma wrappers mark_simple FTS
#pragma wrappers mark_simple FTS64
#pragma wrappers mark_simple glob_t
#pragma wrappers mark_simple glob64_t
Loading