Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement IDL based generators #447
Conversation
This comment has been minimized.
This comment has been minimized.
|
I've just implemented a massive rework of the type-generation - it's now really powerful, and will generate borrowed versions of types for arguments and will generate generic methods when appropriate. |
This comment has been minimized.
This comment has been minimized.
This was referenced Jan 28, 2018
This comment has been minimized.
This comment has been minimized.
|
Woo! This is looking great! |
This comment has been minimized.
This comment has been minimized.
|
I'm wondering if it might actually make sense to create a new crate instead under this repository, called |
This comment has been minimized.
This comment has been minimized.
|
Yeah, I don't really mind, is that what you'd prefer? |
This comment has been minimized.
This comment has been minimized.
|
I personally don't think it's worth creating a new repo. |
This comment has been minimized.
This comment has been minimized.
|
Wasn't talking about creating a new repo, just a new crate as a directory in this repo. If I'm not mistaken it seems like |
This comment has been minimized.
This comment has been minimized.
|
Oh sorry, yes that would make sense! |
This comment has been minimized.
This comment has been minimized.
edwin0cheng
commented
Jan 31, 2018
|
@Diggsey As i mentioned in koute/stdweb#92, will it works in Firefox ? |
This comment has been minimized.
This comment has been minimized.
|
@edwin0cheng not right now - at least not if you try do anything complex. I think this can (and should) be fixed from the stdweb side though. |
This comment has been minimized.
This comment has been minimized.
|
Looking great so far! Let me know when this can progress forward! |
This comment has been minimized.
This comment has been minimized.
|
@brendanzab I've realised that the IDL files are missing information on extensions - these are described via separate IDL embedded in XML in the Khronos WebGL repo. I would like to expose a mapping from "<extension name>" => "<IDL contents>" in the |
Diggsey
force-pushed the
Diggsey:webgl-gen
branch
from
0b42c8c
to
643c5ac
Feb 4, 2018
This comment has been minimized.
This comment has been minimized.
|
I've opened a separate PR to add extension support to The generated bindings are now up to 10,000 lines, and include support for all accepted WebGL extensions. There's also a "version-less" I've uploaded the generated documentation as I think it's quite interesting to read: |
This comment has been minimized.
This comment has been minimized.
Oh, missed this comment! Would have been helpful if you had have linked to it in the PR of #451! Yes, that sounds great. |
This comment has been minimized.
This comment has been minimized.
|
One thing that might be cool would be to pull out the "summary" and "function" sections from the XML files and attach them as doc-comments to the generated code. |
This comment has been minimized.
This comment has been minimized.
|
Ooooh! Wondering if we could do that for all the generators |
Diggsey
force-pushed the
Diggsey:webgl-gen
branch
from
643c5ac
to
43294b0
Feb 5, 2018
Diggsey
added some commits
Jan 21, 2018
Diggsey
added some commits
Feb 26, 2018
This comment has been minimized.
This comment has been minimized.
|
@brendanzab stdweb 0.4.0 was released, and I've updated the PR to use that. It should be ready for you to review now! |
This comment has been minimized.
This comment has been minimized.
|
Woo, looking now! |
brendanzab
reviewed
Feb 27, 2018
| &TypeKind::Primitive(ref p) => ProcessedResult::simple(p.name()), | ||
| &TypeKind::String => ProcessedResult::simple("String"), | ||
| &TypeKind::ArrayBuffer | &TypeKind::ArrayBufferView => ProcessedResult::simple("ArrayBuffer"), | ||
| &TypeKind::BufferSource => unimplemented!("BufferSource not supported in output"), |
This comment has been minimized.
This comment has been minimized.
brendanzab
Feb 27, 2018
Owner
Should we be using unimplemented! here? Are you planning to add support for this later?
This comment has been minimized.
This comment has been minimized.
Diggsey
Mar 3, 2018
Author
Collaborator
BufferSource is not currently used in the WebGL IDL files, so I haven't bothered implementing it.
brendanzab
reviewed
Feb 27, 2018
| }).collect(); | ||
|
|
||
| let rust_args = args.iter().map(|a| a.arg.clone()).collect::<Vec<_>>().join(", "); | ||
| let js_args = args.iter().map(|a| a.js_arg.clone()).collect::<Vec<_>>().join(", "); |
This comment has been minimized.
This comment has been minimized.
brendanzab
Feb 27, 2018
Owner
itertools has join if you wanted to use that to skip the intermediate collect!
This comment has been minimized.
This comment has been minimized.
Diggsey
Mar 3, 2018
Author
Collaborator
Didn't seem worth it - this only happens at build time, and the cost of the extra dependency would outweigh any minor performance improvements.
brendanzab
reviewed
Feb 27, 2018
|
|
||
| // Strings | ||
| DOMString | USVString => TypeKind::String, | ||
| ByteString => unimplemented!(), |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
brendanzab
reviewed
Feb 27, 2018
|
|
||
| Some((field.name, Field { | ||
| type_ | ||
| })) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Would be nice to Run rustfmt on this if you don't mind! |
Diggsey
added some commits
Mar 4, 2018
This comment has been minimized.
This comment has been minimized.
|
@brendanzab done |
This comment has been minimized.
This comment has been minimized.
|
@brendanzab hey is this good to go? |
This comment has been minimized.
This comment has been minimized.
|
Ack - left this one sit around in my notifications making me feel guilty for too long! Merging! |
brendanzab
merged commit 4f081d2
into
brendanzab:master
Apr 1, 2018
1 check passed
Diggsey
deleted the
Diggsey:webgl-gen
branch
Apr 1, 2018
This comment has been minimized.
This comment has been minimized.
|
Thanks! Are you happy to publish the new crate(s) to crates.io? |
This comment has been minimized.
This comment has been minimized.
|
Yup, will do. I'll add you to the crate owners too. |
This comment has been minimized.
This comment has been minimized.
|
What needs to be published - just the new crates? |
This comment has been minimized.
This comment has been minimized.
|
Hum, when publishing I get:
|
This comment has been minimized.
This comment has been minimized.
|
Oh, I think I need to bump the khronos_api version |
This comment has been minimized.
This comment has been minimized.
|
Oh, and probably also publish those changes |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Done! |

Diggsey commentedJan 25, 2018
Example generated bindings:
https://gist.github.com/Diggsey/c8a4cb93c7d5643d20203401ead178a7
This can't be merged until:
CanvasElementtype