home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C++ / Applications / Muddweller 1.2 / source code / MMUDDweller.cp < prev    next >
Encoding:
Text File  |  1994-02-14  |  2.8 KB  |  159 lines  |  [TEXT/MPS ]

  1. /* MMUDDweller - Main program                                                 */
  2.  
  3. #define  __MMUDDWELLER__
  4.  
  5. //  {$MC68020-}            // The main program must be universal code
  6. //  {$MC68881-}
  7.  
  8.         // • Toolbox
  9. #if qDebug
  10. #include <stdio.h>
  11. #include <iostream.h>
  12. #endif
  13.  
  14. #ifndef __CMINTF__
  15. #include "CMIntf.h"
  16. #endif
  17.  
  18. #ifndef __CRMINTF__
  19. #include "CRMIntf.h"
  20. #endif
  21.  
  22. #ifndef __CTBUTILS__
  23. #include "CTBUtils.h"
  24. #endif
  25.  
  26. #ifndef __OSUTILS__
  27. #include "OSUtils.h"
  28. #endif
  29.  
  30.         // • MacApp
  31. #ifndef __UMacApp__
  32. #include <UMacApp.h>
  33. #endif
  34.  
  35. #ifndef __UDialog__
  36. #include <UDialog.h>
  37. #endif
  38.  
  39. #ifndef __UPrinting__
  40. #include <UPrinting.h>
  41. #endif
  42.  
  43. #ifndef __UTEView__
  44. #include <UTEView.h>
  45. #endif
  46.  
  47.         // • Implementation use
  48. #ifndef __COMMANDVIEW__
  49. #include "CommandView.h"
  50. #endif
  51.  
  52. #ifndef __DOCDIALOGS__
  53. #include "DocDialogs.h"
  54. #endif
  55.  
  56. #ifndef __GLOBALS__
  57. #include "Globals.h"
  58. #endif
  59.  
  60. #ifndef __LOGVIEW__
  61. #include "LogView.h"
  62. #endif
  63.  
  64. #ifndef __LOGWINDOW__
  65. #include "LogWindow.h"
  66. #endif
  67.  
  68. #ifndef __MACROS__
  69. #include "Macros.h"
  70. #endif
  71.  
  72. #ifndef __MUDDOC__
  73. #include "MUDDoc.h"
  74. #endif
  75.  
  76. #ifndef __UMUDDWELLER__
  77. #include "UMUDDweller.h"
  78. #endif
  79.  
  80. #ifndef __NOTRACE__
  81. #include "NoTrace.h"
  82. #endif
  83.  
  84. #ifndef __USizerView__
  85. #include "USizerView.h"
  86. #endif
  87.  
  88.  
  89. //------------------------------------------------------------------------------
  90.  
  91. const unsigned char kTCPName[] = "\p.ipp";
  92.  
  93. //------------------------------------------------------------------------------
  94.  
  95. #pragma segment AInit
  96.  
  97. pascal Boolean ValidateComm ()
  98. {
  99.     OSErr err;
  100.     Boolean wasPermanent;
  101.     
  102.     gCTBToolsFound = TRUE;
  103.     gCTBAvailable = TrapExists (_CommToolboxDispatch);
  104.     if (gCTBAvailable) {
  105.         wasPermanent = PermAllocation (TRUE);
  106.         err = InitCTBUtilities ();
  107.         if (err == noErr) err = InitCRM ();
  108.         if (err == noErr) err = InitCM ();
  109.         gCTBAvailable = (err == noErr);
  110.         gCTBToolsFound = (err != cmNoTools);
  111.         wasPermanent = PermAllocation (wasPermanent);
  112.     }
  113.     gTCPAvailable = OpenDriver ((Str255) kTCPName, &gTCPRef) == noErr;
  114.     return gCTBAvailable || gTCPAvailable;
  115. }
  116.  
  117. //------------------------------------------------------------------------------
  118.  
  119. #pragma segment Main
  120.  
  121. void main ()
  122. {
  123.     TMUDDwellerApp *gMUDDwellerApp;
  124.  
  125.     InitToolBox ();
  126.     if (!ValidateConfiguration (&gConfiguration)) {
  127.         StdAlert (phUnsupportedConfiguration);
  128.     } else {
  129.         InitUMacApp (8);
  130. #if qDebug
  131.         cout.sync_with_stdio ();
  132. #endif
  133.         if (!ValidateComm ()) {
  134.             if (!gCTBToolsFound)
  135.                 StdAlert (phNoToolsID);
  136.             else
  137.                 StdAlert (phNoCommID);
  138.         } else {
  139.             InitNoTrace ();
  140.             InitUDialog ();
  141.             InitUPrinting ();
  142.             InitUTEView ();
  143.             InitUSizerView();
  144.             InitCommandView ();
  145.             InitLogView ();
  146.             InitLogWindow ();
  147.             InitDocDialogs ();
  148.             InitMacros ();
  149.             InitMUDDoc ();
  150.             gMUDDwellerApp = new TMUDDwellerApp;
  151.             FailNIL (gMUDDwellerApp);
  152.             gMUDDwellerApp->IMUDDwellerApp ();
  153.             gMUDDwellerApp->Run ();
  154.         }
  155.     }
  156. }
  157.  
  158. //------------------------------------------------------------------------------
  159.