Add a special #ifdef for decomp.me convenience#296
Conversation
|
This sounds like a nice idea to me! Can we let the macro name be just I am thinking of just running the preprocessor for real, but haven't yet looked into what options exist for e.g. disallowing includes, and it might take a little bit until I get time to look. Merging this in the meantime sounds like a good plan. |
|
Yeah, sure. I'm a bit hesitant to make the name look like a "real" macro since you can only use it in this specific pattern, but since Melee will likely only be using it until a full preprocessor gets implemented and it'll get changed anyways, I'll change it. Here's some information on preprocessors (which also was discussed recently in the Melee decomp channel):
|
|
Oh, pcpp looks neat! Thanks for the pointer. For sure I'll pre-define the same macro when integrating preprocessor support. |
This addresses a longstanding issue particularly affecting users trying to match Melee code on the m2c + decomp.me setup, where it's desirable to have the same context file able to both provide the correct type to m2c for the
user_dataof our custom*_GObjstructs, as well as typedef the*_GObjstructs back toHSD_GObj. Since it's undesirable to run a C preprocessor in m2c, a regular expression is used that mimics the functionality of an#ifdef, but only specific expressions are allowed to be used with it. Currently the only expression supported is hardcoded to beM2CTX_DUAL. Use of any other expression will raise aDirectives not supported yeterror like it currently does. The#ifdefalso must contain an#elseclause. For instance:If this kind of functionality is acceptable, I can write documentation for it, as other games may find this useful as well.