I am in the process of porting our current MudOS-based mud to FluffOS, and I am encountering an issue that I believe to be a bug in the driver. It occurs when you have a nested #define macro that is being used with the ‘->’ call_other() syntax. Here is what I am working with as well as the results:
#define NAHENET(str) "/d/islands/nahenet/"+str #define NSTD(str) NAHENET("nstd/"+str) #define NAHENET_D NSTD("nahenet_d")
eval --include /d/islands/nahenet/path.h return NAHENET_D;
Result = “/d/islands/nahenet/nstd/nahenet_d”
eval --include /d/islands/nahenet/path.h return NAHENET_D->query_water_level();
Error = *Error. Could not find object: nahenet_d
(I patched the driver so that call_other() would note the object it failed to find.)
eval --include /d/islands/nahenet/path.h return (NAHENET_D)->query_water_level();
Result = 0 <-- Expected result
The only difference between the 2nd and 3rd eval tests was that the NAHENET_D macro was wrapped in parenthesis. This is unexpected behavior, and it seems to be with the preprocessor parsing, perhaps? This does not occur on our old MudOS driver. Is there a different way this should be done? On our production MUD, which is still on MudOS, we write our macros a little differently, but we had to change it because FluffOS wouldn’t parse them properly.
This is what we would normally do:
#define NAHENET(str) "/d/islands/nahenet/str" #define NSTD(str) NAHENET("nstd/str") #define NAHENET_D NSTD("nahenet_d")
Any help or advice would be greatly appreciated. While I can go through and fix any instances that are broken by wrapping the defines in parenthesis, we have tens of thousands of files in our library, and it seems to me that something somewhere is not correct.