MacOS X: Enable 4-way universal builds

This patch adds a new configure argument on OSX:
        --with-universal-archs=[32-bit|64-bit|all]

When used with the --enable-universalsdk option this controls which
CPU architectures are includes in the framework. The default is 32-bit,
meaning i386 and ppc. The most useful alternative is 'all', which includes
all 4 CPU architectures supported by MacOS X (i386, ppc, x86_64 and ppc64).

This includes limited support for the Carbon bindings in 64-bit mode as well,
limited because (a) I haven't done extensive testing and (b) a large portion
of the Carbon API's aren't available in 64-bit mode anyway.

I've also duplicated a feature of Apple's build of python: setting the
environment variable 'ARCHFLAGS' controls the '-arch' flags used for building
extensions using distutils.
This commit is contained in:
Ronald Oussoren 2008-06-05 12:58:24 +00:00
parent 80af6da748
commit 5640ce2f1e
52 changed files with 1129 additions and 207 deletions

View File

@ -58,11 +58,19 @@ Note the capitalization of the module name; this is a historical artifact.
elaborate functionality was available), but it provides a convenient location to
attach a breakpoint in a low-level debugger like :program:`gdb`.
.. note::
Not available in 64-bit mode.
.. function:: SysBeep()
Ring the bell.
.. note::
Not available in 64-bit mode.
.. function:: GetTicks()
@ -74,6 +82,10 @@ Note the capitalization of the module name; this is a historical artifact.
Return the file creator and file type as two four-character strings. The *file*
parameter can be a pathname or an ``FSSpec`` or ``FSRef`` object.
.. note::
It is not possible to use an ``FSSpec`` in 64-bit mode.
.. function:: SetCreatorAndType(file, creator, type)
@ -81,6 +93,9 @@ Note the capitalization of the module name; this is a historical artifact.
``FSSpec`` or ``FSRef`` object. *creator* and *type* must be four character
strings.
.. note::
It is not possible to use an ``FSSpec`` in 64-bit mode.
.. function:: openrf(name [, mode])
@ -98,3 +113,12 @@ Note the capitalization of the module name; this is a historical artifact.
from an application bundle either when it has been started with
:program:`pythonw` instead of :program:`python` or when running as an applet.
.. function:: splash([resourceid])
Opens a splash screen by resource id. Use resourceid ``0`` to close
the splash screen.
.. note::
Not available in 64-bit mode.

View File

@ -1,11 +1,11 @@
#ifndef Py_PYTHON_H
#define Py_PYTHON_H
#ifndef Py_PYTHON_H #define Py_PYTHON_H
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
/* Include nearly all Python header files */
#include "patchlevel.h"
#include "pyconfig.h"
#include "pymacconfig.h"
/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the
* old symbol for the benefit of extension modules written before then

59
Include/pymacconfig.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef PYMACCONFIG_H
#define PYMACCONFIG_H
/*
* This file moves some of the autoconf magic to compile-time
* when building on MacOSX. This is needed for building 4-way
* universal binaries and for 64-bit universal binaries because
* the values redefined below aren't configure-time constant but
* only compile-time constant in these scenarios.
*/
#if defined(__APPLE__)
# undef SIZEOF_LONG
# undef SIZEOF_PTHREAD_T
# undef SIZEOF_SIZE_T
# undef SIZEOF_TIME_T
# undef SIZEOF_VOID_P
# undef VA_LIST_IS_ARRAY
# if defined(__LP64__) && defined(__x86_64__)
# define VA_LIST_IS_ARRAY 1
# endif
# undef HAVE_LARGEFILE_SUPPORT
# ifndef __LP64__
# define HAVE_LARGEFILE_SUPPORT 1
# endif
# undef SIZEOF_LONG
# ifdef __LP64__
# define SIZEOF_LONG 8
# define SIZEOF_PTHREAD_T 8
# define SIZEOF_SIZE_T 8
# define SIZEOF_TIME_T 8
# define SIZEOF_VOID_P 8
# else
# define SIZEOF_LONG 4
# define SIZEOF_PTHREAD_T 4
# define SIZEOF_SIZE_T 4
# define SIZEOF_TIME_T 4
# define SIZEOF_VOID_P 4
# endif
# if defined(__LP64__)
/* MacOSX 10.4 (the first release to suppport 64-bit code
* at all) only supports 64-bit in the UNIX layer.
* Therefore surpress the toolbox-glue in 64-bit mode.
*/
/* In 64-bit mode setpgrp always has no argments, in 32-bit
* mode that depends on the compilation environment
*/
# undef SETPGRP_HAVE_ARG
# endif
#endif /* defined(_APPLE__) */
#endif /* PYMACCONFIG_H */

View File

