home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / what's new / sample code / overview / moreisbetter / mib-libraries / moredevices / interruptsafedebug / interruptsafedebug.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-23  |  2.9 KB  |  82 lines

  1. /*
  2.     File:        InterruptSafeDebug.h
  3.  
  4.     Contains:    Library for logging directly to the screen.
  5.  
  6.     Written by:    Quinn "The Eskimo!"
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <1>    23/11/98    Quinn   First checked in.
  21. */
  22.  
  23. #pragma once
  24.  
  25. /////////////////////////////////////////////////////////////////////
  26.  
  27. #include "MoreSetup.h"
  28. #include <MacTypes.h>
  29.  
  30. /////////////////////////////////////////////////////////////////////
  31.  
  32. // WARNING
  33. // Once initialised, this library has a cached copy of the screen
  34. // base, bit depth, and row bytes.  If the screen geometry
  35. // (ie resolution or bit depth) changes, this module is likely to
  36. // start writing over random bits of memory.  You must be sure to
  37. // reinitialise the module before logging any text if the screen
  38. // geometry changes.
  39.  
  40. /////////////////////////////////////////////////////////////////////
  41.  
  42. // The following parameter can be twiddled to suit your particular
  43. // environment.
  44.  
  45. enum {
  46.  
  47.     kISDebugNumberOfColumns = 64,
  48.     kISDebugNumberOfRows = 32,
  49.         // These values were chosen to fit on the smallest
  50.         // Mac display.  If you want, you can increase the size.
  51.         // Be sure to always make them a power of 2, otherwise
  52.         // the MOD of gCurrentCharIndex by kMaxCharIndex will do
  53.         // weird things.
  54.     
  55.     kISDebugMaxCharIndex = kISDebugNumberOfColumns * kISDebugNumberOfRows,
  56.  
  57.     kISDebugXPixelOffset = 0,
  58.     kISDebugYPixelOffset = 0
  59.         // You can use these constants to position the debugging
  60.         // output in an appropriate place on the screen for your
  61.         // tests.
  62. };
  63.  
  64. /////////////////////////////////////////////////////////////////////
  65.  
  66. extern OSStatus InitInterruptSafeDebug(void);
  67.     // You must call this routine before calling any of the following.
  68.     // You may call this routine more than once, which is useful
  69.     // is the display geometry has changed.
  70.     
  71. extern void ISDebugChar(UInt8 ch);
  72. extern void ISDebugText(const UInt8 *text, ByteCount len);
  73. extern void ISDebugStr (ConstStr255Param str);
  74. extern void ISdebugstr (const char *str);
  75.     // These routines write the supplied parameter directly to
  76.     // the screen, bypassing QuickDraw and the rest of the OS.
  77.     // The routines are completely interrupt-safe, including
  78.     // when paging is unsafe (as long as you can guarantee that 
  79.     // the code and data sections are held resident).
  80.  
  81. /////////////////////////////////////////////////////////////////////
  82.