Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
CC Macro enhancement required for Allegro
ollydbg:
--- Quote from: joubertdj on July 22, 2009, 10:39:44 pm ---Ollydbg,
Have you ever looked at Wave from Boost: http://www.boost.org/doc/libs/1_39_0/libs/wave/index.html
It looks like a proper pre-processor that "can" be used within other projects such as ours?
Best regards,
--- End quote ---
Hi, I have noticed that, also, many other pre-processors can be found on the internet. But, I think using wave is really “beyond my current programming level", so. :(
ollydbg:
--- Quote from: joubertdj on July 11, 2009, 10:46:33 pm ---Ollydbg,
I see the effort that you put into the CC and would like you to look at something that I think you can fix with regard to the CC.
The Allegro games programming library (www.liballeg.org) is my defacto games programming lib, and their macro usage within their library is insane!!! But hey, the thing works across more platforms than is considered sane, so I am giving them the benefit of the doubt.
Here is my problem:
All the functions within the library is declared with the following macros:
--- Code: ---#ifndef AL_FUNC
#define AL_FUNC(type, name, args) type name args
#endif
#ifndef AL_PRINTFUNC
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args)
#endif
#ifndef AL_METHOD
#define AL_METHOD(type, name, args) type (*name) args
#endif
#ifndef AL_FUNCPTR
#define AL_FUNCPTR(type, name, args) extern type (*name) args
#endif
#ifndef AL_FUNCPTRARRAY
#define AL_FUNCPTRARRAY(type, name, args) extern type (*name[]) args
#endif
#ifndef AL_INLINE
#define AL_INLINE(type, name, args, code) type name args;
#endif
--- End code ---
It looks terribly insane, but is actually not! For example, if the following was declared:
--- Code: ---AL_FUNC(int, drawpixel, (int x,int y, int color));
--- End code ---
Then the final format of the argument when the preprocessor execution is finished looks like:
--- Code: ---int drawpixel (int x,int y, int color);
--- End code ---
Unfortunately our "Replacement tokens" do not facilitate the arguments in question. Do you by any chance have a suggestion or idea how the CC could handle such Macro arguments?
Best regards,
--- End quote ---
Hi, Here is a Good news!!!
I'm happy to test the code:
--- Code: ---#ifndef AL_FUNC
#define AL_FUNC(type, name, args) type name args
#endif
#ifndef AL_PRINTFUNC
#define AL_PRINTFUNC(type, name, args, a, b) AL_FUNC(type, name, args)
#endif
#ifndef AL_METHOD
#define AL_METHOD(type, name, args) type (*name) args
#endif
#ifndef AL_FUNCPTR
#define AL_FUNCPTR(type, name, args) extern type (*name) args
#endif
#ifndef AL_FUNCPTRARRAY
#define AL_FUNCPTRARRAY(type, name, args) extern type (*name[]) args
#endif
#ifndef AL_INLINE
#define AL_INLINE(type, name, args, code) type name args;
#endif
AL_FUNC(int, drawpixel, (int x,int y, int color));
--- End code ---
And here is the result:
This macro expansion and handling is mainly done by "loaden", you can tried it with the latest cc_branch. :D
joubertdj:
:D Whoop!!!!!!!
Any idea when you will be merging into the main branch for "additional" testing?
Navigation
[0] Message Index
[*] Previous page
Go to full version