I am struggling with this header: Standard_Handle.hxx.
I hit several issues with it. I reported a couple of the issues: parsing issue and the most problematic one for me: Token pasting operator `##`.
The closest I got was by using the modded version of the header Standard_Handle.hxx. I have tried with this standard_handle.c2nim:
#ifdef C2NIM
#skipcomments
#skipinclude
#pp DEFINE_STANDARD_HANDLE
#pp Handle
#pp DEFINE_STANDARD_HANDLECLASS
#pp DEFINE_STANDARD_RTTIEXT
#pp DEFINE_STANDARD_RTTI_INLINE
#pp DEFINE_NCOLLECTION_ALLOC
#endif
but when I run:
$ c2nim --cpp --header --strict --skipcomments --out:borrame.nim standard_handle.c2nim Standard_Handle.hxx
Standard_Handle.hxx(345, 52) Error: token expected: ( but got: [identifier]
So I am struggling at the very end:
++
#define DEFINE_STANDARD_HANDLECLASS(C1,C2,BC) class C1; typedef Handle(C1) Handle_##C1;
What can I do to make it work?
I wonder if the last line should be converted into something like:
template DEFINE_STANDARD_HANDLECLASS*(C1, C2, BC: untyped): untyped =
discard "forward decl of C1"
type
`Handle C1` = Handle[C1]
and then I should replace Handle_ with Handle everywhere.
What do you think?