home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp / src / devs / netinfo / assert.c next >
Encoding:
C/C++ Source or Header  |  1994-02-26  |  1.9 KB  |  84 lines

  1. /* $Id: assert.c,v 3.2 1994/02/26 22:50:51 ppessi Exp $
  2.  * 
  3.  * assert.c -- gracious assert with intuition style for SAS C 6
  4.  *
  5.  * Author: ppessi <Pekka.Pessi@hut.fi>
  6.  *
  7.  * This file is part of the AmiTCP/IP Network Library.
  8.  *
  9.  * Copyright © 1993 AmiTCP/IP Group, <AmiTCP-Group@hut.fi>
  10.  *                  Helsinki University of Technology, Finland.
  11.  *
  12.  * Created      : Thu Jun 15 01:24:12 1993 ppessi
  13.  * Last modified: Sun Feb 27 00:50:39 1994 ppessi
  14.  */
  15.  
  16. #include <exec/types.h>
  17. #include <exec/libraries.h>
  18.  
  19. #include <intuition/intuition.h>
  20. #include <assert.h>
  21.  
  22. #include <proto/intuition.h>
  23. #include <proto/exec.h>
  24. #include <stdarg.h>
  25.  
  26. extern const UBYTE _DevName[];
  27.  
  28. __saveds void 
  29. InMsg(const char *fmt, ...)
  30. {
  31.   struct Library *IntuitionBase; 
  32.  
  33.   IntuitionBase = OpenLibrary("intuition.library", 36);
  34.   
  35.   if (IntuitionBase != NULL) {
  36.     struct EasyStruct libraryES;
  37.  
  38.     va_list va;
  39.     va_start(va, fmt);
  40.     
  41.     libraryES.es_StructSize = sizeof(libraryES);
  42.     libraryES.es_Flags = 0;
  43.     libraryES.es_Title = (STRPTR)_DevName;
  44.     libraryES.es_TextFormat = (STRPTR)fmt;
  45.     libraryES.es_GadgetFormat = "Continue";
  46.     
  47.     EasyRequestArgs(NULL, &libraryES, NULL, va);
  48.  
  49.     CloseLibrary(IntuitionBase);
  50.   }
  51.  
  52. }
  53.  
  54. #if defined(__SASC_650)
  55. #define CONST const
  56. #else
  57. #define CONST 
  58. #endif
  59.  
  60. __saveds void 
  61. __assert(int not_failed, CONST char *assertion, CONST char *file, int line)
  62. {
  63.   struct Library *IntuitionBase; 
  64.  
  65.   if (not_failed) return;
  66.  
  67.   IntuitionBase = OpenLibrary("intuition.library", 36);
  68.   
  69.   if (IntuitionBase != NULL) {
  70.     struct EasyStruct libraryES;
  71.     
  72.     libraryES.es_StructSize = sizeof(libraryES);
  73.     libraryES.es_Flags = 0;
  74.     libraryES.es_Title = (STRPTR)_DevName;
  75.     libraryES.es_TextFormat = 
  76.       "Assertion \"%s\" failed at line %ld in file %s.";
  77.     libraryES.es_GadgetFormat = "Continue";
  78.     
  79.     EasyRequest(NULL, &libraryES, NULL, assertion, line, file);
  80.  
  81.     CloseLibrary(IntuitionBase);
  82.   }
  83. }
  84.