Trapping I/O runtime errors in GPC_(re)
Tue, 28 Oct 1997 11:53:13 +1100
On 27 Oct 97 at 8:50, Frank Heckenbach wrote:
> I think I can do the RTS part, if you send me a patch for your
> changes, along with a short description about how you did it.
I'll have to sort though my mods to bring them up to date with the
latest beta.
>
> I'd imagine I'll do it as follows:
>
> - Whenever an I/O function encounters an error condition, it sets
> InOutRes to
> the according error code (which will, of course, *not* be the same
> as in BP ;-), and return in a clean state. (The latter is the
> difficult bit; I've already done so for the Read/Write procedures,
> but I expect there will be more to do so that the program can
> continue safely.)
That's what I was hoping for.
>
> - At the start, each I/O function checks InOutRes, and if <>0,
> returns
> immediately, doing nothing. (Like BP does.)
I hadn't thought of that, but it's an excelent idea.
>
> - After calling an I/O function, if {$I+} is turned on, the calling
> program
> must check InOutRes. The code to be generated (perhaps you've
> already done so) would look like "if InOutRes<>0 then _p_ioerror;"
> where _p_ioerror will be a RTS function I can provide. (The check
> "if InOutRes<>0" could also be done in the function (like in BP!),
> but that's inefficient, because the function has to be called
> after each I/O operation then.)
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.
Bill
--
Leave others their otherness.
Bill Currie (billc@blackmagic.tait.co.nz)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es