@ -8,7 +8,10 @@
#endif
#include <Carbon/Carbon.h>
#ifndef __LP64__
#include <QuickTime/QuickTime.h>
#endif /* !__LP64__ */
/*
** Helper routines for error codes and such.
@ -18,8 +21,11 @@ extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
#ifndef __LP64__
extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
fsspec->path */
#endif /* __LP64__ */
/*
** These conversion routines are defined in mactoolboxglue.c itself.
*/
@ -83,8 +89,10 @@ PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */
#endif /* USE_TOOLBOX_OBJECT_GLUE */
/* macfs exports */
#ifndef __LP64__
int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
#endif /* !__LP64__ */
int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
@ -101,39 +109,54 @@ extern PyObject *CmpInstObj_New(ComponentInstance);
extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
/* Ctl exports */
#ifndef __LP64__
extern PyObject *CtlObj_New(ControlHandle);
extern int CtlObj_Convert(PyObject *, ControlHandle *);
#endif /* !__LP64__ */
/* Dlg exports */
#ifndef __LP64__
extern PyObject *DlgObj_New(DialogPtr);
extern int DlgObj_Convert(PyObject *, DialogPtr *);
extern PyObject *DlgObj_WhichDialog(DialogPtr);
#endif /* !__LP64__ */
/* Drag exports */
#ifndef __LP64__
extern PyObject *DragObj_New(DragReference);
extern int DragObj_Convert(PyObject *, DragReference *);
#endif /* !__LP64__ */
/* List exports */
#ifndef __LP64__
extern PyObject *ListObj_New(ListHandle);
extern int ListObj_Convert(PyObject *, ListHandle *);
#endif /* !__LP64__ */
/* Menu exports */
#ifndef __LP64__
extern PyObject *MenuObj_New(MenuHandle);
extern int MenuObj_Convert(PyObject *, MenuHandle *);
#endif /* !__LP64__ */
/* Qd exports */
#ifndef __LP64__
extern PyObject *GrafObj_New(GrafPtr);
extern int GrafObj_Convert(PyObject *, GrafPtr *);
extern PyObject *BMObj_New(BitMapPtr);
extern int BMObj_Convert(PyObject *, BitMapPtr *);
extern PyObject *QdRGB_New(RGBColor *);
extern int QdRGB_Convert(PyObject *, RGBColor *);
#endif /* !__LP64__ */
/* Qdoffs exports */
#ifndef __LP64__
extern PyObject *GWorldObj_New(GWorldPtr);
extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
#endif /* !__LP64__ */
/* Qt exports */
#ifndef __LP64__
extern PyObject *TrackObj_New(Track);
extern int TrackObj_Convert(PyObject *, Track *);
extern PyObject *MovieObj_New(Movie);
@ -146,6 +169,7 @@ extern PyObject *UserDataObj_New(UserData);
extern int UserDataObj_Convert(PyObject *, UserData *);
extern PyObject *MediaObj_New(Media);
extern int MediaObj_Convert(PyObject *, Media *);
#endif /* !__LP64__ */
/* Res exports */
extern PyObject *ResObj_New(Handle);
@ -154,13 +178,17 @@ extern PyObject *OptResObj_New(Handle);
extern int OptResObj_Convert(PyObject *, Handle *);
/* TE exports */
#ifndef __LP64__
extern PyObject *TEObj_New(TEHandle);
extern int TEObj_Convert(PyObject *, TEHandle *);
#endif /* !__LP64__ */
/* Win exports */
#ifndef __LP64__
extern PyObject *WinObj_New(WindowPtr);
extern int WinObj_Convert(PyObject *, WindowPtr *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#endif /* !__LP64__ */
/* CF exports */
extern PyObject *CFObj_New(CFTypeRef);

View File

@ -539,6 +539,26 @@ def get_config_vars(*args):
flags = re.sub('-isysroot [^ \t]*', ' ', flags)
_config_vars[key] = flags
else:
# Allow the user to override the architecture flags using
# an environment variable.
# NOTE: This name was introduced by Apple in OSX 10.5 and
# is used by several scripting languages distributed with
# that OS release.
if 'ARCHFLAGS' in os.environ:
arch = os.environ['ARCHFLAGS']
for key in ('LDFLAGS', 'BASECFLAGS',
# a number of derived variables. These need to be
# patched up as well.
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
flags = _config_vars[key]
flags = re.sub('-arch\s+\w+\s', ' ', flags)
flags = flags + ' ' + arch
_config_vars[key] = flags
if args:
vals = []
for name in args:

View File

@ -64,7 +64,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
stripArch = '-arch' in cc_args
stripSysroot = '-isysroot' in cc_args
if stripArch:
if stripArch or 'ARCHFLAGS' in os.environ:
while 1:
try:
index = compiler_so.index('-arch')
@ -73,6 +73,12 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
except ValueError:
break
if 'ARCHFLAGS' in os.environ and not stripArch:
# User specified different -arch flags in the environ,
# see also distutils.sysconfig
compiler_so = compiler_so + ' ' + os.environ['ARCHFLAGS']
if stripSysroot:
try:
index = compiler_so.index('-isysroot')

View File

@ -125,12 +125,19 @@ def get_platform ():
osname = "macosx"
if (release + '.') < '10.4.' and \
get_config_vars().get('UNIVERSALSDK', '').strip():
if (release + '.') >= '10.4.' and \
'-arch' in get_config_vars().get('CFLAGS', '').strip():
# The universal build will build fat binaries, but not on
# systems before 10.4
#
# Try to detect 4-way universal builds, those have machine-type
# 'universal' instead of 'fat'.
machine = 'fat'
if '-arch x86_64' in get_config_vars().get('CFLAGS'):
machine = 'universal'
elif machine in ('PowerPC', 'Power_Macintosh'):
# Pick a sane name for the PPC architecture.
machine = 'ppc'

43
Lib/test/test_macos.py Normal file
View File

@ -0,0 +1,43 @@
import unittest
import MacOS
import Carbon.File
from test import test_support
import os
TESTFN2 = test_support.TESTFN + '2'
class TestMacOS(unittest.TestCase):
def testOpenRF(self):
try:
fp = open(test_support.TESTFN, 'w')
fp.write('hello world\n')
fp.close()
rfp = MacOS.openrf(test_support.TESTFN, '*wb')
rfp.write('goodbye world\n')
rfp.close()
fp = open(test_support.TESTFN, 'r')
data = fp.read()
fp.close()
self.assertEquals(data, 'hello world\n')
rfp = MacOS.openrf(test_support.TESTFN, '*rb')
data = rfp.read(100)
data2 = rfp.read(100)
rfp.close()
self.assertEquals(data, 'goodbye world\n')
self.assertEquals(data2, '')
finally:
os.unlink(test_support.TESTFN)
def test_main():
test_support.run_unittest(TestMacOS)
if __name__ == '__main__':
test_main()

View File

@ -42,7 +42,7 @@ IDLE.app: \
$(srcdir)/../Icons/PythonSource.icns \
$(srcdir)/../Icons/PythonCompiled.icns Info.plist
rm -fr IDLE.app
$(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
$(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(BUNDLEBULDER) \
--builddir=. \
--name=IDLE \
--link-exec \
@ -51,7 +51,7 @@ IDLE.app: \
--iconfile=$(srcdir)/../Icons/IDLE.icns \
--resource=$(srcdir)/../Icons/PythonSource.icns \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \
build

View File

@ -13,7 +13,10 @@ os.chdir(os.path.expanduser('~/Documents'))
# Make sure sys.executable points to the python interpreter inside the
# framework, instead of at the helper executable inside the application
# bundle (the latter works, but doesn't allow access to the window server)
sys.executable = os.path.join(sys.prefix, 'bin', 'python')
if sys.executable.endswith('-32'):
sys.executable = os.path.join(sys.prefix, 'bin', 'python-32')
else:
sys.executable = os.path.join(sys.prefix, 'bin', 'python')
# Look for the -psn argument that the launcher adds and remove it, it will
# only confuse the IDLE startup code.

View File

@ -49,12 +49,42 @@ compileall=$(srcdir)/../Lib/compileall.py
installapps: install_Python install_BuildApplet install_PythonLauncher \
install_IDLE checkapplepython install_pythonw install_versionedtools
installapps4way: install_Python4way install_BuildApplet install_PythonLauncher install_IDLE install_pythonw4way install_versionedtools
install_pythonw: pythonw
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python"
ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw"
# Install 3 variants of python/pythonw:
# - 32-bit (i386 and ppc)
# - 64-bit (x86_64 and ppc64)
# - all (all four architectures)
# - Make 'python' and 'pythonw' aliases for the 32-bit variant
install_pythonw4way: pythonw-32 pythonw-64 pythonw
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64"
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64"
ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python-64"
ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw-64"
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32"
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32"
ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32"
ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all"
$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all"
ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python-all"
ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw-all"
ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw"
ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python"
#
# Install unix tools in /usr/local/bin. These are just aliases for the
# actual installation inside the framework.
@ -65,11 +95,16 @@ installunixtools:
fi
for fn in python pythonw idle pydoc python-config smtpd.py \
python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py ;\
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
# TODO: install symlinks for -32, -64 and -all as well
installunixtools4way: installunixtools
#
# Like installunixtools, but only install links to the versioned binaries.
#
@ -78,18 +113,20 @@ altinstallunixtools:
$(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
fi
for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
pydoc$(VERSION) python-config$(VERSION) smtpd$(VERSION).py ;\
pydoc$(VERSION) python$(VERSION)-config) smtpd$(VERSION).py ;\
do \
ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
done
# TODO: -32, -64 and -all variants
altinstallunixtools4way: altinstallunixtools
# By default most tools are installed without a version in their basename, to
# make it easier to install (and use) several python versions side-by-side move
# the tools to a version-specific name and add the non-versioned name as an
# alias.
install_versionedtools:
for fn in idle pydoc python-config ;\
for fn in idle pydoc ;\
do \
if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \
continue ;\
@ -97,6 +134,10 @@ install_versionedtools:
mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\
ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\
done
if [ ! -h "$(DESTDIR)$(prefix)/bin/python-config" ]; then \
mv "$(DESTDIR)$(prefix)/bin/python-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\
ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python-config" ; \
fi
if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \
mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\
ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\
@ -107,6 +148,13 @@ pythonw: $(srcdir)/Tools/pythonw.c Makefile
$(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
$(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \
-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"'
pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
$(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \
-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"'
install_PythonLauncher:
cd PythonLauncher && make install DESTDIR=$(DESTDIR)
@ -159,13 +207,19 @@ install_Python:
done
$(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
install_Python4way: install_Python
lipo -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
lipo -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
install_IDLE:
cd IDLE && make install
install_BuildApplet:
$(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
$(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
--destroot "$(DESTDIR)" \
--python $(INSTALLED_PYTHONAPP) \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \
--output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
$(srcdir)/scripts/BuildApplet.py
@ -225,7 +279,7 @@ installmacsubtree:
done
$(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
$(RUNSHARED) arch -ppc -i386 $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
$(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
$(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)

View File

@ -27,6 +27,9 @@ PERFORMANCE OF THIS SOFTWARE.
/* ----------------------------------------------------- */
#ifndef __LP64__
static char cp_GetColor__doc__[] =
"GetColor(prompt, (r, g, b)) -> (r, g, b), ok"
;
@ -46,11 +49,14 @@ cp_GetColor(PyObject *self, PyObject *args)
return Py_BuildValue("O&h", QdRGB_New, &outColor, ok);
}
#endif /* __LP64__ */
/* List of methods defined in the module */
static struct PyMethodDef cp_methods[] = {
#ifndef __LP64__
{"GetColor", (PyCFunction)cp_GetColor, METH_VARARGS, cp_GetColor__doc__},
#endif /* __LP64__ */
{NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */
};

View File

@ -30,6 +30,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
static PyObject *MacOS_Error; /* Exception MacOS.Error */
#define PATHNAMELEN 1024
@ -40,7 +41,7 @@ static PyObject *MacOS_Error; /* Exception MacOS.Error */
typedef struct {
PyObject_HEAD
short fRefNum;
FSIORefNum fRefNum;
int isclosed;
} rfobject;
@ -54,7 +55,7 @@ static void
do_close(rfobject *self)
{
if (self->isclosed ) return;
(void)FSClose(self->fRefNum);
(void)FSCloseFork(self->fRefNum);
self->isclosed = 1;
}
@ -68,6 +69,7 @@ rf_read(rfobject *self, PyObject *args)
long n;
PyObject *v;
OSErr err;
ByteCount n2;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
@ -81,13 +83,13 @@ rf_read(rfobject *self, PyObject *args)
if (v == NULL)
return NULL;
err = FSRead(self->fRefNum, &n, PyBytes_AsString(v));
err = FSReadFork(self->fRefNum, fsAtMark, 0, n, PyString_AsString(v), &n2);
if (err && err != eofErr) {
PyMac_Error(err);
Py_DECREF(v);
return NULL;
}
_PyBytes_Resize(&v, n);
_PyString_Resize(&v, n2);
return v;
}
@ -109,7 +111,7 @@ rf_write(rfobject *self, PyObject *args)
}
if (!PyArg_ParseTuple(args, "s#", &buffer, &size))
return NULL;
err = FSWrite(self->fRefNum, &size, buffer);
err = FSWriteFork(self->fRefNum, fsAtMark, 0, size, buffer, NULL);
if (err) {
PyMac_Error(err);
return NULL;
@ -126,47 +128,36 @@ static char rf_seek__doc__[] =
static PyObject *
rf_seek(rfobject *self, PyObject *args)
{
long amount, pos;
long amount;
int whence = SEEK_SET;
long eof;
int mode;
OSErr err;
if (self->isclosed) {
PyErr_SetString(PyExc_ValueError, "Operation on closed file");
return NULL;
}
if (!PyArg_ParseTuple(args, "l|i", &amount, &whence))
if (!PyArg_ParseTuple(args, "l|i", &amount, &whence)) {
return NULL;
if ((err = GetEOF(self->fRefNum, &eof)))
goto ioerr;
}
switch (whence) {
case SEEK_CUR:
if ((err = GetFPos(self->fRefNum, &pos)))
goto ioerr;
mode = fsFromMark;
break;
case SEEK_END:
pos = eof;
mode = fsFromLEOF;
break;
case SEEK_SET:
pos = 0;
mode = fsFromStart;
break;
default:
PyErr_BadArgument();
return NULL;
}
pos += amount;
/* Don't bother implementing seek past EOF */
if (pos > eof || pos < 0) {
PyErr_BadArgument();
return NULL;
}
if ((err = SetFPos(self->fRefNum, fsFromStart, pos)) ) {
ioerr:
err = FSSetForkPosition(self->fRefNum, mode, amount);
if (err != noErr) {
PyMac_Error(err);
return NULL;
}
@ -182,7 +173,7 @@ static char rf_tell__doc__[] =
static PyObject *
rf_tell(rfobject *self, PyObject *args)
{
long where;
long long where;
OSErr err;
if (self->isclosed) {
@ -191,11 +182,13 @@ rf_tell(rfobject *self, PyObject *args)
}
if (!PyArg_ParseTuple(args, ""))
return NULL;
if ((err = GetFPos(self->fRefNum, &where)) ) {
err = FSGetForkPosition(self->fRefNum, &where);
if (err != noErr) {
PyMac_Error(err);
return NULL;
}
return PyInt_FromLong(where);
return PyLong_FromLongLong(where);
}
static char rf_close__doc__[] =
@ -281,6 +274,7 @@ static PyTypeObject Rftype = {
Rftype__doc__ /* Documentation string */
};
/* End of code for Resource fork objects */
/* -------------------------------------------------------- */
@ -292,17 +286,61 @@ static char getcrtp_doc[] = "Get MacOS 4-char creator and type for a file";
static PyObject *
MacOS_GetCreatorAndType(PyObject *self, PyObject *args)
{
FSSpec fss;
FInfo info;
PyObject *creator, *type, *res;
OSErr err;
FSRef ref;
FSCatalogInfo cataloginfo;
FileInfo* finfo;
if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSRef, &ref)) {
#ifndef __LP64__
/* This function is documented to take an FSSpec as well,
* which only works in 32-bit mode.
*/
PyErr_Clear();
FSSpec fss;
FInfo info;
if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &fss))
return NULL;
if ((err = FSpGetFInfo(&fss, &info)) != noErr) {
return PyErr_Mac(MacOS_Error, err);
}
creator = PyString_FromStringAndSize(
(char *)&info.fdCreator, 4);
type = PyString_FromStringAndSize((char *)&info.fdType, 4);
res = Py_BuildValue("OO", creator, type);
Py_DECREF(creator);
Py_DECREF(type);
return res;
#else /* __LP64__ */
return NULL;
if ((err = FSpGetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err);
creator = PyBytes_FromStringAndSize((char *)&info.fdCreator, 4);
type = PyBytes_FromStringAndSize((char *)&info.fdType, 4);
#endif /* __LP64__ */
}
err = FSGetCatalogInfo(&ref,
kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
NULL, NULL, NULL);
if (err != noErr) {
PyErr_Mac(MacOS_Error, err);
return NULL;
}
if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
/* Directory: doesn't have type/creator info.
*
* The specific error code is for backward compatibility with
* earlier versions.
*/
PyErr_Mac(MacOS_Error, fnfErr);
return NULL;
}
finfo = (FileInfo*)&(cataloginfo.finderInfo);
creator = PyString_FromStringAndSize((char*)&(finfo->fileCreator), 4);
type = PyString_FromStringAndSize((char*)&(finfo->fileType), 4);
res = Py_BuildValue("OO", creator, type);
Py_DECREF(creator);
Py_DECREF(type);
@ -314,20 +352,66 @@ static char setcrtp_doc[] = "Set MacOS 4-char creator and type for a file";
static PyObject *
MacOS_SetCreatorAndType(PyObject *self, PyObject *args)
{
FSSpec fss;
ResType creator, type;
FInfo info;
FSRef ref;
FileInfo* finfo;
OSErr err;
FSCatalogInfo cataloginfo;
if (!PyArg_ParseTuple(args, "O&O&O&",
PyMac_GetFSRef, &ref, PyMac_GetOSType, &creator, PyMac_GetOSType, &type)) {
#ifndef __LP64__
/* Try to handle FSSpec arguments, for backward compatibility */
FSSpec fss;
FInfo info;
if (!PyArg_ParseTuple(args, "O&O&O&",
PyMac_GetFSSpec, &fss, PyMac_GetOSType, &creator, PyMac_GetOSType, &type))
return NULL;
if ((err = FSpGetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err);
info.fdCreator = creator;
info.fdType = type;
if ((err = FSpSetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err);
Py_INCREF(Py_None);
return Py_None;
#else /* __LP64__ */
return NULL;
if ((err = FSpGetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err);
info.fdCreator = creator;
info.fdType = type;
if ((err = FSpSetFInfo(&fss, &info)) != noErr)
return PyErr_Mac(MacOS_Error, err);
#endif /* __LP64__ */
}
err = FSGetCatalogInfo(&ref,
kFSCatInfoFinderInfo|kFSCatInfoNodeFlags, &cataloginfo,
NULL, NULL, NULL);
if (err != noErr) {
PyErr_Mac(MacOS_Error, err);
return NULL;
}
if ((cataloginfo.nodeFlags & kFSNodeIsDirectoryMask) != 0) {
/* Directory: doesn't have type/creator info.
*
* The specific error code is for backward compatibility with
* earlier versions.
*/
PyErr_Mac(MacOS_Error, fnfErr);
return NULL;
}
finfo = (FileInfo*)&(cataloginfo.finderInfo);
finfo->fileCreator = creator;
finfo->fileType = type;
err = FSSetCatalogInfo(&ref, kFSCatInfoFinderInfo, &cataloginfo);
if (err != noErr) {
PyErr_Mac(MacOS_Error, fnfErr);
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
@ -399,6 +483,9 @@ MacOS_GetErrorString(PyObject *self, PyObject *args)
return Py_BuildValue("s", buf);
}
#ifndef __LP64__
static char splash_doc[] = "Open a splash-screen dialog by resource-id (0=close)";
static PyObject *
@ -452,11 +539,13 @@ MacOS_DebugStr(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O&|O", PyMac_GetStr255, message, &object))
return NULL;
DebugStr(message);
Py_INCREF(Py_None);
return Py_None;
}
static char SysBeep_doc[] = "BEEEEEP!!!";
static PyObject *
@ -471,6 +560,8 @@ MacOS_SysBeep(PyObject *self, PyObject *args)
return Py_None;
}
#endif /* __LP64__ */
static char WMAvailable_doc[] =
"True if this process can interact with the display."
"Will foreground the application on the first call as a side-effect."
@ -530,17 +621,18 @@ MacOS_openrf(PyObject *self, PyObject *args)
{
OSErr err;
char *mode = "r";
FSSpec fss;
SignedByte permission = 1;
FSRef ref;
SInt8 permission = fsRdPerm;
rfobject *fp;
HFSUniStr255 name;
if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSSpec, &fss, &mode))
if (!PyArg_ParseTuple(args, "O&|s", PyMac_GetFSRef, &ref, &mode))
return NULL;
while (*mode) {
switch (*mode++) {
case '*': break;
case 'r': permission = 1; break;
case 'w': permission = 2; break;
case 'r': permission = fsRdPerm; break;
case 'w': permission = fsWrPerm; break;
case 'b': break;
default:
PyErr_BadArgument();
@ -548,33 +640,18 @@ MacOS_openrf(PyObject *self, PyObject *args)
}
}
err = FSGetResourceForkName(&name);
if (err != noErr) {
PyMac_Error(err);
return NULL;
}
if ( (fp = newrfobject()) == NULL )
return NULL;
err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
if ( err == fnfErr ) {
/* In stead of doing complicated things here to get creator/type
** correct we let the standard i/o library handle it
*/
FILE *tfp;
char pathname[PATHNAMELEN];
if ( (err=PyMac_GetFullPathname(&fss, pathname, PATHNAMELEN)) ) {
PyMac_Error(err);
Py_DECREF(fp);
return NULL;
}
if ( (tfp = fopen(pathname, "w")) == NULL ) {
PyMac_Error(fnfErr); /* What else... */
Py_DECREF(fp);
return NULL;
}
fclose(tfp);
err = HOpenRF(fss.vRefNum, fss.parID, fss.name, permission, &fp->fRefNum);
}
if ( err ) {
err = FSOpenFork(&ref, name.length, name.unicode, permission, &fp->fRefNum);
if (err != noErr) {
Py_DECREF(fp);
PyMac_Error(err);
return NULL;
@ -584,15 +661,18 @@ MacOS_openrf(PyObject *self, PyObject *args)
}
static PyMethodDef MacOS_Methods[] = {
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
{"GetErrorString", MacOS_GetErrorString, 1, geterr_doc},
{"openrf", MacOS_openrf, 1, openrf_doc},
#ifndef __LP64__
{"splash", MacOS_splash, 1, splash_doc},
{"DebugStr", MacOS_DebugStr, 1, DebugStr_doc},
{"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"SysBeep", MacOS_SysBeep, 1, SysBeep_doc},
#endif /* __LP64__ */
{"GetTicks", MacOS_GetTicks, 1, GetTicks_doc},
{"WMAvailable", MacOS_WMAvailable, 1, WMAvailable_doc},
{NULL, NULL} /* Sentinel */
};

View File

@ -184,18 +184,22 @@ filldialogoptions(PyObject *d,
} else if( strcmp(keystr, "preferenceKey") == 0 ) {
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, &opt->preferenceKey) )
return 0;
#ifndef __LP64__
} else if( strcmp(keystr, "popupExtension") == 0 ) {
if ( !PyArg_Parse(value, "O&", ResObj_Convert, &opt->popupExtension) )
return 0;
#endif /* !__LP64__ */
} else if( eventProcP && strcmp(keystr, "eventProc") == 0 ) {
*eventProcP = my_eventProcUPP;
} else if( previewProcP && strcmp(keystr, "previewProc") == 0 ) {
*previewProcP = my_previewProcUPP;
} else if( filterProcP && strcmp(keystr, "filterProc") == 0 ) {
*filterProcP = my_filterProcUPP;
#ifndef __LP64__
} else if( typeListP && strcmp(keystr, "typeList") == 0 ) {
if ( !PyArg_Parse(value, "O&", ResObj_Convert, typeListP) )
return 0;
#endif /* !__LP64__ */
} else if( fileTypeP && strcmp(keystr, "fileType") == 0 ) {
if ( !PyArg_Parse(value, "O&", PyMac_GetOSType, fileTypeP) )
return 0;
@ -301,13 +305,26 @@ navrr_dealloc(navrrobject *self)
static PyObject *
navrr_getattr(navrrobject *self, char *name)
{
FSSpec fss;
FSRef fsr;
#ifndef __LP64__
FSSpec fss;
#endif /* !__LP64__ */
if( strcmp(name, "__members__") == 0 )
return Py_BuildValue("ssssssssss", "version", "validRecord", "replacing",
"isStationery", "translationNeeded", "selection", "selection_fsr",
return Py_BuildValue(
#ifndef __LP64__
"ssssssssss",
#else /* __LP64__ */
"ssssssssss",
#endif /* __LP64__ */
"version", "validRecord", "replacing",
"isStationery", "translationNeeded",
#ifndef __LP64__
"selection",
#endif /* !__LP64__ */
"selection_fsr",
"fileTranslation", "keyScript", "saveFileName");
if( strcmp(name, "version") == 0 )
return Py_BuildValue("h", self->itself.version);
if( strcmp(name, "validRecord") == 0 )
@ -318,8 +335,10 @@ navrr_getattr(navrrobject *self, char *name)
return Py_BuildValue("l", (long)self->itself.isStationery);
if( strcmp(name, "translationNeeded") == 0 )
return Py_BuildValue("l", (long)self->itself.translationNeeded);
#ifndef __LP64__
if( strcmp(name, "selection") == 0 ) {
SInt32 i, count;
SInt32 i;
long count;
OSErr err;
PyObject *rv, *rvitem;
AEDesc desc;
@ -348,8 +367,10 @@ navrr_getattr(navrrobject *self, char *name)
}
return rv;
}
#endif /* !__LP64__ */
if( strcmp(name, "selection_fsr") == 0 ) {
SInt32 i, count;
SInt32 i;
long count;
OSErr err;
PyObject *rv, *rvitem;
AEDesc desc;
@ -378,8 +399,10 @@ navrr_getattr(navrrobject *self, char *name)
}
return rv;
}
#ifndef __LP64__
if( strcmp(name, "fileTranslation") == 0 )
return ResObj_New((Handle)self->itself.fileTranslation);
#endif
if( strcmp(name, "keyScript") == 0 )
return Py_BuildValue("h", (short)self->itself.keyScript);
if( strcmp(name, "saveFileName") == 0 )
@ -861,7 +884,12 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
PyErr_Mac(ErrorObject, err);
return NULL;
}
return Py_BuildValue("{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
return Py_BuildValue(
#ifndef __LP64__
"{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
#else /* __LP64__ */
"{s:h,s:l,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&,s:O&}",
#endif /* __LP64__ */
"version", dialogOptions.version,
"dialogOptionFlags", dialogOptions.dialogOptionFlags,
"location", PyMac_BuildPoint, dialogOptions.location,
@ -871,8 +899,11 @@ nav_NavGetDefaultDialogOptions(PyObject *self, PyObject *args)
"cancelButtonLabel", PyMac_BuildStr255, &dialogOptions.cancelButtonLabel,
"savedFileName", PyMac_BuildStr255, &dialogOptions.savedFileName,
"message", PyMac_BuildStr255, &dialogOptions.message,
"preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey,
"popupExtension", OptResObj_New, dialogOptions.popupExtension);
"preferenceKey", PyMac_BuildOSType, dialogOptions.preferenceKey
#ifndef __LP64__
,"popupExtension", OptResObj_New, dialogOptions.popupExtension
#endif /* __LP64__ */
);
}
/* List of methods defined in the module */

View File

@ -11,6 +11,7 @@
#include <Carbon/Carbon.h>
#ifndef __LP64__
static PyObject *
PyOSA_GetAppTerminology(PyObject* self, PyObject* args)
{
@ -68,12 +69,14 @@ PyOSA_GetSysTerminology(PyObject* self, PyObject* args)
if (err) return PyMac_Error(err);
return Py_BuildValue("O&i", AEDesc_New, &theDesc, didLaunch);
}
#endif /* !__LP64__ */
/*
* List of methods defined in the module
*/
static struct PyMethodDef OSATerminology_methods[] =
{
#ifndef __LP64__
{"GetAppTerminology",
(PyCFunction) PyOSA_GetAppTerminology,
METH_VARARGS,
@ -82,10 +85,10 @@ static struct PyMethodDef OSATerminology_methods[] =
(PyCFunction) PyOSA_GetSysTerminology,
METH_VARARGS,
"Get an applications system terminology, as an AEDesc object."},
#endif /* !__LP64__ */
{NULL, (PyCFunction) NULL, 0, NULL}
};
void
initOSATerminology(void)
{

View File

@ -683,7 +683,8 @@ static PyObject *AEDesc_AEResumeTheCurrentEvent(AEDescObject *_self, PyObject *_
return NULL;
_err = AEResumeTheCurrentEvent(&_self->ob_itself,
&reply,
dispatcher__proc__, (long)dispatcher);
dispatcher__proc__,
(SRefCon)dispatcher);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
@ -1154,7 +1155,7 @@ static PyObject *AE_AEInstallEventHandler(PyObject *_self, PyObject *_args)
return NULL;
_err = AEInstallEventHandler(theAEEventClass,
theAEEventID,
handler__proc__, (long)handler,
handler__proc__, (SRefCon)handler,
0);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
@ -1203,7 +1204,7 @@ static PyObject *AE_AEGetEventHandler(PyObject *_self, PyObject *_args)
return NULL;
_err = AEGetEventHandler(theAEEventClass,
theAEEventID,
&handler__proc__, (long *)&handler,
&handler__proc__, (SRefCon *)&handler,
0);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O",

View File

@ -3,6 +3,8 @@
#include "Python.h"
#ifndef __LP64__
/* Carbon GUI stuff, not available in 64-bit mode */
#include "pymactoolbox.h"
@ -18,7 +20,7 @@
#include <Carbon/Carbon.h>
int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
static int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
{
return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
}
@ -1792,17 +1794,25 @@ static PyMethodDef App_methods[] = {
};
#else /* __LP64__ */
static PyMethodDef App_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_App(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* !__LP64__ */
m = Py_InitModule("_App", App_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
App_Error = PyMac_GetOSErrException();
if (App_Error == NULL ||
@ -1815,6 +1825,7 @@ void init_App(void)
/* Backward-compatible name */
Py_INCREF(&ThemeDrawingState_Type);
PyModule_AddObject(m, "ThemeDrawingStateType", (PyObject *)&ThemeDrawingState_Type);
#endif /* __LP64__ */
}
/* ======================== End module _App ========================= */

View File

@ -3,7 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -2141,20 +2141,28 @@ static PyMethodDef CarbonEvents_methods[] = {
{NULL, NULL, 0}
};
#else /* __LP64__ */
static PyMethodDef CarbonEvents_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_CarbonEvt(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
myEventHandlerUPP = NewEventHandlerUPP(myEventHandler);
#endif /* !__LP64__ */
m = Py_InitModule("_CarbonEvt", CarbonEvents_methods);
#ifndef __LP64__
myEventHandlerUPP = NewEventHandlerUPP(myEventHandler);
d = PyModule_GetDict(m);
CarbonEvents_Error = PyMac_GetOSErrException();
if (CarbonEvents_Error == NULL ||
@ -2216,6 +2224,7 @@ void init_CarbonEvt(void)
/* Backward-compatible name */
Py_INCREF(&EventHotKeyRef_Type);
PyModule_AddObject(m, "EventHotKeyRefType", (PyObject *)&EventHotKeyRef_Type);
#endif /* !__LP64__ */
}
/* ===================== End module _CarbonEvt ====================== */

View File

@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
return _res;
}
#ifndef __LP64__
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
_res = Py_None;
return _res;
}
#endif
static PyMethodDef CGContextRefObj_methods[] = {
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
PyDoc_STR("() -> None")},
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
PyDoc_STR("(int shouldAntialias) -> None")},
#ifndef __LP64__
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
PyDoc_STR("(CGrafPtr port) -> None")},
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
#endif
{NULL, NULL, 0}
};
@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
/* ------------------ End object type CGContextRef ------------------ */
#ifndef __LP64__
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
return _res;
}
#endif
static PyMethodDef CG_methods[] = {
#ifndef __LP64__
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
#endif
{NULL, NULL, 0}
};

View File

@ -178,6 +178,7 @@ static PyObject *CmpInstObj_SetComponentInstanceStorage(ComponentInstanceObject
return _res;
}
#ifndef __LP64__
static PyObject *CmpInstObj_ComponentFunctionImplemented(ComponentInstanceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -228,6 +229,7 @@ static PyObject *CmpInstObj_ComponentSetTarget(ComponentInstanceObject *_self, P
_rv);
return _res;
}
#endif /* !__LP64__*/
static PyMethodDef CmpInstObj_methods[] = {
{"CloseComponent", (PyCFunction)CmpInstObj_CloseComponent, 1,
@ -240,12 +242,14 @@ static PyMethodDef CmpInstObj_methods[] = {
PyDoc_STR("() -> (Handle _rv)")},
{"SetComponentInstanceStorage", (PyCFunction)CmpInstObj_SetComponentInstanceStorage, 1,
PyDoc_STR("(Handle theStorage) -> None")},
#ifndef __LP64__
{"ComponentFunctionImplemented", (PyCFunction)CmpInstObj_ComponentFunctionImplemented, 1,
PyDoc_STR("(short ftnNumber) -> (long _rv)")},
{"GetComponentVersion", (PyCFunction)CmpInstObj_GetComponentVersion, 1,
PyDoc_STR("() -> (long _rv)")},
{"ComponentSetTarget", (PyCFunction)CmpInstObj_ComponentSetTarget, 1,
PyDoc_STR("(ComponentInstance target) -> (long _rv)")},
#endif /* !__LP64__ */
{NULL, NULL, 0}
};
@ -631,6 +635,7 @@ static PyObject *CmpObj_UncaptureComponent(ComponentObject *_self, PyObject *_ar
return _res;
}
#ifndef __LP64__
static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -648,6 +653,7 @@ static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *
ResObj_New, iconSuite);
return _res;
}
#endif /* !__LP64__ */
static PyMethodDef CmpObj_methods[] = {
{"UnregisterComponent", (PyCFunction)CmpObj_UnregisterComponent, 1,
@ -678,8 +684,10 @@ static PyMethodDef CmpObj_methods[] = {
PyDoc_STR("(Component capturingComponent) -> (Component _rv)")},
{"UncaptureComponent", (PyCFunction)CmpObj_UncaptureComponent, 1,
PyDoc_STR("() -> None")},
#ifndef __LP64__
{"GetComponentIconSuite", (PyCFunction)CmpObj_GetComponentIconSuite, 1,
PyDoc_STR("() -> (Handle iconSuite)")},
#endif /* !__LP64__ */
{NULL, NULL, 0}
};

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -5765,14 +5766,21 @@ mytrackingproc(ControlHandle control, Point startPt, ControlActionUPP actionProc
return (ControlPartCode)c_rv;
}
#else /* __LP64__ */
static PyMethodDef Ctl_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_Ctl(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
mytracker_upp = NewControlActionUPP(mytracker);
myactionproc_upp = NewControlActionUPP(myactionproc);
mykeydownproc_upp = NewControlUserPaneKeyDownUPP(mykeydownproc);
@ -5783,9 +5791,11 @@ void init_Ctl(void)
mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc);
PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert);
#endif /* !__LP64__ */
m = Py_InitModule("_Ctl", Ctl_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Ctl_Error = PyMac_GetOSErrException();
if (Ctl_Error == NULL ||
@ -5798,6 +5808,7 @@ void init_Ctl(void)
/* Backward-compatible name */
Py_INCREF(&Control_Type);
PyModule_AddObject(m, "ControlType", (PyObject *)&Control_Type);
#endif /* !__LP64__ */
}
/* ======================== End module _Ctl ========================= */

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -1564,10 +1565,19 @@ DlgObj_WhichDialog(DialogPtr d)
return it;
}
#else /* __LP64__ */
static PyMethodDef Dlg_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_Dlg(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
@ -1575,9 +1585,11 @@ void init_Dlg(void)
PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New);
PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert);
#endif /* !__LP64__ */
m = Py_InitModule("_Dlg", Dlg_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Dlg_Error = PyMac_GetOSErrException();
if (Dlg_Error == NULL ||
@ -1590,6 +1602,7 @@ void init_Dlg(void)
/* Backward-compatible name */
Py_INCREF(&Dialog_Type);
PyModule_AddObject(m, "DialogType", (PyObject *)&Dialog_Type);
#endif /* !__LP64__ */
}
/* ======================== End module _Dlg ========================= */

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -1106,21 +1107,28 @@ dragglue_Drawing(xxxx
return 0;
}
#endif
#else /* __LP64__ */
static PyMethodDef Drag_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_Drag(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert);
#endif /* !__LP64__ */
m = Py_InitModule("_Drag", Drag_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Drag_Error = PyMac_GetOSErrException();
if (Drag_Error == NULL ||
@ -1142,6 +1150,7 @@ void init_Drag(void)
dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing);
#endif
#endif /* !__LP64__ */
}

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -526,22 +527,32 @@ static PyMethodDef Evt_methods[] = {
};
#else /* __LP64__ */
static PyMethodDef Evt_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_Evt(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_Evt", Evt_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Evt_Error = PyMac_GetOSErrException();
if (Evt_Error == NULL ||
PyDict_SetItemString(d, "Error", Evt_Error) != 0)
return;
#endif /* __LP64__ */
}
/* ======================== End module _Evt ========================= */

View File

@ -18,30 +18,45 @@
#include <Carbon/Carbon.h>
#ifdef USE_TOOLBOX_OBJECT_GLUE
extern int _PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr);
extern PyObject *_PyMac_BuildFSSpec(FSSpec *spec);
extern PyObject *_PyMac_BuildFSRef(FSRef *spec);
#ifndef __LP64__
extern int _PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
extern PyObject *_PyMac_BuildFSSpec(FSSpec *spec);
#define PyMac_BuildFSSpec _PyMac_BuildFSSpec
#endif /* __LP64__*/
extern int _PyMac_GetFSRef(PyObject *v, FSRef *fsr);
extern PyObject *_PyMac_BuildFSRef(FSRef *spec);
#define PyMac_BuildFSRef _PyMac_BuildFSRef
#define PyMac_GetFSSpec _PyMac_GetFSSpec
#define PyMac_GetFSRef _PyMac_GetFSRef
#define PyMac_BuildFSSpec _PyMac_BuildFSSpec
#define PyMac_BuildFSRef _PyMac_BuildFSRef
#else
#else /* !USE_TOOLBOX_OBJECT_GLUE */
#ifndef __LP64__
extern int PyMac_GetFSSpec(PyObject *v, FSSpec *spec);
extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
extern PyObject *PyMac_BuildFSSpec(FSSpec *spec);
#endif /* !__LP64__*/
extern int PyMac_GetFSRef(PyObject *v, FSRef *fsr);
extern PyObject *PyMac_BuildFSRef(FSRef *spec);
#endif
#endif /* !USE_TOOLBOX_OBJECT_GLUE */
/* Forward declarations */
static PyObject *FInfo_New(FInfo *itself);
static PyObject *FSRef_New(FSRef *itself);
#ifndef __LP64__
static PyObject *FInfo_New(FInfo *itself);
static PyObject *FSSpec_New(FSSpec *itself);
static PyObject *Alias_New(AliasHandle itself);
static int FInfo_Convert(PyObject *v, FInfo *p_itself);
#define FSRef_Convert PyMac_GetFSRef
#define FSSpec_Convert PyMac_GetFSSpec
#endif /* !__LP64__ */
static PyObject *Alias_New(AliasHandle itself);
#ifndef __LP64__
static int FInfo_Convert(PyObject *v, FInfo *p_itself);
#endif /* !__LP64__ */
#define FSRef_Convert PyMac_GetFSRef
static int Alias_Convert(PyObject *v, AliasHandle *p_itself);
/*
@ -62,6 +77,7 @@ UTCDateTime_New(UTCDateTime *ptr)
/*
** Optional fsspec and fsref pointers. None will pass NULL
*/
#ifndef __LP64__
static int
myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
{
@ -71,6 +87,7 @@ myPyMac_GetOptFSSpecPtr(PyObject *v, FSSpec **spec)
}
return PyMac_GetFSSpec(v, *spec);
}
#endif /* !__LP64__ */
static int
myPyMac_GetOptFSRefPtr(PyObject *v, FSRef **ref)
@ -92,6 +109,7 @@ PyMac_BuildHFSUniStr255(HFSUniStr255 *itself)
return Py_BuildValue("u#", itself->unicode, itself->length);
}
#ifndef __LP64__
static OSErr
_PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@ -135,6 +153,7 @@ _PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
}
return 0;
}
#endif /* !__LP64__ */
static PyObject *File_Error;
@ -174,6 +193,10 @@ static int FSCatalogInfo_Convert(PyObject *v, FSCatalogInfo *p_itself)
static void FSCatalogInfo_dealloc(FSCatalogInfoObject *self)
{
/* Cleanup of self->ob_itself goes here */
FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
if (info->fileSec != NULL) {
CFRelease(info->fileSec);
}
self->ob_type->tp_free((PyObject *)self);
}
@ -282,12 +305,28 @@ static int FSCatalogInfo_set_backupDate(FSCatalogInfoObject *self, PyObject *v,
static PyObject *FSCatalogInfo_get_permissions(FSCatalogInfoObject *self, void *closure)
{
return Py_BuildValue("(llll)", self->ob_itself.permissions[0], self->ob_itself.permissions[1], self->ob_itself.permissions[2], self->ob_itself.permissions[3]);
FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
return Py_BuildValue("(llll)", info->userID, info->groupID, info->userAccess, info->mode);
}
static int FSCatalogInfo_set_permissions(FSCatalogInfoObject *self, PyObject *v, void *closure)
{
return PyArg_Parse(v, "(llll)", &self->ob_itself.permissions[0], &self->ob_itself.permissions[1], &self->ob_itself.permissions[2], &self->ob_itself.permissions[3])-1;
long userID;
long groupID;
long userAccess;
long mode;
int r;
FSPermissionInfo* info = (FSPermissionInfo*)&(self->ob_itself.permissions);
r = PyArg_Parse(v, "(llll)", &userID, &groupID, &userAccess, &mode);
if (!r) {
return -1;
}
info->userID = userID;
info->groupID = groupID;
info->userAccess = userAccess;
info->mode = mode;
return 0;
}
@ -501,6 +540,8 @@ static PyTypeObject FSCatalogInfo_Type = {
/* ----------------------- Object type FInfo ------------------------ */
#ifndef __LP64__
static PyTypeObject FInfo_Type;
#define FInfo_Check(x) ((x)->ob_type == &FInfo_Type || PyObject_TypeCheck((x), &FInfo_Type))
@ -682,6 +723,7 @@ static PyTypeObject FInfo_Type = {
FInfo_tp_free, /* tp_free */
};
#endif /* !__LP64__ */
/* --------------------- End object type FInfo ---------------------- */
@ -729,6 +771,7 @@ static void Alias_dealloc(AliasObject *self)
self->ob_type->tp_free((PyObject *)self);
}
#ifndef __LP64__
static PyObject *Alias_ResolveAlias(AliasObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -818,6 +861,7 @@ static PyObject *Alias_FollowFinderAlias(AliasObject *_self, PyObject *_args)
wasChanged);
return _res;
}
#endif /* !__LP64__ */
static PyObject *Alias_FSResolveAliasWithMountFlags(AliasObject *_self, PyObject *_args)
{
@ -891,6 +935,7 @@ static PyObject *Alias_FSFollowFinderAlias(AliasObject *_self, PyObject *_args)
}
static PyMethodDef Alias_methods[] = {
#ifndef __LP64__
{"ResolveAlias", (PyCFunction)Alias_ResolveAlias, 1,
PyDoc_STR("(FSSpec fromFile) -> (FSSpec target, Boolean wasChanged)")},
{"GetAliasInfo", (PyCFunction)Alias_GetAliasInfo, 1,
@ -899,6 +944,7 @@ static PyMethodDef Alias_methods[] = {
PyDoc_STR("(FSSpec fromFile, unsigned long mountFlags) -> (FSSpec target, Boolean wasChanged)")},
{"FollowFinderAlias", (PyCFunction)Alias_FollowFinderAlias, 1,
PyDoc_STR("(FSSpec fromFile, Boolean logon) -> (FSSpec target, Boolean wasChanged)")},
#endif /* !__LP64__ */
{"FSResolveAliasWithMountFlags", (PyCFunction)Alias_FSResolveAliasWithMountFlags, 1,
PyDoc_STR("(FSRef fromFile, unsigned long mountFlags) -> (FSRef target, Boolean wasChanged)")},
{"FSResolveAlias", (PyCFunction)Alias_FSResolveAlias, 1,
@ -1033,6 +1079,7 @@ static PyTypeObject Alias_Type = {
/* ----------------------- Object type FSSpec ----------------------- */
#ifndef __LP64__
static PyTypeObject FSSpec_Type;
@ -1488,6 +1535,7 @@ static PyTypeObject FSSpec_Type = {
FSSpec_tp_free, /* tp_free */
};
#endif /* !__LP64__ */
/* --------------------- End object type FSSpec --------------------- */
@ -1568,7 +1616,9 @@ static PyObject *FSRef_FSCreateFileUnicode(FSRefObject *_self, PyObject *_args)
FSCatalogInfoBitmap whichInfo;
FSCatalogInfo catalogInfo;
FSRef newRef;
#ifndef __LP64__
FSSpec newSpec;
#endif
if (!PyArg_ParseTuple(_args, "u#lO&",
&nameLength__in__, &nameLength__in_len__,
&whichInfo,
@ -1580,11 +1630,22 @@ static PyObject *FSRef_FSCreateFileUnicode(FSRefObject *_self, PyObject *_args)
whichInfo,
&catalogInfo,
&newRef,
&newSpec);
#ifndef __LP64__
&newSpec
#else /* __LP64__ */
NULL
#endif /* __LP64__*/
);
if (_err != noErr) return PyMac_Error(_err);
#ifndef __LP64__
_res = Py_BuildValue("O&O&",
FSRef_New, &newRef,
FSSpec_New, &newSpec);
#else /* __LP64__ */
_res = Py_BuildValue("O&O", FSRef_New, &newRef, Py_None);
#endif /* __LP64__ */
return _res;
}
@ -1598,7 +1659,9 @@ static PyObject *FSRef_FSCreateDirectoryUnicode(FSRefObject *_self, PyObject *_a
FSCatalogInfoBitmap whichInfo;
FSCatalogInfo catalogInfo;
FSRef newRef;
#ifndef __LP64__
FSSpec newSpec;
#endif /* !__LP64__ */
UInt32 newDirID;
if (!PyArg_ParseTuple(_args, "u#lO&",
&nameLength__in__, &nameLength__in_len__,
@ -1611,13 +1674,25 @@ static PyObject *FSRef_FSCreateDirectoryUnicode(FSRefObject *_self, PyObject *_a
whichInfo,
&catalogInfo,
&newRef,
#ifndef __LP64__
&newSpec,
#else /* !__LP64__ */
NULL,
#endif /* !__LP64__ */
&newDirID);
if (_err != noErr) return PyMac_Error(_err);
#ifndef __LP64__
_res = Py_BuildValue("O&O&l",
FSRef_New, &newRef,
FSSpec_New, &newSpec,
newDirID);
#else /* __LP64__ */
_res = Py_BuildValue("O&Ol",
FSRef_New, &newRef,
Py_None,
newDirID);
#endif /* __LP64__ */
return _res;
}
@ -1699,7 +1774,9 @@ static PyObject *FSRef_FSGetCatalogInfo(FSRefObject *_self, PyObject *_args)
FSCatalogInfoBitmap whichInfo;
FSCatalogInfo catalogInfo;
HFSUniStr255 outName;
#ifndef __LP64__
FSSpec fsSpec;
#endif /* !__LP64__ */
FSRef parentRef;
if (!PyArg_ParseTuple(_args, "l",
&whichInfo))
@ -1708,14 +1785,27 @@ static PyObject *FSRef_FSGetCatalogInfo(FSRefObject *_self, PyObject *_args)
whichInfo,
&catalogInfo,
&outName,
#ifndef __LP64__
&fsSpec,
#else /* __LP64__ */
NULL,
#endif /* __LP64__ */
&parentRef);
if (_err != noErr) return PyMac_Error(_err);
#ifndef __LP64__
_res = Py_BuildValue("O&O&O&O&",
FSCatalogInfo_New, &catalogInfo,
PyMac_BuildHFSUniStr255, &outName,
FSSpec_New, &fsSpec,
FSRef_New, &parentRef);
#else /* __LP64__ */
_res = Py_BuildValue("O&O&OO&",
FSCatalogInfo_New, &catalogInfo,
PyMac_BuildHFSUniStr255, &outName,
Py_None,
FSRef_New, &parentRef);
#endif /* __LP64__ */
return _res;
}
@ -1784,7 +1874,7 @@ static PyObject *FSRef_FSOpenFork(FSRefObject *_self, PyObject *_args)
UniCharCount forkNameLength__len__;
int forkNameLength__in_len__;
SInt8 permissions;
SInt16 forkRefNum;
FSIORefNum forkRefNum;
if (!PyArg_ParseTuple(_args, "u#b",
&forkNameLength__in__, &forkNameLength__in_len__,
&permissions))
@ -2034,7 +2124,7 @@ static PyTypeObject FSRef_Type = {
/* --------------------- End object type FSRef ---------------------- */
#ifndef __LP64__
static PyObject *File_UnmountVol(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -2562,6 +2652,7 @@ static PyObject *File_FSMakeFSSpec(PyObject *_self, PyObject *_args)
FSSpec_New, &spec);
return _res;
}
#endif /* !__LP64__ */
static PyObject *File_FSGetForkPosition(PyObject *_self, PyObject *_args)
{
@ -2785,6 +2876,7 @@ static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args)
return _res;
}
#ifndef __LP64__
static PyObject *File_NewAlias(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -2933,6 +3025,7 @@ static PyObject *File_ResolveAliasFileWithMountFlagsNoUI(PyObject *_self, PyObje
wasAliased);
return _res;
}
#endif /* !__LP64__ */
static PyObject *File_FSNewAlias(PyObject *_self, PyObject *_args)
{
@ -3050,6 +3143,7 @@ static PyObject *File_pathname(PyObject *_self, PyObject *_args)
}
static PyMethodDef File_methods[] = {
#ifndef __LP64__
{"UnmountVol", (PyCFunction)File_UnmountVol, 1,
PyDoc_STR("(Str63 volName, short vRefNum) -> None")},
{"FlushVol", (PyCFunction)File_FlushVol, 1,
@ -3100,6 +3194,7 @@ static PyMethodDef File_methods[] = {
PyDoc_STR("(short vRefNum, long dirID, Str255 oldName, long newDirID, Str255 newName) -> None")},
{"FSMakeFSSpec", (PyCFunction)File_FSMakeFSSpec, 1,
PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> (FSSpec spec)")},
#endif /* !__LP64__*/
{"FSGetForkPosition", (PyCFunction)File_FSGetForkPosition, 1,
PyDoc_STR("(SInt16 forkRefNum) -> (SInt64 position)")},
{"FSSetForkPosition", (PyCFunction)File_FSSetForkPosition, 1,
@ -3124,6 +3219,7 @@ static PyMethodDef File_methods[] = {
PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")},
{"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1,
PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
#ifndef __LP64__
{"NewAlias", (PyCFunction)File_NewAlias, 1,
PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")},
{"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1,
@ -3136,6 +3232,7 @@ static PyMethodDef File_methods[] = {
PyDoc_STR("(FSSpec fromFile, FSSpec target, AliasHandle alias) -> (Boolean wasChanged)")},
{"ResolveAliasFileWithMountFlagsNoUI", (PyCFunction)File_ResolveAliasFileWithMountFlagsNoUI, 1,
PyDoc_STR("(FSSpec theSpec, Boolean resolveAliasChains, unsigned long mountFlags) -> (FSSpec theSpec, Boolean targetIsFolder, Boolean wasAliased)")},
#endif /* !__LP64__ */
{"FSNewAlias", (PyCFunction)File_FSNewAlias, 1,
PyDoc_STR("(FSRef fromFile, FSRef target) -> (AliasHandle inAlias)")},
{"FSResolveAliasFileWithMountFlags", (PyCFunction)File_FSResolveAliasFileWithMountFlags, 1,
@ -3150,7 +3247,7 @@ static PyMethodDef File_methods[] = {
};
#ifndef __LP64__
int
PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
{
@ -3188,12 +3285,15 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
}
return 0;
}
#endif /* !__LP64__ */
int
PyMac_GetFSRef(PyObject *v, FSRef *fsr)
{
OSStatus err;
#ifndef __LP64__
FSSpec fss;
#endif /* !__LP64__ */
if (FSRef_Check(v)) {
*fsr = ((FSRefObject *)v)->ob_itself;
@ -3205,12 +3305,14 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
char *path = NULL;
if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
return 0;
if ( (err=FSPathMakeRef(path, fsr, NULL)) )
if ( (err=FSPathMakeRef((unsigned char*)path, fsr, NULL)) )
PyMac_Error(err);
PyMem_Free(path);
return !err;
}
/* XXXX Should try unicode here too */
#ifndef __LP64__
/* Otherwise we try to go via an FSSpec */
if (FSSpec_Check(v)) {
fss = ((FSSpecObject *)v)->ob_itself;
@ -3219,15 +3321,19 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
PyMac_Error(err);
return 0;
}
#endif /* !__LP64__ */
PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required");
return 0;
}
#ifndef __LP64__
extern PyObject *
PyMac_BuildFSSpec(FSSpec *spec)
{
return FSSpec_New(spec);
}
#endif /* !__LP64__ */
extern PyObject *
PyMac_BuildFSRef(FSRef *spec)
@ -3242,10 +3348,12 @@ void init_File(void)
PyObject *d;
#ifndef __LP64__
PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec);
PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec);
#endif /* !__LP64__ */
PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef);
@ -3262,6 +3370,8 @@ void init_File(void)
/* Backward-compatible name */
Py_INCREF(&FSCatalogInfo_Type);
PyModule_AddObject(m, "FSCatalogInfoType", (PyObject *)&FSCatalogInfo_Type);
#ifndef __LP64__
FInfo_Type.ob_type = &PyType_Type;
if (PyType_Ready(&FInfo_Type) < 0) return;
Py_INCREF(&FInfo_Type);
@ -3269,6 +3379,7 @@ void init_File(void)
/* Backward-compatible name */
Py_INCREF(&FInfo_Type);
PyModule_AddObject(m, "FInfoType", (PyObject *)&FInfo_Type);
#endif /* !__LP64__ */
Alias_Type.ob_type = &PyType_Type;
if (PyType_Ready(&Alias_Type) < 0) return;
Py_INCREF(&Alias_Type);
@ -3276,6 +3387,8 @@ void init_File(void)
/* Backward-compatible name */
Py_INCREF(&Alias_Type);
PyModule_AddObject(m, "AliasType", (PyObject *)&Alias_Type);
#ifndef __LP64__
FSSpec_Type.ob_type = &PyType_Type;
if (PyType_Ready(&FSSpec_Type) < 0) return;
Py_INCREF(&FSSpec_Type);
@ -3283,6 +3396,7 @@ void init_File(void)
/* Backward-compatible name */
Py_INCREF(&FSSpec_Type);
PyModule_AddObject(m, "FSSpecType", (PyObject *)&FSSpec_Type);
#endif /* !__LP64__ */
FSRef_Type.ob_type = &PyType_Type;
if (PyType_Ready(&FSRef_Type) < 0) return;
Py_INCREF(&FSRef_Type);

View File

@ -6,6 +6,13 @@
# XXXX TO DO:
# - Implement correct missing FSSpec handling for Alias methods
# - Implement FInfo
#
# WARNING WARNING WARNING
# The file _Filemodule.c was modified manually, don't run this script
# unless you really know what you're doing.
import sys
sys.exit(42)
import string
@ -199,6 +206,7 @@ PyMac_BuildHFSUniStr255(HFSUniStr255 *itself)
return Py_BuildValue("u#", itself->unicode, itself->length);
}
#ifndef __LP64__
/*
** Get pathname for a given FSSpec
*/
@ -244,10 +252,13 @@ _PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
}
return 0;
}
#endif /* !__LP64__ */
"""
finalstuff = finalstuff + """
#ifndef __LP64__
int
PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
{
@ -286,6 +297,8 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec)
return 0;
}
#endif /* !__LP64__ */
int
PyMac_GetFSRef(PyObject *v, FSRef *fsr)
{
@ -309,6 +322,7 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
}
/* XXXX Should try unicode here too */
/* Otherwise we try to go via an FSSpec */
#ifndef __LP64__
if (FSSpec_Check(v)) {
fss = ((FSSpecObject *)v)->ob_itself;
if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
@ -317,14 +331,19 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr)
return 0;
}
PyErr_SetString(PyExc_TypeError, "FSRef, FSSpec or pathname required");
#else /* __LP64__ */
PyErr_SetString(PyExc_TypeError, "FSRef or pathname required");
#endif /* __LP64__ */
return 0;
}
#ifndef __LP64__
extern PyObject *
PyMac_BuildFSSpec(FSSpec *spec)
{
return FSSpec_New(spec);
}
#endif /* __LP64__ */
extern PyObject *
PyMac_BuildFSRef(FSRef *spec)
@ -334,9 +353,11 @@ PyMac_BuildFSRef(FSRef *spec)
"""
initstuff = initstuff + """
#ifndef __LP64__
PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec);
PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec);
#endif /* !__LP64__*/
PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef);
"""

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -335,23 +336,32 @@ static PyMethodDef Fm_methods[] = {
{NULL, NULL, 0}
};
#else /* __LP64__ */
static PyMethodDef Fm_methods[] = {
{NULL, NULL, 0}
};
#endif /* __LP64__ */
void init_Fm(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_Fm", Fm_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Fm_Error = PyMac_GetOSErrException();
if (Fm_Error == NULL ||
PyDict_SetItemString(d, "Error", Fm_Error) != 0)
return;
#endif /* __LP64__ */
}
/* ========================= End module _Fm ========================= */

View File

@ -27,8 +27,8 @@ static PyObject *Folder_FindFolder(PyObject *_self, PyObject *_args)
short vRefNum;
OSType folderType;
Boolean createFolder;
short foundVRefNum;
long foundDirID;
FSVolumeRefNum foundVRefNum;
SInt32 foundDirID;
if (!PyArg_ParseTuple(_args, "hO&b",
&vRefNum,
PyMac_GetOSType, &folderType,
@ -158,6 +158,7 @@ static PyObject *Folder_RemoveFolderDescriptor(PyObject *_self, PyObject *_args)
return _res;
}
#ifndef __LP64__
static PyObject *Folder_GetFolderName(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -248,6 +249,7 @@ static PyObject *Folder_FindFolderRouting(PyObject *_self, PyObject *_args)
flags);
return _res;
}
#endif /* !__LP64__ */
static PyObject *Folder_InvalidateFolderDescriptorCache(PyObject *_self, PyObject *_args)
{
@ -300,6 +302,7 @@ static PyMethodDef Folder_methods[] = {
PyDoc_STR("(UInt32 requestedTypeCount) -> (UInt32 totalTypeCount, FolderType theTypes)")},
{"RemoveFolderDescriptor", (PyCFunction)Folder_RemoveFolderDescriptor, 1,
PyDoc_STR("(FolderType foldType) -> None")},
#ifndef __LP64__
{"GetFolderName", (PyCFunction)Folder_GetFolderName, 1,
PyDoc_STR("(short vRefNum, OSType foldType, Str255 name) -> (short foundVRefNum)")},
{"AddFolderRouting", (PyCFunction)Folder_AddFolderRouting, 1,
@ -308,6 +311,7 @@ static PyMethodDef Folder_methods[] = {
PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> None")},
{"FindFolderRouting", (PyCFunction)Folder_FindFolderRouting, 1,
PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> (FolderType routeToFolder, RoutingFlags flags)")},
#endif /* !__LP64__ */
{"InvalidateFolderDescriptorCache", (PyCFunction)Folder_InvalidateFolderDescriptorCache, 1,
PyDoc_STR("(short vRefNum, long dirID) -> None")},
{"IdentifyFolder", (PyCFunction)Folder_IdentifyFolder, 1,

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -144,7 +145,10 @@ static PyObject *Help_HMHideTag(PyObject *_self, PyObject *_args)
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Help_methods[] = {
#ifndef __LP64__
{"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1,
PyDoc_STR("() -> (MenuRef outHelpMenu, MenuItemIndex outFirstCustomItemIndex)")},
{"HMAreHelpTagsDisplayed", (PyCFunction)Help_HMAreHelpTagsDisplayed, 1,
@ -161,6 +165,7 @@ static PyMethodDef Help_methods[] = {
PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")},
{"HMHideTag", (PyCFunction)Help_HMHideTag, 1,
PyDoc_STR("() -> None")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -170,17 +175,21 @@ static PyMethodDef Help_methods[] = {
void init_Help(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_Help", Help_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Help_Error = PyMac_GetOSErrException();
if (Help_Error == NULL ||
PyDict_SetItemString(d, "Error", Help_Error) != 0)
return;
#endif /* __LP64__ */
}
/* ======================== End module _Help ======================== */

View File

@ -4,6 +4,7 @@
#include "Python.h"
#ifndef __LP64__
#include <Carbon/Carbon.h>
#include "pymactoolbox.h"
@ -224,10 +225,13 @@ static PyObject *IBCarbon_CreateNibReference(PyObject *_self, PyObject *_args)
IBNibRefObj_New, outNibRef);
return _res;
}
#endif /* __LP64__ */
static PyMethodDef IBCarbon_methods[] = {
#ifndef __LP64__
{"CreateNibReference", (PyCFunction)IBCarbon_CreateNibReference, 1,
PyDoc_STR("(CFStringRef inNibName) -> (IBNibRef outNibRef)")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -237,13 +241,16 @@ static PyMethodDef IBCarbon_methods[] = {
void init_IBCarbon(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_IBCarbon", IBCarbon_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
IBCarbon_Error = PyMac_GetOSErrException();
if (IBCarbon_Error == NULL ||
@ -256,6 +263,7 @@ void init_IBCarbon(void)
/* Backward-compatible name */
Py_INCREF(&IBNibRef_Type);
PyModule_AddObject(m, "IBNibRefType", (PyObject *)&IBNibRef_Type);
#endif /* __LP64__ */
}
/* ====================== End module _IBCarbon ====================== */

View File

@ -4,6 +4,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -1447,8 +1448,10 @@ static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args)
_res = Py_None;
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Icn_methods[] = {
#ifndef __LP64__
{"GetCIcon", (PyCFunction)Icn_GetCIcon, 1,
PyDoc_STR("(SInt16 iconID) -> (CIconHandle _rv)")},
{"PlotCIcon", (PyCFunction)Icn_PlotCIcon, 1,
@ -1573,6 +1576,7 @@ static PyMethodDef Icn_methods[] = {
PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")},
{"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1,
PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -1582,17 +1586,21 @@ static PyMethodDef Icn_methods[] = {
void init_Icn(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_Icn", Icn_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Icn_Error = PyMac_GetOSErrException();
if (Icn_Error == NULL ||
PyDict_SetItemString(d, "Error", Icn_Error) != 0)
return;
#endif /* __LP64__ */
}
/* ======================== End module _Icn ========================= */

View File

@ -50,6 +50,7 @@ OptCFStringRefObj_New(CFStringRef it)
PyObject *
LSItemInfoRecord_New(LSItemInfoRecord *it)
{
#ifndef __LP64__
return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}",
"flags", it->flags,
"filetype", PyMac_BuildOSType, it->filetype,
@ -57,6 +58,13 @@ LSItemInfoRecord_New(LSItemInfoRecord *it)
"extension", OptCFStringRefObj_New, it->extension,
"iconFileName", OptCFStringRefObj_New, it->iconFileName,
"kindID", it->kindID);
#else
return Py_BuildValue("{s:is:O&s:O&s:O&}",
"flags", it->flags,
"filetype", PyMac_BuildOSType, it->filetype,
"creator", PyMac_BuildOSType, it->creator,
"extension", OptCFStringRefObj_New, it->extension);
#endif
}
static PyObject *Launch_Error;

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -1032,8 +1033,10 @@ static PyObject *List_as_List(PyObject *_self, PyObject *_args)
return _res;
}
#endif /* __LP64__ */
static PyMethodDef List_methods[] = {
#ifndef __LP64__
{"CreateCustomList", (PyCFunction)List_CreateCustomList, 1,
PyDoc_STR("(Rect rView, Rect dataBounds, Point cellSize, ListDefSpec theSpec, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListHandle outList)")},
{"LNew", (PyCFunction)List_LNew, 1,
@ -1056,9 +1059,11 @@ static PyMethodDef List_methods[] = {
PyDoc_STR("(ListHandle list, OptionBits selectionFlags) -> None")},
{"as_List", (PyCFunction)List_as_List, 1,
PyDoc_STR("(Resource)->List.\nReturns List object (which is not auto-freed!)")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
#ifndef __LP64__
static void myListDefFunction(SInt16 message,
@ -1096,11 +1101,13 @@ static void myListDefFunction(SInt16 message,
Py_DECREF(rv);
}
}
#endif /* __LP64__ */
void init_List(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
@ -1109,9 +1116,11 @@ void init_List(void)
PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_List", List_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
List_Error = PyMac_GetOSErrException();
if (List_Error == NULL ||
@ -1124,6 +1133,7 @@ void init_List(void)
/* Backward-compatible name */
Py_INCREF(&List_Type);
PyModule_AddObject(m, "ListType", (PyObject *)&List_Type);
#endif /* __LP64__ */
}
/* ======================== End module _List ======================== */

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -3347,8 +3348,10 @@ static PyObject *Menu_RemoveMenuCommandProperty(PyObject *_self, PyObject *_args
_res = Py_None;
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Menu_methods[] = {
#ifndef __LP64__
{"NewMenu", (PyCFunction)Menu_NewMenu, 1,
PyDoc_STR("(MenuID menuID, Str255 menuTitle) -> (MenuHandle _rv)")},
{"MacGetMenu", (PyCFunction)Menu_MacGetMenu, 1,
@ -3433,6 +3436,7 @@ static PyMethodDef Menu_methods[] = {
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> (ByteCount outSize)")},
{"RemoveMenuCommandProperty", (PyCFunction)Menu_RemoveMenuCommandProperty, 1,
PyDoc_STR("(MenuHandle inMenu, MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -3442,15 +3446,18 @@ static PyMethodDef Menu_methods[] = {
void init_Menu(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_Menu", Menu_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Menu_Error = PyMac_GetOSErrException();
if (Menu_Error == NULL ||
@ -3463,6 +3470,7 @@ void init_Menu(void)
/* Backward-compatible name */
Py_INCREF(&Menu_Type);
PyModule_AddObject(m, "MenuType", (PyObject *)&Menu_Type);
#endif /* __LP64__ */
}
/* ======================== End module _Menu ======================== */

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -1622,7 +1623,10 @@ static PyObject *Mlte_TXNInitTextension(PyObject *_self, PyObject *_args)
}
#endif /* __LP64__ */
static PyMethodDef Mlte_methods[] = {
#ifndef __LP64__
{"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1,
PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")},
{"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1,
@ -1639,6 +1643,7 @@ static PyMethodDef Mlte_methods[] = {
PyDoc_STR("() -> (TXNVersionValue _rv, TXNFeatureBits oFeatureFlags)")},
{"TXNInitTextension", (PyCFunction)Mlte_TXNInitTextension, 1,
PyDoc_STR("(TXNInitOptions) -> None")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -1648,14 +1653,17 @@ static PyMethodDef Mlte_methods[] = {
void init_Mlte(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
// PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx);
#endif /* __LP64__ */
m = Py_InitModule("_Mlte", Mlte_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Mlte_Error = PyMac_GetOSErrException();
if (Mlte_Error == NULL ||
@ -1675,6 +1683,7 @@ void init_Mlte(void)
/* Backward-compatible name */
Py_INCREF(&TXNFontMenuObject_Type);
PyModule_AddObject(m, "TXNFontMenuObjectType", (PyObject *)&TXNFontMenuObject_Type);
#endif /* __LP64__ */
}
/* ======================== End module _Mlte ======================== */

View File

@ -4,6 +4,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -6544,8 +6545,10 @@ static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Qd_methods[] = {
#ifndef __LP64__
{"GetPort", (PyCFunction)Qd_GetPort, 1,
PyDoc_STR("() -> (GrafPtr port)")},
{"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
@ -7080,10 +7083,12 @@ static PyMethodDef Qd_methods[] = {
PyDoc_STR("Take (string, int, Rect) argument and create BitMap")},
{"RawBitMap", (PyCFunction)Qd_RawBitMap, 1,
PyDoc_STR("Take string BitMap and turn into BitMap object")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
#ifndef __LP64__
/* Like BMObj_New, but the original bitmap data structure is copied (and
** released when the object is released)
@ -7101,11 +7106,13 @@ PyObject *BMObj_NewCopied(BitMapPtr itself)
return (PyObject *)it;
}
#endif /* __LP64__ */
void init_Qd(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
@ -7117,8 +7124,10 @@ void init_Qd(void)
PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColor, QdRGB_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_Qd", Qd_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Qd_Error = PyMac_GetOSErrException();
if (Qd_Error == NULL ||
@ -7138,6 +7147,7 @@ void init_Qd(void)
/* Backward-compatible name */
Py_INCREF(&BitMap_Type);
PyModule_AddObject(m, "BitMapType", (PyObject *)&BitMap_Type);
#endif /* __LP64__ */
}
/* ========================= End module _Qd ========================= */

View File

@ -4,6 +4,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -630,8 +631,10 @@ static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args)
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Qdoffs_methods[] = {
#ifndef __LP64__
{"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1,
PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")},
{"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1,
@ -678,6 +681,7 @@ static PyMethodDef Qdoffs_methods[] = {
PyDoc_STR("(pixmap, int start, int size) -> string. Return bytes from the pixmap")},
{"PutPixMapBytes", (PyCFunction)Qdoffs_PutPixMapBytes, 1,
PyDoc_STR("(pixmap, int start, string data). Store bytes into the pixmap")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -687,6 +691,7 @@ static PyMethodDef Qdoffs_methods[] = {
void init_Qdoffs(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
@ -694,8 +699,10 @@ void init_Qdoffs(void)
PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_Qdoffs", Qdoffs_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Qdoffs_Error = PyMac_GetOSErrException();
if (Qdoffs_Error == NULL ||
@ -708,6 +715,7 @@ void init_Qdoffs(void)
/* Backward-compatible name */
Py_INCREF(&GWorld_Type);
PyModule_AddObject(m, "GWorldType", (PyObject *)&GWorld_Type);
#endif /* __LP64__ */
}
/* ======================= End module _Qdoffs ======================= */

View File

@ -4,6 +4,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -26294,8 +26295,10 @@ static PyObject *Qt_MoviesTask(PyObject *_self, PyObject *_args)
_res = Py_None;
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Qt_methods[] = {
#ifndef __LP64__
{"EnterMovies", (PyCFunction)Qt_EnterMovies, 1,
PyDoc_STR("() -> None")},
{"ExitMovies", (PyCFunction)Qt_ExitMovies, 1,
@ -27988,6 +27991,7 @@ static PyMethodDef Qt_methods[] = {
PyDoc_STR("(WindowPtr wp, Point startPt, Rect boundsRect) -> None")},
{"MoviesTask", (PyCFunction)Qt_MoviesTask, 1,
PyDoc_STR("(long maxMilliSecToUse) -> None")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -27997,6 +28001,7 @@ static PyMethodDef Qt_methods[] = {
void init_Qt(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
@ -28013,9 +28018,11 @@ void init_Qt(void)
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert);
PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_Qt", Qt_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Qt_Error = PyMac_GetOSErrException();
if (Qt_Error == NULL ||
@ -28077,6 +28084,7 @@ void init_Qt(void)
/* Backward-compatible name */
Py_INCREF(&SGOutput_Type);
PyModule_AddObject(m, "SGOutputType", (PyObject *)&SGOutput_Type);
#endif /* __LP64__ */
}
/* ========================= End module _Qt ========================= */

View File

@ -4,7 +4,6 @@
#include "Python.h"
#include "pymactoolbox.h"
/* Macro to test whether a weak-loaded CFM function exists */
@ -414,6 +413,7 @@ static PyObject *ResObj_GetNextFOND(ResourceObject *_self, PyObject *_args)
return _res;
}
#ifndef __LP64__
static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -431,6 +431,7 @@ static PyObject *ResObj_as_Menu(ResourceObject *_self, PyObject *_args)
return _res;
}
#endif /* !__LP64__ */
static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
{
@ -501,10 +502,12 @@ static PyMethodDef ResObj_methods[] = {
PyDoc_STR("(long newSize) -> None")},
{"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1,
PyDoc_STR("() -> (Handle _rv)")},
#ifndef __LP64__
{"as_Control", (PyCFunction)ResObj_as_Control, 1,
PyDoc_STR("Return this resource/handle as a Control")},
{"as_Menu", (PyCFunction)ResObj_as_Menu, 1,
PyDoc_STR("Return this resource/handle as a Menu")},
#endif /* !__LP64__ */
{"LoadResource", (PyCFunction)ResObj_LoadResource, 1,
PyDoc_STR("() -> None")},
{"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1,
@ -1152,6 +1155,7 @@ static PyObject *Res_SetResFileAttrs(PyObject *_self, PyObject *_args)
return _res;
}
#ifndef __LP64__
static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1287,6 +1291,7 @@ static PyObject *Res_FSpCreateResFile(PyObject *_self, PyObject *_args)
_res = Py_None;
return _res;
}
#endif /* !__LP64__ */
static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
{
@ -1327,6 +1332,7 @@ static PyObject *Res_DetachResourceFile(PyObject *_self, PyObject *_args)
return _res;
}
#ifndef __LP64__
static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1394,6 +1400,7 @@ static PyObject *Res_GetTopResourceFile(PyObject *_self, PyObject *_args)
return _res;
}
static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1413,6 +1420,7 @@ static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args)
nextRefNum);
return _res;
}
#endif /* !__LP64__ */
static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
{
@ -1438,6 +1446,8 @@ static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
return _res;
}
#ifndef __LP64__
static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1534,6 +1544,7 @@ static PyObject *Res_FSCreateResourceFile(PyObject *_self, PyObject *_args)
PyMac_BuildFSSpec, &newSpec);
return _res;
}
#endif /* __LP64__ */
static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
{
@ -1544,7 +1555,7 @@ static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
UniCharCount forkNameLength__len__;
int forkNameLength__in_len__;
SignedByte permissions;
SInt16 refNum;
ResFileRefNum refNum;
#ifndef FSOpenResourceFile
PyMac_PRECHECK(FSOpenResourceFile);
#endif
@ -1637,6 +1648,7 @@ static PyMethodDef Res_methods[] = {
PyDoc_STR("(short refNum) -> (short _rv)")},
{"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
PyDoc_STR("(short refNum, short attrs) -> None")},
#ifndef __LP64__
{"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
{"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
@ -1647,10 +1659,12 @@ static PyMethodDef Res_methods[] = {
PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
{"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
#endif /* !__LP64__ */
{"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
{"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
PyDoc_STR("(SInt16 refNum) -> None")},
#ifndef __LP64__
{"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
@ -1659,14 +1673,17 @@ static PyMethodDef Res_methods[] = {
PyDoc_STR("() -> (SInt16 refNum)")},
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
#endif /* __LP64__ */
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
#ifndef __LP64__
{"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
{"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
#endif /* __LP64__ */
{"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
{"Handle", (PyCFunction)Res_Handle, 1,
@ -1676,7 +1693,6 @@ static PyMethodDef Res_methods[] = {
/* Alternative version of ResObj_New, which returns None for null argument */
PyObject *OptResObj_New(Handle itself)
{

View File

@ -4,6 +4,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -315,8 +316,10 @@ static PyObject *Scrap_CallInScrapPromises(PyObject *_self, PyObject *_args)
_res = Py_None;
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Scrap_methods[] = {
#ifndef __LP64__
{"LoadScrap", (PyCFunction)Scrap_LoadScrap, 1,
PyDoc_STR("() -> None")},
{"UnloadScrap", (PyCFunction)Scrap_UnloadScrap, 1,
@ -327,6 +330,7 @@ static PyMethodDef Scrap_methods[] = {
PyDoc_STR("() -> None")},
{"CallInScrapPromises", (PyCFunction)Scrap_CallInScrapPromises, 1,
PyDoc_STR("() -> None")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -336,12 +340,15 @@ static PyMethodDef Scrap_methods[] = {
void init_Scrap(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_Scrap", Scrap_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Scrap_Error = PyMac_GetOSErrException();
if (Scrap_Error == NULL ||
@ -351,6 +358,7 @@ void init_Scrap(void)
Py_INCREF(&Scrap_Type);
if (PyDict_SetItemString(d, "ScrapType", (PyObject *)&Scrap_Type) != 0)
Py_FatalError("can't initialize ScrapType");
#endif /* __LP64__ */
}
/* ======================= End module _Scrap ======================== */

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -981,8 +982,10 @@ static PyObject *Snd_SPBBytesToMilliseconds(PyObject *_self, PyObject *_args)
byteCount);
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Snd_methods[] = {
#ifndef __LP64__
{"SPB", (PyCFunction)Snd_SPB, 1,
PyDoc_STR(NULL)},
{"SysBeep", (PyCFunction)Snd_SysBeep, 1,
@ -1047,10 +1050,12 @@ static PyMethodDef Snd_methods[] = {
PyDoc_STR("(long inRefNum) -> (long milliseconds)")},
{"SPBBytesToMilliseconds", (PyCFunction)Snd_SPBBytesToMilliseconds, 1,
PyDoc_STR("(long inRefNum) -> (long byteCount)")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
#ifndef __LP64__
/* Routine passed to Py_AddPendingCall -- call the Python callback */
static int
@ -1113,19 +1118,23 @@ SPB_completion(SPBPtr my_spb)
SetA5(A5);
}
}
#endif /* __LP64__ */
void init_Snd(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
#endif /* __LP64__ */
m = Py_InitModule("_Snd", Snd_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Snd_Error = PyMac_GetOSErrException();
if (Snd_Error == NULL ||
@ -1145,6 +1154,7 @@ void init_Snd(void)
/* Backward-compatible name */
Py_INCREF(&SPB_Type);
PyModule_AddObject(m, "SPBType", (PyObject *)&SPB_Type);
#endif /* __LP64__ */
}
/* ======================== End module _Snd ========================= */

View File

@ -3,6 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -1267,8 +1268,10 @@ static PyObject *TE_as_TE(PyObject *_self, PyObject *_args)
TEObj_New, _rv);
return _res;
}
#endif /* __LP64__ */
static PyMethodDef TE_methods[] = {
#ifndef __LP64__
{"TEScrapHandle", (PyCFunction)TE_TEScrapHandle, 1,
PyDoc_STR("() -> (Handle _rv)")},
{"TEGetScrapLength", (PyCFunction)TE_TEGetScrapLength, 1,
@ -1295,6 +1298,7 @@ static PyMethodDef TE_methods[] = {
PyDoc_STR("(UInt8 value) -> None")},
{"as_TE", (PyCFunction)TE_as_TE, 1,
PyDoc_STR("(Handle h) -> (TEHandle _rv)")},
#endif /* __LP64__ */
{NULL, NULL, 0}
};
@ -1304,6 +1308,7 @@ static PyMethodDef TE_methods[] = {
void init_TE(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
@ -1311,8 +1316,10 @@ void init_TE(void)
PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_TE", TE_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
TE_Error = PyMac_GetOSErrException();
if (TE_Error == NULL ||
@ -1325,6 +1332,7 @@ void init_TE(void)
/* Backward-compatible name */
Py_INCREF(&TE_Type);
PyModule_AddObject(m, "TEType", (PyObject *)&TE_Type);
#endif /* __LP64__ */
}
/* ========================= End module _TE ========================= */

View File

@ -3,7 +3,7 @@
#include "Python.h"
#ifndef __LP64__
#include "pymactoolbox.h"
@ -3147,8 +3147,10 @@ static PyObject *Win_FindWindow(PyObject *_self, PyObject *_args)
WinObj_WhichWindow, theWindow);
return _res;
}
#endif /* __LP64__ */
static PyMethodDef Win_methods[] = {
#ifndef __LP64__
{"GetNewCWindow", (PyCFunction)Win_GetNewCWindow, 1,
PyDoc_STR("(short windowID, WindowPtr behind) -> (WindowPtr _rv)")},
{"NewWindow", (PyCFunction)Win_NewWindow, 1,
@ -3200,10 +3202,12 @@ static PyMethodDef Win_methods[] = {
{"FindWindow", (PyCFunction)Win_FindWindow, 1,
PyDoc_STR("(Point thePoint) -> (short _rv, WindowPtr theWindow)")},
{NULL, NULL, 0}
#endif /* __LP64__ */
};
#ifndef __LP64__
/* Return the object corresponding to the window, or NULL */
PyObject *
@ -3226,20 +3230,22 @@ WinObj_WhichWindow(WindowPtr w)
return it;
}
#endif /* __LP64__ */
void init_Win(void)
{
PyObject *m;
#ifndef __LP64__
PyObject *d;
PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New);
PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New);
PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow);
PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert);
#endif /* __LP64__ */
m = Py_InitModule("_Win", Win_methods);
#ifndef __LP64__
d = PyModule_GetDict(m);
Win_Error = PyMac_GetOSErrException();
if (Win_Error == NULL ||
@ -3252,6 +3258,7 @@ void init_Win(void)
/* Backward-compatible name */
Py_INCREF(&Window_Type);
PyModule_AddObject(m, "WindowType", (PyObject *)&Window_Type);
#endif /* __LP64__ */
}
/* ======================== End module _Win ========================= */

View File

@ -430,7 +430,7 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
$(RESSRCDIR)/Info.plist
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)
if test "${UNIVERSALSDK}"; then \
$(CC) -o $(LDLIBRARY) -arch i386 -arch ppc -dynamiclib \
$(CC) -o $(LDLIBRARY) @UNIVERSAL_ARCH_FLAGS@ -dynamiclib \
-isysroot "${UNIVERSALSDK}" \
-all_load $(LIBRARY) -Wl,-single_module \
-install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \
@ -1051,13 +1051,22 @@ frameworkinstallmaclib:
frameworkinstallapps:
cd Mac && $(MAKE) installapps DESTDIR="$(DESTDIR)"
frameworkinstallapps4way:
cd Mac && $(MAKE) installapps4way DESTDIR="$(DESTDIR)"
# This install the unix python and pythonw tools in /usr/local/bin
frameworkinstallunixtools:
cd Mac && $(MAKE) installunixtools DESTDIR="$(DESTDIR)"
frameworkinstallunixtools4way:
cd Mac && $(MAKE) installunixtools4way DESTDIR="$(DESTDIR)"
frameworkaltinstallunixtools:
cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"
frameworkaltinstallunixtools4way:
cd Mac && $(MAKE) altinstallunixtools4way DESTDIR="$(DESTDIR)"
# This installs the Demos and Tools into the applications directory.
# It is not part of a normal frameworkinstall
frameworkinstallextras:
@ -1184,7 +1193,7 @@ funny:
# Perform some verification checks on any modified files.
check:
./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
# Dependencies

View File

@ -259,6 +259,14 @@ Library
- The Mac Modules (including Carbon) have been deprecated for removal
in Python 3.0.
- Library: on MacOS X you can now set ``ARCHFLAGS`` in the shell
environment to control the '-arch' flags that are used to build
an extension. This was added for compatibility with Apple's build
of Python.
- The bundled OSX-specific copy of libbffi is now in sync with the version
shipped with PyObjC 2.0 and includes support for x86_64 and ppc64 platforms.
Build
-----
@ -266,6 +274,23 @@ Build
- ``Lib/lib-old`` is now added to sys.path.
- On MacOS X it is now possible to install the framework in 64-bit
mode or even as a 4-way universal binary (that is, PPC, i386,
PPC64 and x86_64 support in one binary)
This is controlled by the configure argument ``--with-universal-archs``:
- ``--with-universal-archs=all``: install 4-way universal
- ``--with-universal-archs=32-bit``: install 2-way universal, 32-bit (the default)
- ``--with-universal-archs=64-bit``: install 2-way universal, 64-bit
This option should be used in combination with ``--enable-universalsdk=``.
NOTE: 64-bit and 4-way builds are only suppported on Mac OS X 10.5 (or later).
C API
-----

View File

@ -1758,6 +1758,7 @@ ffi_type ffi_type_double = { sizeof(double), DOUBLE_ALIGN, FFI_TYPE_DOUBLE };
#ifdef ffi_type_longdouble
#undef ffi_type_longdouble
#endif
/* This is already defined on OSX */
ffi_type ffi_type_longdouble = { sizeof(long double), LONGDOUBLE_ALIGN,
FFI_TYPE_LONGDOUBLE };

View File

@ -179,7 +179,6 @@ epilogue:
movl %ebp,%esp
popl %ebp
ret
.LFE1:
.ffi_call_SYSV_end:
#if 0
.size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV
@ -220,7 +219,7 @@ epilogue:
#else
.long .LFB1 /* FDE initial location */
#endif
.long .LFE1-.LFB1 /* FDE address range */
.long .ffi_call_SYSV_end-.LFB1 /* FDE address range */
#ifdef __PIC__
.byte 0x0 /* .uleb128 0x0; Augmentation size */
#endif

View File

@ -106,6 +106,7 @@ PyMac_Error(OSErr err)
}
#ifndef __LP64__
OSErr
PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
{
@ -153,6 +154,7 @@ PyMac_GetFullPathname(FSSpec *fss, char *path, int len)
Py_XDECREF(fs);
return err;
}
#endif /* !__LP64__ */
/* Convert a 4-char string object argument to an OSType value */
int
@ -417,6 +419,7 @@ GLUE_CONVERT(RGBColor, QdRGB_Convert, "Carbon.Qd")
GLUE_NEW(GWorldPtr, GWorldObj_New, "Carbon.Qdoffs")
GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Carbon.Qdoffs")
#ifndef __LP64__
GLUE_NEW(Track, TrackObj_New, "Carbon.Qt")
GLUE_CONVERT(Track, TrackObj_Convert, "Carbon.Qt")
GLUE_NEW(Movie, MovieObj_New, "Carbon.Qt")
@ -429,6 +432,7 @@ GLUE_NEW(UserData, UserDataObj_New, "Carbon.Qt")
GLUE_CONVERT(UserData, UserDataObj_Convert, "Carbon.Qt")
GLUE_NEW(Media, MediaObj_New, "Carbon.Qt")
GLUE_CONVERT(Media, MediaObj_Convert, "Carbon.Qt")
#endif /* !__LP64__ */
GLUE_NEW(Handle, ResObj_New, "Carbon.Res")
GLUE_CONVERT(Handle, ResObj_Convert, "Carbon.Res")

96
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Revision: 63545 .
# From configure.in Revision: 63690 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 2.6.
#
@ -703,6 +703,7 @@ INSTALL_DATA
LN
OPT
BASECFLAGS
UNIVERSAL_ARCH_FLAGS
OTHER_LIBTOOL_OPT
LIBTOOL_CRUFT
SO
@ -1328,6 +1329,9 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-universal-archs=ARCH
select architectures for universal build ("32-bit",
"64-bit" or "all")
--with-framework-name=FRAMEWORK
specify an alternate name of the framework built
with --enable-framework
@ -1850,6 +1854,16 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
# them.
cat >>confdefs.h <<\_ACEOF
#define _DARWIN_C_SOURCE 1
_ACEOF
define_xopen_source=yes
# Arguments passed to configure.
@ -1883,6 +1897,27 @@ fi
UNIVERSAL_ARCHS="32-bit"
{ echo "$as_me:$LINENO: checking for --with-universal-archs" >&5
echo $ECHO_N "checking for --with-universal-archs... $ECHO_C" >&6; }
# Check whether --with-universal-archs was given.
if test "${with_universal_archs+set}" = set; then
withval=$with_universal_archs;
{ echo "$as_me:$LINENO: result: $withval" >&5
echo "${ECHO_T}$withval" >&6; }
UNIVERSAL_ARCHS="$withval"
else
{ echo "$as_me:$LINENO: result: 32-bit" >&5
echo "${ECHO_T}32-bit" >&6; }
fi
# Check whether --with-framework-name was given.
if test "${with_framework_name+set}" = set; then
@ -1927,9 +1962,14 @@ if test "${enable_framework+set}" = set; then
PYTHONFRAMEWORKPREFIX=$enableval
PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall"
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
if test "$UNIVERSAL_ARCHS" = "all"
then
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
else
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
fi
if test "x${prefix}" = "xNONE" ; then
FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
else
@ -1968,6 +2008,12 @@ else
fi
enable_framework=
if test "$UNIVERSAL_ARCHS" = "all"
then
FRAMEWORKINSTALLLAST=update4wayuniversal
FRAMEWORKALTINSTALLLAST=update4wayuniversal
fi
fi
@ -4509,6 +4555,11 @@ then
fi
# The -arch flags for universal builds on OSX
UNIVERSAL_ARCH_FLAGS=
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
@ -4589,7 +4640,25 @@ echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6; }
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
UNIVERSAL_ARCH_FLAGS=""
if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
elif test "$UNIVERSAL_ARCHS" = "all" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
else
{ { echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5
echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;}
{ (exit 1); exit 1; }; }
fi
BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
;;
@ -12500,6 +12569,12 @@ then
if test ${cur_target} '>' 10.2; then
cur_target=10.3
fi
if test "${UNIVERSAL_ARCHS}" = "all"; then
# Ensure that the default platform for a 4-way
# universal build is OSX 10.5, that's the first
# OS release where 4-way builds make sense.
cur_target='10.5'
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
# Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
@ -12510,10 +12585,10 @@ then
export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
then
if test "${enable_universalsdk}"; then
LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
fi
LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED"
@ -22212,8 +22287,6 @@ presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
esac
# Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters).
{ echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5
@ -24771,6 +24844,7 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim
LN!$LN$ac_delim
OPT!$OPT$ac_delim
BASECFLAGS!$BASECFLAGS$ac_delim
UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim
OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim
LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim
SO!$SO$ac_delim
@ -24780,7 +24854,6 @@ CCSHARED!$CCSHARED$ac_delim
LINKFORSHARED!$LINKFORSHARED$ac_delim
CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim
SHLIBS!$SHLIBS$ac_delim
USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@ -24822,6 +24895,7 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim
SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim
USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim
LDLAST!$LDLAST$ac_delim
@ -24844,7 +24918,7 @@ SRCDIRS!$SRCDIRS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 21; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

View File

@ -57,6 +57,12 @@ AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]
# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
# them.
AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
define_xopen_source=yes
# Arguments passed to configure.
@ -86,6 +92,20 @@ AC_ARG_ENABLE(universalsdk,
])
AC_SUBST(UNIVERSALSDK)
UNIVERSAL_ARCHS="32-bit"
AC_MSG_CHECKING(for --with-universal-archs)
AC_ARG_WITH(universal-archs,
AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit" or "all")),
[
AC_MSG_RESULT($withval)
UNIVERSAL_ARCHS="$withval"
],
[
AC_MSG_RESULT(32-bit)
])
AC_ARG_WITH(framework-name,
AC_HELP_STRING(--with-framework-name=FRAMEWORK,
specify an alternate name of the framework built with --enable-framework),
@ -127,9 +147,14 @@ AC_ARG_ENABLE(framework,
PYTHONFRAMEWORKPREFIX=$enableval
PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall"
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
if test "$UNIVERSAL_ARCHS" = "all"
then
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
else
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
fi
if test "x${prefix}" = "xNONE" ; then
FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
else
@ -160,6 +185,12 @@ AC_ARG_ENABLE(framework,
FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
fi
enable_framework=
if test "$UNIVERSAL_ARCHS" = "all"
then
FRAMEWORKINSTALLLAST=update4wayuniversal
FRAMEWORKALTINSTALLLAST=update4wayuniversal
fi
])
AC_SUBST(PYTHONFRAMEWORK)
AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
@ -827,6 +858,11 @@ then
fi
AC_SUBST(BASECFLAGS)
# The -arch flags for universal builds on OSX
UNIVERSAL_ARCH_FLAGS=
AC_SUBST(UNIVERSAL_ARCH_FLAGS)
# tweak BASECFLAGS based on compiler and platform
case $GCC in
yes)
@ -865,7 +901,23 @@ yes)
# -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
# used to be here, but non-Apple gcc doesn't accept them.
if test "${enable_universalsdk}"; then
BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
UNIVERSAL_ARCH_FLAGS=""
if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
elif test "$UNIVERSAL_ARCHS" = "all" ; then
UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
else
AC_MSG_ERROR([proper usage is --with-universalarch=32-bit|64-bit|all])
fi
BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
fi
;;
@ -1558,6 +1610,12 @@ then
if test ${cur_target} '>' 10.2; then
cur_target=10.3
fi
if test "${UNIVERSAL_ARCHS}" = "all"; then
# Ensure that the default platform for a 4-way
# universal build is OSX 10.5, that's the first
# OS release where 4-way builds make sense.
cur_target='10.5'
fi
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
# Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
@ -1568,10 +1626,10 @@ then
export MACOSX_DEPLOYMENT_TARGET
EXPORT_MACOSX_DEPLOYMENT_TARGET=''
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
then
if test "${enable_universalsdk}"; then
LDFLAGS="-arch i386 -arch ppc -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
fi
LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
BLDSHARED="$LDSHARED"
@ -3191,23 +3249,6 @@ fi
# check for endianness
AC_C_BIGENDIAN
AH_VERBATIM([WORDS_BIGENDIAN],
[
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX).
The block below does compile-time checking for endianness on platforms
that use GCC and therefore allows compiling fat binaries on OSX by using
'-arch ppc -arch i386' as the compile flags. The phrasing was choosen
such that the configure-result is used on systems that don't use GCC.
*/
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#ifndef __LITTLE_ENDIAN__
#undef WORDS_BIGENDIAN
#endif
#endif])
# Check whether right shifting a negative integer extends the sign bit
# or fills with zeros (like the Cray J90, according to Tim Peters).

View File

@ -489,6 +489,9 @@
/* Define if you have readline 4.2 */
#undef HAVE_RL_COMPLETION_MATCHES
/* Define when using libedit's readline emulation */
#undef HAVE_RL_DISPM_VFUNC
/* Define if you have readline 4.0 */
#undef HAVE_RL_PRE_INPUT_HOOK
@ -973,22 +976,9 @@
/* Define to profile with the Pentium timestamp counter */
#undef WITH_TSC
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX).
The block below does compile-time checking for endianness on platforms
that use GCC and therefore allows compiling fat binaries on OSX by using
'-arch ppc -arch i386' as the compile flags. The phrasing was choosen
such that the configure-result is used on systems that don't use GCC.
*/
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#ifndef __LITTLE_ENDIAN__
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
#endif
#endif
/* Define to 1 if on AIX 3.
System headers sometimes define this.
@ -1003,6 +993,9 @@
/* Define on Irix to enable u_int */
#undef _BSD_TYPES
/* Define on Darwin to activate all library features */
#undef _DARWIN_C_SOURCE
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS

View File

@ -248,6 +248,19 @@ class PyBuildExt(build_ext):
'WARNING: skipping import check for Carbon-based "%s"' %
ext.name)
return
if self.get_platform() == 'darwin' and (
sys.maxint > 2**32 and '-arch' in ext.extra_link_args):
# Don't bother doing an import check when an extension was
# build with an explicit '-arch' flag on OSX. That's currently
# only used to build 32-bit only extensions in a 4-way
# universal build and loading 32-bit code into a 64-bit
# process will fail.
self.announce(
'WARNING: skipping import check for "%s"' %
ext.name)
return
# Workaround for Cygwin: Cygwin currently has fork issues when many
# modules have been imported
if self.get_platform() == 'cygwin':
@ -541,10 +554,12 @@ class PyBuildExt(build_ext):
# readline
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
if platform == 'darwin':
if platform == 'darwin': # and os.uname()[2] < '9.':
# MacOSX 10.4 has a broken readline. Don't try to build
# the readline module unless the user has installed a fixed
# readline package
# FIXME: The readline emulation on 10.5 is better, but the
# readline module doesn't compile out of the box.
if find_file('readline/rlconf.h', inc_dirs, []) is None:
do_readline = False
if do_readline:
@ -1304,11 +1319,24 @@ class PyBuildExt(build_ext):
'_Dlg', '_Drag', '_Evt', '_File', '_Folder', '_Fm',
'_Help', '_Icn', '_IBCarbon', '_List',
'_Menu', '_Mlte', '_OSA', '_Res', '_Qd', '_Qdoffs',
'_Scrap', '_Snd', '_TE', '_Win',
'_Scrap', '_Snd', '_TE',
]
for name in CARBON_EXTS:
addMacExtension(name, carbon_kwds)
# Workaround for a bug in the version of gcc shipped with Xcode 3.
# The _Win extension should build just like the other Carbon extensions, but
# this actually results in a hard crash of the linker.
#
if '-arch ppc64' in cflags and '-arch ppc' in cflags:
win_kwds = {'extra_compile_args': carbon_extra_compile_args + ['-arch', 'i386', '-arch', 'ppc'],
'extra_link_args': ['-framework', 'Carbon', '-arch', 'i386', '-arch', 'ppc'],
}
addMacExtension('_Win', win_kwds)
else:
addMacExtension('_Win', carbon_kwds)
# Application Services & QuickTime
app_kwds = {'extra_compile_args': carbon_extra_compile_args,
'extra_link_args': ['-framework','ApplicationServices'],
@ -1375,11 +1403,29 @@ class PyBuildExt(build_ext):
include_dirs.append('/usr/X11R6/include')
frameworks = ['-framework', 'Tcl', '-framework', 'Tk']
# All existing framework builds of Tcl/Tk don't support 64-bit
# architectures.
cflags = sysconfig.get_config_vars('CFLAGS')[0]
archs = re.findall('-arch\s+(\w+)', cflags)
if 'x86_64' in archs or 'ppc64' in archs:
try:
archs.remove('x86_64')
except ValueError:
pass
try:
archs.remove('ppc64')
except ValueError:
pass
for a in archs:
frameworks.append('-arch')
frameworks.append(a)
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
define_macros=[('WITH_APPINIT', 1)],
include_dirs = include_dirs,
libraries = [],
extra_compile_args = frameworks,
extra_compile_args = frameworks[2:],
extra_link_args = frameworks,
)
self.extensions.append(ext)
@ -1510,6 +1556,7 @@ class PyBuildExt(build_ext):
'_ctypes', 'libffi_osx'))
sources = [os.path.join(ffi_srcdir, p)
for p in ['ffi.c',
'x86/darwin64.S',
'x86/x86-darwin.S',
'x86/x86-ffi_darwin.c',
'x86/x86-ffi64.c',