
Jonathan Turkanis wrote:
Rene Rivera wrote:
INHERITED(INTERFACE(DataTransferEvent),Event) ENUM(DataTransferEventType) NAME(Type VALUE(0x003)) METHOD(DataTransferEvent::Request,getRequest,ARGS0,throw()) VOID_METHOD(getRequestData,ARGS2(UInt64&,UInt64&),throw()) VOID_METHOD(readDataExtent,ARGS1(UInt64&),throw()) VOID_METHOD(readData,ARGS3(UInt64&,UInt64&,Pointer&),throw()) INTERFACE_CLOSE
Unfortunately, once you switch to the boost macro-naming conventions, having a macros to declare the argument list becomes a bit verbose:
BOOST_IDL_VOID_METHOD(readData,BOOST_IDL_ARGS3(UInt64&,UInt64&,Pointer&))
I guess you could have the outer macro stick the prefix on the inner macro, so there wouldn't really be any ARGn macros. Is that what you do?
Something like that.. I have a Def.h to define the bare macros in terms of fully prefixed macros, THOT_* in my case, and a corresponding Undef.h to clear things out. The Def.h takes care to prepend the prefix only when needed, and the individual outer macros will prepend the inner ones as needed. It's a round about way of doing it but it has the benefit of: a) having the real macros defined once, b) the real macros are much easier to read, c) the outer layer can take care of PP problems (like for CW8).
The project you mention looks interesting. What sort of interfaces are you generating?
I current use them to generate: 1. Public header only PIMPL API to all my DLLs/SOs. 2. Private header PIMPL implementation declarations to all my DLLs/SOs. 3. Private source PIMPL implementation to forward to implementation classes. 4. Lua bindings to my API using LuaBind. All that is done by changing only the definition of the inner macros. To produce the code I'm looking for. For example here's the file to do the Lua binding for the above DataTransferEvent interface.. ===BindDataTransferEvent.cpp=== /* Copyright (c) 2003 Redshift Software, Inc. All Rights Reserved. */ #include <com/redshift-software/projects/Thot/product/plugins/lua5_script/lua_def.h> #include <com/redshift-software/projects/Thot/product/api/All.h> #include <com/redshift-software/projects/Thot/product/plugins/lua5_script/Imp.h> #undef com_redshift_software_projects_thot_product_api_datatransferevent_h #include <com/redshift-software/projects/Thot/product/api/DataTransferEvent.h> ===.=== [Imp.h is the one that defines the inner macros in this case] That alone was worth all the effort of implementing a PP based IDL -- I once even tried to bind my complete API in a single file like the above, but that ground the compiler to a halt when it tried to use a few magnitudes more memory than I have :-) -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq