home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnuc / library / rcs / ix_panic.c,v < prev    next >
Encoding:
Text File  |  1992-08-09  |  3.5 KB  |  143 lines

  1. head    1.2;
  2. access;
  3. symbols
  4.     version39-41:1.1;
  5. locks;
  6. comment    @ *  @;
  7.  
  8.  
  9. 1.2
  10. date    92.08.09.20.53.58;    author amiga;    state Exp;
  11. branches;
  12. next    1.1;
  13.  
  14. 1.1
  15. date    92.05.14.19.55.40;    author mwild;    state Exp;
  16. branches;
  17. next    ;
  18.  
  19.  
  20. desc
  21. @display `nice' requestor to present a warning to the user
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @add cast
  28. @
  29. text
  30. @/*
  31.  *  This file is part of ixemul.library for the Amiga.
  32.  *  Copyright (C) 1991, 1992  Markus M. Wild
  33.  *
  34.  *  This library is free software; you can redistribute it and/or
  35.  *  modify it under the terms of the GNU Library General Public
  36.  *  License as published by the Free Software Foundation; either
  37.  *  version 2 of the License, or (at your option) any later version.
  38.  *
  39.  *  This library is distributed in the hope that it will be useful,
  40.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  41.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  42.  *  Library General Public License for more details.
  43.  *
  44.  *  You should have received a copy of the GNU Library General Public
  45.  *  License along with this library; if not, write to the Free
  46.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  47.  *
  48.  *  $Id: ix_panic.c,v 1.1 1992/05/14 19:55:40 mwild Exp $
  49.  *
  50.  *  $Log: ix_panic.c,v $
  51.  *  Revision 1.1  1992/05/14  19:55:40  mwild
  52.  *  Initial revision
  53.  *
  54.  */
  55.  
  56. /*
  57.  * This once was req.c by Markus Wandel. It doesn't look too much like the
  58.  * original version though... Well, it was PD, I used it, so here is his
  59.  * original disclaimer:
  60.  *
  61.  * req.c - by Markus Wandel - 1990
  62.  * Placed in the public domain 7 Oct 1990
  63.  * Please have the courtesy to give credit if you use this code
  64.  * in any program.
  65.  *
  66.  */
  67. #include <exec/types.h>
  68. #include <exec/tasks.h>
  69. #include <exec/execbase.h>
  70. #include <intuition/intuition.h>
  71. #include <sys/types.h>
  72.  
  73. #define BASE_EXT_DECL
  74. #define BASE_PAR_DECL struct IntuitionBase *IntuitionBase,
  75. #define BASE_PAR_DECL0 struct IntuitionBase *IntuitionBase
  76. #include <inline/intuition.h>
  77.  
  78. #include <inline/exec.h>
  79.  
  80. int
  81. ix_panic (const char *msg)
  82. {
  83.   struct IntuiText line, righttext;
  84.   struct IntuitionBase *IntuitionBase;
  85.   int result = -1;
  86.   u_char old_flags;
  87.   struct Task *me = (*(struct ExecBase **)4)->ThisTask;
  88.  
  89.   /*
  90.    * This function may be called with our signals enabled. So we have to make
  91.    * sure, that no signals are processed while in here.
  92.    * Since this function may be called at random points in initialization,
  93.    * it is not save to call sigsetmask() here, so I have to resort to the
  94.    * more drastic sollution of temporarily turning off TF_LAUNCH
  95.    */
  96.   old_flags = me->tc_Flags;
  97.   me->tc_Flags &= ~TF_LAUNCH;
  98.  
  99.   /* we (re)open intuition, because that way we don't depend on arp.library
  100.    * being available for us to open intuibase */
  101.  
  102.   if (IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0))
  103.     {
  104.       line.FrontPen = AUTOFRONTPEN;
  105.       line.BackPen = AUTOBACKPEN;
  106.       line.DrawMode = AUTODRAWMODE;
  107.       line.ITextFont = AUTOITEXTFONT;
  108.       line.NextText = 0;
  109.       CopyMem(&line, &righttext, sizeof(line));
  110.       righttext.LeftEdge = AUTOLEFTEDGE;
  111.       righttext.TopEdge = AUTOTOPEDGE;
  112.       line.LeftEdge = 15;
  113.       line.TopEdge = 5;
  114.  
  115.       line.IText = (UBYTE *) msg;
  116.       righttext.IText = (UBYTE *) "Abort";
  117.       result = AutoRequest(IntuitionBase,0L,&line,0L,&righttext,0L,0L,320L,72L);
  118.       CloseLibrary ((struct Library *) IntuitionBase);
  119.    }
  120.  
  121.   me->tc_Flags = old_flags;
  122.  
  123.   return result;
  124. }
  125. @
  126.  
  127.  
  128. 1.1
  129. log
  130. @Initial revision
  131. @
  132. text
  133. @d19 1
  134. a19 1
  135.  *  $Id$
  136. d21 4
  137. a24 1
  138.  *  $Log$
  139. d89 1
  140. a89 1
  141.       CloseLibrary(IntuitionBase);
  142. @
  143.