The African Chief wrote:
Actually, that's almost exactly what my mods do. If IO checking is enabled ( {$I+} ), a proceedure taking no parameters is called that would check the InOutRes state (though I used a different name) and if it's set dumps a dirty message and aborts the program.
For compatibility with BP, you would need to call the variable "InOutRes", and it should be exported, so that programmers can set it manually if they want (this feature of BP might be considered to be a bug by some, but I have found great use for it ...).
I've made use of it, too. Since there's no proper way to raise an I/O error, setting InOutRes seems to next best thing to do.
Therefore, we'll call it InOutRes in GPC as well. Exporting it will be no problem. One little question is its type: should it be Integer as in BP, or Integer(16) (which the BP Integer is in GPC)? I'd prefer Integer as that's more natural and easier to handle in the RTS functions written in C. I hope there aren't BP programs that rely on its exact size (e.g. by passing it VAR to a procedure expecting a 16 bit Integer).
Bill Currie wrote:
Good point. If I leave the check as a function call, there's no problem, but if I go to inline code I will use InOutRes.
And as long as it's a separate RTS function, I will use InOutRes, too... :-)