home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / MacPerl Source ƒ / MacPerl5 / MPGlobals.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-14  |  7.0 KB  |  336 lines  |  [TEXT/MPS ]

  1. /*********************************************************************
  2. Project    :    MacPerl                -    Real Perl Application
  3. File        :    MPGlobals.h    -
  4. Author    :    Matthias Neeracher
  5.  
  6. A lot of this code is borrowed from 7Edit written by
  7. Apple Developer Support UK
  8.  
  9. Language    :    MPW C
  10.  
  11. $Log: MPGlobals.h,v $
  12. Revision 1.2  1994/05/04  02:51:46  neeri
  13. Inline Input.
  14.  
  15. Revision 1.1  1994/02/27  23:03:27  neeri
  16. Initial revision
  17.  
  18. Revision 0.5  1993/12/12  00:00:00  neeri
  19. PerlPrefs, SacrificalGoat
  20.  
  21. Revision 0.4  1993/08/17  00:00:00  neeri
  22. LibraryPaths
  23.  
  24. Revision 0.3  1993/08/05  00:00:00  neeri
  25. Small icons
  26.  
  27. Revision 0.2  1993/05/29  00:00:00  neeri
  28. Support console windows
  29.  
  30. Revision 0.1  1993/05/29  00:00:00  neeri
  31. Compiles correctly
  32.  
  33. *********************************************************************/
  34.  
  35. #ifndef __MPGLOBALS__
  36. #define __MPGLOBALS__
  37.  
  38. #include <Types.h>
  39. #include <QuickDraw.h>
  40. #include <Menus.h>
  41. #include <Editions.h>
  42. #include <Printing.h>
  43. #include <AppleEvents.h>
  44. #include <TextServices.h>
  45. #include <TSMTE.h>
  46. #include <ICAPI.h>
  47. #include <setjmp.h>
  48.  
  49. #define MAC_CONTEXT
  50. #include "macish.h"
  51.  
  52. #include "MPRsrc.h"
  53.  
  54. #ifndef EXTERN
  55. #define EXTERN extern 
  56. #define INIT(x)
  57. #endif
  58.  
  59. #define  PerlWindowKind    5146
  60.  
  61. #define    LibraryPaths    128
  62.  
  63. /*
  64.     Items in Apple Menu
  65. */
  66.  
  67. #define  aboutItem  1
  68.  
  69. /*
  70.     Items in File Menu
  71. */
  72.  
  73. #define  fmNew                    1
  74. #define  fmOpen                2
  75. #define  fmClose                4
  76. #define  fmSave                5
  77. #define  fmSaveAs                6
  78. #define  fmRevert                7
  79. #define  fmPageSetUp            9
  80. #define  fmPrint                10
  81. #define  fmQuit                12
  82.  
  83. /*
  84.     Items in Edit Menu
  85. */
  86. #define  undoCommand            1
  87. #define  cutCommand             3
  88. #define  copyCommand         4
  89. #define  pasteCommand         5
  90. #define  clearCommand         6
  91. #define  selectAllCommand     7
  92.  
  93. #define    emJumpTo                9
  94. #define    emFormat                11
  95.  
  96. #define  cPublisher           13
  97. #define  cSubscriber          14
  98. #define  cOptions             15
  99. #define  cBorders             16
  100.  
  101. #define    emPreferences        18
  102.  
  103. /*
  104.     Items in Perl Menu
  105. */
  106. #define    pmRun                1
  107. #define    pmRunFront        2
  108. #define    pmCheckSyntax    3
  109. #define    pmWarnings        5
  110. #define    pmDebug            6
  111.  
  112. /*
  113.     Item in Help Menu
  114. */
  115. #define    hmExplain        5
  116.  
  117. /*
  118.     Entry of Menu in myMenus
  119. */
  120. #define  appleM             0
  121. #define  fileM              1
  122. #define  editM              2
  123. #define    windowM            3
  124. #define    perlM                4
  125. #define    helpM                5
  126. #define  kLastMenu        5
  127.  
  128. /*
  129.     Save Changes Dialog Items
  130. */
  131.  
  132. #define  aaSave              1
  133. #define  aaDiscard          2
  134. #define  aaCancel         3
  135.  
  136. #define  kOSEvent                       app4Evt    /*event used by MultiFinder*/
  137. #define  kSuspendResumeMessage        1        /*high byte of suspend/resume event message*/
  138. #define  kResumeMask                         1        /*bit of message field for resume vs. suspend*/
  139. #define  kMouseMovedMessage              0xFA    /*high byte of mouse-moved event message*/
  140. #define  kNoEvents                         0        /*no events mask*/
  141.  
  142. /* How much memory to set aside for emergencies */
  143.  
  144. #define SACRIFICE        32768
  145.  
  146. /* File too bulky for TextEdit */
  147.  
  148. #define elvisErr        666
  149.  
  150. /*
  151.     this is a section record to hold the information about
  152.     the publishers and subscribers in this document
  153. */
  154.  
  155. struct SectRec {
  156.     SectionHandle   fSectHandle;
  157.     short           fSectionID;
  158.     RgnHandle       fBorderRgn; /*handle to the outside border*/
  159.     Rect            fInnerBounds;
  160.     short           fStart;     /*fStart and fEnd are both specific to a*/
  161.     short           fEnd;       /*text handling application- start and end of text selection*/
  162.     struct SectRec  **fNextSection;
  163.     FSSpec          fFSSpec;
  164.     short           fCount;
  165.     Handle          fTextHandle;
  166.     Boolean         fChanged; /*has the section been changed*/
  167.     struct DocRec   *fDocument;
  168. };
  169.  
  170. typedef struct SectRec SectRec;
  171. typedef SectRec *SectPtr, **SectHandle;
  172.  
  173. typedef enum {
  174.     kDocumentWindow,
  175.     kWorksheetWindow,
  176.     kConsoleWindow
  177. } WindowKind;
  178.  
  179. typedef struct RegularDoc {
  180.     Boolean          showBorders;
  181.     Boolean        everSaved;
  182.     Boolean            everLoaded;
  183.     SectHandle       firstSection; /*the first section in the list*/
  184.     SectHandle       lastSection;  /*the last section*/
  185.     short          numSections;
  186.     short          lastID;      /*the last sectionID*/
  187.     FSSpec             origFSSpec;
  188. } RegularDoc;
  189.  
  190. struct DocRec;
  191.  
  192. typedef struct ConsoleDoc {
  193.     struct DocRec *next;
  194.     Ptr                cookie;
  195.     short                memory;
  196.     short                fence;
  197.     Boolean            selected;
  198. } ConsoleDoc;
  199.  
  200. enum {
  201.     stateConsole = 0x0001,
  202.     stateDocument= 0x0002,
  203.     stateRdWr    = 0x0010,
  204.     stateRdOnly  = 0x0020,
  205.     stateBlocked = 0x0030
  206. };
  207.  
  208. enum {
  209.     kPreferenceDoc = 'pref',
  210.     kPlainTextDoc    = 'TEXT',
  211.     kScriptDoc        = 'SCPT',
  212.     kRuntime7Doc    = 'MrP7',
  213.     kOldRuntime6Doc= 'OlP6',
  214.     kUnknownDoc        = '\?\?\?\?'
  215. };
  216.  
  217. typedef OSType    DocType;
  218.  
  219. struct DocRec {
  220.     TEHandle       theText;
  221.     ControlHandle  vScrollBar;
  222.     ControlHandle  hScrollBar;
  223.     WindowPtr      theWindow;
  224.     short          refNum;
  225.     short                lastState;
  226.     Str255         theFileName;
  227.     FSSpec           theFSSpec;
  228.     THPrint        thePrintSetup;
  229.     Rect           pageSize;    /*From thePrintSetUp^^.prInfo.rPage but 0 offset*/
  230.     Boolean        dirty;
  231.     Boolean            inDataFork;
  232.     DocType            type;
  233.     WindowKind        kind;
  234.     TSMTERecHandle    tsmTERecHandle;
  235.     TSMDocumentID    tsmDoc;
  236.     union {
  237.         RegularDoc    reg;
  238.         ConsoleDoc    cons;
  239.     } u;
  240. };
  241.  
  242. typedef struct DocRec DocRec;
  243. typedef DocRec *DPtr;
  244.  
  245. #if defined(powerc) || defined (__powerc)
  246. #pragma options align=mac68k
  247. #endif
  248.  
  249. struct HeaderRec {
  250.     Rect        theRect;
  251.     Str255   theFont;
  252.     short        theSize;
  253.     short    theLength;
  254.     short    numSections;
  255.     short    lastID;
  256. };
  257.  
  258. typedef struct HeaderRec HeaderRec;
  259.  
  260. #if defined(powerc) || defined (__powerc)
  261. #pragma options align=reset
  262. #endif
  263.  
  264. typedef HeaderRec *HPtr, **HHandle;
  265.  
  266. struct DocFormat {
  267.     short        font;
  268.     short        size;
  269. };
  270.  
  271. typedef struct DocFormat DocFormat;
  272.  
  273. #if defined(powerc) || defined (__powerc)
  274. #pragma options align=mac68k
  275. #endif
  276.  
  277. struct PerlPrefs    {
  278.     short        version;
  279. #define PerlPrefVersion411    0
  280. #define PerlPrefVersion413    1
  281. #define PerlPrefVersion500 2
  282.     Boolean    runFinderOpens;
  283.     Boolean    checkType;
  284.     Boolean    inlineInput;
  285. };
  286.  
  287. typedef struct PerlPrefs PerlPrefs;
  288.  
  289. #if defined(powerc) || defined (__powerc)
  290. #pragma options align=reset
  291. #endif
  292.  
  293. EXTERN short              gWCount;
  294. EXTERN short              gNewDocCount;
  295. EXTERN MenuHandle         myMenus[kLastMenu+1];
  296. EXTERN short              gFontMItem;
  297. EXTERN Boolean            gQuitting;
  298. EXTERN Boolean                gWarnings;
  299. EXTERN Boolean                gDebug;
  300. EXTERN Boolean            gInBackground;
  301. EXTERN Boolean                gRunningPerl;
  302. EXTERN Boolean                gRemoteControl;
  303. EXTERN Cursor             editCursor;
  304. EXTERN Cursor             waitCursor;
  305. EXTERN DPtr                    gConsoleList;
  306. EXTERN short                gPrefsFile;
  307. EXTERN short                gScriptFile;
  308. EXTERN WindowPtr            gActiveWindow;
  309. MP_EXT short                gAppFile;
  310. MP_EXT short                gAppVol;
  311. MP_EXT long                    gAppDir;
  312. EXTERN DocFormat            gFormat;
  313. EXTERN Handle                gRuntimeScript;
  314. EXTERN Handle                gPseudoFile;
  315. EXTERN AppleEvent ***    gWaitingScripts;
  316. EXTERN DPtr                    gGotEof;
  317. EXTERN PerlPrefs            gPerlPrefs;
  318. MP_EXT Handle                gSacrificialGoat;
  319. EXTERN jmp_buf                gExitPerl;
  320. EXTERN AppleEvent            gDelayedScript;
  321. EXTERN short                gCompletedScripts;
  322. EXTERN long                 gSavedFontForce;
  323.  
  324.   /*now for the environment variables set up by Gestalt*/
  325.  
  326. EXTERN Boolean    gAppleEventsImplemented;
  327.  
  328. EXTERN Boolean    gAliasManagerImplemented;
  329. EXTERN Boolean    gEditionManagerImplemented;
  330. EXTERN Boolean    gOutlineFontsImplemented;
  331. EXTERN Boolean    gRecordingImplemented;
  332. EXTERN Boolean        gTextServicesImplemented;
  333. EXTERN Boolean        gTSMTEImplemented;
  334. EXTERN ICInstance    gICInstance;
  335.  
  336. #endif