home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / schematk / src_1152.lha / defines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-09  |  10.9 KB  |  252 lines

  1. /* Copyright รก 1991 Gustavus Adolphus College.  All rights reserved.
  2.  *
  3.  * Schematik was developed by Gustavus Adolphus College (GAC) with
  4.  * support from NeXT Computer, Inc.  Permission to copy this software,
  5.  * to redistribute it, and to use it for any purpose is granted,
  6.  * subject to the following restrictions and understandings.
  7.  *
  8.  * 1. Any copy made of this software must include this copyright
  9.  * notice in full.
  10.  *
  11.  * 2. Users of this software agree to make their best efforts (a) to
  12.  * return to the GAC Mathematics and Computer Science Department any
  13.  * improvements or extensions that they make, so that these may be
  14.  * included in future releases; and (b) to inform GAC of noteworthy
  15.  * uses of this software.
  16.  *
  17.  * 3. All materials developed as a consequence of the use of this
  18.  * software shall duly acknowledge such use, in accordance with the
  19.  * usual standards of acknowledging credit in academic research.
  20.  *
  21.  * 4. GAC makes no express or implied warranty or representation of
  22.  * any kind with respect to this software, including any warranty
  23.  * that the operation of this software will be error-free.  ANY
  24.  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
  25.  * PURPOSE IS HEREBY DISCLAIMED.  GAC is under no obligation to
  26.  * provide any services, by way of maintenance, update, or otherwise.
  27.  *
  28.  * 5. In conjunction with products arising from the use of this
  29.  * material, there shall be no use of the name of Gustavus Adolphus
  30.  * College nor of any adaptation thereof in any advertising,
  31.  * promotional, or sales literature without prior written consent
  32.  * from GAC in each case.
  33.  */
  34.  
  35. // General application macros
  36. #define APPVERSION        "1.1.5.2"
  37. #define APPNAME            "Schematik"
  38. #define DOCUMENTEXTENSION    "scm"
  39.  
  40. // Macros for names of header files
  41. #define DocText_h        "../Doc.subproj/DocText.h"
  42. #define DocWin_h        "../Doc.subproj/DocWin.h"
  43. #define FindAgent_h        "../Agent.subproj/FindAgent.h"
  44. #define GraphicsView_h        "../Graphics.subproj/GraphicsView.h"
  45. #define HelpAgent_h        "../Agent.subproj/HelpAgent.h"
  46. #define IndentationState_h    "../Doc.subproj/DocText.h"
  47. #define InfoAgent_h        "../Agent.subproj/InfoAgent.h"
  48. #define InteractionWin_h    "../Doc.subproj/InteractionWin.h"
  49. #define Main_h            "../Main.subproj/Main.h"
  50. #define Marker_h        "../Doc.subproj/DocText.h"
  51. #define MyFontPanel_h        "../Main.subproj/Main.h"
  52. #define PrefAgent_h        "../Agent.subproj/PrefAgent.h"
  53. #define SchemeProtocol_h        "../Main.subproj/SchemeProtocol.h"
  54.  
  55. // Macro constants used in more than one source file
  56. #define BACKUPEXTENSION        "~"
  57. #define BROWSERCOLUMN        0
  58. #define EVALUATING        1
  59. #define FINDBACKWARD        -1
  60. #define FINDFORWARD        1
  61. #define GARBCOLLECT        2
  62. #define GOODFONT1        "Ohlfs"
  63. #define GOODFONT2        "Courier"
  64. #define INPUTSTATE        0
  65. #define NEWLINECHAR        '\n'
  66. #define NEWLINESTRING        "\n"
  67. #define PATHSEPARATOR        '/'
  68. #define PREVIOUS        -1
  69. #define SIGNALABORTPREV        SIGQUIT
  70. #define SIGNALABORTSAME        SIGUSR2
  71. #define SIGNALABORTTOP        SIGINT
  72. #define SIGNALBREAKPOINT    SIGUSR1
  73. #define WHITESPACECHARS        " \n\t\r\v\f"
  74.  
  75. // Macros for local strings
  76. #define ADDCMDLINEPARAMS    LocalString("Additional command-line parameters",NULL)
  77. #define CMDLINEPARAMS        LocalString("Command-line parameters",NULL)
  78. #define DEFAULTFILENAME        LocalString("~/UNTITLED",NULL)
  79. //
  80. #define ERRORALTERNATE        LocalString("No",NULL)
  81. #define ERRORDEFAULT        LocalString("Yes",NULL)
  82. #define ERRORMESSAGE        LocalString("%s\nAbort computation?",NULL)
  83. #define ERRORTITLE        LocalString("Error",NULL)
  84. #define EVALMESSAGE        LocalString("Evaluating...",NULL)
  85. #define EXECERRORMESSAGE    LocalString("ERROR: Scheme process could not be exec'd.", NULL)
  86. #define FILENAMETEMPLATE    LocalString("%s/English.lproj/Help/%s.rtf",NULL)
  87. #define FILEOPENERROR        LocalString("Could not open file.",NULL)
  88. #define FILESAVEERROR        LocalString("Could not save file.", NULL)
  89. #define FORKERRORMESSAGE    LocalString("Could not vfork to create Scheme process.", NULL)
  90. #define GCMESSAGE        LocalString("Garbage collecting...",NULL)
  91. #define GENERICTITLE        LocalString("Graphics (#%d)",NULL)
  92. #define GRAPHICSPROTOCOLERROR    LocalString("Unimplemented graphics protocol: (ESC G %c)",NULL)
  93. #define HELPBROWSERTITLE    LocalString("Topics",NULL)
  94. #define HELPDIR            LocalString("%s/English.lproj/Help",NULL)
  95. #define HELPPANELTITLE        LocalString("Help",NULL)
  96. #define INTERWINDOWTITLE    LocalString("Interaction Window",NULL)
  97. #define LEVELTITLE        LocalString("Level:",NULL)
  98. #define LICENSEPANELTITLE    LocalString("Licenses",NULL)
  99. #define MEMORYSTREAMERROR    LocalString("Cannot open memory stream.",NULL)
  100. #define NOHELPFILE        LocalString(".NoHelp",NULL)
  101. #define NONPROTOCOLERROR    LocalString("(ESC %c) sequence received from Scheme.  This is not a valid protocol sequence.", NULL)
  102. #define NOTFOUNDMESSAGE        LocalString("Not\nFound",NULL)
  103. #define NOVALUESTRING        LocalString("No value",NULL)
  104. #define OKSTRING        LocalString("OK", NULL)
  105. #define OPENALERTTITLE        LocalString("Open",NULL)
  106. #define PROCESSEXITTERM        LocalString("The scheme process has terminated on exit(%u).",NULL)
  107. #define PROCESSRESTARTBAD    LocalString("The scheme process could NOT be sucessfully restarted.", NULL)
  108. #define PROCESSRESTARTOK    LocalString("The scheme process was restarted.", NULL)
  109. #define PROCESSSIGTERM        LocalString("The scheme process has terminated on signal %u: %s.",NULL)
  110. #define PROCESSSTOPPED        LocalString("The scheme process has stopped on signal %u: %s.",NULL)
  111. #define PROTOCOLERROR        LocalString("Protocol Error", NULL)
  112. //
  113. #define QUERYALTERNATE        LocalString("No",NULL)
  114. #define QUERYDEFAULT        LocalString("Yes",NULL)
  115. #define QUERYTITLE        LocalString("Query",NULL)
  116. #define QUITALERTALTERNATE    LocalString("Quit Anyway",NULL)
  117. #define QUITALERTDEFAULT    LocalString("Review Unsaved",NULL)
  118. #define QUITALERTMESSAGE    LocalString("You have unsaved documents.",NULL)
  119. #define QUITALERTMESSAGE2    LocalString("Save interaction window?",NULL)
  120. #define QUITALERTOTHER        LocalString("Cancel",NULL)
  121. #define QUITALERTTITLE        LocalString("Quit",NULL)
  122. #define REPLACEDMESSAGE        LocalString("%i\nreplaced",NULL)
  123. //
  124. #define RESTARTALTERNATE    LocalString("No",NULL)
  125. #define RESTARTDEFAULT        LocalString("Restart",NULL)
  126. //
  127. #define REVERTALERTALTERNATE    LocalString("No", NULL)
  128. #define REVERTALERTDEFAULT    LocalString("Revert", NULL)
  129. #define REVERTALERTQUERY    LocalString("Do you want to lose changes in %s?", NULL)
  130. #define REVERTALERTTITLE    LocalString("Revert", NULL)
  131. #define SAVEALERTALTERNATE    LocalString("No",NULL)
  132. #define SAVEALERTDEFAULT    LocalString("Save",NULL)
  133. #define SAVEALERTOTHER        LocalString("Cancel",NULL)
  134. #define SAVEALERTQUERY        LocalString("Save changes to %s?", NULL)
  135. #define SAVEALERTTITLE        LocalString("Save", NULL)
  136. #define SAVEERRORMESSAGE    LocalString("An error occurred in saving the file.  Possibly the file is write protected.", NULL)
  137. #define SAVINGMESSAGE        LocalString("saving: %s", NULL)
  138. #define SCHEMEPROCMESSAGE    LocalString("Scheme Process",NULL)
  139. #define SOCKETERRORMESSAGE    LocalString("Could not create socketpair to Scheme process.", NULL)
  140. #define TERMINATIONERRORMESSAGE    LocalString("Scheme process terminated unexpectedly.", NULL)
  141. #define UNIMPLEMENTEDERROR    LocalString("Unimplemented protocol: (ESC %c)", NULL)
  142. #define VALUESTRING        LocalString("Value: ",NULL)
  143.  
  144.  
  145. // Menu cell tags.  Names ending in some lowercase characters denote leaves.
  146. #define MENU_INFO    0
  147. #define MENU_INFO_InfoPanel    0
  148. #define MENU_INFO_License    1
  149. #define MENU_INFO_Help        2
  150. #define MENU_INFO_Manual    3
  151. #define MENU_INFO_Preferences    4
  152. #define MENU_DOCUMENT    1
  153. #define MENU_DOCUMENT_Open    0
  154. #define MENU_DOCUMENT_New    1
  155. #define MENU_DOCUMENT_Save    2
  156. #define MENU_DOCUMENT_SaveAs    3
  157. #define MENU_DOCUMENT_Revert    4
  158. #define MENU_DOCUMENT_Close    5
  159. #define MENU_EDIT        2
  160. #define MENU_EDIT_Cut        0
  161. #define MENU_EDIT_Copy        1
  162. #define MENU_EDIT_Paste        2
  163. #define MENU_EDIT_Undo        3
  164. #define MENU_EDIT_FIND        4
  165. #define MENU_EDIT_FIND_FindPanel    0
  166. #define MENU_EDIT_FIND_FindNext        1
  167. #define MENU_EDIT_FIND_FindPrevious    2
  168. #define MENU_EDIT_SelectAll    5
  169. #define MENU_FORMAT    3
  170. #define MENU_FORMAT_FontPanel    0
  171. #define MENU_FORMAT_AdjIndents    1
  172. #define MENU_FORMAT_PageLayout    2
  173. #define MENU_ACTIONS    4
  174. #define MENU_ACTIONS_Evaluate    0
  175. #define MENU_ACTIONS_EvalAll    1
  176. #define MENU_ACTIONS_AbortTop    2
  177. #define MENU_ACTIONS_AbortSame    3
  178. #define MENU_ACTIONS_AbortPrev    4
  179. #define MENU_ACTIONS_Breakpoint    5
  180. #define MENU_Print    5
  181. #define MENU_WINDOWS    6
  182. #define MENU_WINDOWS_Arrange    0
  183. #define MENU_WINDOWS_Miniturize    1
  184. #define MENU_WINDOWS_Close    2
  185. #define MENU_SERVICES    7
  186. #define MENU_Hide    8
  187. #define MENU_Quit    9
  188.  
  189. // Macros for common operations
  190. #define LoadNIB(file,owned,zone)    [[NXApp prefAgent] loadLocalNib:file owner:owned fromZone:zone]
  191. #define FindMenuCell1(tag1)        [[NXApp mainMenu] findCellWithTag:tag1]
  192. #define FindMenuCell2(tag1,tag2)    [[[[NXApp mainMenu] findCellWithTag:tag1] target] findCellWithTag:tag2]
  193. #define FindMenuCell3(tag1,tag2,tag3)    [[[[[[NXApp mainMenu] findCellWithTag:tag1] target] findCellWithTag:tag2] target] findCellWithTag:tag3]
  194. #define EnableMenuItem(cell)        [cell setEnabled:YES]
  195. #define DisableMenuItem(cell)        [cell setEnabled:NO]
  196.  
  197. // Macros for debugging
  198.  
  199. #define DEBUG
  200. #undef DEBUG
  201.  
  202. #ifdef DEBUG
  203.   #import <stdio.h>
  204.   #import <objc/Object.h>
  205.   #define DEBUGLEVEL        3
  206.   #define DEBUGTHRESHOLD    3
  207.   #define DEBUG_OUTFILE        stderr
  208.   #define DEBUG_VERSION        APPNAME " version " APPVERSION ".\n  Source file " __FILE__ " last compiled on " __DATE__ " at " __TIME__ "\n"
  209.   #define DEBUG_PUTS(string)    fputs(string, DEBUG_OUTFILE)
  210.   #define DEBUG_PRINTF        fprintf(DEBUG_OUTFILE,
  211.   #define DEBUG_PRINTFIF(x)    if (x) DEBUG_PRINTF
  212.   #define DEBUG_ASSERT(x)    if (!(x)) DEBUG_PRINTF "Assertion: %s failed in source file: %s line: %i\n",#x,__FILE__,__LINE__);
  213.   #define DEBUG_ASSERTIF(x,y)    if ((x)&&!(y)) DEBUG_PRINTF "Assertion: %s failed in source file: %s line: %i\n",#y,__FILE__,__LINE__);
  214.   #define DEBUG_FUNC1        doDebug
  215.  
  216. void translateencoding(char *, void *, int);
  217.  
  218.   #define doDebug(level)        \
  219.     {                    \
  220.       unsigned int i,numargs;                    \
  221.       Method thisMeth;                        \
  222.       BOOL inClassMethod=!NXOrderStrings((unsigned char *)@encode(typeof(self)),(unsigned char *)"#",YES,-1,NULL);    \
  223.       switch(level)                        \
  224.         {                            \
  225.          case 4 : DEBUG_PUTS(DEBUG_VERSION);            \
  226.                   break;                    \
  227.          case 3 : DEBUG_PRINTF "In class: %s, ",__FILE__);    \
  228.          case 2 : thisMeth=(inClassMethod?class_getClassMethod(isa,_cmd):class_getInstanceMethod(isa,_cmd));        \
  229.                   numargs=method_getNumberOfArguments(thisMeth);        \
  230.                   DEBUG_PRINTF "%s called",sel_getName(_cmd));            \
  231.           if (2<numargs) DEBUG_PRINTF " with: ");            \
  232.                   for(i=2; i<numargs; i++)                    \
  233.                     {                                \
  234.                       char *type;                        \
  235.                       int offset;                        \
  236.                       method_getArgumentInfo(thisMeth,i,&type,&offset);        \
  237.                       translateencoding(type,&self,offset);            \
  238.                     }                                \
  239.                   DEBUG_PRINTF "\n");                        \
  240.                   break;                            \
  241.          case 1 : DEBUG_PRINTF "%s called.\n", sel_getName(_cmd));        \
  242.                   break;                            \
  243.          default: break;                            \
  244.        }                                \
  245.    }
  246.  
  247. #else
  248.   #define DEBUG_ASSERT(x)    {}
  249.   #define DEBUG_ASSERTIF(x,y)    {}
  250.   #define DEBUG_FUNC1(x)    {}
  251. #endif /* DEBUG */
  252.