Hmm, this looks like a current limitation of the webidl binder,

https://github.com/kripken/emscripten/blob/master/tools/webidl_binder.py#L695

Seems like it only handles one "::" (or none). In principle it should be
straightforward to generalize it, although it has some special logic to
check if the name before the "::" is a class or not, and it's not
immediately obvious to me how that would work for more elements.

On Tue, Jan 31, 2017 at 7:59 PM, Kristina Chodorow <[email protected]>
wrote:

> I'm trying to write an IDL to describe http://bulletphysics.
> org/Bullet/BulletFull/btSoftBody_8h_source.html#l00486, basically:
>
> class btSoftBody {
>   struct Joint {
>     struct eType {
>       enum _ {
>         Linear, Angular, Contact
>       };
>     };
>   };
> };
>
> However, I can't figure out how to express this in my .idl file. Based on
> https://kripken.github.io/emscripten-site/docs/porting/
> connecting_cpp_and_javascript/WebIDL-Binder.html#enums, I tried:
>
> enum btSoftBody_Joint_eType__ {
>   "btSoftBody::Joint::eType::Linear",
>   "btSoftBody::Joint::eType::Angular",
>   "btSoftBody::Joint::eType::Contact"
> };
>
> [Prefix="btSoftBody::Joint::"]
> interface eType {
> };
>
> ... // So on for Joint and btSoftBody.
>
> But that gives me:
>
> Traceback (most recent call last):
>   File "/Users/k/emsdk_portable/emscripten/incoming/tools/webidl_binder.py",
> line 709, in <module>
>     raise Exception("Illegal enum value %s" % value)
>
> So then I tried:
>
> enum btSoftBody_Joint_eType__ {
>   "eType::Linear",
>   "eType::Angular",
>   "eType::Contact"
> };
>
> This gets further (it generates the cpp bindings) but when it tries to
> compile them, the types don't resolve to anything:
>
> glue.cpp:4539:1: error: unknown type name 'btSoftBody_Joint_eType__'
> btSoftBody_Joint_eType__ EMSCRIPTEN_KEEPALIVE 
> emscripten_enum_btSoftBody_Joint_eType___Linear()
> {
> ^
> glue.cpp:4539:26: error: expected unqualified-id
> btSoftBody_Joint_eType__ EMSCRIPTEN_KEEPALIVE 
> emscripten_enum_btSoftBody_Joint_eType___Linear()
> {
>                          ^
> /Users/k/emsdk_portable/emscripten/incoming/system/
> include/emscripten/emscripten.h:64:30: note: expanded from macro
> 'EMSCRIPTEN_KEEPALIVE'
> #define EMSCRIPTEN_KEEPALIVE __attribute__((used))
>                              ^
> glue.cpp:4542:1: error: unknown type name 'btSoftBody_Joint_eType__'
> ...
>
> Does anyone know what I'm doing wrong?  Or how to express this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to