home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / gcc / ixemulsrc.lha / ixemul / ixnet / ix_panic.c < prev    next >
C/C++ Source or Header  |  1996-12-11  |  2KB  |  62 lines

  1. /*
  2.  *  This file is part of ixemul.library for the Amiga.
  3.  *  Copyright (C) 1994  Rafael W. Luebbert
  4.  *
  5.  *  This library is free software; you can redistribute it and/or
  6.  *  modify it under the terms of the GNU Library General Public
  7.  *  License as published by the Free Software Foundation; either
  8.  *  version 2 of the License, or (at your option) any later version.
  9.  *
  10.  *  This library is distributed in the hope that it will be useful,
  11.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  *  Library General Public License for more details.
  14.  *
  15.  *  You should have received a copy of the GNU Library General Public
  16.  *  License along with this library; if not, write to the Free
  17.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #define _KERNEL
  21. #include <ixemul.h>
  22. #include <stdarg.h>
  23. #include <proto/intuition.h>
  24.  
  25. void ix_panic(const char *msg, ...)
  26. {
  27.   struct IntuitionBase *IntuitionBase;
  28.   u_char old_flags;
  29.   struct Task *me = SysBase->ThisTask;
  30.   va_list ap;
  31.  
  32.   /*
  33.    * This function may be called with our signals enabled. So we have to make
  34.    * sure that no signals are processed while in here.
  35.    * Since this function may be called at random points in initialization,
  36.    * it is not safe to call sigsetmask() here, so I have to resort to the
  37.    * more drastic solution of temporarily turning off TF_LAUNCH
  38.    */
  39.   old_flags = me->tc_Flags;
  40.   me->tc_Flags &= ~TF_LAUNCH;
  41.  
  42.   va_start(ap, msg);
  43.  
  44.   if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 0)))
  45.     {
  46.       struct EasyStruct panic = {
  47.         sizeof(struct EasyStruct),
  48.         0,
  49.         "ixnet.library message",
  50.         (char *)msg,
  51.         "Abort"
  52.       };
  53.         
  54.       EasyRequestArgs(NULL, &panic, NULL, ap);
  55.  
  56.       CloseLibrary ((struct Library *) IntuitionBase);
  57.    }
  58.  
  59.   me->tc_Flags = old_flags;
  60.   va_end(ap);
  61. }
  62.