chiark / gitweb /
Merge branch 'work'
[mLib] / exc.h
diff --git a/exc.h b/exc.h
index a2e004e8df486d469f807192a51998e23b87fafe..1db4a370a34d6ab3d440d72b8a5e8e6e717dbd74 100644 (file)
--- a/exc.h
+++ b/exc.h
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: exc.h,v 1.1 1998/06/17 23:44:42 mdw Exp $
+ * $Id: exc.h,v 1.7 2004/04/08 01:36:11 mdw Exp $
  *
  * Structured exception handling in C
  *
  * 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 General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * 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 General Public License for more details.
+ * GNU Library General Public License for more details.
  *
- * You should have received a copy of the GNU 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.
+ * 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.
  */
 
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: exc.h,v $
- * Revision 1.1  1998/06/17 23:44:42  mdw
- * Initial revision
- *
- */
-
-#ifndef EXC_H
-#define EXC_H
+#ifndef MLIB_EXC_H
+#define MLIB_EXC_H
 
 #ifdef __cplusplus
   extern "C" {
  *     ... something dangerous ...
  *   } CATCH switch (exc_type) {
  *     case EXC_INTERESTING:
- *      ... handle exception ...
- *      break;
+ *      ... handle exception ...
+ *      break;
  *     default:
- *      ... do tidying up ...
- *      RETHROW;
+ *      ... do tidying up ...
+ *      RETHROW;
  *   } END_TRY;
  */
 
  * the type of the value field (see below).
  */
 
-/* --- Type type of an exception --- */
+/* --- Type of an exception --- */
 
 typedef unsigned long exc_extype;
 
@@ -145,6 +138,7 @@ typedef unsigned long exc_extype;
 
 #define EXC_GLOBAL 0u                  /* The global space defined here */
 #define EXC_SHARED 0xFFFFu             /* The shared space for everyone */
+#define EXC_MLIB EXC_PAIR('m', 'L')    /* Space for mLib exceptions */
 
 /*----- Exception values --------------------------------------------------*
  *
@@ -266,10 +260,10 @@ extern __exc_hnd *__exc_list;             /* List of active handlers */
  *     __exc_hnd h;
  *     add_handler(&h);
  *     if (!setjmp(h.buf)) {
- *      do <try code> while (0);
- *      remove_handler(&h);
+ *      do <try code> while (0);
+ *      remove_handler(&h);
  *     } else
- *      <catch code>
+ *      <catch code>
  *   } while (0)
  *
  * Everything else is ugly hacking to make things work.