home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GERLIB_DEV08B.LHA / gerlib / gnulib / normal / ger_default_new.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  1.1 KB  |  41 lines

  1. extern struct DosLibrary * DOSBase;
  2.  
  3. static __inline long
  4. Write (unsigned long file, unsigned long buffer,long length)
  5. {
  6.   register long  _res  __asm("d0");
  7.   register struct DosLibrary *a6 __asm("a6") = DOSBase;
  8.   register unsigned long d1 __asm("d1") = file;
  9.   register unsigned long d2 __asm("d2") = buffer;
  10.   register long d3 __asm("d3") = length;
  11.   __asm __volatile ("jsr a6@(-0x30)"
  12.   : "=r" (_res)
  13.   : "r" (a6), "r" (d1), "r" (d2), "r" (d3)
  14.   : "a0","a1","d0","d1","d2","d3", "memory");
  15.   return _res;
  16. }
  17.  
  18. static __inline unsigned long
  19. Output (void)
  20. {
  21.   register unsigned long  _res  __asm("d0");
  22.   register struct DosLibrary *a6 __asm("a6") = DOSBase;
  23.   __asm __volatile ("jsr a6@(-0x3c)"
  24.   : "=r" (_res)
  25.   : "r" (a6)
  26.   : "a0","a1","d0","d1", "memory");
  27.   return _res;
  28. }
  29.  
  30. extern void _exit(int status);
  31.  
  32. void
  33. default_new_handler ()
  34. {
  35.   /* don't use fprintf (stderr, ...) because it may need to call malloc.  */
  36.   Write (Output(), (unsigned long)"default_new_handler: out of memory... aaaiiiiiieeeeeeeeeeeeee!\n", 65);
  37.   /* don't call exit () because that may call global destructors which
  38.      may cause a loop.  */
  39.   _exit (-1);
  40. }
  41.