.\" -*-nroff-*-
-.de VS
-.sp 1
-.in +5n
-.ft B
-.nf
-..
-.de VE
-.ft R
-.in -5n
-.sp 1
-.fi
-..
-.TH exc 3 "20 June 1999" "Straylight/Edgeware" "mLib utilities library"
-.SH NAME
-exc \- exception handling for C programs
+.\"
+.\" Manual for exception handling
+.\"
+.\" (c) 1999, 2001, 2005, 2009, 2024 Straylight/Edgeware
+.\"
+.
+.\"----- Licensing notice ---------------------------------------------------
+.\"
+.\" This file is part of the mLib utilities library.
+.\"
+.\" mLib is free software: you can redistribute it and/or modify it under
+.\" the terms of the GNU Library General Public License as published by
+.\" the Free Software Foundation; either version 2 of the License, or (at
+.\" your option) any later version.
+.\"
+.\" mLib is distributed in the hope that it will be useful, but WITHOUT
+.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+.\" License for more details.
+.\"
+.\" You should have received a copy of the GNU Library General Public
+.\" License along with mLib. If not, write to the Free Software
+.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+.\" USA.
+.
+.\"--------------------------------------------------------------------------
+.so ../defs.man \" @@@PRE@@@
+.
+.\"--------------------------------------------------------------------------
+.TH exc 3mLib "20 June 1999" "Straylight/Edgeware" "mLib utilities library"
.\" @TRY
.\" @CATCH
.\" @END_TRY
.\" @THROW
.\" @RETHROW
-.\"
+.
.\" @exc_uncaught
-.\"
+.
.\" @EXC_PAIR
.\" @EXC_ALLOC
.\" @EXC_ALLOCN
.\" @EXC_ALLOCI
.\" @EXC_ALLOCP
.\" @EXC_ALLOCS
-.\"
+.
+.\"--------------------------------------------------------------------------
+.SH NAME
+exc \- exception handling for C programs
+.
+.\"--------------------------------------------------------------------------
.SH SYNOPSIS
+.
+.nf
.B "#include <mLib/exc.h>"
-.sp 1
+.PP
+.ta 2n
.B TRY
-.I statement
+.I " statement"
.B CATCH
-.I statement
+.I " statement"
.B END_TRY;
-.br
.B EXIT_TRY;
-.sp 1
-.BI "THROW(exc_extype " type
-.RB [ ,
-.IR data ]\fB);
-.br
+.PP
+.BI "THROW(exc_extype " type " " "" \fR[ "" ", "data \fR] "" );
.B RETHROW;
-.sp 1
+.PP
.nf
.B "typedef void (*exc__uncaught)(exc_extype, exc_exval);"
.BI "exc__uncaught exc_uncaught(exc__uncaught " proc );
.BI "exc_extype EXC_ALLOCP(exc_extype " owner ", exc_extype " type );
.BI "exc_extype EXC_ALLOCS(exc_extype " owner ", exc_extype " type );
.fi
+.
+.\"--------------------------------------------------------------------------
.SH DESCRIPTION
+.
The header file
.B <mLib/exc.h>
introduces some new syntax and definitions to support exception handling
It's unfortunately important to remember that the syntax is provided
using macro expansion and standard C facilities; some of the
restrictions of these features show through.
+.
.SS "The TRY statement"
The
.B TRY
which refer to members of
.B exc_val
directly.
+.
.SS "The EXIT_TRY statement"
It is not safe to leave the dynamic scope of an exception handler early
(e.g., by a
scope of the
.B TRY
statement.
+.
.SS "The THROW and RETHROW statements"
The
.B THROW
nor
.B RETHROW
yields any value.
+.
.SS "Exception type allocation"
Exception types are 32-bit values. The top 16 bits are an
.IR "owner identifier" .
.B EXC_PAIR
as described above), and the type code. The data type is encoded into
the exception type by the allocation macro.
+.
.SS "Predefined exceptions"
The following exceptions are predefined:
.TP
and automatic data apply. Also, note that status such as the signal
mask is not reset, so you might have to do that manually in order to
recover from a signal.
+.
+.\"--------------------------------------------------------------------------
.SH "SEE ALSO"
+.
.BR mLib (3).
+.
+.\"--------------------------------------------------------------------------
.SH AUTHOR
+.
Mark Wooding, <mdw@distorted.org.uk>
+.
+.\"----- That's all, folks --------------------------------------------------