I frequently find myself editing CallFunction.cc to put some special pre call and post call functions in place. Sometimes, I just want to see a message when I exit and exit a function, so I have context for any other print messages I see in the log. Another use I have is to provide automatic checks to see when a function modifies a variable (by doing checksums before and after), and so on. I have a few more.
What I'd like to have is the ability to register a function to run before a call and/or after a call. In principle, Accelerator_PreCall/PostCall could then use this mechanism rather than having carpet call them explicitly. The attached patch implements this functionality. I assume that there are lots of things about my implementation that people won't like, but I attach it anyway as a prototype.