-
Notifications
You must be signed in to change notification settings - Fork 131
[ffigen] Vibe coded prototype of transformer API #3482
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
1b014b7
7044019
39c2a1b
bd69dfe
66b3ab2
68bba3a
dbba048
dcd9218
4e08daf
36358a9
cc8cb0b
13f4370
c2ed9c8
30fde52
e1fb622
173954c
22839e7
983d31f
cceba6d
1de61b7
bd53b4f
a532462
b86079b
1b767f7
b57df8c
2b5a5b3
4f3aacc
e60f0c8
ac6d86f
3df1a17
a2006b2
eaad4da
c4b1e14
98c09b9
c425c00
eb0f393
aa9fb00
a68ad13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,21 +12,17 @@ void main() { | |
| headers: Headers( | ||
| entryPoints: [packageRoot.resolve('third_party/miniaudio.h')], | ||
| ), | ||
| functions: Functions( | ||
| include: (decl) => { | ||
| visitors: const [ | ||
| IncludeSetVisitor({ | ||
| 'ma_engine_init', | ||
| 'ma_engine_play_sound', | ||
| 'ma_engine_uninit', | ||
| }.contains(decl.originalName), | ||
| recordUse: (_) => true, | ||
| ), | ||
| structs: Structs( | ||
| include: (decl) => {'ma_engine'}.contains(decl.originalName), | ||
| ), | ||
| enums: Enums( | ||
| include: (decl) => {'ma_result'}.contains(decl.originalName), | ||
| silenceWarning: true, | ||
| ), | ||
| 'ma_engine', | ||
| 'ma_result', | ||
| }), | ||
| RecordUseVisitor(), | ||
| ], | ||
| enums: const Enums(silenceWarning: true), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, we need to think where to put everything that doesn't end up in visitors that fit next to the declaration-type-specific config before. How many of such elements are there?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WDYM? I figured we'd just leave those fields where they are, in the hierarchy. Are you suggesting we delete the whole existing hierarchy? |
||
| output: Output( | ||
| dartFile: packageRoot.resolve('lib/src/third_party/miniaudio.g.dart'), | ||
| recordUseMapping: packageRoot.resolve( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,12 +9,16 @@ import 'package:meta/meta.dart'; | |
|
|
||
| import '../code_generator.dart'; | ||
| import '../ffigen.dart'; | ||
| import '../public_ast/public_ast.dart' show Visitor; | ||
| import 'config_types.dart'; | ||
|
|
||
| /// The generator that generates bindings for `dart:ffi` from C and Objective-C | ||
| /// headers. | ||
| // TODO: Add a code snippet example. | ||
| final class FfiGenerator { | ||
| /// User custom visitors to modify/filter AST elements. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the other fields are called "configuration". Maybe we should say something along the lines of: /// Visitors to configure the generation options for target language declarations.
///
/// You can filter:
/// code snippet
///
/// You can rename:
/// code snippet
///
/// The visitors run in order.
/// some explanation or example |
||
| final List<Visitor>? visitors; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In which order do these run?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One at a time, first to last.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add that to the doc comment :)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a difference between setting this to |
||
|
|
||
| /// The configuration for header parsing of [FfiGenerator]. | ||
| final Headers headers; | ||
|
|
||
|
|
@@ -88,6 +92,7 @@ final class FfiGenerator { | |
| final Uri? libclangDylib; | ||
|
|
||
| const FfiGenerator({ | ||
| this.visitors, | ||
| this.headers = const Headers(), | ||
| this.enums = Enums.excludeAll, | ||
| this.functions = Functions.excludeAll, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.