Commit Graph

272 Commits

Author SHA1 Message Date
Jack Jansen 69652f8abe Moved to the Compat folder (in case anyone still wants to try MPW building), it hasn't been used for years. 2000-05-03 08:42:26 +00:00
Jack Jansen 6a066805e0 Removed, the core-python getmtime works fine with GUSI2. 2000-05-03 08:41:56 +00:00
Jack Jansen ee0810403d Made the GUSI options work again with GUSI 2. 2000-04-21 23:53:37 +00:00
Jack Jansen 2d1306b7cf Started on GUSI2 and threading support. 2000-04-07 09:10:49 +00:00
Jack Jansen 3d7575406f If there's an error in an fsspec argument raise MacOS.Error, not ValueError. 2000-01-24 09:56:06 +00:00
Jack Jansen 205b435c50 Added initializer routine optionally to be used as PEF fragment initialization routine, which allows us to get at our own resource fork even if some shared library init routine opens other resource files. 2000-01-07 14:53:31 +00:00
Jack Jansen b734adef4b Added PyMac_BuildOptStr255, which returns None on a null pointer. 1999-12-17 17:15:50 +00:00
Jack Jansen 608b3fa801 Dummy functions which return unimpErr for lots of toolbox calls that are unavailable for 68K. This way we don't have to disable thm in bgen, so we
can still use them on PPC.
1999-12-12 21:38:29 +00:00
Jack Jansen 8bb573e2ab Oops, PLstring funcs should be "pascal". Funny this never caused problems before... 1999-12-12 21:37:14 +00:00
Jack Jansen 8f5725af60 First bits and pieces of appearance support: an init routine, a global flag PyMac_AppearanceCompliant (exported thru MacOS). If USE_APPEARANCE
is off the code is disabled (but the variables are still there, set to 0).
1999-12-07 23:08:10 +00:00
Jack Jansen e742487ca5 Bigger buffer size for C profiler (if profiling is enabled). 1999-09-30 11:20:11 +00:00
Jack Jansen fac3008e77 Optimization: don't try to get a tabsize resource if we know the file
doesn't have one (stdin and such), OpenRF appears to be an expensive call.
1999-09-30 11:19:16 +00:00
Jack Jansen 68ecab455c Put the applet code inside USE_MAC_APPLET_SUPPORT ifdefs, to make 68k standalone Python compile. 1999-02-15 23:34:56 +00:00
Jack Jansen 6b6e61dd32 (finally) unified the interpreter and the applet as Just suggested ages ago. The
resulting program is called PythonInterpreter.
1999-02-15 21:33:34 +00:00
Just van Rossum 26a69db4c7 put the preferences file in a folder called "Python" inside the prefs folder, just like the IDE does -- jvr 1999-02-02 15:49:03 +00:00
Jack Jansen deff89c8be Replaced fprintf(stderr,...) with PySys_WriteStderr(...) where appropriate. 1998-10-12 20:53:15 +00:00
Jack Jansen 48a9c3634b Mods by Just to allow aliases in sys.path entries 1998-09-07 11:36:17 +00:00
Jack Jansen b93f52158b Support for freezing packages (Just). 1998-08-18 12:23:11 +00:00
Jack Jansen 87c485c1ad Initialize the program name before adding shared library resources (Just). 1998-07-31 09:38:01 +00:00
Jack Jansen 2e6445caa6 Don't add the library file to the resource file chain if it is the
same as the application file (Just).
1998-07-31 09:37:02 +00:00
Jack Jansen 7e1fb7c92d New about box, with the version mesage filled in in a text item, and
PLstrcmp() fixed. (Just)
1998-07-31 09:36:30 +00:00
Jack Jansen 017e0ff1a0 The PYD resource should now contain 2 strings: one for the ppc
fragment name and one for the cfm68k fragment name (Just).
Also, some unused variables removed.
1998-07-31 09:34:47 +00:00
Jack Jansen abdf93c6dc Re-indented properly (Just). 1998-07-31 09:33:28 +00:00
Jack Jansen ac82b6a041 If the preference filename resource is empty don't try to open or
create the preferences file. This is so that frozen programs don't
interfere with an existing Python installation, or leave turds in the
Preferences folder.
1998-07-13 13:38:29 +00:00
Jack Jansen 1e2260fcb4 All import-related code has moved to macimport.c.
There's also new support for importing code fragments: if a file on
sys.path contains a PYD resource with resourcename equal to the name
of the module to be imported this PYD resource should contain a
(pascal) string with the name of a code fragment to load. This allows
freezing Python programs without access to source or a development
environment.
1998-07-13 13:37:12 +00:00
Jack Jansen fa68b07526 Print message when we load a PYC resource, if verbose import flag is on. 1998-06-26 14:52:04 +00:00
Jack Jansen 0072b8d994 An applet with Popt and GUSI preferences but without alis resource
didn't work, because the resource file chain was incomplete when we
tried to open the preference file. Fixed.
1998-05-07 13:08:58 +00:00
Jack Jansen bbf4be2c2f Incorrect argument for PyMacBuildwide() 1998-04-23 13:20:17 +00:00
Jack Jansen d58cd630eb Added PyMac_{Get,Build}wide. These should support python longints at
some point in the future.
1998-04-21 15:24:39 +00:00
Jack Jansen efaada75e4 - Universal Headers 3 mods
- Started on menubar-restore code (but it still doesn't work 100%)
1998-02-20 16:03:15 +00:00
Jack Jansen 213649023c Bug fix for fast module location 1997-10-08 15:32:46 +00:00
Jack Jansen a7a89ebdbe Implemented nositepython and oldexceptions flags 1997-10-07 21:48:57 +00:00
Jack Jansen c73f83c8d9 Fixed for new "import dir.module" semantics. Needs accompanying fix in
import.c (yes Guido, I'll send it tomorrow)
1997-10-07 21:48:31 +00:00
Jack Jansen 36b983c2c2 Added old-exception and no-site-python options and balloon help 1997-09-09 13:53:21 +00:00
Jack Jansen 5b3c9717c4 The preference resource now has a version number 1997-09-08 13:22:49 +00:00
Jack Jansen ac62569fd0 sys.prefix and sys.exec_prefix are now set correctly. 1997-09-08 13:22:22 +00:00
Jack Jansen 0c96887d35 Handle systemclicks ourselves, in stead of passing them to Sioux. This
fixes (or masks?) a bug with Python becoming unreactive during
time.sleep() if you have already switched applications before.
1997-08-26 13:20:34 +00:00
Jack Jansen a8441ded7a Added (dummy) PyOS_FiniInterrupts 1997-08-08 14:57:37 +00:00
Jack Jansen 7330b39a41 Adapted for 1.5a3: Py_SupressPrintingFlag is gone, and
Py_SetProgramName replaces Py_GetProgramName
1997-08-08 14:56:41 +00:00
Jack Jansen 36ed506f09 Added PyMac_SetEventHandler which allows you to replace complete event
handling in inner loop with python code. Also move (previously
machine independent) PyErr_CheckSignals here, so we can propagate
exceptions in event handling code.
1997-06-20 16:18:15 +00:00
Jack Jansen eda78634a4 Make imports faster on the Mac, by
- Remembering whether sys.path components refer to files or folders,
- Using mac-specific code to check for file existence, in stead of trying
  to fopen() each possible file.

These mods need an accompanying mod to import.c.
1997-06-12 15:29:46 +00:00
Jack Jansen caa7c46ac4 - Restore SIOUX menubar just before exiting, if the console window is kept
open (so the user can quit with cmd-Q, print, etc)
- Removed a few unused routines
1997-06-12 10:49:13 +00:00
Jack Jansen e3ae0dfeb7 Removed old scheduler parameterizing calls and replaced with something
a bit easier to use and understand
1997-06-03 15:28:29 +00:00
Jack Jansen a39f1b0ce2 - Added Py_GetProgramFullPath
- Added PyMac_StopGUSISpin and have it called at exit time (fixes crash
  when exiting with sockets open)
- Added PLstr... funcs needed by gusi: those provided by StdCLib are
  broken under cfm68k
1997-05-23 15:35:14 +00:00
Jack Jansen e44545fc0b Workaround for bug in MSL and CWGUSI interaction that stopped the
"don't close window on exit" feature to work.
1997-05-07 15:48:54 +00:00
Jack Jansen 3089b7eead - Various names in CodeFragments.h have changed
- a dummy main program was added, so we can use the standard MW MSL
  runtime library for main programs (in stead of rolling our own, as we
  did previously).
1997-05-07 15:48:01 +00:00
Jack Jansen 08c3be35c3 Changed the few old routine names still used to the new ones
Started working on MSL support
1997-04-08 15:27:00 +00:00
Jack Jansen c587301e2e - Changed GestaltEqu.h to Gestalt.h
- Changed FragLoader.h to CodeFragments.h
- Removed Desk.h
1997-02-24 13:59:38 +00:00
Jack Jansen 7e94404081 Only go into eventloop/interrupt check 10 times per second 1997-02-20 15:23:18 +00:00
Jack Jansen 42218ce33c Added/updated copyright notices
(and the &*^$%@ resource files got binhexed again, sigh)
1997-01-31 16:15:11 +00:00
Jack Jansen 52ac037249 Added PyMac_Initialize() routine, to be used by embedding programs (in
stead of standard Py_Initialize(), which it calls).
1997-01-15 15:49:08 +00:00
Jack Jansen 8dc8a6e4be Mac-specific version of getmtime (for non-GUSI Python, which needs
different include files)
1997-01-10 15:24:19 +00:00
Jack Jansen 8c6932136c Added profiler initialization/finalization code (if __profile__ is defined) 1997-01-07 16:19:42 +00:00
Jack Jansen e1d8c9bade Fixed FSSpec->pathname code to add colon if the fsspec points to a disk. 1996-11-20 14:58:27 +00:00
Jack Jansen 26ee1260a2 Got rid of nfullpath in favor of PyMac_GetFullPath (which was pretty
much identical anyway).
Initialize PyMac_ApplicationPath and PyMac_ApplicationFSSpec to point
to the current application.
1996-11-09 18:45:18 +00:00
Jack Jansen 8096daad4f When loading a PYC resource check whether the filename is the
application, and if so take a shortcut. This should speedup loading
PYC resources when running off a CDROM quite a bit.
1996-11-09 18:43:44 +00:00
Jack Jansen 83c74dfa2a - Get preference filename from a resource
- Create the file if it doesn't exist and don't be fussy about it
1996-10-22 15:25:42 +00:00
Jack Jansen 0e06e7e7d5 About boxes should be at 20% of screen height, not halfway 1996-09-23 15:51:06 +00:00
Jack Jansen d617c57dce Changed default background yield time to 1 tick 1996-09-22 22:14:30 +00:00
Jack Jansen 924ca855da Added macfs.FindApplication() to find application FSSpec given signature. 1996-09-20 15:25:16 +00:00
Jack Jansen daed771fbb Py_GetProgramName turns out not to be obsolete (used by _tkinter). 1996-09-09 14:48:05 +00:00
Jack Jansen 7d5f9e847a - Put all options in a struct
- Unified initialization code for interpreter and applet
- Implemented new options to skip AE-processing for argc/argv and for
  disabling interactive option setting
1996-09-07 17:09:31 +00:00
Jack Jansen 3f7d2b4319 - Rationalized override preferences support, by remembering
application resource fork RefNum and looking there only
- Added support for loading gusi prefs from Preferences file (needs
  modified GUSI, but Matthias promised he'd incorporate the fixes in
  the next release)
1996-09-06 22:21:07 +00:00
Jack Jansen 3469e997b4 Python about box implemented. Slightly convoluted, since (a) we have
to override an internal sioux routine and (b) we have to override the
"about sioux" menuitem after sioux has created its menus.
1996-09-06 00:30:45 +00:00
Jack Jansen f12e7093d5 Check that our override pythonpath is actually coming from the
application, not from some system extension that happens to use the
same resource id.
1996-09-05 15:19:24 +00:00
Jack Jansen b9bf6e2dde Removed unused vars 1996-09-05 15:17:57 +00:00
Jack Jansen f6865f77d4 - Fixed PyMac_DoYield:
- Update lastyield correctly
  - Do event handling if PyMac_YieldEnabled > 0 (previous cmd-. fix
    broke this)
- Use our own GUSISpin routine: fixes crash when exiting with sockets
  open and keeps windows, etc reacting consistently when waiting for
  accepts(), etc.
1996-09-04 15:24:59 +00:00
Jack Jansen 5bd85d93c4 Always call __initialize(), also on PPC 1996-08-23 15:45:26 +00:00
Jack Jansen 7bbd1a5327 Added void before main 1996-08-20 16:21:06 +00:00
Jack Jansen bf05d4cd6f Fixed command-. handling
Added hacks for GetEventQueue (so you don't have to edit Events.h)
1996-08-19 15:11:45 +00:00
Jack Jansen a06f13dc78 Fixed to work for ppc and cfm68k 1996-08-19 15:10:50 +00:00
Jack Jansen 499a8afd0f Removed debug printf 1996-08-19 11:38:03 +00:00
Jack Jansen 3bc6fe636a Removed obsolete cfm68k ifdef (Guido) 1996-08-19 11:37:32 +00:00
Jack Jansen 007fa82581 Include config.h 1996-08-19 11:36:59 +00:00
Jack Jansen cfadbd40e1 Guido:
- new SpinCursor (replacing Jack's almost-identical one)
- use GetEventQueue in stead of GetEvQHdr
1996-08-19 11:36:25 +00:00
Jack Jansen 76ceece75a Guido: added some void's to declarations 1996-08-19 11:18:24 +00:00
Jack Jansen 9ff06cea7f Guido: changed __sinit to __initialize for CFM68K. 1996-08-19 11:17:33 +00:00
Jack Jansen 7ac70afed1 Dummy SpinCursor() if __CFM68K__ is defined 1996-08-19 11:01:05 +00:00
Jack Jansen 1d2f863e51 Guido's 1.4b2 fixes: Py_GetProgramName, Py_GetPrefix and Py_GetExecPrefix. 1996-08-02 15:16:16 +00:00
Jack Jansen d1f06313f6 - Minimum stacksize is now 8K for PPC, 4K for 68K
- Added PyMac_BuildNumVersion
1996-08-01 15:23:54 +00:00
Jack Jansen 1ed9529a68 Added PyOS_CheckStack() function which returns -1 when we are running
low on stackspace.
1996-07-22 15:25:10 +00:00
Jack Jansen a547dcaff0 Old names changed to Py_GetCopyright, etc. 1996-07-10 15:48:25 +00:00
Jack Jansen 31dd5c083b PyMac_GetFixed() didn't return 1 on success 1996-05-31 13:01:39 +00:00
Jack Jansen a486a55f59 Added support for override preferences 1996-04-04 15:39:18 +00:00
Jack Jansen 975aa22bdd Don't change Standard File folder on chdir(). 1996-03-25 15:46:25 +00:00
Jack Jansen 415571cc9f Replaced non-ascii chars by backslash escapes 1996-03-25 15:46:03 +00:00
Jack Jansen 1a0dafb1ce Somehow the <<terminated>> got mangled. Fixed. 1996-03-20 16:19:00 +00:00
Jack Jansen e355c4568f - Allow setting of argc/argv in <option>-start dialog
- Set "ok" to be default button
1996-03-12 13:29:04 +00:00
Jack Jansen 2429c722d7 Added missing include of Fonts.h 1996-03-07 15:17:11 +00:00
Jack Jansen 378815ca86 Replaced previous gusi-chdir() fix by a call to PyMac_FixGUSIcd()
after each chdir call.
1996-03-06 16:21:34 +00:00
Jack Jansen 911ad6b067 Added code to make fsspecs work for gusi-python 1996-03-05 16:56:24 +00:00
Jack Jansen 8ab1148762 Added __sinit() call, so C++ initializations in shared library work 1996-02-29 16:10:32 +00:00
Jack Jansen 01fbc68896 - Reorganized init code
- Fixed serious bug in code to get options from a resource
1996-02-28 15:42:47 +00:00
Jack Jansen a4b7e14df8 Store default startup options in preference file or
app.
1996-02-21 16:46:57 +00:00
Jack Jansen 532e3c2bf6 Changed MacOS creator code from PYTH to Pyth 1996-02-21 15:36:26 +00:00
Jack Jansen 56ed26ed11 Ported to CW8 (added PRE_CW8 ifdef for CW7, for the time being) 1996-02-20 16:25:31 +00:00
Jack Jansen c743c8d166 Modified for GUSI 1996-02-14 16:02:30 +00:00
Jack Jansen fa4d5d0414 Added converters for Fixed 1995-11-15 15:19:29 +00:00
Jack Jansen e2b5d046d6 Changed for the 1.3.2 compiler (CW7.5) 1995-11-14 10:26:00 +00:00
Jack Jansen 79559dcf47 Initialize GUSI for MacTkPython 1995-11-14 10:24:44 +00:00
Jack Jansen dbe75ae1d3 Continue looking for "open doc" events even after "open app". This
allows you to debug the interpreter in non-interactive mode.
1995-11-10 14:54:16 +00:00
Jack Jansen 38e976665d Cosmetic change to event handling. 1995-11-10 14:53:00 +00:00
Jack Jansen 1e8557a9fe For MW Python, update titlebar of window when python exits. 1995-11-10 14:51:26 +00:00
Jack Jansen 0168f279cc Added options for keeping window open on normal/error termination
Moved whole exit-handling of console window here (from pythonrun.c)
1995-10-27 13:32:30 +00:00
Jack Jansen 85c9aea6e2 Added prototypes. 1995-10-23 13:57:03 +00:00
Jack Jansen 178652b06d Export strdup (parsermodule needs it) 1995-10-12 10:22:57 +00:00
Jack Jansen 83f45401e8 Removed unused variables 1995-10-09 23:25:32 +00:00
Jack Jansen b39be2173b Fixed to work on 68K (could be yet another optimizer bug or something) 1995-09-01 11:48:10 +00:00
Jack Jansen 41fa7ea719 Python will now attempt (again) to create at least a minimal
preferences file if it is missing.
1995-08-31 13:59:36 +00:00
Jack Jansen 847e89ecfa Removed unused variables 1995-08-31 13:57:40 +00:00
Jack Jansen 57633c1a48 removed unused variables 1995-08-31 13:57:06 +00:00
Jack Jansen 819f1770f6 Lots of stuff moved to other files.
Include pythonresources.h.
1995-08-14 12:35:10 +00:00
Jack Jansen 696c95800e This is completely different from the old mainmain (which wasn't used
anymore) and is the new main program for MacPython. Built from bits
and pieces of config.c, macglue.c and pythonmain.c.
1995-08-14 12:33:20 +00:00
Jack Jansen 12fce3eda9 macgetpath - sys.path setting code factored out of config.c and
macglue.c
macgetplatform - factored out of config.c
1995-08-14 12:31:44 +00:00
Jack Jansen f717ac29f0 Merged Jack's macgetcompiler.c and Guido's maccompiler.c and named the
result macgetcompiler.c (after all, *I* did the merging:-)
1995-08-14 12:30:15 +00:00
Guido van Rossum 6e39e53cde Initial revision 1995-08-08 14:11:07 +00:00
Jack Jansen cf6369394e Better error messages wrt missing resources and preferences 1995-08-07 14:36:06 +00:00
Jack Jansen 292b0f96f3 Added code so you canset "command line options" if you
option-click/drag python. Needs a new dialog resource.
1995-07-29 13:52:37 +00:00
Jack Jansen cc456fbe82 Un-installing of AE handlers fixed (AE is very picky that you specify
the same UPP)
1995-07-29 13:50:59 +00:00
Jack Jansen f74f63a43f Initial port to CodeWarrior CFM68K support (mainly by disabling
unsupported features).
1995-06-27 13:18:14 +00:00
Jack Jansen 08305504f1 Added code to obtain sys.path from a resource
Removed code to update the preferences file, use EditPythonPrefs.py
in stead (actually, code is still there if you define USE_MAC_MODPREFS)
1995-06-18 20:03:40 +00:00
Jack Jansen 2a58638eae Ported to CW6 1995-06-14 14:44:17 +00:00
Jack Jansen 45ff77f43e - The prefs file wasn't updated correctly if it already existed.
- Guido's r1.23 fix wrt PyMac_DoYieldEnabled had somehow gotten lost.
1995-04-24 12:41:41 +00:00
Jack Jansen 16df2aa57b Under MW also be more conservative about events to request 1995-02-27 16:17:28 +00:00
Guido van Rossum e7134aa0f2 return old value of PyMac_DoYieldEnabled; -1 means do not even check for interrupts 1995-02-26 10:20:53 +00:00
Jack Jansen 76efd8e7a1 MAde a few things more orthogonal and did some cleanups:
- Applications now have their (minimal) main prrogram in
  macapplication.c and the rest of the init code in macglue.c.
- A new define, USE_MAC_APPLET_SUPPORT, independent of
  USE_MAC_SHARED_LIB
- chdir to script directory now done in PyMac_InitApplication.
1995-02-24 22:53:16 +00:00
Guido van Rossum 24a45e3c18 ported to MPW, moved main() here 1995-02-20 23:45:53 +00:00
Guido van Rossum 850f44b47c moved main() to macglue.c 1995-02-20 23:45:09 +00:00
Guido van Rossum 7c496ec629 ported to CFM-68K 1995-02-20 23:44:43 +00:00
Jack Jansen 3ec804af85 - Added PyMac_GetDirectory call which asks the user to select a
directory.
- No __main__ resource found message is now a dialog
- Fixes wrt stdio window handling in applets.

NB: these fixes require a new resource file.
1995-02-20 15:56:10 +00:00
Guido van Rossum 6fc5aecd53 ported back to Think C 1995-02-19 23:32:59 +00:00
Guido van Rossum 8c89a6fdc7 use PyMac_GetArgv (in macgetargv.c) for applet inits 1995-02-19 15:52:17 +00:00
Guido van Rossum dbfb282d2c get argc/argv from AppleEvents 1995-02-19 15:51:30 +00:00
Guido van Rossum c3d1c8e9fc added applet initialization;
fewer restrictions on loading modules from resources (+ fix!);
macstrerror -> MacOS_StrError
1995-02-18 15:01:31 +00:00
Guido van Rossum e5df962958 moved most of it to macglue.c 1995-02-18 14:56:09 +00:00
Guido van Rossum 930b36b349 main program for applets 1995-02-17 14:24:53 +00:00
Jack Jansen 74162f311f Added support for loading pyc code from a resource. 1995-02-15 22:58:33 +00:00
Guido van Rossum becdbec806 ported to Think C 1995-02-14 01:27:24 +00:00
Jack Jansen 6cfab2346c Changed PyMac_GetPythonDir to use a preferences file to store the
alias resource. Also added a few comments.
1995-02-13 22:46:00 +00:00
Jack Jansen fc0ff42034 Open library resource file read-only 1995-02-13 22:43:38 +00:00
Guido van Rossum cc9bc8f824 null-terminate the error string in macstrerror 1995-02-13 16:17:03 +00:00
Jack Jansen 2e4679db8e Glue for the python shared library: an init routine that remembers
where we're loaded from and PyMac_AddLibResources() which adds that
file to the resource file list.
1995-02-13 11:39:17 +00:00
Jack Jansen f950f8d414 Various changes wrt shared-library python:
- Moved fileargument to config.c
- Added PyMac_AddLibResources() call in case of shlib python
- Build argc/argv differently in case of applet template
1995-02-13 11:35:34 +00:00
Jack Jansen 8cd2b720f6 Added PyMac_GetPythonDir routine which obtains python home directory
from an alias resource (or from the user). Note: this uses a dialog
resource so there's an accompanying change in the resource file.
1995-02-13 11:33:28 +00:00
Jack Jansen b3642579fd Added getfiletype routine 1995-02-13 11:31:51 +00:00
Jack Jansen c76fd39587 Added stuff so CodeWarrior isn't so verbose about its stdio windows 1995-02-02 14:27:31 +00:00
Jack Jansen a76382a6ac Added HandleEvent method to macos, so python programs can hand back
events they don't want to handle to stdio
1995-02-02 14:25:56 +00:00
Guido van Rossum cc0d879069 added <OSEvents.h> for Think C 1995-01-30 08:57:13 +00:00
Jack Jansen ee23d6ec87 - Moved interrupt code to macglue.c
- Added possibility to turn off mainloop event handling
- Check interrupts even when not handling events
- Be more carefulabout which events we want
- Use different method to determine fg/bg
1995-01-27 14:43:25 +00:00
Guido van Rossum 5279ec683a reverse h/v in Point and Rect 1995-01-26 22:56:59 +00:00