Jack Jansen | 42218ce | 1997-01-31 16:15:11 +0000 | [diff] [blame] | 1 | /*********************************************************** |
| 2 | Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, |
| 3 | The Netherlands. |
| 4 | |
| 5 | All Rights Reserved |
| 6 | |
| 7 | Permission to use, copy, modify, and distribute this software and its |
| 8 | documentation for any purpose and without fee is hereby granted, |
| 9 | provided that the above copyright notice appear in all copies and that |
| 10 | both that copyright notice and this permission notice appear in |
| 11 | supporting documentation, and that the names of Stichting Mathematisch |
| 12 | Centrum or CWI not be used in advertising or publicity pertaining to |
| 13 | distribution of the software without specific, written prior permission. |
| 14 | |
| 15 | STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO |
| 16 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 17 | FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE |
| 18 | FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 19 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 20 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT |
| 21 | OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 22 | |
| 23 | ******************************************************************/ |
| 24 | |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 25 | /* |
| 26 | ** Resource-IDs in use by Python. |
| 27 | ** |
| 28 | ** All resources used by the python interpreter itself fall |
Jack Jansen | 6b02ac2 | 1998-01-06 16:48:49 +0000 | [diff] [blame] | 29 | ** in the range 228-256. The range 128-228 is not used, because |
| 30 | ** there is too much chance of conflicts with other packages. |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 31 | ** |
| 32 | ** Standard python modules use resources in the range |
| 33 | ** 256-512. |
| 34 | ** |
| 35 | ** Python programs that use their own resources are advised to |
| 36 | ** choose resource numbers higher than 512. |
| 37 | */ |
| 38 | |
| 39 | /* |
| 40 | ** Resources that reside in the python executable (or, for |
| 41 | ** shared ppc python, in the core dynamic library) |
| 42 | */ |
| 43 | |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 44 | #define BASE_ID 228 |
| 45 | |
Jack Jansen | 41fa7ea | 1995-08-31 13:59:36 +0000 | [diff] [blame] | 46 | /* The alert for "No Python directory, where is it?" (OBSOLETE) */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 47 | #define NOPYTHON_ALERT BASE_ID+0 |
Jack Jansen | 41fa7ea | 1995-08-31 13:59:36 +0000 | [diff] [blame] | 48 | #define YES_ITEM 1 |
| 49 | #define NO_ITEM 2 |
| 50 | #define CURWD_ITEM 3 |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 51 | |
| 52 | /* The alert for "this is an applet template" */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 53 | #define NOPYC_ALERT BASE_ID+1 |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 54 | |
| 55 | /* The dialog for our GetDirectory and PromptGetFile call */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 56 | #define GETDIR_ID BASE_ID+2 /* Resource ID for our "get directory" */ |
| 57 | #define GETFILEPROMPT_ID BASE_ID+4 /* Resource id for prompted get file */ |
| 58 | #define PROMPT_ITEM 10 /* The prompt, at the top */ |
| 59 | #define SELECTCUR_ITEM 11 /* "Select current directory" button */ |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 60 | |
| 61 | |
| 62 | /* The dialog for interactive options */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 63 | #define OPT_DIALOG BASE_ID+3 /* Resource ID for dialog */ |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 64 | #define OPT_OK 1 |
| 65 | #define OPT_CANCEL 2 |
| 66 | #define OPT_INSPECT 3 |
| 67 | #define OPT_VERBOSE 4 |
Jack Jansen | c6bb281 | 1997-09-09 13:50:40 +0000 | [diff] [blame] | 68 | #define OPT_OPTIMIZE 5 |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 69 | #define OPT_UNBUFFERED 6 |
| 70 | #define OPT_DEBUGGING 7 |
Jack Jansen | 4a5eb96 | 2000-09-22 21:50:11 +0000 | [diff] [blame] | 71 | #define OPT_KEEPALWAYS 8 |
| 72 | #define OPT_KEEPOUTPUT 9 |
| 73 | #define OPT_KEEPERROR 10 |
| 74 | #define OPT_KEEPNEVER 11 |
| 75 | #define OPT_CMDLINE 12 |
Jack Jansen | e4d7b5e | 2000-05-07 22:07:26 +0000 | [diff] [blame] | 76 | #define OPT_TABWARN 13 |
Jack Jansen | c6bb281 | 1997-09-09 13:50:40 +0000 | [diff] [blame] | 77 | #define OPT_NOSITE 14 |
Jack Jansen | e4d7b5e | 2000-05-07 22:07:26 +0000 | [diff] [blame] | 78 | #define OPT_HELP 15 |
| 79 | #define OPT_NONAVSERV 16 |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 80 | |
Jack Jansen | 41fa7ea | 1995-08-31 13:59:36 +0000 | [diff] [blame] | 81 | /* Dialog for 'No preferences directory' */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 82 | #define NOPREFDIR_ID BASE_ID+5 |
Jack Jansen | 41fa7ea | 1995-08-31 13:59:36 +0000 | [diff] [blame] | 83 | |
Jack Jansen | 447e01b | 1997-09-08 13:24:54 +0000 | [diff] [blame] | 84 | /* Dialog for 'Bad or outdated preferences' */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 85 | #define BADPREFERENCES_ID BASE_ID+6 |
Jack Jansen | 447e01b | 1997-09-08 13:24:54 +0000 | [diff] [blame] | 86 | #define BADPREF_DELETE 1 |
| 87 | #define BADPREF_CONTINUE 2 |
| 88 | #define BADPREF_QUIT 3 |
Jack Jansen | 41fa7ea | 1995-08-31 13:59:36 +0000 | [diff] [blame] | 89 | /* Dialog for 'Bad preference file' */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 90 | #define BADPREFFILE_ID BASE_ID+7 |
Jack Jansen | 41fa7ea | 1995-08-31 13:59:36 +0000 | [diff] [blame] | 91 | |
Jack Jansen | 3469e99 | 1996-09-06 00:30:45 +0000 | [diff] [blame] | 92 | /* About box */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 93 | #define ABOUT_ID BASE_ID+8 |
Jack Jansen | 3469e99 | 1996-09-06 00:30:45 +0000 | [diff] [blame] | 94 | |
Jack Jansen | d081b13 | 1996-10-22 15:24:21 +0000 | [diff] [blame] | 95 | /* No preferences file name resource */ |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 96 | #define NOPREFNAME_ID BASE_ID+9 |
Jack Jansen | d081b13 | 1996-10-22 15:24:21 +0000 | [diff] [blame] | 97 | |
Jack Jansen | a58d89e | 1996-10-11 13:19:52 +0000 | [diff] [blame] | 98 | /* EditPythonPrefs range. Needed here to forestall conflicts with applets */ |
Jack Jansen | a83caa0 | 1996-12-23 17:23:23 +0000 | [diff] [blame] | 99 | #define EDITPYTHONPREFS_MIN 508 |
Jack Jansen | a58d89e | 1996-10-11 13:19:52 +0000 | [diff] [blame] | 100 | #define EDITPYTHONPREFS_MAX 511 |
Jack Jansen | a83caa0 | 1996-12-23 17:23:23 +0000 | [diff] [blame] | 101 | /* twit range. Again needed to forestall conflicts with scripts using their own resources */ |
| 102 | #define TWIT_MIN 500 |
| 103 | #define TWIT_MAX 507 |
Jack Jansen | 001aa86 | 1997-05-28 11:54:43 +0000 | [diff] [blame] | 104 | /* Bruce range. The same */ |
| 105 | #define BRUCE_MIN 468 |
| 106 | #define BRUCE_MAX 499 |
Jack Jansen | a58d89e | 1996-10-11 13:19:52 +0000 | [diff] [blame] | 107 | |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 108 | /* |
| 109 | ** The following are valid both in the binary (or shared library) |
Jack Jansen | ab69eb9 | 1996-04-04 15:39:42 +0000 | [diff] [blame] | 110 | ** and in the Preferences file. |
Jack Jansen | 3d22887 | 1996-09-06 22:18:40 +0000 | [diff] [blame] | 111 | ** For all these the override is tried first, in the application resource fork |
| 112 | ** only, this allows an applet to override standard settings. |
| 113 | ** If there is no override resource the preferences file is added to the head |
| 114 | ** of the resource file chain and the non-override version of the resource is |
| 115 | ** searched in any resource file. |
| 116 | ** |
Jack Jansen | 6b02ac2 | 1998-01-06 16:48:49 +0000 | [diff] [blame] | 117 | ** The effect of this is that, for example, a 'Popt' of 228 in the application or |
Jack Jansen | 3d22887 | 1996-09-06 22:18:40 +0000 | [diff] [blame] | 118 | ** shared library provides default options for use when no preferences are set, |
Jack Jansen | 6b02ac2 | 1998-01-06 16:48:49 +0000 | [diff] [blame] | 119 | ** while a 'Popt' of 229 (in the application *only*) overrides any options in the |
Jack Jansen | 3d22887 | 1996-09-06 22:18:40 +0000 | [diff] [blame] | 120 | ** preferences file. |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 121 | */ |
| 122 | |
Jack Jansen | d081b13 | 1996-10-22 15:24:21 +0000 | [diff] [blame] | 123 | /* The STR resource that holds the preference file name */ |
Jack Jansen | 245d179 | 1999-01-30 13:21:24 +0000 | [diff] [blame] | 124 | #define PREFFILENAME_ID 228 /* For Rez only */ |
| 125 | #define PREFFILENAME_PASCAL_NAME "PythonPreferenceFileName" |
Jack Jansen | d081b13 | 1996-10-22 15:24:21 +0000 | [diff] [blame] | 126 | #define PREFFILENAME_NAME "\pPythonPreferenceFileName" |
| 127 | |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 128 | /* The STR# resource for sys.path initialization */ |
Jack Jansen | 6b02ac2 | 1998-01-06 16:48:49 +0000 | [diff] [blame] | 129 | #define PYTHONPATH_ID 228 |
| 130 | #define PYTHONPATHOVERRIDE_ID 229 |
Jack Jansen | c2e6dd8 | 1995-08-14 12:34:42 +0000 | [diff] [blame] | 131 | |
| 132 | /* The alis resource for locating the python home directory */ |
Jack Jansen | 6b02ac2 | 1998-01-06 16:48:49 +0000 | [diff] [blame] | 133 | #define PYTHONHOME_ID 228 |
| 134 | #define PYTHONHOMEOVERRIDE_ID 229 |
Jack Jansen | a4b7e14 | 1996-02-21 16:46:57 +0000 | [diff] [blame] | 135 | |
| 136 | /* The Python options resource and offset of its members */ |
Jack Jansen | 6b02ac2 | 1998-01-06 16:48:49 +0000 | [diff] [blame] | 137 | #define PYTHONOPTIONS_ID 228 |
| 138 | #define PYTHONOPTIONSOVERRIDE_ID 229 |
Jack Jansen | 447e01b | 1997-09-08 13:24:54 +0000 | [diff] [blame] | 139 | |
Jack Jansen | 8a38714 | 2001-02-11 01:08:04 +0000 | [diff] [blame] | 140 | #define POPT_VERSION_CURRENT 7 /* Current version number */ |
Jack Jansen | 4a5eb96 | 2000-09-22 21:50:11 +0000 | [diff] [blame] | 141 | #define POPT_KEEPCONSOLE_NEVER 0 |
| 142 | #define POPT_KEEPCONSOLE_OUTPUT 1 |
| 143 | #define POPT_KEEPCONSOLE_ERROR 2 |
| 144 | #define POPT_KEEPCONSOLE_ALWAYS 3 |
Jack Jansen | 01fbc68 | 1996-02-28 15:42:47 +0000 | [diff] [blame] | 145 | |
Jack Jansen | 245d179 | 1999-01-30 13:21:24 +0000 | [diff] [blame] | 146 | #ifndef rez |
Jack Jansen | 7d5f9e8 | 1996-09-07 17:09:31 +0000 | [diff] [blame] | 147 | typedef struct PyMac_PrefRecord { |
Jack Jansen | 447e01b | 1997-09-08 13:24:54 +0000 | [diff] [blame] | 148 | unsigned char version; |
Jack Jansen | 7d5f9e8 | 1996-09-07 17:09:31 +0000 | [diff] [blame] | 149 | unsigned char inspect; |
| 150 | unsigned char verbose; |
Jack Jansen | 447e01b | 1997-09-08 13:24:54 +0000 | [diff] [blame] | 151 | unsigned char optimize; |
Jack Jansen | 7d5f9e8 | 1996-09-07 17:09:31 +0000 | [diff] [blame] | 152 | unsigned char unbuffered; |
| 153 | unsigned char debugging; |
Jack Jansen | 4a5eb96 | 2000-09-22 21:50:11 +0000 | [diff] [blame] | 154 | unsigned char unused; |
| 155 | unsigned char keep_console; |
Jack Jansen | 7d5f9e8 | 1996-09-07 17:09:31 +0000 | [diff] [blame] | 156 | unsigned char nointopt; |
| 157 | unsigned char noargs; |
Jack Jansen | e4d7b5e | 2000-05-07 22:07:26 +0000 | [diff] [blame] | 158 | unsigned char tabwarn; |
Jack Jansen | c6bb281 | 1997-09-09 13:50:40 +0000 | [diff] [blame] | 159 | unsigned char nosite; |
Jack Jansen | e4d7b5e | 2000-05-07 22:07:26 +0000 | [diff] [blame] | 160 | unsigned char nonavservice; |
Jack Jansen | 8a38714 | 2001-02-11 01:08:04 +0000 | [diff] [blame] | 161 | unsigned char delayconsole; |
Jack Jansen | 7d5f9e8 | 1996-09-07 17:09:31 +0000 | [diff] [blame] | 162 | } PyMac_PrefRecord; |
Jack Jansen | 245d179 | 1999-01-30 13:21:24 +0000 | [diff] [blame] | 163 | #endif |
Jack Jansen | 7d5f9e8 | 1996-09-07 17:09:31 +0000 | [diff] [blame] | 164 | |
Jack Jansen | 3d22887 | 1996-09-06 22:18:40 +0000 | [diff] [blame] | 165 | /* The GUSI options resources */ |
| 166 | #define GUSIOPTIONS_ID 10240 |
| 167 | #define GUSIOPTIONSOVERRIDE_ID 10241 |
Jack Jansen | 3469e99 | 1996-09-06 00:30:45 +0000 | [diff] [blame] | 168 | |
Jack Jansen | 245d179 | 1999-01-30 13:21:24 +0000 | [diff] [blame] | 169 | #ifndef rez |
Jack Jansen | 01fbc68 | 1996-02-28 15:42:47 +0000 | [diff] [blame] | 170 | /* From macgetpath.c: */ |
Jack Jansen | d88296d | 2000-07-11 19:51:05 +0000 | [diff] [blame] | 171 | void PyMac_PreferenceOptions(PyMac_PrefRecord *); |
| 172 | char * PyMac_GetPythonDir(void); |
Jack Jansen | d5fd45f | 2000-10-13 19:44:40 +0000 | [diff] [blame] | 173 | /* from macmain.c: */ |
| 174 | extern PyMac_PrefRecord PyMac_options; |
Jack Jansen | 8f5725a | 1999-12-07 23:08:10 +0000 | [diff] [blame] | 175 | #endif |