home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCommon / SLPriDeb.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.2 KB  |  124 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLPriDeb.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFound.hpp"
  11.  
  12. // Need to include first so that FW_DEBUG is properly defined
  13.  
  14. #ifndef SLPRIDEB_H
  15. #include "SLPriDeb.h"
  16. #endif
  17.  
  18. #ifdef FW_DEBUG
  19.  
  20. #ifndef FWPRISTR_H
  21. #include "FWPriStr.h"
  22. #endif
  23.  
  24. #ifndef FWPRIMEM_H
  25. #include "FWPriMem.h"
  26. #endif
  27.  
  28. #include <stdio.h>
  29.  
  30. #if defined(FW_BUILD_MAC) && !defined(__TYPES__)
  31. #include <Types.h>
  32. #endif
  33.  
  34. #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
  35. #include <Windows.h>
  36. #endif
  37.  
  38. #ifdef FW_BUILD_MAC
  39. #pragma segment FWCommon
  40. #endif
  41.  
  42. //----------------------------------------------------------------------------------------
  43. // FW_PrivDebugger
  44. //----------------------------------------------------------------------------------------
  45. FW_EXPORT void FW_PrivDebugger()
  46. {
  47.     // No try block necessary - Do not throw
  48. #if defined(FW_BUILD_WIN)
  49.     ::DebugBreak();
  50. #elif defined(FW_BUILD_MAC)
  51.     ::Debugger();
  52. #endif
  53. }
  54.  
  55. #if defined(FW_BUILD_MAC) && !defined(CGLUESUPPORTED)
  56. //----------------------------------------------------------------------------------------
  57. // fwctop
  58. //----------------------------------------------------------------------------------------
  59.  
  60. static void fwctop(char* s)
  61. {
  62.     int len = FW_PrimitiveStringLength(s);
  63.     FW_PrimitiveCopyMemory(s, s+1, len);
  64.     s[0] = len;
  65. }
  66.  
  67. //----------------------------------------------------------------------------------------
  68. // fwptoc
  69. //----------------------------------------------------------------------------------------
  70.  
  71. static void fwptoc(char* s)
  72. {
  73.     int len = s[0];
  74.     FW_PrimitiveCopyMemory(s+1, s, len);
  75.     s[len] = 0;
  76. }
  77.  
  78. //----------------------------------------------------------------------------------------
  79. // debugstr
  80. //----------------------------------------------------------------------------------------
  81. static void debugstr(const char *message)
  82. {
  83.     fwctop((char*) message);
  84.     DebugStr((const unsigned char*) message);
  85.     fwptoc((char*) message);
  86. }
  87. #endif
  88.  
  89. //----------------------------------------------------------------------------------------
  90. // FW_PrivDebugMessage
  91. //----------------------------------------------------------------------------------------
  92. FW_EXPORT void FW_PrivDebugMessage(const char *message)
  93. {
  94.     // No try block necessary - Do not throw
  95. #if defined(FW_BUILD_WIN)
  96.     char crlf[3] = {0x0D, 0x0A, 0x00};
  97.     ::OutputDebugString(message);
  98.     ::OutputDebugString(crlf);
  99.     ::DebugBreak();
  100. #elif defined(FW_BUILD_MAC)
  101.     ::debugstr(message);
  102. #endif
  103. }
  104.  
  105. #else
  106.  
  107. //----------------------------------------------------------------------------------------
  108. // FW_PrivDebugMessage
  109. //----------------------------------------------------------------------------------------
  110. FW_EXPORT void FW_PrivDebugMessage(const char *message)
  111. {
  112. FW_UNUSED(message);
  113. }
  114.  
  115. //----------------------------------------------------------------------------------------
  116. // FW_PrivDebugger
  117. //----------------------------------------------------------------------------------------
  118. FW_EXPORT void FW_PrivDebugger()
  119. {
  120. }
  121.  
  122. #endif
  123.  
  124.