Creating WebIDL files from existing .idl files and using webidl_binder.py

10 views
Skip to first unread message

Balázs Varga

unread,
Nov 3, 2022, 9:16:20 AM11/3/22
to emscripten-discuss
Hi All,


I have a lot of .idl files from a project like this one:
There are two .idl example:

Is it possible to #include existing .idl files with webIDL and then creating .cpp and .js from them?

I tried to make a .cpp and .js file from the original XInterface.idl file with './webidl_binder XInterface.idl glue', but as I expected it didn't work, because of the #ifndef prepocess

Can webIDL handle prepocesess like #ifndef #define and/or #include existing .idl files with webIDL?

By the way the error msg was:

Traceback (most recent call last):
  File "/home/bvarga/builder/emsdk/upstream/emscripten/tools/./webidl_binder.py", line 55, in <module>
    p.parse(r'''
  File "/home/bvarga/builder/emsdk/upstream/emscripten/third_party/WebIDL.py", line 4960, in parse
    self._productions.extend(self.parser.parse(lexer=self.lexer,tracking=True))
  File "/home/bvarga/builder/emsdk/upstream/emscripten/third_party/ply/ply/yacc.py", line 263, in parse
    return self.parseopt(input,lexer,debug,tracking,tokenfunc)
  File "/home/bvarga/builder/emsdk/upstream/emscripten/third_party/ply/ply/yacc.py", line 792, in parseopt
    tok = self.errorfunc(errtoken)
  File "/home/bvarga/builder/emsdk/upstream/emscripten/third_party/WebIDL.py", line 4909, in p_error
    raise WebIDLError("invalid syntax", [Location(self.lexer, p.lineno, p.lexpos, self._filename)])
WebIDL.WebIDLError: error: invalid syntax, <unknown> line 22:0
#ifndef __com_sun_star_uno_XInterface_idl__
^

Thanks for the feedback in advance.

Best,
Balázs

Sam Clegg

unread,
Nov 3, 2022, 2:20:58 PM11/3/22
to emscripte...@googlegroups.com
Those IDL files don't look like they are in WebIDL format (https://webidl.spec.whatwg.org/).  If you want to use them with webidl_binder you would need to first convert them to webidl format.

cheers,
sam

--
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 emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/da554b58-e4d8-4c15-9742-2882e45af411n%40googlegroups.com.

Balázs Varga

unread,
Nov 8, 2022, 7:08:54 AM11/8/22
to emscripten-discuss
Thanks for the feedback , Sam.

I have started to converte it, but I have some problem with exceptions. I have exceptions in the *.idl files, like below. (It is partly converted from .idl to webidl)

[Prefix = "com::sun::star::uno::"]
    interface XInterface;
    exception Exception {
     string Message;
     _com_sun_star_uno_XInterface Context;
    };

[Prefix = "com::sun::star::uno::beans::"]
    exception IllegalTypeException: _com_sun_star_uno_Exception {
    };

Is it possible to use exceptions in webIDL? I found these options (https://webidl.spec.whatwg.org/#dfn-create-exception), but its not clear for me how can I replace the exception object type.

Ofc, the webidl_binder didn't like it:
File "/home/bvarga/builder/emsdk/upstream/emscripten/third_party/WebIDL.py", line 3711, in p_Definition
    assert p[1] # We might not have implemented something ...
AssertionError

Thanks for your help, in advance.
Balazs
Reply all
Reply to author
Forward
0 new messages