home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Divers / DinkClass ƒ / DinkClass / DObject.c < prev    next >
Encoding:
Text File  |  1992-12-31  |  2.4 KB  |  129 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        DObject.cp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Mark Gross
  7.  
  8.     Copyright:    © 1992 by Applied Technical Software, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>    12/31/92    MTG        making the code conditionaly compiled so         that I am
  13.                                     always working with a current         version in either think c
  14.                                     or MPW C++
  15.          <2>     9/20/92    MTG        Bringin the C++ version up to date with the THINK C version
  16.  
  17.     To Do:
  18. */
  19.  
  20.  
  21. // This is the definition file for the DObject root class
  22. // for the DinkClass CLass library.  it is responcible for
  23. // implementing Global wornings and some Debuging tools.
  24.  
  25. #include "DObject.h"
  26.  
  27. #ifdef THINK_C
  28.     #include <pascal.h>
  29. #else
  30.     //nothing!
  31. #endif
  32.  
  33. #include <stdio.h>
  34.  
  35. void    DObject::ErrorAlert(short stringsID, short theError)
  36. {
  37.     short    result;
  38.     Str255    theStr;
  39.     
  40.     GetIndString(theStr, stringsID, theError);
  41.     
  42.     ParamText( theStr , "\p", "\p", "\p");
  43.     result = CautionAlert(rErrorAlert, NULL);
  44.  
  45. }// end of function ErrorAlert
  46.  
  47.  
  48.  
  49. void    DObject::Beep(int times)
  50. {
  51.     while ( times--)
  52.         SysBeep(20);
  53. }
  54.  
  55. void     DObject::EnterMB(void)
  56. {
  57.     Debugger( );
  58. }
  59.  
  60. /*
  61. void    DObject::EnterMBStr(char *theString)
  62. {
  63.     
  64.     DebugStr( CtoPstr(theString) );
  65.     // MPW version ... Debugger( C2Pstr(theString) );
  66.  
  67. }
  68. */
  69.  
  70. void    DObject::EnterMBStr(char *theString)
  71. {
  72.     
  73. //    DebugStr( CtoPstr(theString) );
  74.  
  75. // Non-DeBug Version.....
  76.     short    result;
  77.         
  78.     ParamText( CtoPstr(theString) , "\p", "\p", "\p");
  79.     result = CautionAlert(rErrorAlert, NULL);
  80. }
  81.  
  82.  
  83. void DObject::MakeMBAlias(char* alias, void* address)
  84. {
  85.     char buffer[80];
  86.     
  87.     sprintf(buffer, ";MC %s %lx", alias, address);
  88.                 // Just be carefull that the string in alias is a vaild
  89.                 // MB macro name!!!    
  90.     EnterMBStr(buffer);
  91. }        
  92.     
  93.  
  94. pascal void DObject::SetZero(void)
  95. {
  96.     *(long *)(NULL) = 0x50FFC001;
  97. }
  98.  
  99. Boolean DObject::HasColorQD(void)
  100. {
  101.     SysEnvRec    env_rec;
  102.     
  103.     if (SysEnvirons(1, &env_rec) == envNotPresent || !env_rec.hasColorQD)
  104.         return(FALSE);
  105.     return(TRUE);
  106. }
  107.  
  108.  
  109. // The following are the hooks into the ThinkC oopsDebug lib
  110. // Gee, why arn't these guys docuemented in the manuals?
  111. // I just kept getting link errors untill I knew enough 
  112. // to look at the interface file oops.h to find the specs
  113. // for these two "/*  debugging hooks  */"
  114.  
  115. void __noObject(void)
  116. {
  117.         SysBeep(20);
  118.         DebugStr("\p noObject catch, from oopsDebug stubs!!!");
  119. }
  120.  
  121. void __noMethod(void)
  122. {
  123.         SysBeep(20);
  124.         SysBeep(20);
  125.         DebugStr("\p noMethod catch, from oopsDebug stubs");
  126. }
  127.  
  128.  
  129.