I am doing a project and use projects from years past to help me get ideas on how to do certain things. Note that I am not copying mindlessly but there is a lot of stuff that isn’t in the book.
Anyhow here is the macro that I don’t understand:
#define PREPAREENTRY(numIVT,oldINT) \
void interrupt int##numIVT(...){\
IVTEntry::entries[##numIVT]->signalAll();\
if (oldINT) IVTEntry::entries[##numIVT]->callOld();}\
IVTEntry entry##numIVT(##numIVT,int##numIVT);
#endif
I am not completely sure, but I think I got the hang of most of it. So, PREPAREENTRY gets two values, numIVT (number in IV Table) and OldNT (old interrupt).
Then it makes a interrupt function whose name is the number numIVT, which I can later set as a interrupt function for a certain interrupt, or what happens when that interrupt appears.
The new interrupt function calls signalAll() of a certain object from an array of objects depending on numIVT. Then it checks if it should call the old interrupt function and calls it or not.
That’s the end of the new interrupt function.
But what does the line before #endif do? I’ve been looking all over project and can’t find the answer. Before looking at this project during brainstorming I thought of something similar to this but without the last line.
If someone could tell me if I am right or wrong about the parts I think I got hang off and if someone could tell me what this mysterious line does it would be greatly appreciated.
Lets assume
numIVT=1. That last part of the macro would be expanded to:That means you’re defining an object of type
IVTEntry, and using1andint1(the function declared in the same macro) as its constructor arguments.